appwrite-cli 4.2.0 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/README.md +3 -3
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.js +61 -74
- package/lib/commands/account.js +550 -196
- package/lib/commands/assistant.js +42 -7
- package/lib/commands/avatars.js +197 -81
- package/lib/commands/console.js +42 -3
- package/lib/commands/databases.js +981 -552
- package/lib/commands/functions.js +561 -291
- package/lib/commands/graphql.js +58 -11
- package/lib/commands/health.js +325 -68
- package/lib/commands/locale.js +154 -17
- package/lib/commands/migrations.js +328 -147
- package/lib/commands/project.js +128 -33
- package/lib/commands/projects.js +788 -411
- package/lib/commands/proxy.js +113 -28
- package/lib/commands/storage.js +422 -207
- package/lib/commands/teams.js +279 -103
- package/lib/commands/users.js +550 -262
- package/lib/commands/vcs.js +186 -53
- package/package.json +9 -9
- package/scoop/appwrite.json +3 -3
package/lib/commands/users.js
CHANGED
|
@@ -9,896 +9,1184 @@ const { Command } = require('commander');
|
|
|
9
9
|
const { sdkForProject, sdkForConsole } = require('../sdks')
|
|
10
10
|
const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
|
|
11
11
|
const { localConfig, globalConfig } = require("../config");
|
|
12
|
+
const { File } = require('undici');
|
|
13
|
+
const { ReadableStream } = require('stream/web');
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {fs.ReadStream} readStream
|
|
17
|
+
* @returns {ReadableStream}
|
|
18
|
+
*/
|
|
19
|
+
function convertReadStreamToReadableStream(readStream) {
|
|
20
|
+
return new ReadableStream({
|
|
21
|
+
start(controller) {
|
|
22
|
+
readStream.on("data", (chunk) => {
|
|
23
|
+
controller.enqueue(chunk);
|
|
24
|
+
});
|
|
25
|
+
readStream.on("end", () => {
|
|
26
|
+
controller.close();
|
|
27
|
+
});
|
|
28
|
+
readStream.on("error", (err) => {
|
|
29
|
+
controller.error(err);
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
cancel() {
|
|
33
|
+
readStream.destroy();
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
12
37
|
|
|
13
38
|
const users = new Command("users").description(commandDescriptions['users']).configureHelp({
|
|
14
39
|
helpWidth: process.stdout.columns || 80
|
|
15
40
|
})
|
|
16
41
|
|
|
42
|
+
/**
|
|
43
|
+
* @typedef {Object} UsersListRequestParams
|
|
44
|
+
* @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification
|
|
45
|
+
* @property {string} search Search term to filter your list results. Max length: 256 chars.
|
|
46
|
+
* @property {boolean} parseOutput
|
|
47
|
+
* @property {libClient | undefined} sdk
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {UsersListRequestParams} params
|
|
52
|
+
*/
|
|
17
53
|
const usersList = async ({ queries, search, parseOutput = true, sdk = undefined}) => {
|
|
18
|
-
/* @param {string[]} queries */
|
|
19
|
-
/* @param {string} search */
|
|
20
|
-
|
|
21
54
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
55
|
+
|
|
22
56
|
let apiPath = '/users';
|
|
23
57
|
let payload = {};
|
|
24
|
-
|
|
25
|
-
/** Query Params */
|
|
26
58
|
if (typeof queries !== 'undefined') {
|
|
27
59
|
payload['queries'] = queries;
|
|
28
60
|
}
|
|
29
61
|
if (typeof search !== 'undefined') {
|
|
30
62
|
payload['search'] = search;
|
|
31
63
|
}
|
|
64
|
+
|
|
65
|
+
|
|
32
66
|
let response = undefined;
|
|
67
|
+
|
|
33
68
|
response = await client.call('get', apiPath, {
|
|
34
69
|
'content-type': 'application/json',
|
|
35
70
|
}, payload);
|
|
71
|
+
|
|
36
72
|
|
|
37
73
|
if (parseOutput) {
|
|
38
74
|
parse(response)
|
|
39
75
|
success()
|
|
40
76
|
}
|
|
77
|
+
|
|
41
78
|
return response;
|
|
42
79
|
}
|
|
43
80
|
|
|
81
|
+
/**
|
|
82
|
+
* @typedef {Object} UsersCreateRequestParams
|
|
83
|
+
* @property {string} userId User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
84
|
+
* @property {string} email User email.
|
|
85
|
+
* @property {string} phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
86
|
+
* @property {string} password Plain text user password. Must be at least 8 chars.
|
|
87
|
+
* @property {string} name User name. Max length: 128 chars.
|
|
88
|
+
* @property {boolean} parseOutput
|
|
89
|
+
* @property {libClient | undefined} sdk
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @param {UsersCreateRequestParams} params
|
|
94
|
+
*/
|
|
44
95
|
const usersCreate = async ({ userId, email, phone, password, name, parseOutput = true, sdk = undefined}) => {
|
|
45
|
-
/* @param {string} userId */
|
|
46
|
-
/* @param {string} email */
|
|
47
|
-
/* @param {string} phone */
|
|
48
|
-
/* @param {string} password */
|
|
49
|
-
/* @param {string} name */
|
|
50
|
-
|
|
51
96
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
97
|
+
|
|
52
98
|
let apiPath = '/users';
|
|
53
99
|
let payload = {};
|
|
54
|
-
|
|
55
|
-
/** Body Params */
|
|
56
|
-
|
|
57
100
|
if (typeof userId !== 'undefined') {
|
|
58
101
|
payload['userId'] = userId;
|
|
59
102
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
103
|
if (typeof email !== 'undefined') {
|
|
63
104
|
payload['email'] = email;
|
|
64
105
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
106
|
if (typeof phone !== 'undefined') {
|
|
68
107
|
payload['phone'] = phone;
|
|
69
108
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
109
|
if (typeof password !== 'undefined') {
|
|
73
110
|
payload['password'] = password;
|
|
74
111
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
112
|
if (typeof name !== 'undefined') {
|
|
78
113
|
payload['name'] = name;
|
|
79
114
|
}
|
|
80
115
|
|
|
116
|
+
|
|
81
117
|
let response = undefined;
|
|
118
|
+
|
|
82
119
|
response = await client.call('post', apiPath, {
|
|
83
120
|
'content-type': 'application/json',
|
|
84
121
|
}, payload);
|
|
122
|
+
|
|
85
123
|
|
|
86
124
|
if (parseOutput) {
|
|
87
125
|
parse(response)
|
|
88
126
|
success()
|
|
89
127
|
}
|
|
128
|
+
|
|
90
129
|
return response;
|
|
91
130
|
}
|
|
92
131
|
|
|
132
|
+
/**
|
|
133
|
+
* @typedef {Object} UsersCreateArgon2UserRequestParams
|
|
134
|
+
* @property {string} userId User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
135
|
+
* @property {string} email User email.
|
|
136
|
+
* @property {string} password User password hashed using Argon2.
|
|
137
|
+
* @property {string} name User name. Max length: 128 chars.
|
|
138
|
+
* @property {boolean} parseOutput
|
|
139
|
+
* @property {libClient | undefined} sdk
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @param {UsersCreateArgon2UserRequestParams} params
|
|
144
|
+
*/
|
|
93
145
|
const usersCreateArgon2User = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
|
|
94
|
-
/* @param {string} userId */
|
|
95
|
-
/* @param {string} email */
|
|
96
|
-
/* @param {string} password */
|
|
97
|
-
/* @param {string} name */
|
|
98
|
-
|
|
99
146
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
147
|
+
|
|
100
148
|
let apiPath = '/users/argon2';
|
|
101
149
|
let payload = {};
|
|
102
|
-
|
|
103
|
-
/** Body Params */
|
|
104
|
-
|
|
105
150
|
if (typeof userId !== 'undefined') {
|
|
106
151
|
payload['userId'] = userId;
|
|
107
152
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
153
|
if (typeof email !== 'undefined') {
|
|
111
154
|
payload['email'] = email;
|
|
112
155
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
156
|
if (typeof password !== 'undefined') {
|
|
116
157
|
payload['password'] = password;
|
|
117
158
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
159
|
if (typeof name !== 'undefined') {
|
|
121
160
|
payload['name'] = name;
|
|
122
161
|
}
|
|
123
162
|
|
|
163
|
+
|
|
124
164
|
let response = undefined;
|
|
165
|
+
|
|
125
166
|
response = await client.call('post', apiPath, {
|
|
126
167
|
'content-type': 'application/json',
|
|
127
168
|
}, payload);
|
|
169
|
+
|
|
128
170
|
|
|
129
171
|
if (parseOutput) {
|
|
130
172
|
parse(response)
|
|
131
173
|
success()
|
|
132
174
|
}
|
|
175
|
+
|
|
133
176
|
return response;
|
|
134
177
|
}
|
|
135
178
|
|
|
179
|
+
/**
|
|
180
|
+
* @typedef {Object} UsersCreateBcryptUserRequestParams
|
|
181
|
+
* @property {string} userId User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
182
|
+
* @property {string} email User email.
|
|
183
|
+
* @property {string} password User password hashed using Bcrypt.
|
|
184
|
+
* @property {string} name User name. Max length: 128 chars.
|
|
185
|
+
* @property {boolean} parseOutput
|
|
186
|
+
* @property {libClient | undefined} sdk
|
|
187
|
+
*/
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* @param {UsersCreateBcryptUserRequestParams} params
|
|
191
|
+
*/
|
|
136
192
|
const usersCreateBcryptUser = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
|
|
137
|
-
/* @param {string} userId */
|
|
138
|
-
/* @param {string} email */
|
|
139
|
-
/* @param {string} password */
|
|
140
|
-
/* @param {string} name */
|
|
141
|
-
|
|
142
193
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
194
|
+
|
|
143
195
|
let apiPath = '/users/bcrypt';
|
|
144
196
|
let payload = {};
|
|
145
|
-
|
|
146
|
-
/** Body Params */
|
|
147
|
-
|
|
148
197
|
if (typeof userId !== 'undefined') {
|
|
149
198
|
payload['userId'] = userId;
|
|
150
199
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
200
|
if (typeof email !== 'undefined') {
|
|
154
201
|
payload['email'] = email;
|
|
155
202
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
203
|
if (typeof password !== 'undefined') {
|
|
159
204
|
payload['password'] = password;
|
|
160
205
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
206
|
if (typeof name !== 'undefined') {
|
|
164
207
|
payload['name'] = name;
|
|
165
208
|
}
|
|
166
209
|
|
|
210
|
+
|
|
167
211
|
let response = undefined;
|
|
212
|
+
|
|
168
213
|
response = await client.call('post', apiPath, {
|
|
169
214
|
'content-type': 'application/json',
|
|
170
215
|
}, payload);
|
|
216
|
+
|
|
171
217
|
|
|
172
218
|
if (parseOutput) {
|
|
173
219
|
parse(response)
|
|
174
220
|
success()
|
|
175
221
|
}
|
|
222
|
+
|
|
176
223
|
return response;
|
|
177
224
|
}
|
|
178
225
|
|
|
226
|
+
/**
|
|
227
|
+
* @typedef {Object} UsersListIdentitiesRequestParams
|
|
228
|
+
* @property {string} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
|
|
229
|
+
* @property {string} search Search term to filter your list results. Max length: 256 chars.
|
|
230
|
+
* @property {boolean} parseOutput
|
|
231
|
+
* @property {libClient | undefined} sdk
|
|
232
|
+
*/
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* @param {UsersListIdentitiesRequestParams} params
|
|
236
|
+
*/
|
|
179
237
|
const usersListIdentities = async ({ queries, search, parseOutput = true, sdk = undefined}) => {
|
|
180
|
-
/* @param {string} queries */
|
|
181
|
-
/* @param {string} search */
|
|
182
|
-
|
|
183
238
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
239
|
+
|
|
184
240
|
let apiPath = '/users/identities';
|
|
185
241
|
let payload = {};
|
|
186
|
-
|
|
187
|
-
/** Query Params */
|
|
188
242
|
if (typeof queries !== 'undefined') {
|
|
189
243
|
payload['queries'] = queries;
|
|
190
244
|
}
|
|
191
245
|
if (typeof search !== 'undefined') {
|
|
192
246
|
payload['search'] = search;
|
|
193
247
|
}
|
|
248
|
+
|
|
249
|
+
|
|
194
250
|
let response = undefined;
|
|
251
|
+
|
|
195
252
|
response = await client.call('get', apiPath, {
|
|
196
253
|
'content-type': 'application/json',
|
|
197
254
|
}, payload);
|
|
255
|
+
|
|
198
256
|
|
|
199
257
|
if (parseOutput) {
|
|
200
258
|
parse(response)
|
|
201
259
|
success()
|
|
202
260
|
}
|
|
261
|
+
|
|
203
262
|
return response;
|
|
204
263
|
}
|
|
205
264
|
|
|
206
|
-
|
|
207
|
-
|
|
265
|
+
/**
|
|
266
|
+
* @typedef {Object} UsersDeleteIdentityRequestParams
|
|
267
|
+
* @property {string} identityId Identity ID.
|
|
268
|
+
* @property {boolean} parseOutput
|
|
269
|
+
* @property {libClient | undefined} sdk
|
|
270
|
+
*/
|
|
208
271
|
|
|
272
|
+
/**
|
|
273
|
+
* @param {UsersDeleteIdentityRequestParams} params
|
|
274
|
+
*/
|
|
275
|
+
const usersDeleteIdentity = async ({ identityId, parseOutput = true, sdk = undefined}) => {
|
|
209
276
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
277
|
+
|
|
210
278
|
let apiPath = '/users/identities/{identityId}'.replace('{identityId}', identityId);
|
|
211
279
|
let payload = {};
|
|
280
|
+
|
|
281
|
+
|
|
212
282
|
let response = undefined;
|
|
283
|
+
|
|
213
284
|
response = await client.call('delete', apiPath, {
|
|
214
285
|
'content-type': 'application/json',
|
|
215
286
|
}, payload);
|
|
287
|
+
|
|
216
288
|
|
|
217
289
|
if (parseOutput) {
|
|
218
290
|
parse(response)
|
|
219
291
|
success()
|
|
220
292
|
}
|
|
293
|
+
|
|
221
294
|
return response;
|
|
222
295
|
}
|
|
223
296
|
|
|
297
|
+
/**
|
|
298
|
+
* @typedef {Object} UsersCreateMD5UserRequestParams
|
|
299
|
+
* @property {string} userId User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
300
|
+
* @property {string} email User email.
|
|
301
|
+
* @property {string} password User password hashed using MD5.
|
|
302
|
+
* @property {string} name User name. Max length: 128 chars.
|
|
303
|
+
* @property {boolean} parseOutput
|
|
304
|
+
* @property {libClient | undefined} sdk
|
|
305
|
+
*/
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* @param {UsersCreateMD5UserRequestParams} params
|
|
309
|
+
*/
|
|
224
310
|
const usersCreateMD5User = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
|
|
225
|
-
/* @param {string} userId */
|
|
226
|
-
/* @param {string} email */
|
|
227
|
-
/* @param {string} password */
|
|
228
|
-
/* @param {string} name */
|
|
229
|
-
|
|
230
311
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
312
|
+
|
|
231
313
|
let apiPath = '/users/md5';
|
|
232
314
|
let payload = {};
|
|
233
|
-
|
|
234
|
-
/** Body Params */
|
|
235
|
-
|
|
236
315
|
if (typeof userId !== 'undefined') {
|
|
237
316
|
payload['userId'] = userId;
|
|
238
317
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
318
|
if (typeof email !== 'undefined') {
|
|
242
319
|
payload['email'] = email;
|
|
243
320
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
321
|
if (typeof password !== 'undefined') {
|
|
247
322
|
payload['password'] = password;
|
|
248
323
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
324
|
if (typeof name !== 'undefined') {
|
|
252
325
|
payload['name'] = name;
|
|
253
326
|
}
|
|
254
327
|
|
|
328
|
+
|
|
255
329
|
let response = undefined;
|
|
330
|
+
|
|
256
331
|
response = await client.call('post', apiPath, {
|
|
257
332
|
'content-type': 'application/json',
|
|
258
333
|
}, payload);
|
|
334
|
+
|
|
259
335
|
|
|
260
336
|
if (parseOutput) {
|
|
261
337
|
parse(response)
|
|
262
338
|
success()
|
|
263
339
|
}
|
|
340
|
+
|
|
264
341
|
return response;
|
|
265
342
|
}
|
|
266
343
|
|
|
344
|
+
/**
|
|
345
|
+
* @typedef {Object} UsersCreatePHPassUserRequestParams
|
|
346
|
+
* @property {string} userId User ID. Choose a custom ID or pass the string 'ID.unique()'to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
347
|
+
* @property {string} email User email.
|
|
348
|
+
* @property {string} password User password hashed using PHPass.
|
|
349
|
+
* @property {string} name User name. Max length: 128 chars.
|
|
350
|
+
* @property {boolean} parseOutput
|
|
351
|
+
* @property {libClient | undefined} sdk
|
|
352
|
+
*/
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* @param {UsersCreatePHPassUserRequestParams} params
|
|
356
|
+
*/
|
|
267
357
|
const usersCreatePHPassUser = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
|
|
268
|
-
/* @param {string} userId */
|
|
269
|
-
/* @param {string} email */
|
|
270
|
-
/* @param {string} password */
|
|
271
|
-
/* @param {string} name */
|
|
272
|
-
|
|
273
358
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
359
|
+
|
|
274
360
|
let apiPath = '/users/phpass';
|
|
275
361
|
let payload = {};
|
|
276
|
-
|
|
277
|
-
/** Body Params */
|
|
278
|
-
|
|
279
362
|
if (typeof userId !== 'undefined') {
|
|
280
363
|
payload['userId'] = userId;
|
|
281
364
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
365
|
if (typeof email !== 'undefined') {
|
|
285
366
|
payload['email'] = email;
|
|
286
367
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
368
|
if (typeof password !== 'undefined') {
|
|
290
369
|
payload['password'] = password;
|
|
291
370
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
371
|
if (typeof name !== 'undefined') {
|
|
295
372
|
payload['name'] = name;
|
|
296
373
|
}
|
|
297
374
|
|
|
375
|
+
|
|
298
376
|
let response = undefined;
|
|
377
|
+
|
|
299
378
|
response = await client.call('post', apiPath, {
|
|
300
379
|
'content-type': 'application/json',
|
|
301
380
|
}, payload);
|
|
381
|
+
|
|
302
382
|
|
|
303
383
|
if (parseOutput) {
|
|
304
384
|
parse(response)
|
|
305
385
|
success()
|
|
306
386
|
}
|
|
387
|
+
|
|
307
388
|
return response;
|
|
308
389
|
}
|
|
309
390
|
|
|
391
|
+
/**
|
|
392
|
+
* @typedef {Object} UsersCreateScryptUserRequestParams
|
|
393
|
+
* @property {string} userId User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
394
|
+
* @property {string} email User email.
|
|
395
|
+
* @property {string} password User password hashed using Scrypt.
|
|
396
|
+
* @property {string} passwordSalt Optional salt used to hash password.
|
|
397
|
+
* @property {number} passwordCpu Optional CPU cost used to hash password.
|
|
398
|
+
* @property {number} passwordMemory Optional memory cost used to hash password.
|
|
399
|
+
* @property {number} passwordParallel Optional parallelization cost used to hash password.
|
|
400
|
+
* @property {number} passwordLength Optional hash length used to hash password.
|
|
401
|
+
* @property {string} name User name. Max length: 128 chars.
|
|
402
|
+
* @property {boolean} parseOutput
|
|
403
|
+
* @property {libClient | undefined} sdk
|
|
404
|
+
*/
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* @param {UsersCreateScryptUserRequestParams} params
|
|
408
|
+
*/
|
|
310
409
|
const usersCreateScryptUser = async ({ userId, email, password, passwordSalt, passwordCpu, passwordMemory, passwordParallel, passwordLength, name, parseOutput = true, sdk = undefined}) => {
|
|
311
|
-
/* @param {string} userId */
|
|
312
|
-
/* @param {string} email */
|
|
313
|
-
/* @param {string} password */
|
|
314
|
-
/* @param {string} passwordSalt */
|
|
315
|
-
/* @param {number} passwordCpu */
|
|
316
|
-
/* @param {number} passwordMemory */
|
|
317
|
-
/* @param {number} passwordParallel */
|
|
318
|
-
/* @param {number} passwordLength */
|
|
319
|
-
/* @param {string} name */
|
|
320
|
-
|
|
321
410
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
411
|
+
|
|
322
412
|
let apiPath = '/users/scrypt';
|
|
323
413
|
let payload = {};
|
|
324
|
-
|
|
325
|
-
/** Body Params */
|
|
326
|
-
|
|
327
414
|
if (typeof userId !== 'undefined') {
|
|
328
415
|
payload['userId'] = userId;
|
|
329
416
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
417
|
if (typeof email !== 'undefined') {
|
|
333
418
|
payload['email'] = email;
|
|
334
419
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
420
|
if (typeof password !== 'undefined') {
|
|
338
421
|
payload['password'] = password;
|
|
339
422
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
423
|
if (typeof passwordSalt !== 'undefined') {
|
|
343
424
|
payload['passwordSalt'] = passwordSalt;
|
|
344
425
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
426
|
if (typeof passwordCpu !== 'undefined') {
|
|
348
427
|
payload['passwordCpu'] = passwordCpu;
|
|
349
428
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
429
|
if (typeof passwordMemory !== 'undefined') {
|
|
353
430
|
payload['passwordMemory'] = passwordMemory;
|
|
354
431
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
432
|
if (typeof passwordParallel !== 'undefined') {
|
|
358
433
|
payload['passwordParallel'] = passwordParallel;
|
|
359
434
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
435
|
if (typeof passwordLength !== 'undefined') {
|
|
363
436
|
payload['passwordLength'] = passwordLength;
|
|
364
437
|
}
|
|
365
|
-
|
|
366
|
-
|
|
367
438
|
if (typeof name !== 'undefined') {
|
|
368
439
|
payload['name'] = name;
|
|
369
440
|
}
|
|
370
441
|
|
|
442
|
+
|
|
371
443
|
let response = undefined;
|
|
444
|
+
|
|
372
445
|
response = await client.call('post', apiPath, {
|
|
373
446
|
'content-type': 'application/json',
|
|
374
447
|
}, payload);
|
|
448
|
+
|
|
375
449
|
|
|
376
450
|
if (parseOutput) {
|
|
377
451
|
parse(response)
|
|
378
452
|
success()
|
|
379
453
|
}
|
|
454
|
+
|
|
380
455
|
return response;
|
|
381
456
|
}
|
|
382
457
|
|
|
458
|
+
/**
|
|
459
|
+
* @typedef {Object} UsersCreateScryptModifiedUserRequestParams
|
|
460
|
+
* @property {string} userId User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
461
|
+
* @property {string} email User email.
|
|
462
|
+
* @property {string} password User password hashed using Scrypt Modified.
|
|
463
|
+
* @property {string} passwordSalt Salt used to hash password.
|
|
464
|
+
* @property {string} passwordSaltSeparator Salt separator used to hash password.
|
|
465
|
+
* @property {string} passwordSignerKey Signer key used to hash password.
|
|
466
|
+
* @property {string} name User name. Max length: 128 chars.
|
|
467
|
+
* @property {boolean} parseOutput
|
|
468
|
+
* @property {libClient | undefined} sdk
|
|
469
|
+
*/
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* @param {UsersCreateScryptModifiedUserRequestParams} params
|
|
473
|
+
*/
|
|
383
474
|
const usersCreateScryptModifiedUser = async ({ userId, email, password, passwordSalt, passwordSaltSeparator, passwordSignerKey, name, parseOutput = true, sdk = undefined}) => {
|
|
384
|
-
/* @param {string} userId */
|
|
385
|
-
/* @param {string} email */
|
|
386
|
-
/* @param {string} password */
|
|
387
|
-
/* @param {string} passwordSalt */
|
|
388
|
-
/* @param {string} passwordSaltSeparator */
|
|
389
|
-
/* @param {string} passwordSignerKey */
|
|
390
|
-
/* @param {string} name */
|
|
391
|
-
|
|
392
475
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
476
|
+
|
|
393
477
|
let apiPath = '/users/scrypt-modified';
|
|
394
478
|
let payload = {};
|
|
395
|
-
|
|
396
|
-
/** Body Params */
|
|
397
|
-
|
|
398
479
|
if (typeof userId !== 'undefined') {
|
|
399
480
|
payload['userId'] = userId;
|
|
400
481
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
482
|
if (typeof email !== 'undefined') {
|
|
404
483
|
payload['email'] = email;
|
|
405
484
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
485
|
if (typeof password !== 'undefined') {
|
|
409
486
|
payload['password'] = password;
|
|
410
487
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
488
|
if (typeof passwordSalt !== 'undefined') {
|
|
414
489
|
payload['passwordSalt'] = passwordSalt;
|
|
415
490
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
491
|
if (typeof passwordSaltSeparator !== 'undefined') {
|
|
419
492
|
payload['passwordSaltSeparator'] = passwordSaltSeparator;
|
|
420
493
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
494
|
if (typeof passwordSignerKey !== 'undefined') {
|
|
424
495
|
payload['passwordSignerKey'] = passwordSignerKey;
|
|
425
496
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
497
|
if (typeof name !== 'undefined') {
|
|
429
498
|
payload['name'] = name;
|
|
430
499
|
}
|
|
431
500
|
|
|
501
|
+
|
|
432
502
|
let response = undefined;
|
|
503
|
+
|
|
433
504
|
response = await client.call('post', apiPath, {
|
|
434
505
|
'content-type': 'application/json',
|
|
435
506
|
}, payload);
|
|
507
|
+
|
|
436
508
|
|
|
437
509
|
if (parseOutput) {
|
|
438
510
|
parse(response)
|
|
439
511
|
success()
|
|
440
512
|
}
|
|
513
|
+
|
|
441
514
|
return response;
|
|
442
515
|
}
|
|
443
516
|
|
|
517
|
+
/**
|
|
518
|
+
* @typedef {Object} UsersCreateSHAUserRequestParams
|
|
519
|
+
* @property {string} userId User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
520
|
+
* @property {string} email User email.
|
|
521
|
+
* @property {string} password User password hashed using SHA.
|
|
522
|
+
* @property {string} passwordVersion Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512'
|
|
523
|
+
* @property {string} name User name. Max length: 128 chars.
|
|
524
|
+
* @property {boolean} parseOutput
|
|
525
|
+
* @property {libClient | undefined} sdk
|
|
526
|
+
*/
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* @param {UsersCreateSHAUserRequestParams} params
|
|
530
|
+
*/
|
|
444
531
|
const usersCreateSHAUser = async ({ userId, email, password, passwordVersion, name, parseOutput = true, sdk = undefined}) => {
|
|
445
|
-
/* @param {string} userId */
|
|
446
|
-
/* @param {string} email */
|
|
447
|
-
/* @param {string} password */
|
|
448
|
-
/* @param {string} passwordVersion */
|
|
449
|
-
/* @param {string} name */
|
|
450
|
-
|
|
451
532
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
533
|
+
|
|
452
534
|
let apiPath = '/users/sha';
|
|
453
535
|
let payload = {};
|
|
454
|
-
|
|
455
|
-
/** Body Params */
|
|
456
|
-
|
|
457
536
|
if (typeof userId !== 'undefined') {
|
|
458
537
|
payload['userId'] = userId;
|
|
459
538
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
539
|
if (typeof email !== 'undefined') {
|
|
463
540
|
payload['email'] = email;
|
|
464
541
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
542
|
if (typeof password !== 'undefined') {
|
|
468
543
|
payload['password'] = password;
|
|
469
544
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
545
|
if (typeof passwordVersion !== 'undefined') {
|
|
473
546
|
payload['passwordVersion'] = passwordVersion;
|
|
474
547
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
548
|
if (typeof name !== 'undefined') {
|
|
478
549
|
payload['name'] = name;
|
|
479
550
|
}
|
|
480
551
|
|
|
552
|
+
|
|
481
553
|
let response = undefined;
|
|
554
|
+
|
|
482
555
|
response = await client.call('post', apiPath, {
|
|
483
556
|
'content-type': 'application/json',
|
|
484
557
|
}, payload);
|
|
558
|
+
|
|
485
559
|
|
|
486
560
|
if (parseOutput) {
|
|
487
561
|
parse(response)
|
|
488
562
|
success()
|
|
489
563
|
}
|
|
564
|
+
|
|
490
565
|
return response;
|
|
491
566
|
}
|
|
492
567
|
|
|
568
|
+
/**
|
|
569
|
+
* @typedef {Object} UsersGetUsageRequestParams
|
|
570
|
+
* @property {string} range Date range.
|
|
571
|
+
* @property {string} provider Provider Name.
|
|
572
|
+
* @property {boolean} parseOutput
|
|
573
|
+
* @property {libClient | undefined} sdk
|
|
574
|
+
*/
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* @param {UsersGetUsageRequestParams} params
|
|
578
|
+
*/
|
|
493
579
|
const usersGetUsage = async ({ range, provider, parseOutput = true, sdk = undefined}) => {
|
|
494
|
-
/* @param {string} range */
|
|
495
|
-
/* @param {string} provider */
|
|
496
|
-
|
|
497
580
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
581
|
+
|
|
498
582
|
let apiPath = '/users/usage';
|
|
499
583
|
let payload = {};
|
|
500
|
-
|
|
501
|
-
/** Query Params */
|
|
502
584
|
if (typeof range !== 'undefined') {
|
|
503
585
|
payload['range'] = range;
|
|
504
586
|
}
|
|
505
587
|
if (typeof provider !== 'undefined') {
|
|
506
588
|
payload['provider'] = provider;
|
|
507
589
|
}
|
|
590
|
+
|
|
591
|
+
|
|
508
592
|
let response = undefined;
|
|
593
|
+
|
|
509
594
|
response = await client.call('get', apiPath, {
|
|
510
595
|
'content-type': 'application/json',
|
|
511
596
|
}, payload);
|
|
597
|
+
|
|
512
598
|
|
|
513
599
|
if (parseOutput) {
|
|
514
600
|
parse(response)
|
|
515
601
|
success()
|
|
516
602
|
}
|
|
603
|
+
|
|
517
604
|
return response;
|
|
518
605
|
}
|
|
519
606
|
|
|
520
|
-
|
|
521
|
-
|
|
607
|
+
/**
|
|
608
|
+
* @typedef {Object} UsersGetRequestParams
|
|
609
|
+
* @property {string} userId User ID.
|
|
610
|
+
* @property {boolean} parseOutput
|
|
611
|
+
* @property {libClient | undefined} sdk
|
|
612
|
+
*/
|
|
522
613
|
|
|
614
|
+
/**
|
|
615
|
+
* @param {UsersGetRequestParams} params
|
|
616
|
+
*/
|
|
617
|
+
const usersGet = async ({ userId, parseOutput = true, sdk = undefined}) => {
|
|
523
618
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
619
|
+
|
|
524
620
|
let apiPath = '/users/{userId}'.replace('{userId}', userId);
|
|
525
621
|
let payload = {};
|
|
622
|
+
|
|
623
|
+
|
|
526
624
|
let response = undefined;
|
|
625
|
+
|
|
527
626
|
response = await client.call('get', apiPath, {
|
|
528
627
|
'content-type': 'application/json',
|
|
529
628
|
}, payload);
|
|
629
|
+
|
|
530
630
|
|
|
531
631
|
if (parseOutput) {
|
|
532
632
|
parse(response)
|
|
533
633
|
success()
|
|
534
634
|
}
|
|
635
|
+
|
|
535
636
|
return response;
|
|
536
637
|
}
|
|
537
638
|
|
|
538
|
-
|
|
539
|
-
|
|
639
|
+
/**
|
|
640
|
+
* @typedef {Object} UsersDeleteRequestParams
|
|
641
|
+
* @property {string} userId User ID.
|
|
642
|
+
* @property {boolean} parseOutput
|
|
643
|
+
* @property {libClient | undefined} sdk
|
|
644
|
+
*/
|
|
540
645
|
|
|
646
|
+
/**
|
|
647
|
+
* @param {UsersDeleteRequestParams} params
|
|
648
|
+
*/
|
|
649
|
+
const usersDelete = async ({ userId, parseOutput = true, sdk = undefined}) => {
|
|
541
650
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
651
|
+
|
|
542
652
|
let apiPath = '/users/{userId}'.replace('{userId}', userId);
|
|
543
653
|
let payload = {};
|
|
654
|
+
|
|
655
|
+
|
|
544
656
|
let response = undefined;
|
|
657
|
+
|
|
545
658
|
response = await client.call('delete', apiPath, {
|
|
546
659
|
'content-type': 'application/json',
|
|
547
660
|
}, payload);
|
|
661
|
+
|
|
548
662
|
|
|
549
663
|
if (parseOutput) {
|
|
550
664
|
parse(response)
|
|
551
665
|
success()
|
|
552
666
|
}
|
|
667
|
+
|
|
553
668
|
return response;
|
|
554
669
|
}
|
|
555
670
|
|
|
671
|
+
/**
|
|
672
|
+
* @typedef {Object} UsersUpdateEmailRequestParams
|
|
673
|
+
* @property {string} userId User ID.
|
|
674
|
+
* @property {string} email User email.
|
|
675
|
+
* @property {boolean} parseOutput
|
|
676
|
+
* @property {libClient | undefined} sdk
|
|
677
|
+
*/
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* @param {UsersUpdateEmailRequestParams} params
|
|
681
|
+
*/
|
|
556
682
|
const usersUpdateEmail = async ({ userId, email, parseOutput = true, sdk = undefined}) => {
|
|
557
|
-
/* @param {string} userId */
|
|
558
|
-
/* @param {string} email */
|
|
559
|
-
|
|
560
683
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
684
|
+
|
|
561
685
|
let apiPath = '/users/{userId}/email'.replace('{userId}', userId);
|
|
562
686
|
let payload = {};
|
|
563
|
-
|
|
564
|
-
/** Body Params */
|
|
565
|
-
|
|
566
687
|
if (typeof email !== 'undefined') {
|
|
567
688
|
payload['email'] = email;
|
|
568
689
|
}
|
|
569
690
|
|
|
691
|
+
|
|
570
692
|
let response = undefined;
|
|
693
|
+
|
|
571
694
|
response = await client.call('patch', apiPath, {
|
|
572
695
|
'content-type': 'application/json',
|
|
573
696
|
}, payload);
|
|
697
|
+
|
|
574
698
|
|
|
575
699
|
if (parseOutput) {
|
|
576
700
|
parse(response)
|
|
577
701
|
success()
|
|
578
702
|
}
|
|
703
|
+
|
|
579
704
|
return response;
|
|
580
705
|
}
|
|
581
706
|
|
|
707
|
+
/**
|
|
708
|
+
* @typedef {Object} UsersUpdateLabelsRequestParams
|
|
709
|
+
* @property {string} userId User ID.
|
|
710
|
+
* @property {string[]} labels Array of user labels. Replaces the previous labels. Maximum of 100 labels are allowed, each up to 36 alphanumeric characters long.
|
|
711
|
+
* @property {boolean} parseOutput
|
|
712
|
+
* @property {libClient | undefined} sdk
|
|
713
|
+
*/
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* @param {UsersUpdateLabelsRequestParams} params
|
|
717
|
+
*/
|
|
582
718
|
const usersUpdateLabels = async ({ userId, labels, parseOutput = true, sdk = undefined}) => {
|
|
583
|
-
/* @param {string} userId */
|
|
584
|
-
/* @param {string[]} labels */
|
|
585
|
-
|
|
586
719
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
720
|
+
|
|
587
721
|
let apiPath = '/users/{userId}/labels'.replace('{userId}', userId);
|
|
588
722
|
let payload = {};
|
|
589
|
-
|
|
590
|
-
/** Body Params */
|
|
591
723
|
labels = labels === true ? [] : labels;
|
|
592
|
-
|
|
593
724
|
if (typeof labels !== 'undefined') {
|
|
594
725
|
payload['labels'] = labels;
|
|
595
726
|
}
|
|
596
727
|
|
|
728
|
+
|
|
597
729
|
let response = undefined;
|
|
730
|
+
|
|
598
731
|
response = await client.call('put', apiPath, {
|
|
599
732
|
'content-type': 'application/json',
|
|
600
733
|
}, payload);
|
|
734
|
+
|
|
601
735
|
|
|
602
736
|
if (parseOutput) {
|
|
603
737
|
parse(response)
|
|
604
738
|
success()
|
|
605
739
|
}
|
|
740
|
+
|
|
606
741
|
return response;
|
|
607
742
|
}
|
|
608
743
|
|
|
744
|
+
/**
|
|
745
|
+
* @typedef {Object} UsersListLogsRequestParams
|
|
746
|
+
* @property {string} userId User ID.
|
|
747
|
+
* @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
|
|
748
|
+
* @property {boolean} parseOutput
|
|
749
|
+
* @property {libClient | undefined} sdk
|
|
750
|
+
*/
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* @param {UsersListLogsRequestParams} params
|
|
754
|
+
*/
|
|
609
755
|
const usersListLogs = async ({ userId, queries, parseOutput = true, sdk = undefined}) => {
|
|
610
|
-
/* @param {string} userId */
|
|
611
|
-
/* @param {string[]} queries */
|
|
612
|
-
|
|
613
756
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
757
|
+
|
|
614
758
|
let apiPath = '/users/{userId}/logs'.replace('{userId}', userId);
|
|
615
759
|
let payload = {};
|
|
616
|
-
|
|
617
|
-
/** Query Params */
|
|
618
760
|
if (typeof queries !== 'undefined') {
|
|
619
761
|
payload['queries'] = queries;
|
|
620
762
|
}
|
|
763
|
+
|
|
764
|
+
|
|
621
765
|
let response = undefined;
|
|
766
|
+
|
|
622
767
|
response = await client.call('get', apiPath, {
|
|
623
768
|
'content-type': 'application/json',
|
|
624
769
|
}, payload);
|
|
770
|
+
|
|
625
771
|
|
|
626
772
|
if (parseOutput) {
|
|
627
773
|
parse(response)
|
|
628
774
|
success()
|
|
629
775
|
}
|
|
776
|
+
|
|
630
777
|
return response;
|
|
631
778
|
}
|
|
632
779
|
|
|
633
|
-
|
|
634
|
-
|
|
780
|
+
/**
|
|
781
|
+
* @typedef {Object} UsersListMembershipsRequestParams
|
|
782
|
+
* @property {string} userId User ID.
|
|
783
|
+
* @property {boolean} parseOutput
|
|
784
|
+
* @property {libClient | undefined} sdk
|
|
785
|
+
*/
|
|
635
786
|
|
|
787
|
+
/**
|
|
788
|
+
* @param {UsersListMembershipsRequestParams} params
|
|
789
|
+
*/
|
|
790
|
+
const usersListMemberships = async ({ userId, parseOutput = true, sdk = undefined}) => {
|
|
636
791
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
792
|
+
|
|
637
793
|
let apiPath = '/users/{userId}/memberships'.replace('{userId}', userId);
|
|
638
794
|
let payload = {};
|
|
795
|
+
|
|
796
|
+
|
|
639
797
|
let response = undefined;
|
|
798
|
+
|
|
640
799
|
response = await client.call('get', apiPath, {
|
|
641
800
|
'content-type': 'application/json',
|
|
642
801
|
}, payload);
|
|
802
|
+
|
|
643
803
|
|
|
644
804
|
if (parseOutput) {
|
|
645
805
|
parse(response)
|
|
646
806
|
success()
|
|
647
807
|
}
|
|
808
|
+
|
|
648
809
|
return response;
|
|
649
810
|
}
|
|
650
811
|
|
|
812
|
+
/**
|
|
813
|
+
* @typedef {Object} UsersUpdateNameRequestParams
|
|
814
|
+
* @property {string} userId User ID.
|
|
815
|
+
* @property {string} name User name. Max length: 128 chars.
|
|
816
|
+
* @property {boolean} parseOutput
|
|
817
|
+
* @property {libClient | undefined} sdk
|
|
818
|
+
*/
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* @param {UsersUpdateNameRequestParams} params
|
|
822
|
+
*/
|
|
651
823
|
const usersUpdateName = async ({ userId, name, parseOutput = true, sdk = undefined}) => {
|
|
652
|
-
/* @param {string} userId */
|
|
653
|
-
/* @param {string} name */
|
|
654
|
-
|
|
655
824
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
825
|
+
|
|
656
826
|
let apiPath = '/users/{userId}/name'.replace('{userId}', userId);
|
|
657
827
|
let payload = {};
|
|
658
|
-
|
|
659
|
-
/** Body Params */
|
|
660
|
-
|
|
661
828
|
if (typeof name !== 'undefined') {
|
|
662
829
|
payload['name'] = name;
|
|
663
830
|
}
|
|
664
831
|
|
|
832
|
+
|
|
665
833
|
let response = undefined;
|
|
834
|
+
|
|
666
835
|
response = await client.call('patch', apiPath, {
|
|
667
836
|
'content-type': 'application/json',
|
|
668
837
|
}, payload);
|
|
838
|
+
|
|
669
839
|
|
|
670
840
|
if (parseOutput) {
|
|
671
841
|
parse(response)
|
|
672
842
|
success()
|
|
673
843
|
}
|
|
844
|
+
|
|
674
845
|
return response;
|
|
675
846
|
}
|
|
676
847
|
|
|
848
|
+
/**
|
|
849
|
+
* @typedef {Object} UsersUpdatePasswordRequestParams
|
|
850
|
+
* @property {string} userId User ID.
|
|
851
|
+
* @property {string} password New user password. Must be at least 8 chars.
|
|
852
|
+
* @property {boolean} parseOutput
|
|
853
|
+
* @property {libClient | undefined} sdk
|
|
854
|
+
*/
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* @param {UsersUpdatePasswordRequestParams} params
|
|
858
|
+
*/
|
|
677
859
|
const usersUpdatePassword = async ({ userId, password, parseOutput = true, sdk = undefined}) => {
|
|
678
|
-
/* @param {string} userId */
|
|
679
|
-
/* @param {string} password */
|
|
680
|
-
|
|
681
860
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
861
|
+
|
|
682
862
|
let apiPath = '/users/{userId}/password'.replace('{userId}', userId);
|
|
683
863
|
let payload = {};
|
|
684
|
-
|
|
685
|
-
/** Body Params */
|
|
686
|
-
|
|
687
864
|
if (typeof password !== 'undefined') {
|
|
688
865
|
payload['password'] = password;
|
|
689
866
|
}
|
|
690
867
|
|
|
868
|
+
|
|
691
869
|
let response = undefined;
|
|
870
|
+
|
|
692
871
|
response = await client.call('patch', apiPath, {
|
|
693
872
|
'content-type': 'application/json',
|
|
694
873
|
}, payload);
|
|
874
|
+
|
|
695
875
|
|
|
696
876
|
if (parseOutput) {
|
|
697
877
|
parse(response)
|
|
698
878
|
success()
|
|
699
879
|
}
|
|
880
|
+
|
|
700
881
|
return response;
|
|
701
882
|
}
|
|
702
883
|
|
|
884
|
+
/**
|
|
885
|
+
* @typedef {Object} UsersUpdatePhoneRequestParams
|
|
886
|
+
* @property {string} userId User ID.
|
|
887
|
+
* @property {string} number User phone number.
|
|
888
|
+
* @property {boolean} parseOutput
|
|
889
|
+
* @property {libClient | undefined} sdk
|
|
890
|
+
*/
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* @param {UsersUpdatePhoneRequestParams} params
|
|
894
|
+
*/
|
|
703
895
|
const usersUpdatePhone = async ({ userId, number, parseOutput = true, sdk = undefined}) => {
|
|
704
|
-
/* @param {string} userId */
|
|
705
|
-
/* @param {string} number */
|
|
706
|
-
|
|
707
896
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
897
|
+
|
|
708
898
|
let apiPath = '/users/{userId}/phone'.replace('{userId}', userId);
|
|
709
899
|
let payload = {};
|
|
710
|
-
|
|
711
|
-
/** Body Params */
|
|
712
|
-
|
|
713
900
|
if (typeof number !== 'undefined') {
|
|
714
901
|
payload['number'] = number;
|
|
715
902
|
}
|
|
716
903
|
|
|
904
|
+
|
|
717
905
|
let response = undefined;
|
|
906
|
+
|
|
718
907
|
response = await client.call('patch', apiPath, {
|
|
719
908
|
'content-type': 'application/json',
|
|
720
909
|
}, payload);
|
|
910
|
+
|
|
721
911
|
|
|
722
912
|
if (parseOutput) {
|
|
723
913
|
parse(response)
|
|
724
914
|
success()
|
|
725
915
|
}
|
|
916
|
+
|
|
726
917
|
return response;
|
|
727
918
|
}
|
|
728
919
|
|
|
729
|
-
|
|
730
|
-
|
|
920
|
+
/**
|
|
921
|
+
* @typedef {Object} UsersGetPrefsRequestParams
|
|
922
|
+
* @property {string} userId User ID.
|
|
923
|
+
* @property {boolean} parseOutput
|
|
924
|
+
* @property {libClient | undefined} sdk
|
|
925
|
+
*/
|
|
731
926
|
|
|
927
|
+
/**
|
|
928
|
+
* @param {UsersGetPrefsRequestParams} params
|
|
929
|
+
*/
|
|
930
|
+
const usersGetPrefs = async ({ userId, parseOutput = true, sdk = undefined}) => {
|
|
732
931
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
932
|
+
|
|
733
933
|
let apiPath = '/users/{userId}/prefs'.replace('{userId}', userId);
|
|
734
934
|
let payload = {};
|
|
935
|
+
|
|
936
|
+
|
|
735
937
|
let response = undefined;
|
|
938
|
+
|
|
736
939
|
response = await client.call('get', apiPath, {
|
|
737
940
|
'content-type': 'application/json',
|
|
738
941
|
}, payload);
|
|
942
|
+
|
|
739
943
|
|
|
740
944
|
if (parseOutput) {
|
|
741
945
|
parse(response)
|
|
742
946
|
success()
|
|
743
947
|
}
|
|
948
|
+
|
|
744
949
|
return response;
|
|
745
950
|
}
|
|
746
951
|
|
|
952
|
+
/**
|
|
953
|
+
* @typedef {Object} UsersUpdatePrefsRequestParams
|
|
954
|
+
* @property {string} userId User ID.
|
|
955
|
+
* @property {object} prefs Prefs key-value JSON object.
|
|
956
|
+
* @property {boolean} parseOutput
|
|
957
|
+
* @property {libClient | undefined} sdk
|
|
958
|
+
*/
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* @param {UsersUpdatePrefsRequestParams} params
|
|
962
|
+
*/
|
|
747
963
|
const usersUpdatePrefs = async ({ userId, prefs, parseOutput = true, sdk = undefined}) => {
|
|
748
|
-
/* @param {string} userId */
|
|
749
|
-
/* @param {object} prefs */
|
|
750
|
-
|
|
751
964
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
965
|
+
|
|
752
966
|
let apiPath = '/users/{userId}/prefs'.replace('{userId}', userId);
|
|
753
967
|
let payload = {};
|
|
754
|
-
|
|
755
|
-
/** Body Params */
|
|
756
968
|
if (typeof prefs !== 'undefined') {
|
|
757
969
|
payload['prefs'] = JSON.parse(prefs);
|
|
758
970
|
}
|
|
759
971
|
|
|
972
|
+
|
|
760
973
|
let response = undefined;
|
|
974
|
+
|
|
761
975
|
response = await client.call('patch', apiPath, {
|
|
762
976
|
'content-type': 'application/json',
|
|
763
977
|
}, payload);
|
|
978
|
+
|
|
764
979
|
|
|
765
980
|
if (parseOutput) {
|
|
766
981
|
parse(response)
|
|
767
982
|
success()
|
|
768
983
|
}
|
|
984
|
+
|
|
769
985
|
return response;
|
|
770
986
|
}
|
|
771
987
|
|
|
772
|
-
|
|
773
|
-
|
|
988
|
+
/**
|
|
989
|
+
* @typedef {Object} UsersListSessionsRequestParams
|
|
990
|
+
* @property {string} userId User ID.
|
|
991
|
+
* @property {boolean} parseOutput
|
|
992
|
+
* @property {libClient | undefined} sdk
|
|
993
|
+
*/
|
|
774
994
|
|
|
995
|
+
/**
|
|
996
|
+
* @param {UsersListSessionsRequestParams} params
|
|
997
|
+
*/
|
|
998
|
+
const usersListSessions = async ({ userId, parseOutput = true, sdk = undefined}) => {
|
|
775
999
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
1000
|
+
|
|
776
1001
|
let apiPath = '/users/{userId}/sessions'.replace('{userId}', userId);
|
|
777
1002
|
let payload = {};
|
|
1003
|
+
|
|
1004
|
+
|
|
778
1005
|
let response = undefined;
|
|
1006
|
+
|
|
779
1007
|
response = await client.call('get', apiPath, {
|
|
780
1008
|
'content-type': 'application/json',
|
|
781
1009
|
}, payload);
|
|
1010
|
+
|
|
782
1011
|
|
|
783
1012
|
if (parseOutput) {
|
|
784
1013
|
parse(response)
|
|
785
1014
|
success()
|
|
786
1015
|
}
|
|
1016
|
+
|
|
787
1017
|
return response;
|
|
788
1018
|
}
|
|
789
1019
|
|
|
790
|
-
|
|
791
|
-
|
|
1020
|
+
/**
|
|
1021
|
+
* @typedef {Object} UsersDeleteSessionsRequestParams
|
|
1022
|
+
* @property {string} userId User ID.
|
|
1023
|
+
* @property {boolean} parseOutput
|
|
1024
|
+
* @property {libClient | undefined} sdk
|
|
1025
|
+
*/
|
|
792
1026
|
|
|
1027
|
+
/**
|
|
1028
|
+
* @param {UsersDeleteSessionsRequestParams} params
|
|
1029
|
+
*/
|
|
1030
|
+
const usersDeleteSessions = async ({ userId, parseOutput = true, sdk = undefined}) => {
|
|
793
1031
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
1032
|
+
|
|
794
1033
|
let apiPath = '/users/{userId}/sessions'.replace('{userId}', userId);
|
|
795
1034
|
let payload = {};
|
|
1035
|
+
|
|
1036
|
+
|
|
796
1037
|
let response = undefined;
|
|
1038
|
+
|
|
797
1039
|
response = await client.call('delete', apiPath, {
|
|
798
1040
|
'content-type': 'application/json',
|
|
799
1041
|
}, payload);
|
|
1042
|
+
|
|
800
1043
|
|
|
801
1044
|
if (parseOutput) {
|
|
802
1045
|
parse(response)
|
|
803
1046
|
success()
|
|
804
1047
|
}
|
|
1048
|
+
|
|
805
1049
|
return response;
|
|
806
1050
|
}
|
|
807
1051
|
|
|
1052
|
+
/**
|
|
1053
|
+
* @typedef {Object} UsersDeleteSessionRequestParams
|
|
1054
|
+
* @property {string} userId User ID.
|
|
1055
|
+
* @property {string} sessionId Session ID.
|
|
1056
|
+
* @property {boolean} parseOutput
|
|
1057
|
+
* @property {libClient | undefined} sdk
|
|
1058
|
+
*/
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* @param {UsersDeleteSessionRequestParams} params
|
|
1062
|
+
*/
|
|
808
1063
|
const usersDeleteSession = async ({ userId, sessionId, parseOutput = true, sdk = undefined}) => {
|
|
809
|
-
/* @param {string} userId */
|
|
810
|
-
/* @param {string} sessionId */
|
|
811
|
-
|
|
812
1064
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
1065
|
+
|
|
813
1066
|
let apiPath = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId);
|
|
814
1067
|
let payload = {};
|
|
1068
|
+
|
|
1069
|
+
|
|
815
1070
|
let response = undefined;
|
|
1071
|
+
|
|
816
1072
|
response = await client.call('delete', apiPath, {
|
|
817
1073
|
'content-type': 'application/json',
|
|
818
1074
|
}, payload);
|
|
1075
|
+
|
|
819
1076
|
|
|
820
1077
|
if (parseOutput) {
|
|
821
1078
|
parse(response)
|
|
822
1079
|
success()
|
|
823
1080
|
}
|
|
1081
|
+
|
|
824
1082
|
return response;
|
|
825
1083
|
}
|
|
826
1084
|
|
|
1085
|
+
/**
|
|
1086
|
+
* @typedef {Object} UsersUpdateStatusRequestParams
|
|
1087
|
+
* @property {string} userId User ID.
|
|
1088
|
+
* @property {boolean} status User Status. To activate the user pass 'true' and to block the user pass 'false'.
|
|
1089
|
+
* @property {boolean} parseOutput
|
|
1090
|
+
* @property {libClient | undefined} sdk
|
|
1091
|
+
*/
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* @param {UsersUpdateStatusRequestParams} params
|
|
1095
|
+
*/
|
|
827
1096
|
const usersUpdateStatus = async ({ userId, status, parseOutput = true, sdk = undefined}) => {
|
|
828
|
-
/* @param {string} userId */
|
|
829
|
-
/* @param {boolean} status */
|
|
830
|
-
|
|
831
1097
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
1098
|
+
|
|
832
1099
|
let apiPath = '/users/{userId}/status'.replace('{userId}', userId);
|
|
833
1100
|
let payload = {};
|
|
834
|
-
|
|
835
|
-
/** Body Params */
|
|
836
|
-
|
|
837
1101
|
if (typeof status !== 'undefined') {
|
|
838
1102
|
payload['status'] = status;
|
|
839
1103
|
}
|
|
840
1104
|
|
|
1105
|
+
|
|
841
1106
|
let response = undefined;
|
|
1107
|
+
|
|
842
1108
|
response = await client.call('patch', apiPath, {
|
|
843
1109
|
'content-type': 'application/json',
|
|
844
1110
|
}, payload);
|
|
1111
|
+
|
|
845
1112
|
|
|
846
1113
|
if (parseOutput) {
|
|
847
1114
|
parse(response)
|
|
848
1115
|
success()
|
|
849
1116
|
}
|
|
1117
|
+
|
|
850
1118
|
return response;
|
|
851
1119
|
}
|
|
852
1120
|
|
|
1121
|
+
/**
|
|
1122
|
+
* @typedef {Object} UsersUpdateEmailVerificationRequestParams
|
|
1123
|
+
* @property {string} userId User ID.
|
|
1124
|
+
* @property {boolean} emailVerification User email verification status.
|
|
1125
|
+
* @property {boolean} parseOutput
|
|
1126
|
+
* @property {libClient | undefined} sdk
|
|
1127
|
+
*/
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* @param {UsersUpdateEmailVerificationRequestParams} params
|
|
1131
|
+
*/
|
|
853
1132
|
const usersUpdateEmailVerification = async ({ userId, emailVerification, parseOutput = true, sdk = undefined}) => {
|
|
854
|
-
/* @param {string} userId */
|
|
855
|
-
/* @param {boolean} emailVerification */
|
|
856
|
-
|
|
857
1133
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
1134
|
+
|
|
858
1135
|
let apiPath = '/users/{userId}/verification'.replace('{userId}', userId);
|
|
859
1136
|
let payload = {};
|
|
860
|
-
|
|
861
|
-
/** Body Params */
|
|
862
|
-
|
|
863
1137
|
if (typeof emailVerification !== 'undefined') {
|
|
864
1138
|
payload['emailVerification'] = emailVerification;
|
|
865
1139
|
}
|
|
866
1140
|
|
|
1141
|
+
|
|
867
1142
|
let response = undefined;
|
|
1143
|
+
|
|
868
1144
|
response = await client.call('patch', apiPath, {
|
|
869
1145
|
'content-type': 'application/json',
|
|
870
1146
|
}, payload);
|
|
1147
|
+
|
|
871
1148
|
|
|
872
1149
|
if (parseOutput) {
|
|
873
1150
|
parse(response)
|
|
874
1151
|
success()
|
|
875
1152
|
}
|
|
1153
|
+
|
|
876
1154
|
return response;
|
|
877
1155
|
}
|
|
878
1156
|
|
|
1157
|
+
/**
|
|
1158
|
+
* @typedef {Object} UsersUpdatePhoneVerificationRequestParams
|
|
1159
|
+
* @property {string} userId User ID.
|
|
1160
|
+
* @property {boolean} phoneVerification User phone verification status.
|
|
1161
|
+
* @property {boolean} parseOutput
|
|
1162
|
+
* @property {libClient | undefined} sdk
|
|
1163
|
+
*/
|
|
1164
|
+
|
|
1165
|
+
/**
|
|
1166
|
+
* @param {UsersUpdatePhoneVerificationRequestParams} params
|
|
1167
|
+
*/
|
|
879
1168
|
const usersUpdatePhoneVerification = async ({ userId, phoneVerification, parseOutput = true, sdk = undefined}) => {
|
|
880
|
-
/* @param {string} userId */
|
|
881
|
-
/* @param {boolean} phoneVerification */
|
|
882
|
-
|
|
883
1169
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
1170
|
+
|
|
884
1171
|
let apiPath = '/users/{userId}/verification/phone'.replace('{userId}', userId);
|
|
885
1172
|
let payload = {};
|
|
886
|
-
|
|
887
|
-
/** Body Params */
|
|
888
|
-
|
|
889
1173
|
if (typeof phoneVerification !== 'undefined') {
|
|
890
1174
|
payload['phoneVerification'] = phoneVerification;
|
|
891
1175
|
}
|
|
892
1176
|
|
|
1177
|
+
|
|
893
1178
|
let response = undefined;
|
|
1179
|
+
|
|
894
1180
|
response = await client.call('patch', apiPath, {
|
|
895
1181
|
'content-type': 'application/json',
|
|
896
1182
|
}, payload);
|
|
1183
|
+
|
|
897
1184
|
|
|
898
1185
|
if (parseOutput) {
|
|
899
1186
|
parse(response)
|
|
900
1187
|
success()
|
|
901
1188
|
}
|
|
1189
|
+
|
|
902
1190
|
return response;
|
|
903
1191
|
}
|
|
904
1192
|
|
|
@@ -1128,33 +1416,33 @@ users
|
|
|
1128
1416
|
|
|
1129
1417
|
module.exports = {
|
|
1130
1418
|
users,
|
|
1131
|
-
usersList,
|
|
1132
|
-
usersCreate,
|
|
1133
|
-
usersCreateArgon2User,
|
|
1134
|
-
usersCreateBcryptUser,
|
|
1135
|
-
usersListIdentities,
|
|
1136
|
-
usersDeleteIdentity,
|
|
1137
|
-
usersCreateMD5User,
|
|
1138
|
-
usersCreatePHPassUser,
|
|
1139
|
-
usersCreateScryptUser,
|
|
1140
|
-
usersCreateScryptModifiedUser,
|
|
1141
|
-
usersCreateSHAUser,
|
|
1142
|
-
usersGetUsage,
|
|
1143
|
-
usersGet,
|
|
1144
|
-
usersDelete,
|
|
1145
|
-
usersUpdateEmail,
|
|
1146
|
-
usersUpdateLabels,
|
|
1147
|
-
usersListLogs,
|
|
1148
|
-
usersListMemberships,
|
|
1149
|
-
usersUpdateName,
|
|
1150
|
-
usersUpdatePassword,
|
|
1151
|
-
usersUpdatePhone,
|
|
1152
|
-
usersGetPrefs,
|
|
1153
|
-
usersUpdatePrefs,
|
|
1154
|
-
usersListSessions,
|
|
1155
|
-
usersDeleteSessions,
|
|
1156
|
-
usersDeleteSession,
|
|
1157
|
-
usersUpdateStatus,
|
|
1158
|
-
usersUpdateEmailVerification,
|
|
1159
|
-
usersUpdatePhoneVerification
|
|
1160
|
-
};
|
|
1419
|
+
usersList,
|
|
1420
|
+
usersCreate,
|
|
1421
|
+
usersCreateArgon2User,
|
|
1422
|
+
usersCreateBcryptUser,
|
|
1423
|
+
usersListIdentities,
|
|
1424
|
+
usersDeleteIdentity,
|
|
1425
|
+
usersCreateMD5User,
|
|
1426
|
+
usersCreatePHPassUser,
|
|
1427
|
+
usersCreateScryptUser,
|
|
1428
|
+
usersCreateScryptModifiedUser,
|
|
1429
|
+
usersCreateSHAUser,
|
|
1430
|
+
usersGetUsage,
|
|
1431
|
+
usersGet,
|
|
1432
|
+
usersDelete,
|
|
1433
|
+
usersUpdateEmail,
|
|
1434
|
+
usersUpdateLabels,
|
|
1435
|
+
usersListLogs,
|
|
1436
|
+
usersListMemberships,
|
|
1437
|
+
usersUpdateName,
|
|
1438
|
+
usersUpdatePassword,
|
|
1439
|
+
usersUpdatePhone,
|
|
1440
|
+
usersGetPrefs,
|
|
1441
|
+
usersUpdatePrefs,
|
|
1442
|
+
usersListSessions,
|
|
1443
|
+
usersDeleteSessions,
|
|
1444
|
+
usersDeleteSession,
|
|
1445
|
+
usersUpdateStatus,
|
|
1446
|
+
usersUpdateEmailVerification,
|
|
1447
|
+
usersUpdatePhoneVerification
|
|
1448
|
+
};
|