Skip to content

Commit 6408b43

Browse files
committed
add getPrefix
1 parent 40c530a commit 6408b43

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

lib/connectionConfig.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,13 @@ ConnectionConfig.prototype.documentURL = function (params) {
663663
return this.branchBase('document') + paramsStr;
664664
};
665665

666+
ConnectionConfig.prototype.prefixesURL = function () {
667+
if (this.db() === this.system_db) {
668+
return this.dbBase('prefixes');
669+
}
670+
return this.branchBase('prefixes');
671+
};
672+
666673
ConnectionConfig.prototype.queryParameter = function (params) {
667674
if (!params || typeof params !== 'object') return '';
668675
const queryString = Object.keys(params).map((key) => `${key}=${encodeURISegment(params[key])}`).join('&');

lib/woqlClient.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,21 @@ WOQLClient.prototype.getBranches = function (dbId) {
11821182
// reset branch
11831183
};
11841184

1185+
/**
1186+
* get the database collections list
1187+
* @param {string} [dbId] - the database id
1188+
* @returns {Promise} A promise that returns the call response object, or an Error if rejected.
1189+
* @example
1190+
* client.getBranches()
1191+
*/
1192+
WOQLClient.prototype.getPrefixes = function (dbId) {
1193+
if (dbId) this.db(dbId);
1194+
return this.dispatch(
1195+
CONST.GET,
1196+
this.connectionConfig.prefixesURL(),
1197+
);
1198+
};
1199+
11851200
/**
11861201
* Get the list of the user's organizations and the database related
11871202
* @returns {Promise} A promise that returns the call response object, or an Error if rejected.

0 commit comments

Comments
 (0)