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/teams.js
CHANGED
|
@@ -9,386 +9,562 @@ 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 teams = new Command("teams").description(commandDescriptions['teams']).configureHelp({
|
|
14
39
|
helpWidth: process.stdout.columns || 80
|
|
15
40
|
})
|
|
16
41
|
|
|
42
|
+
/**
|
|
43
|
+
* @typedef {Object} TeamsListRequestParams
|
|
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, total
|
|
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 {TeamsListRequestParams} params
|
|
52
|
+
*/
|
|
17
53
|
const teamsList = 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 = '/teams';
|
|
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} TeamsCreateRequestParams
|
|
83
|
+
* @property {string} teamId Team 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} name Team name. Max length: 128 chars.
|
|
85
|
+
* @property {string[]} roles Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
|
|
86
|
+
* @property {boolean} parseOutput
|
|
87
|
+
* @property {libClient | undefined} sdk
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @param {TeamsCreateRequestParams} params
|
|
92
|
+
*/
|
|
44
93
|
const teamsCreate = async ({ teamId, name, roles, parseOutput = true, sdk = undefined}) => {
|
|
45
|
-
/* @param {string} teamId */
|
|
46
|
-
/* @param {string} name */
|
|
47
|
-
/* @param {string[]} roles */
|
|
48
|
-
|
|
49
94
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
95
|
+
|
|
50
96
|
let apiPath = '/teams';
|
|
51
97
|
let payload = {};
|
|
52
|
-
|
|
53
|
-
/** Body Params */
|
|
54
|
-
|
|
55
98
|
if (typeof teamId !== 'undefined') {
|
|
56
99
|
payload['teamId'] = teamId;
|
|
57
100
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
101
|
if (typeof name !== 'undefined') {
|
|
61
102
|
payload['name'] = name;
|
|
62
103
|
}
|
|
63
|
-
|
|
64
104
|
roles = roles === true ? [] : roles;
|
|
65
|
-
|
|
66
105
|
if (typeof roles !== 'undefined') {
|
|
67
106
|
payload['roles'] = roles;
|
|
68
107
|
}
|
|
69
108
|
|
|
109
|
+
|
|
70
110
|
let response = undefined;
|
|
111
|
+
|
|
71
112
|
response = await client.call('post', apiPath, {
|
|
72
113
|
'content-type': 'application/json',
|
|
73
114
|
}, payload);
|
|
115
|
+
|
|
74
116
|
|
|
75
117
|
if (parseOutput) {
|
|
76
118
|
parse(response)
|
|
77
119
|
success()
|
|
78
120
|
}
|
|
121
|
+
|
|
79
122
|
return response;
|
|
80
123
|
}
|
|
81
124
|
|
|
82
|
-
|
|
83
|
-
|
|
125
|
+
/**
|
|
126
|
+
* @typedef {Object} TeamsGetRequestParams
|
|
127
|
+
* @property {string} teamId Team ID.
|
|
128
|
+
* @property {boolean} parseOutput
|
|
129
|
+
* @property {libClient | undefined} sdk
|
|
130
|
+
*/
|
|
84
131
|
|
|
132
|
+
/**
|
|
133
|
+
* @param {TeamsGetRequestParams} params
|
|
134
|
+
*/
|
|
135
|
+
const teamsGet = async ({ teamId, parseOutput = true, sdk = undefined}) => {
|
|
85
136
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
137
|
+
|
|
86
138
|
let apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
|
|
87
139
|
let payload = {};
|
|
140
|
+
|
|
141
|
+
|
|
88
142
|
let response = undefined;
|
|
143
|
+
|
|
89
144
|
response = await client.call('get', apiPath, {
|
|
90
145
|
'content-type': 'application/json',
|
|
91
146
|
}, payload);
|
|
147
|
+
|
|
92
148
|
|
|
93
149
|
if (parseOutput) {
|
|
94
150
|
parse(response)
|
|
95
151
|
success()
|
|
96
152
|
}
|
|
153
|
+
|
|
97
154
|
return response;
|
|
98
155
|
}
|
|
99
156
|
|
|
157
|
+
/**
|
|
158
|
+
* @typedef {Object} TeamsUpdateNameRequestParams
|
|
159
|
+
* @property {string} teamId Team ID.
|
|
160
|
+
* @property {string} name New team name. Max length: 128 chars.
|
|
161
|
+
* @property {boolean} parseOutput
|
|
162
|
+
* @property {libClient | undefined} sdk
|
|
163
|
+
*/
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @param {TeamsUpdateNameRequestParams} params
|
|
167
|
+
*/
|
|
100
168
|
const teamsUpdateName = async ({ teamId, name, parseOutput = true, sdk = undefined}) => {
|
|
101
|
-
/* @param {string} teamId */
|
|
102
|
-
/* @param {string} name */
|
|
103
|
-
|
|
104
169
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
170
|
+
|
|
105
171
|
let apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
|
|
106
172
|
let payload = {};
|
|
107
|
-
|
|
108
|
-
/** Body Params */
|
|
109
|
-
|
|
110
173
|
if (typeof name !== 'undefined') {
|
|
111
174
|
payload['name'] = name;
|
|
112
175
|
}
|
|
113
176
|
|
|
177
|
+
|
|
114
178
|
let response = undefined;
|
|
179
|
+
|
|
115
180
|
response = await client.call('put', apiPath, {
|
|
116
181
|
'content-type': 'application/json',
|
|
117
182
|
}, payload);
|
|
183
|
+
|
|
118
184
|
|
|
119
185
|
if (parseOutput) {
|
|
120
186
|
parse(response)
|
|
121
187
|
success()
|
|
122
188
|
}
|
|
189
|
+
|
|
123
190
|
return response;
|
|
124
191
|
}
|
|
125
192
|
|
|
126
|
-
|
|
127
|
-
|
|
193
|
+
/**
|
|
194
|
+
* @typedef {Object} TeamsDeleteRequestParams
|
|
195
|
+
* @property {string} teamId Team ID.
|
|
196
|
+
* @property {boolean} parseOutput
|
|
197
|
+
* @property {libClient | undefined} sdk
|
|
198
|
+
*/
|
|
128
199
|
|
|
200
|
+
/**
|
|
201
|
+
* @param {TeamsDeleteRequestParams} params
|
|
202
|
+
*/
|
|
203
|
+
const teamsDelete = async ({ teamId, parseOutput = true, sdk = undefined}) => {
|
|
129
204
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
205
|
+
|
|
130
206
|
let apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
|
|
131
207
|
let payload = {};
|
|
208
|
+
|
|
209
|
+
|
|
132
210
|
let response = undefined;
|
|
211
|
+
|
|
133
212
|
response = await client.call('delete', apiPath, {
|
|
134
213
|
'content-type': 'application/json',
|
|
135
214
|
}, payload);
|
|
215
|
+
|
|
136
216
|
|
|
137
217
|
if (parseOutput) {
|
|
138
218
|
parse(response)
|
|
139
219
|
success()
|
|
140
220
|
}
|
|
221
|
+
|
|
141
222
|
return response;
|
|
142
223
|
}
|
|
143
224
|
|
|
225
|
+
/**
|
|
226
|
+
* @typedef {Object} TeamsListLogsRequestParams
|
|
227
|
+
* @property {string} teamId Team ID.
|
|
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). Only supported methods are limit and offset
|
|
229
|
+
* @property {boolean} parseOutput
|
|
230
|
+
* @property {libClient | undefined} sdk
|
|
231
|
+
*/
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* @param {TeamsListLogsRequestParams} params
|
|
235
|
+
*/
|
|
144
236
|
const teamsListLogs = async ({ teamId, queries, parseOutput = true, sdk = undefined}) => {
|
|
145
|
-
/* @param {string} teamId */
|
|
146
|
-
/* @param {string[]} queries */
|
|
147
|
-
|
|
148
237
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
238
|
+
|
|
149
239
|
let apiPath = '/teams/{teamId}/logs'.replace('{teamId}', teamId);
|
|
150
240
|
let payload = {};
|
|
151
|
-
|
|
152
|
-
/** Query Params */
|
|
153
241
|
if (typeof queries !== 'undefined') {
|
|
154
242
|
payload['queries'] = queries;
|
|
155
243
|
}
|
|
244
|
+
|
|
245
|
+
|
|
156
246
|
let response = undefined;
|
|
247
|
+
|
|
157
248
|
response = await client.call('get', apiPath, {
|
|
158
249
|
'content-type': 'application/json',
|
|
159
250
|
}, payload);
|
|
251
|
+
|
|
160
252
|
|
|
161
253
|
if (parseOutput) {
|
|
162
254
|
parse(response)
|
|
163
255
|
success()
|
|
164
256
|
}
|
|
257
|
+
|
|
165
258
|
return response;
|
|
166
259
|
}
|
|
167
260
|
|
|
261
|
+
/**
|
|
262
|
+
* @typedef {Object} TeamsListMembershipsRequestParams
|
|
263
|
+
* @property {string} teamId Team ID.
|
|
264
|
+
* @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, teamId, invited, joined, confirm
|
|
265
|
+
* @property {string} search Search term to filter your list results. Max length: 256 chars.
|
|
266
|
+
* @property {boolean} parseOutput
|
|
267
|
+
* @property {libClient | undefined} sdk
|
|
268
|
+
*/
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* @param {TeamsListMembershipsRequestParams} params
|
|
272
|
+
*/
|
|
168
273
|
const teamsListMemberships = async ({ teamId, queries, search, parseOutput = true, sdk = undefined}) => {
|
|
169
|
-
/* @param {string} teamId */
|
|
170
|
-
/* @param {string[]} queries */
|
|
171
|
-
/* @param {string} search */
|
|
172
|
-
|
|
173
274
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
275
|
+
|
|
174
276
|
let apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
|
|
175
277
|
let payload = {};
|
|
176
|
-
|
|
177
|
-
/** Query Params */
|
|
178
278
|
if (typeof queries !== 'undefined') {
|
|
179
279
|
payload['queries'] = queries;
|
|
180
280
|
}
|
|
181
281
|
if (typeof search !== 'undefined') {
|
|
182
282
|
payload['search'] = search;
|
|
183
283
|
}
|
|
284
|
+
|
|
285
|
+
|
|
184
286
|
let response = undefined;
|
|
287
|
+
|
|
185
288
|
response = await client.call('get', apiPath, {
|
|
186
289
|
'content-type': 'application/json',
|
|
187
290
|
}, payload);
|
|
291
|
+
|
|
188
292
|
|
|
189
293
|
if (parseOutput) {
|
|
190
294
|
parse(response)
|
|
191
295
|
success()
|
|
192
296
|
}
|
|
297
|
+
|
|
193
298
|
return response;
|
|
194
299
|
}
|
|
195
300
|
|
|
301
|
+
/**
|
|
302
|
+
* @typedef {Object} TeamsCreateMembershipRequestParams
|
|
303
|
+
* @property {string} teamId Team ID.
|
|
304
|
+
* @property {string[]} roles Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
|
|
305
|
+
* @property {string} email Email of the new team member.
|
|
306
|
+
* @property {string} userId ID of the user to be added to a team.
|
|
307
|
+
* @property {string} phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
308
|
+
* @property {string} url URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
309
|
+
* @property {string} name Name of the new team member. Max length: 128 chars.
|
|
310
|
+
* @property {boolean} parseOutput
|
|
311
|
+
* @property {libClient | undefined} sdk
|
|
312
|
+
*/
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* @param {TeamsCreateMembershipRequestParams} params
|
|
316
|
+
*/
|
|
196
317
|
const teamsCreateMembership = async ({ teamId, roles, email, userId, phone, url, name, parseOutput = true, sdk = undefined}) => {
|
|
197
|
-
/* @param {string} teamId */
|
|
198
|
-
/* @param {string[]} roles */
|
|
199
|
-
/* @param {string} email */
|
|
200
|
-
/* @param {string} userId */
|
|
201
|
-
/* @param {string} phone */
|
|
202
|
-
/* @param {string} url */
|
|
203
|
-
/* @param {string} name */
|
|
204
|
-
|
|
205
318
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
319
|
+
|
|
206
320
|
let apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
|
|
207
321
|
let payload = {};
|
|
208
|
-
|
|
209
|
-
/** Body Params */
|
|
210
|
-
|
|
211
322
|
if (typeof email !== 'undefined') {
|
|
212
323
|
payload['email'] = email;
|
|
213
324
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
325
|
if (typeof userId !== 'undefined') {
|
|
217
326
|
payload['userId'] = userId;
|
|
218
327
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
328
|
if (typeof phone !== 'undefined') {
|
|
222
329
|
payload['phone'] = phone;
|
|
223
330
|
}
|
|
224
|
-
|
|
225
331
|
roles = roles === true ? [] : roles;
|
|
226
|
-
|
|
227
332
|
if (typeof roles !== 'undefined') {
|
|
228
333
|
payload['roles'] = roles;
|
|
229
334
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
335
|
if (typeof url !== 'undefined') {
|
|
233
336
|
payload['url'] = url;
|
|
234
337
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
338
|
if (typeof name !== 'undefined') {
|
|
238
339
|
payload['name'] = name;
|
|
239
340
|
}
|
|
240
341
|
|
|
342
|
+
|
|
241
343
|
let response = undefined;
|
|
344
|
+
|
|
242
345
|
response = await client.call('post', apiPath, {
|
|
243
346
|
'content-type': 'application/json',
|
|
244
347
|
}, payload);
|
|
348
|
+
|
|
245
349
|
|
|
246
350
|
if (parseOutput) {
|
|
247
351
|
parse(response)
|
|
248
352
|
success()
|
|
249
353
|
}
|
|
354
|
+
|
|
250
355
|
return response;
|
|
251
356
|
}
|
|
252
357
|
|
|
358
|
+
/**
|
|
359
|
+
* @typedef {Object} TeamsGetMembershipRequestParams
|
|
360
|
+
* @property {string} teamId Team ID.
|
|
361
|
+
* @property {string} membershipId Membership ID.
|
|
362
|
+
* @property {boolean} parseOutput
|
|
363
|
+
* @property {libClient | undefined} sdk
|
|
364
|
+
*/
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* @param {TeamsGetMembershipRequestParams} params
|
|
368
|
+
*/
|
|
253
369
|
const teamsGetMembership = async ({ teamId, membershipId, parseOutput = true, sdk = undefined}) => {
|
|
254
|
-
/* @param {string} teamId */
|
|
255
|
-
/* @param {string} membershipId */
|
|
256
|
-
|
|
257
370
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
371
|
+
|
|
258
372
|
let apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
|
|
259
373
|
let payload = {};
|
|
374
|
+
|
|
375
|
+
|
|
260
376
|
let response = undefined;
|
|
377
|
+
|
|
261
378
|
response = await client.call('get', apiPath, {
|
|
262
379
|
'content-type': 'application/json',
|
|
263
380
|
}, payload);
|
|
381
|
+
|
|
264
382
|
|
|
265
383
|
if (parseOutput) {
|
|
266
384
|
parse(response)
|
|
267
385
|
success()
|
|
268
386
|
}
|
|
387
|
+
|
|
269
388
|
return response;
|
|
270
389
|
}
|
|
271
390
|
|
|
391
|
+
/**
|
|
392
|
+
* @typedef {Object} TeamsUpdateMembershipRequestParams
|
|
393
|
+
* @property {string} teamId Team ID.
|
|
394
|
+
* @property {string} membershipId Membership ID.
|
|
395
|
+
* @property {string[]} roles An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
|
|
396
|
+
* @property {boolean} parseOutput
|
|
397
|
+
* @property {libClient | undefined} sdk
|
|
398
|
+
*/
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* @param {TeamsUpdateMembershipRequestParams} params
|
|
402
|
+
*/
|
|
272
403
|
const teamsUpdateMembership = async ({ teamId, membershipId, roles, parseOutput = true, sdk = undefined}) => {
|
|
273
|
-
/* @param {string} teamId */
|
|
274
|
-
/* @param {string} membershipId */
|
|
275
|
-
/* @param {string[]} roles */
|
|
276
|
-
|
|
277
404
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
405
|
+
|
|
278
406
|
let apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
|
|
279
407
|
let payload = {};
|
|
280
|
-
|
|
281
|
-
/** Body Params */
|
|
282
408
|
roles = roles === true ? [] : roles;
|
|
283
|
-
|
|
284
409
|
if (typeof roles !== 'undefined') {
|
|
285
410
|
payload['roles'] = roles;
|
|
286
411
|
}
|
|
287
412
|
|
|
413
|
+
|
|
288
414
|
let response = undefined;
|
|
415
|
+
|
|
289
416
|
response = await client.call('patch', apiPath, {
|
|
290
417
|
'content-type': 'application/json',
|
|
291
418
|
}, payload);
|
|
419
|
+
|
|
292
420
|
|
|
293
421
|
if (parseOutput) {
|
|
294
422
|
parse(response)
|
|
295
423
|
success()
|
|
296
424
|
}
|
|
425
|
+
|
|
297
426
|
return response;
|
|
298
427
|
}
|
|
299
428
|
|
|
429
|
+
/**
|
|
430
|
+
* @typedef {Object} TeamsDeleteMembershipRequestParams
|
|
431
|
+
* @property {string} teamId Team ID.
|
|
432
|
+
* @property {string} membershipId Membership ID.
|
|
433
|
+
* @property {boolean} parseOutput
|
|
434
|
+
* @property {libClient | undefined} sdk
|
|
435
|
+
*/
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* @param {TeamsDeleteMembershipRequestParams} params
|
|
439
|
+
*/
|
|
300
440
|
const teamsDeleteMembership = async ({ teamId, membershipId, parseOutput = true, sdk = undefined}) => {
|
|
301
|
-
/* @param {string} teamId */
|
|
302
|
-
/* @param {string} membershipId */
|
|
303
|
-
|
|
304
441
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
442
|
+
|
|
305
443
|
let apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
|
|
306
444
|
let payload = {};
|
|
445
|
+
|
|
446
|
+
|
|
307
447
|
let response = undefined;
|
|
448
|
+
|
|
308
449
|
response = await client.call('delete', apiPath, {
|
|
309
450
|
'content-type': 'application/json',
|
|
310
451
|
}, payload);
|
|
452
|
+
|
|
311
453
|
|
|
312
454
|
if (parseOutput) {
|
|
313
455
|
parse(response)
|
|
314
456
|
success()
|
|
315
457
|
}
|
|
458
|
+
|
|
316
459
|
return response;
|
|
317
460
|
}
|
|
318
461
|
|
|
462
|
+
/**
|
|
463
|
+
* @typedef {Object} TeamsUpdateMembershipStatusRequestParams
|
|
464
|
+
* @property {string} teamId Team ID.
|
|
465
|
+
* @property {string} membershipId Membership ID.
|
|
466
|
+
* @property {string} userId User ID.
|
|
467
|
+
* @property {string} secret Secret key.
|
|
468
|
+
* @property {boolean} parseOutput
|
|
469
|
+
* @property {libClient | undefined} sdk
|
|
470
|
+
*/
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* @param {TeamsUpdateMembershipStatusRequestParams} params
|
|
474
|
+
*/
|
|
319
475
|
const teamsUpdateMembershipStatus = async ({ teamId, membershipId, userId, secret, parseOutput = true, sdk = undefined}) => {
|
|
320
|
-
/* @param {string} teamId */
|
|
321
|
-
/* @param {string} membershipId */
|
|
322
|
-
/* @param {string} userId */
|
|
323
|
-
/* @param {string} secret */
|
|
324
|
-
|
|
325
476
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
477
|
+
|
|
326
478
|
let apiPath = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
|
|
327
479
|
let payload = {};
|
|
328
|
-
|
|
329
|
-
/** Body Params */
|
|
330
|
-
|
|
331
480
|
if (typeof userId !== 'undefined') {
|
|
332
481
|
payload['userId'] = userId;
|
|
333
482
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
483
|
if (typeof secret !== 'undefined') {
|
|
337
484
|
payload['secret'] = secret;
|
|
338
485
|
}
|
|
339
486
|
|
|
487
|
+
|
|
340
488
|
let response = undefined;
|
|
489
|
+
|
|
341
490
|
response = await client.call('patch', apiPath, {
|
|
342
491
|
'content-type': 'application/json',
|
|
343
492
|
}, payload);
|
|
493
|
+
|
|
344
494
|
|
|
345
495
|
if (parseOutput) {
|
|
346
496
|
parse(response)
|
|
347
497
|
success()
|
|
348
498
|
}
|
|
499
|
+
|
|
349
500
|
return response;
|
|
350
501
|
}
|
|
351
502
|
|
|
352
|
-
|
|
353
|
-
|
|
503
|
+
/**
|
|
504
|
+
* @typedef {Object} TeamsGetPrefsRequestParams
|
|
505
|
+
* @property {string} teamId Team ID.
|
|
506
|
+
* @property {boolean} parseOutput
|
|
507
|
+
* @property {libClient | undefined} sdk
|
|
508
|
+
*/
|
|
354
509
|
|
|
510
|
+
/**
|
|
511
|
+
* @param {TeamsGetPrefsRequestParams} params
|
|
512
|
+
*/
|
|
513
|
+
const teamsGetPrefs = async ({ teamId, parseOutput = true, sdk = undefined}) => {
|
|
355
514
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
515
|
+
|
|
356
516
|
let apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
|
|
357
517
|
let payload = {};
|
|
518
|
+
|
|
519
|
+
|
|
358
520
|
let response = undefined;
|
|
521
|
+
|
|
359
522
|
response = await client.call('get', apiPath, {
|
|
360
523
|
'content-type': 'application/json',
|
|
361
524
|
}, payload);
|
|
525
|
+
|
|
362
526
|
|
|
363
527
|
if (parseOutput) {
|
|
364
528
|
parse(response)
|
|
365
529
|
success()
|
|
366
530
|
}
|
|
531
|
+
|
|
367
532
|
return response;
|
|
368
533
|
}
|
|
369
534
|
|
|
535
|
+
/**
|
|
536
|
+
* @typedef {Object} TeamsUpdatePrefsRequestParams
|
|
537
|
+
* @property {string} teamId Team ID.
|
|
538
|
+
* @property {object} prefs Prefs key-value JSON object.
|
|
539
|
+
* @property {boolean} parseOutput
|
|
540
|
+
* @property {libClient | undefined} sdk
|
|
541
|
+
*/
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* @param {TeamsUpdatePrefsRequestParams} params
|
|
545
|
+
*/
|
|
370
546
|
const teamsUpdatePrefs = async ({ teamId, prefs, parseOutput = true, sdk = undefined}) => {
|
|
371
|
-
/* @param {string} teamId */
|
|
372
|
-
/* @param {object} prefs */
|
|
373
|
-
|
|
374
547
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
548
|
+
|
|
375
549
|
let apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
|
|
376
550
|
let payload = {};
|
|
377
|
-
|
|
378
|
-
/** Body Params */
|
|
379
551
|
if (typeof prefs !== 'undefined') {
|
|
380
552
|
payload['prefs'] = JSON.parse(prefs);
|
|
381
553
|
}
|
|
382
554
|
|
|
555
|
+
|
|
383
556
|
let response = undefined;
|
|
557
|
+
|
|
384
558
|
response = await client.call('put', apiPath, {
|
|
385
559
|
'content-type': 'application/json',
|
|
386
560
|
}, payload);
|
|
561
|
+
|
|
387
562
|
|
|
388
563
|
if (parseOutput) {
|
|
389
564
|
parse(response)
|
|
390
565
|
success()
|
|
391
566
|
}
|
|
567
|
+
|
|
392
568
|
return response;
|
|
393
569
|
}
|
|
394
570
|
|
|
@@ -501,18 +677,18 @@ teams
|
|
|
501
677
|
|
|
502
678
|
module.exports = {
|
|
503
679
|
teams,
|
|
504
|
-
teamsList,
|
|
505
|
-
teamsCreate,
|
|
506
|
-
teamsGet,
|
|
507
|
-
teamsUpdateName,
|
|
508
|
-
teamsDelete,
|
|
509
|
-
teamsListLogs,
|
|
510
|
-
teamsListMemberships,
|
|
511
|
-
teamsCreateMembership,
|
|
512
|
-
teamsGetMembership,
|
|
513
|
-
teamsUpdateMembership,
|
|
514
|
-
teamsDeleteMembership,
|
|
515
|
-
teamsUpdateMembershipStatus,
|
|
516
|
-
teamsGetPrefs,
|
|
517
|
-
teamsUpdatePrefs
|
|
518
|
-
};
|
|
680
|
+
teamsList,
|
|
681
|
+
teamsCreate,
|
|
682
|
+
teamsGet,
|
|
683
|
+
teamsUpdateName,
|
|
684
|
+
teamsDelete,
|
|
685
|
+
teamsListLogs,
|
|
686
|
+
teamsListMemberships,
|
|
687
|
+
teamsCreateMembership,
|
|
688
|
+
teamsGetMembership,
|
|
689
|
+
teamsUpdateMembership,
|
|
690
|
+
teamsDeleteMembership,
|
|
691
|
+
teamsUpdateMembershipStatus,
|
|
692
|
+
teamsGetPrefs,
|
|
693
|
+
teamsUpdatePrefs
|
|
694
|
+
};
|