@@ -34,11 +34,13 @@ const { default: axios } = require('axios')
34
34
* {user:"myemail@something.com", organization:'mycloudTeam' })
35
35
*
36
36
* client.setApiKey(MY_ACCESS_TOKEN)
37
+ *
37
38
* //to get the list of all organization's databases
38
- * client.getDatabases(result=>{
39
- * console.log(result)
39
+ * async function callGetDatabases(){
40
+ * const dbList = await client.getDatabases()
41
+ * console.log(dbList)
42
+ * }
40
43
*
41
- * })
42
44
* async function getSchema() {
43
45
* client.db("test")
44
46
* client.checkout("dev")
@@ -131,10 +133,15 @@ WOQLClient.prototype.organization = function(orgId) {
131
133
}
132
134
133
135
/**
134
- * Gets the organization's databases list
136
+ * Gets the organization's databases list.
137
+ *
138
+ * If no organization has been set up, the function throws an exception
135
139
* @returns {string | boolean }
136
140
* @example
137
- * client.getDatabases()
141
+ * async function callGetDatabases(){
142
+ * const dbList = await client.getDatabases()
143
+ * console.log(dbList)
144
+ * }
138
145
*/
139
146
WOQLClient . prototype . getDatabases = async function ( ) {
140
147
// return response
@@ -150,6 +157,23 @@ WOQLClient.prototype.getDatabases = async function(){
150
157
return dbList
151
158
}
152
159
160
+ /**
161
+ * Set/Get the organization's databases list (id, label, comment) that the current user has access to on the server.
162
+ * @param {array } [dbList] a list of databases the user has access to on the server, each having:
163
+ * @returns {array } the organization's databases list
164
+ * @example
165
+ * //to get the list of all organization's databases
166
+ * async function callGetDatabases(){
167
+ * await client.getDatabases()
168
+ * console.log(client.databases())
169
+ * }
170
+ *
171
+ */
172
+ WOQLClient . prototype . databases = function ( dbList ) {
173
+ if ( dbList ) this . databaseList = dbList
174
+ return this . databaseList || [ ]
175
+ }
176
+
153
177
/**
154
178
* Gets the current user object as returned by the connect capabilities response
155
179
* user has fields: [id, name, notes, author]
@@ -170,32 +194,6 @@ WOQLClient.prototype.userOrganization = function() {
170
194
}
171
195
172
196
173
- /**
174
- * Retrieves a list of databases (id, organization, label, comment) that the current user has access to on the server.
175
- * @param {array } [dbList] a list of databases the user has access to on the server, each having:
176
- * @returns {array } the user databases list
177
- * @example
178
- * const my_dbs = client.databases()
179
- */
180
- WOQLClient . prototype . databases = function ( dbList ) {
181
- if ( dbList ) this . databaseList = dbList
182
- return this . databaseList || [ ]
183
- }
184
-
185
- /**
186
- * Retrieves a list of databases (id, organization, label, comment) that the current user has access to on the server.
187
- * @param {array } [orgList] a list of databases the user has access to on the server, each having:
188
- * @returns {array } the user databases list
189
- * @example
190
- * const my_dbs = client.databases()
191
- */
192
- WOQLClient . prototype . userOrganizations = function ( orgList ) {
193
- if ( orgList ) this . organizationList = orgList
194
- return this . organizationList || [ ]
195
- }
196
-
197
-
198
-
199
197
/**
200
198
* Gets the database's details
201
199
* @param {string } [dbId] - the datbase id
@@ -220,8 +218,6 @@ WOQLClient.prototype.db = function(dbId) {
220
218
this . connectionConfig . setDB ( dbId )
221
219
}
222
220
return this . connectionConfig . dbid
223
-
224
- //this.connectionConfig.db()
225
221
}
226
222
227
223
/**
@@ -1083,12 +1079,13 @@ WOQLClient.prototype.getBranches = function(dbId){
1083
1079
}
1084
1080
1085
1081
/**
1086
- * get the organizations and the database related
1082
+ * Get the list of the user's organizations and the database related
1087
1083
* @returns {Promise } A promise that returns the call response object, or an Error if rejected.
1088
1084
* @example
1089
- * client.getUserOrganizations().then(result=>{
1090
- * console.log(result)
1091
- * })
1085
+ * async funtion callGetUserOrganizations(){
1086
+ * await getUserOrganizations()
1087
+ * console.log(client.userOrganizations())
1088
+ * }
1092
1089
*/
1093
1090
WOQLClient . prototype . getUserOrganizations = function ( ) {
1094
1091
// this will be change to give back only the organizations list
@@ -1102,6 +1099,21 @@ WOQLClient.prototype.getBranches = function(dbId){
1102
1099
} )
1103
1100
}
1104
1101
1102
+ /**
1103
+ * Get/Set the list of the user's organizations (id, organization, label, comment).
1104
+ * @param {array } [orgList] a list of user's Organization
1105
+ * @returns {array } the user Organizations list
1106
+ * @example
1107
+ * async funtion callGetUserOrganizations(){
1108
+ * await client.getUserOrganizations()
1109
+ * console.log(client.userOrganizations())
1110
+ * }
1111
+ */
1112
+ WOQLClient . prototype . userOrganizations = function ( orgList ) {
1113
+ if ( orgList ) this . organizationList = orgList
1114
+ return this . organizationList || [ ]
1115
+ }
1116
+
1105
1117
/**
1106
1118
* Get the patch of difference between two documents.
1107
1119
* @param {object } before - The current state of JSON document
0 commit comments