node-appwrite 10.0.1 → 11.1.0
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/README.md +1 -1
- package/docs/examples/functions/create.md +1 -1
- package/docs/examples/functions/update.md +1 -1
- package/docs/examples/health/get-queue-builds.md +20 -0
- package/docs/examples/health/get-queue-databases.md +20 -0
- package/docs/examples/health/get-queue-deletes.md +20 -0
- package/docs/examples/health/get-queue-mails.md +20 -0
- package/docs/examples/health/get-queue-messaging.md +20 -0
- package/docs/examples/health/get-queue-migrations.md +20 -0
- package/docs/examples/teams/create-membership.md +1 -1
- package/index.d.ts +297 -214
- package/lib/client.js +7 -7
- package/lib/query.js +1 -1
- package/lib/services/account.js +35 -31
- package/lib/services/avatars.js +11 -10
- package/lib/services/databases.js +48 -48
- package/lib/services/functions.js +26 -26
- package/lib/services/graphql.js +2 -2
- package/lib/services/health.js +177 -14
- package/lib/services/locale.js +7 -7
- package/lib/services/storage.js +12 -12
- package/lib/services/teams.js +19 -23
- package/lib/services/users.js +44 -42
- package/package.json +1 -1
package/lib/services/health.js
CHANGED
|
@@ -32,7 +32,7 @@ class Health extends Service {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* Get
|
|
35
|
+
* Get antivirus
|
|
36
36
|
*
|
|
37
37
|
* Check the Appwrite Antivirus server is up and connection is successful.
|
|
38
38
|
*
|
|
@@ -49,7 +49,7 @@ class Health extends Service {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
* Get
|
|
52
|
+
* Get cache
|
|
53
53
|
*
|
|
54
54
|
* Check the Appwrite in-memory cache servers are up and connection is
|
|
55
55
|
* successful.
|
|
@@ -84,7 +84,7 @@ class Health extends Service {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
* Get
|
|
87
|
+
* Get pubsub
|
|
88
88
|
*
|
|
89
89
|
* Check the Appwrite pub-sub servers are up and connection is successful.
|
|
90
90
|
*
|
|
@@ -101,7 +101,7 @@ class Health extends Service {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
|
-
* Get
|
|
104
|
+
* Get queue
|
|
105
105
|
*
|
|
106
106
|
* Check the Appwrite queue messaging servers are up and connection is
|
|
107
107
|
* successful.
|
|
@@ -119,77 +119,240 @@ class Health extends Service {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
* Get
|
|
122
|
+
* Get builds queue
|
|
123
|
+
*
|
|
124
|
+
* Get the number of builds that are waiting to be processed in the Appwrite
|
|
125
|
+
* internal queue server.
|
|
126
|
+
*
|
|
127
|
+
* @param {number} threshold
|
|
128
|
+
* @throws {AppwriteException}
|
|
129
|
+
* @returns {Promise}
|
|
130
|
+
*/
|
|
131
|
+
async getQueueBuilds(threshold) {
|
|
132
|
+
const apiPath = '/health/queue/builds';
|
|
133
|
+
let payload = {};
|
|
134
|
+
|
|
135
|
+
if (typeof threshold !== 'undefined') {
|
|
136
|
+
payload['threshold'] = threshold;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return await this.client.call('get', apiPath, {
|
|
140
|
+
'content-type': 'application/json',
|
|
141
|
+
}, payload);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Get certificates queue
|
|
123
146
|
*
|
|
124
147
|
* Get the number of certificates that are waiting to be issued against
|
|
125
148
|
* [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue
|
|
126
149
|
* server.
|
|
127
150
|
*
|
|
151
|
+
* @param {number} threshold
|
|
128
152
|
* @throws {AppwriteException}
|
|
129
153
|
* @returns {Promise}
|
|
130
154
|
*/
|
|
131
|
-
async getQueueCertificates() {
|
|
155
|
+
async getQueueCertificates(threshold) {
|
|
132
156
|
const apiPath = '/health/queue/certificates';
|
|
133
157
|
let payload = {};
|
|
134
158
|
|
|
159
|
+
if (typeof threshold !== 'undefined') {
|
|
160
|
+
payload['threshold'] = threshold;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return await this.client.call('get', apiPath, {
|
|
164
|
+
'content-type': 'application/json',
|
|
165
|
+
}, payload);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Get databases queue
|
|
170
|
+
*
|
|
171
|
+
* Get the number of database changes that are waiting to be processed in the
|
|
172
|
+
* Appwrite internal queue server.
|
|
173
|
+
*
|
|
174
|
+
* @param {string} name
|
|
175
|
+
* @param {number} threshold
|
|
176
|
+
* @throws {AppwriteException}
|
|
177
|
+
* @returns {Promise}
|
|
178
|
+
*/
|
|
179
|
+
async getQueueDatabases(name, threshold) {
|
|
180
|
+
const apiPath = '/health/queue/databases';
|
|
181
|
+
let payload = {};
|
|
182
|
+
|
|
183
|
+
if (typeof name !== 'undefined') {
|
|
184
|
+
payload['name'] = name;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (typeof threshold !== 'undefined') {
|
|
188
|
+
payload['threshold'] = threshold;
|
|
189
|
+
}
|
|
190
|
+
|
|
135
191
|
return await this.client.call('get', apiPath, {
|
|
136
192
|
'content-type': 'application/json',
|
|
137
193
|
}, payload);
|
|
138
194
|
}
|
|
139
195
|
|
|
140
196
|
/**
|
|
141
|
-
* Get
|
|
197
|
+
* Get deletes queue
|
|
198
|
+
*
|
|
199
|
+
* Get the number of background destructive changes that are waiting to be
|
|
200
|
+
* processed in the Appwrite internal queue server.
|
|
142
201
|
*
|
|
202
|
+
* @param {number} threshold
|
|
143
203
|
* @throws {AppwriteException}
|
|
144
204
|
* @returns {Promise}
|
|
145
205
|
*/
|
|
146
|
-
async
|
|
206
|
+
async getQueueDeletes(threshold) {
|
|
207
|
+
const apiPath = '/health/queue/deletes';
|
|
208
|
+
let payload = {};
|
|
209
|
+
|
|
210
|
+
if (typeof threshold !== 'undefined') {
|
|
211
|
+
payload['threshold'] = threshold;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return await this.client.call('get', apiPath, {
|
|
215
|
+
'content-type': 'application/json',
|
|
216
|
+
}, payload);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Get functions queue
|
|
221
|
+
*
|
|
222
|
+
* @param {number} threshold
|
|
223
|
+
* @throws {AppwriteException}
|
|
224
|
+
* @returns {Promise}
|
|
225
|
+
*/
|
|
226
|
+
async getQueueFunctions(threshold) {
|
|
147
227
|
const apiPath = '/health/queue/functions';
|
|
148
228
|
let payload = {};
|
|
149
229
|
|
|
230
|
+
if (typeof threshold !== 'undefined') {
|
|
231
|
+
payload['threshold'] = threshold;
|
|
232
|
+
}
|
|
233
|
+
|
|
150
234
|
return await this.client.call('get', apiPath, {
|
|
151
235
|
'content-type': 'application/json',
|
|
152
236
|
}, payload);
|
|
153
237
|
}
|
|
154
238
|
|
|
155
239
|
/**
|
|
156
|
-
* Get
|
|
240
|
+
* Get logs queue
|
|
157
241
|
*
|
|
158
242
|
* Get the number of logs that are waiting to be processed in the Appwrite
|
|
159
243
|
* internal queue server.
|
|
160
244
|
*
|
|
245
|
+
* @param {number} threshold
|
|
161
246
|
* @throws {AppwriteException}
|
|
162
247
|
* @returns {Promise}
|
|
163
248
|
*/
|
|
164
|
-
async getQueueLogs() {
|
|
249
|
+
async getQueueLogs(threshold) {
|
|
165
250
|
const apiPath = '/health/queue/logs';
|
|
166
251
|
let payload = {};
|
|
167
252
|
|
|
253
|
+
if (typeof threshold !== 'undefined') {
|
|
254
|
+
payload['threshold'] = threshold;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return await this.client.call('get', apiPath, {
|
|
258
|
+
'content-type': 'application/json',
|
|
259
|
+
}, payload);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Get mails queue
|
|
264
|
+
*
|
|
265
|
+
* Get the number of mails that are waiting to be processed in the Appwrite
|
|
266
|
+
* internal queue server.
|
|
267
|
+
*
|
|
268
|
+
* @param {number} threshold
|
|
269
|
+
* @throws {AppwriteException}
|
|
270
|
+
* @returns {Promise}
|
|
271
|
+
*/
|
|
272
|
+
async getQueueMails(threshold) {
|
|
273
|
+
const apiPath = '/health/queue/mails';
|
|
274
|
+
let payload = {};
|
|
275
|
+
|
|
276
|
+
if (typeof threshold !== 'undefined') {
|
|
277
|
+
payload['threshold'] = threshold;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return await this.client.call('get', apiPath, {
|
|
281
|
+
'content-type': 'application/json',
|
|
282
|
+
}, payload);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Get messaging queue
|
|
287
|
+
*
|
|
288
|
+
* Get the number of messages that are waiting to be processed in the Appwrite
|
|
289
|
+
* internal queue server.
|
|
290
|
+
*
|
|
291
|
+
* @param {number} threshold
|
|
292
|
+
* @throws {AppwriteException}
|
|
293
|
+
* @returns {Promise}
|
|
294
|
+
*/
|
|
295
|
+
async getQueueMessaging(threshold) {
|
|
296
|
+
const apiPath = '/health/queue/messaging';
|
|
297
|
+
let payload = {};
|
|
298
|
+
|
|
299
|
+
if (typeof threshold !== 'undefined') {
|
|
300
|
+
payload['threshold'] = threshold;
|
|
301
|
+
}
|
|
302
|
+
|
|
168
303
|
return await this.client.call('get', apiPath, {
|
|
169
304
|
'content-type': 'application/json',
|
|
170
305
|
}, payload);
|
|
171
306
|
}
|
|
172
307
|
|
|
173
308
|
/**
|
|
174
|
-
* Get
|
|
309
|
+
* Get migrations queue
|
|
310
|
+
*
|
|
311
|
+
* Get the number of migrations that are waiting to be processed in the
|
|
312
|
+
* Appwrite internal queue server.
|
|
313
|
+
*
|
|
314
|
+
* @param {number} threshold
|
|
315
|
+
* @throws {AppwriteException}
|
|
316
|
+
* @returns {Promise}
|
|
317
|
+
*/
|
|
318
|
+
async getQueueMigrations(threshold) {
|
|
319
|
+
const apiPath = '/health/queue/migrations';
|
|
320
|
+
let payload = {};
|
|
321
|
+
|
|
322
|
+
if (typeof threshold !== 'undefined') {
|
|
323
|
+
payload['threshold'] = threshold;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return await this.client.call('get', apiPath, {
|
|
327
|
+
'content-type': 'application/json',
|
|
328
|
+
}, payload);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Get webhooks queue
|
|
175
333
|
*
|
|
176
334
|
* Get the number of webhooks that are waiting to be processed in the Appwrite
|
|
177
335
|
* internal queue server.
|
|
178
336
|
*
|
|
337
|
+
* @param {number} threshold
|
|
179
338
|
* @throws {AppwriteException}
|
|
180
339
|
* @returns {Promise}
|
|
181
340
|
*/
|
|
182
|
-
async getQueueWebhooks() {
|
|
341
|
+
async getQueueWebhooks(threshold) {
|
|
183
342
|
const apiPath = '/health/queue/webhooks';
|
|
184
343
|
let payload = {};
|
|
185
344
|
|
|
345
|
+
if (typeof threshold !== 'undefined') {
|
|
346
|
+
payload['threshold'] = threshold;
|
|
347
|
+
}
|
|
348
|
+
|
|
186
349
|
return await this.client.call('get', apiPath, {
|
|
187
350
|
'content-type': 'application/json',
|
|
188
351
|
}, payload);
|
|
189
352
|
}
|
|
190
353
|
|
|
191
354
|
/**
|
|
192
|
-
* Get
|
|
355
|
+
* Get local storage
|
|
193
356
|
*
|
|
194
357
|
* Check the Appwrite local storage device is up and connection is successful.
|
|
195
358
|
*
|
|
@@ -206,7 +369,7 @@ class Health extends Service {
|
|
|
206
369
|
}
|
|
207
370
|
|
|
208
371
|
/**
|
|
209
|
-
* Get
|
|
372
|
+
* Get time
|
|
210
373
|
*
|
|
211
374
|
* Check the Appwrite server time is synced with Google remote NTP server. We
|
|
212
375
|
* use this technology to smoothly handle leap seconds with no disruptive
|
package/lib/services/locale.js
CHANGED
|
@@ -15,7 +15,7 @@ class Locale extends Service {
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Get
|
|
18
|
+
* Get user locale
|
|
19
19
|
*
|
|
20
20
|
* Get the current user location based on IP. Returns an object with user
|
|
21
21
|
* country code, country name, continent name, continent code, ip address and
|
|
@@ -55,7 +55,7 @@ class Locale extends Service {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* List
|
|
58
|
+
* List continents
|
|
59
59
|
*
|
|
60
60
|
* List of all continents. You can use the locale header to get the data in a
|
|
61
61
|
* supported language.
|
|
@@ -73,7 +73,7 @@ class Locale extends Service {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
|
-
* List
|
|
76
|
+
* List countries
|
|
77
77
|
*
|
|
78
78
|
* List of all countries. You can use the locale header to get the data in a
|
|
79
79
|
* supported language.
|
|
@@ -91,7 +91,7 @@ class Locale extends Service {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
* List EU
|
|
94
|
+
* List EU countries
|
|
95
95
|
*
|
|
96
96
|
* List of all countries that are currently members of the EU. You can use the
|
|
97
97
|
* locale header to get the data in a supported language.
|
|
@@ -109,7 +109,7 @@ class Locale extends Service {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
|
-
* List
|
|
112
|
+
* List countries phone codes
|
|
113
113
|
*
|
|
114
114
|
* List of all countries phone codes. You can use the locale header to get the
|
|
115
115
|
* data in a supported language.
|
|
@@ -127,7 +127,7 @@ class Locale extends Service {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
* List
|
|
130
|
+
* List currencies
|
|
131
131
|
*
|
|
132
132
|
* List of all currencies, including currency symbol, name, plural, and
|
|
133
133
|
* decimal digits for all major and minor currencies. You can use the locale
|
|
@@ -146,7 +146,7 @@ class Locale extends Service {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
|
-
* List
|
|
149
|
+
* List languages
|
|
150
150
|
*
|
|
151
151
|
* List of all languages classified by ISO 639-1 including 2-letter code, name
|
|
152
152
|
* in English, and name in the respective language.
|
package/lib/services/storage.js
CHANGED
|
@@ -118,7 +118,7 @@ class Storage extends Service {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
|
-
* Get
|
|
121
|
+
* Get bucket
|
|
122
122
|
*
|
|
123
123
|
* Get a storage bucket by its unique ID. This endpoint response returns a
|
|
124
124
|
* JSON object with the storage bucket metadata.
|
|
@@ -141,7 +141,7 @@ class Storage extends Service {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
|
-
* Update
|
|
144
|
+
* Update bucket
|
|
145
145
|
*
|
|
146
146
|
* Update a storage bucket by its unique ID.
|
|
147
147
|
*
|
|
@@ -212,7 +212,7 @@ class Storage extends Service {
|
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
/**
|
|
215
|
-
* Delete
|
|
215
|
+
* Delete bucket
|
|
216
216
|
*
|
|
217
217
|
* Delete a storage bucket by its unique ID.
|
|
218
218
|
*
|
|
@@ -234,7 +234,7 @@ class Storage extends Service {
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
/**
|
|
237
|
-
* List
|
|
237
|
+
* List files
|
|
238
238
|
*
|
|
239
239
|
* Get a list of all the user files. You can use the query params to filter
|
|
240
240
|
* your results.
|
|
@@ -267,12 +267,12 @@ class Storage extends Service {
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
/**
|
|
270
|
-
* Create
|
|
270
|
+
* Create file
|
|
271
271
|
*
|
|
272
272
|
* Create a new file. Before using this route, you should create a new bucket
|
|
273
273
|
* resource using either a [server
|
|
274
|
-
* integration](/docs/server/storage#storageCreateBucket)
|
|
275
|
-
* your Appwrite console.
|
|
274
|
+
* integration](https://appwrite.io/docs/server/storage#storageCreateBucket)
|
|
275
|
+
* API or directly from your Appwrite console.
|
|
276
276
|
*
|
|
277
277
|
* Larger files should be uploaded using multiple requests with the
|
|
278
278
|
* [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
|
|
@@ -458,7 +458,7 @@ class Storage extends Service {
|
|
|
458
458
|
}
|
|
459
459
|
|
|
460
460
|
/**
|
|
461
|
-
* Get
|
|
461
|
+
* Get file
|
|
462
462
|
*
|
|
463
463
|
* Get a file by its unique ID. This endpoint response returns a JSON object
|
|
464
464
|
* with the file metadata.
|
|
@@ -486,7 +486,7 @@ class Storage extends Service {
|
|
|
486
486
|
}
|
|
487
487
|
|
|
488
488
|
/**
|
|
489
|
-
* Update
|
|
489
|
+
* Update file
|
|
490
490
|
*
|
|
491
491
|
* Update a file by its unique ID. Only users with write permissions have
|
|
492
492
|
* access to update this resource.
|
|
@@ -552,7 +552,7 @@ class Storage extends Service {
|
|
|
552
552
|
}
|
|
553
553
|
|
|
554
554
|
/**
|
|
555
|
-
* Get
|
|
555
|
+
* Get file for download
|
|
556
556
|
*
|
|
557
557
|
* Get a file content by its unique ID. The endpoint response return with a
|
|
558
558
|
* 'Content-Disposition: attachment' header that tells the browser to start
|
|
@@ -581,7 +581,7 @@ class Storage extends Service {
|
|
|
581
581
|
}
|
|
582
582
|
|
|
583
583
|
/**
|
|
584
|
-
* Get
|
|
584
|
+
* Get file preview
|
|
585
585
|
*
|
|
586
586
|
* Get a file preview image. Currently, this method supports preview for image
|
|
587
587
|
* files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
|
|
@@ -667,7 +667,7 @@ class Storage extends Service {
|
|
|
667
667
|
}
|
|
668
668
|
|
|
669
669
|
/**
|
|
670
|
-
* Get
|
|
670
|
+
* Get file for view
|
|
671
671
|
*
|
|
672
672
|
* Get a file content by its unique ID. This endpoint is similar to the
|
|
673
673
|
* download method but returns with no 'Content-Disposition: attachment'
|
package/lib/services/teams.js
CHANGED
|
@@ -15,7 +15,7 @@ class Teams extends Service {
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* List
|
|
18
|
+
* List teams
|
|
19
19
|
*
|
|
20
20
|
* Get a list of all the teams in which the current user is a member. You can
|
|
21
21
|
* use the parameters to filter your results.
|
|
@@ -43,7 +43,7 @@ class Teams extends Service {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
* Create
|
|
46
|
+
* Create team
|
|
47
47
|
*
|
|
48
48
|
* Create a new team. The user who creates the team will automatically be
|
|
49
49
|
* assigned as the owner of the team. Only the users with the owner role can
|
|
@@ -85,7 +85,7 @@ class Teams extends Service {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* Get
|
|
88
|
+
* Get team
|
|
89
89
|
*
|
|
90
90
|
* Get a team by its ID. All team members have read access for this resource.
|
|
91
91
|
*
|
|
@@ -107,7 +107,7 @@ class Teams extends Service {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
|
-
* Update
|
|
110
|
+
* Update name
|
|
111
111
|
*
|
|
112
112
|
* Update the team's name by its unique ID.
|
|
113
113
|
*
|
|
@@ -138,7 +138,7 @@ class Teams extends Service {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
|
-
* Delete
|
|
141
|
+
* Delete team
|
|
142
142
|
*
|
|
143
143
|
* Delete a team using its ID. Only team members with the owner role can
|
|
144
144
|
* delete the team.
|
|
@@ -161,7 +161,7 @@ class Teams extends Service {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
|
-
* List
|
|
164
|
+
* List team memberships
|
|
165
165
|
*
|
|
166
166
|
* Use this endpoint to list a team's members using the team's ID. All team
|
|
167
167
|
* members have read access to this endpoint.
|
|
@@ -194,7 +194,7 @@ class Teams extends Service {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
/**
|
|
197
|
-
* Create
|
|
197
|
+
* Create team membership
|
|
198
198
|
*
|
|
199
199
|
* Invite a new member to join your team. Provide an ID for existing users, or
|
|
200
200
|
* invite unregistered users using an email or phone number. If initiated from
|
|
@@ -209,8 +209,8 @@ class Teams extends Service {
|
|
|
209
209
|
*
|
|
210
210
|
* Use the `url` parameter to redirect the user from the invitation email to
|
|
211
211
|
* your app. After the user is redirected, use the [Update Team Membership
|
|
212
|
-
* Status](/docs/client/teams#
|
|
213
|
-
* the user to accept the invitation to the team.
|
|
212
|
+
* Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus)
|
|
213
|
+
* endpoint to allow the user to accept the invitation to the team.
|
|
214
214
|
*
|
|
215
215
|
* Please note that to avoid a [Redirect
|
|
216
216
|
* Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
|
@@ -220,15 +220,15 @@ class Teams extends Service {
|
|
|
220
220
|
*
|
|
221
221
|
* @param {string} teamId
|
|
222
222
|
* @param {string[]} roles
|
|
223
|
-
* @param {string} url
|
|
224
223
|
* @param {string} email
|
|
225
224
|
* @param {string} userId
|
|
226
225
|
* @param {string} phone
|
|
226
|
+
* @param {string} url
|
|
227
227
|
* @param {string} name
|
|
228
228
|
* @throws {AppwriteException}
|
|
229
229
|
* @returns {Promise}
|
|
230
230
|
*/
|
|
231
|
-
async createMembership(teamId, roles,
|
|
231
|
+
async createMembership(teamId, roles, email, userId, phone, url, name) {
|
|
232
232
|
const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
|
|
233
233
|
let payload = {};
|
|
234
234
|
if (typeof teamId === 'undefined') {
|
|
@@ -239,10 +239,6 @@ class Teams extends Service {
|
|
|
239
239
|
throw new AppwriteException('Missing required parameter: "roles"');
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
if (typeof url === 'undefined') {
|
|
243
|
-
throw new AppwriteException('Missing required parameter: "url"');
|
|
244
|
-
}
|
|
245
|
-
|
|
246
242
|
|
|
247
243
|
if (typeof email !== 'undefined') {
|
|
248
244
|
payload['email'] = email;
|
|
@@ -274,7 +270,7 @@ class Teams extends Service {
|
|
|
274
270
|
}
|
|
275
271
|
|
|
276
272
|
/**
|
|
277
|
-
* Get
|
|
273
|
+
* Get team membership
|
|
278
274
|
*
|
|
279
275
|
* Get a team member by the membership unique id. All team members have read
|
|
280
276
|
* access for this resource.
|
|
@@ -302,11 +298,11 @@ class Teams extends Service {
|
|
|
302
298
|
}
|
|
303
299
|
|
|
304
300
|
/**
|
|
305
|
-
* Update
|
|
301
|
+
* Update membership
|
|
306
302
|
*
|
|
307
303
|
* Modify the roles of a team member. Only team members with the owner role
|
|
308
304
|
* have access to this endpoint. Learn more about [roles and
|
|
309
|
-
* permissions](/docs/permissions).
|
|
305
|
+
* permissions](https://appwrite.io/docs/permissions).
|
|
310
306
|
*
|
|
311
307
|
*
|
|
312
308
|
* @param {string} teamId
|
|
@@ -341,7 +337,7 @@ class Teams extends Service {
|
|
|
341
337
|
}
|
|
342
338
|
|
|
343
339
|
/**
|
|
344
|
-
* Delete
|
|
340
|
+
* Delete team membership
|
|
345
341
|
*
|
|
346
342
|
* This endpoint allows a user to leave a team or for a team owner to delete
|
|
347
343
|
* the membership of any other team member. You can also use this endpoint to
|
|
@@ -370,7 +366,7 @@ class Teams extends Service {
|
|
|
370
366
|
}
|
|
371
367
|
|
|
372
368
|
/**
|
|
373
|
-
* Update
|
|
369
|
+
* Update team membership status
|
|
374
370
|
*
|
|
375
371
|
* Use this endpoint to allow a user to accept an invitation to join a team
|
|
376
372
|
* after being redirected back to your app from the invitation email received
|
|
@@ -421,11 +417,11 @@ class Teams extends Service {
|
|
|
421
417
|
}
|
|
422
418
|
|
|
423
419
|
/**
|
|
424
|
-
* Get
|
|
420
|
+
* Get team preferences
|
|
425
421
|
*
|
|
426
422
|
* Get the team's shared preferences by its unique ID. If a preference doesn't
|
|
427
423
|
* need to be shared by all team members, prefer storing them in [user
|
|
428
|
-
* preferences](/docs/client/account#
|
|
424
|
+
* preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
|
|
429
425
|
*
|
|
430
426
|
* @param {string} teamId
|
|
431
427
|
* @throws {AppwriteException}
|
|
@@ -445,7 +441,7 @@ class Teams extends Service {
|
|
|
445
441
|
}
|
|
446
442
|
|
|
447
443
|
/**
|
|
448
|
-
* Update
|
|
444
|
+
* Update preferences
|
|
449
445
|
*
|
|
450
446
|
* Update the team's preferences by its unique ID. The object you pass is
|
|
451
447
|
* stored as is and replaces any previous value. The maximum allowed prefs
|