react-native-appwrite 0.7.0 → 0.7.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/dist/cjs/sdk.js +1096 -1449
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +1096 -1449
- package/dist/esm/sdk.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +4 -3
- package/src/services/account.ts +90 -184
- package/src/services/avatars.ts +0 -14
- package/src/services/databases.ts +10 -20
- package/src/services/functions.ts +6 -12
- package/src/services/graphql.ts +4 -8
- package/src/services/locale.ts +16 -32
- package/src/services/messaging.ts +4 -8
- package/src/services/storage.ts +9 -25
- package/src/services/teams.ts +26 -52
- package/types/services/account.d.ts +0 -94
- package/types/services/avatars.d.ts +0 -14
- package/types/services/databases.d.ts +0 -10
- package/types/services/functions.d.ts +0 -6
- package/types/services/graphql.d.ts +0 -4
- package/types/services/locale.d.ts +0 -16
- package/types/services/messaging.d.ts +0 -4
- package/types/services/storage.d.ts +0 -16
- package/types/services/teams.d.ts +0 -26
package/src/services/teams.ts
CHANGED
|
@@ -14,8 +14,6 @@ export class Teams extends Service {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* List teams
|
|
18
|
-
*
|
|
19
17
|
* Get a list of all the teams in which the current user is a member. You can
|
|
20
18
|
* use the parameters to filter your results.
|
|
21
19
|
*
|
|
@@ -24,7 +22,7 @@ export class Teams extends Service {
|
|
|
24
22
|
* @throws {AppwriteException}
|
|
25
23
|
* @returns {Promise}
|
|
26
24
|
*/
|
|
27
|
-
|
|
25
|
+
list<Preferences extends Models.Preferences>(queries?: string[], search?: string): Promise<Models.TeamList<Preferences>> {
|
|
28
26
|
const apiPath = '/teams';
|
|
29
27
|
const payload: Payload = {};
|
|
30
28
|
|
|
@@ -37,14 +35,12 @@ export class Teams extends Service {
|
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
40
|
-
return
|
|
38
|
+
return this.client.call('get', uri, {
|
|
41
39
|
'content-type': 'application/json',
|
|
42
40
|
}, payload);
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
/**
|
|
46
|
-
* Create team
|
|
47
|
-
*
|
|
48
44
|
* Create a new team. The user who creates the team will automatically be
|
|
49
45
|
* assigned as the owner of the team. Only the users with the owner role can
|
|
50
46
|
* invite new members, add new owners and delete or update the team.
|
|
@@ -55,7 +51,7 @@ export class Teams extends Service {
|
|
|
55
51
|
* @throws {AppwriteException}
|
|
56
52
|
* @returns {Promise}
|
|
57
53
|
*/
|
|
58
|
-
|
|
54
|
+
create<Preferences extends Models.Preferences>(teamId: string, name: string, roles?: string[]): Promise<Models.Team<Preferences>> {
|
|
59
55
|
if (typeof teamId === 'undefined') {
|
|
60
56
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
61
57
|
}
|
|
@@ -80,21 +76,19 @@ export class Teams extends Service {
|
|
|
80
76
|
}
|
|
81
77
|
|
|
82
78
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
83
|
-
return
|
|
79
|
+
return this.client.call('post', uri, {
|
|
84
80
|
'content-type': 'application/json',
|
|
85
81
|
}, payload);
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
/**
|
|
89
|
-
* Get team
|
|
90
|
-
*
|
|
91
85
|
* Get a team by its ID. All team members have read access for this resource.
|
|
92
86
|
*
|
|
93
87
|
* @param {string} teamId
|
|
94
88
|
* @throws {AppwriteException}
|
|
95
89
|
* @returns {Promise}
|
|
96
90
|
*/
|
|
97
|
-
|
|
91
|
+
get<Preferences extends Models.Preferences>(teamId: string): Promise<Models.Team<Preferences>> {
|
|
98
92
|
if (typeof teamId === 'undefined') {
|
|
99
93
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
100
94
|
}
|
|
@@ -103,14 +97,12 @@ export class Teams extends Service {
|
|
|
103
97
|
const payload: Payload = {};
|
|
104
98
|
|
|
105
99
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
106
|
-
return
|
|
100
|
+
return this.client.call('get', uri, {
|
|
107
101
|
'content-type': 'application/json',
|
|
108
102
|
}, payload);
|
|
109
103
|
}
|
|
110
104
|
|
|
111
105
|
/**
|
|
112
|
-
* Update name
|
|
113
|
-
*
|
|
114
106
|
* Update the team's name by its unique ID.
|
|
115
107
|
*
|
|
116
108
|
* @param {string} teamId
|
|
@@ -118,7 +110,7 @@ export class Teams extends Service {
|
|
|
118
110
|
* @throws {AppwriteException}
|
|
119
111
|
* @returns {Promise}
|
|
120
112
|
*/
|
|
121
|
-
|
|
113
|
+
updateName<Preferences extends Models.Preferences>(teamId: string, name: string): Promise<Models.Team<Preferences>> {
|
|
122
114
|
if (typeof teamId === 'undefined') {
|
|
123
115
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
124
116
|
}
|
|
@@ -135,14 +127,12 @@ export class Teams extends Service {
|
|
|
135
127
|
}
|
|
136
128
|
|
|
137
129
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
138
|
-
return
|
|
130
|
+
return this.client.call('put', uri, {
|
|
139
131
|
'content-type': 'application/json',
|
|
140
132
|
}, payload);
|
|
141
133
|
}
|
|
142
134
|
|
|
143
135
|
/**
|
|
144
|
-
* Delete team
|
|
145
|
-
*
|
|
146
136
|
* Delete a team using its ID. Only team members with the owner role can
|
|
147
137
|
* delete the team.
|
|
148
138
|
*
|
|
@@ -150,7 +140,7 @@ export class Teams extends Service {
|
|
|
150
140
|
* @throws {AppwriteException}
|
|
151
141
|
* @returns {Promise}
|
|
152
142
|
*/
|
|
153
|
-
|
|
143
|
+
delete(teamId: string): Promise<{}> {
|
|
154
144
|
if (typeof teamId === 'undefined') {
|
|
155
145
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
156
146
|
}
|
|
@@ -159,14 +149,12 @@ export class Teams extends Service {
|
|
|
159
149
|
const payload: Payload = {};
|
|
160
150
|
|
|
161
151
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
162
|
-
return
|
|
152
|
+
return this.client.call('delete', uri, {
|
|
163
153
|
'content-type': 'application/json',
|
|
164
154
|
}, payload);
|
|
165
155
|
}
|
|
166
156
|
|
|
167
157
|
/**
|
|
168
|
-
* List team memberships
|
|
169
|
-
*
|
|
170
158
|
* Use this endpoint to list a team's members using the team's ID. All team
|
|
171
159
|
* members have read access to this endpoint. Hide sensitive attributes from
|
|
172
160
|
* the response by toggling membership privacy in the Console.
|
|
@@ -177,7 +165,7 @@ export class Teams extends Service {
|
|
|
177
165
|
* @throws {AppwriteException}
|
|
178
166
|
* @returns {Promise}
|
|
179
167
|
*/
|
|
180
|
-
|
|
168
|
+
listMemberships(teamId: string, queries?: string[], search?: string): Promise<Models.MembershipList> {
|
|
181
169
|
if (typeof teamId === 'undefined') {
|
|
182
170
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
183
171
|
}
|
|
@@ -194,14 +182,12 @@ export class Teams extends Service {
|
|
|
194
182
|
}
|
|
195
183
|
|
|
196
184
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
197
|
-
return
|
|
185
|
+
return this.client.call('get', uri, {
|
|
198
186
|
'content-type': 'application/json',
|
|
199
187
|
}, payload);
|
|
200
188
|
}
|
|
201
189
|
|
|
202
190
|
/**
|
|
203
|
-
* Create team membership
|
|
204
|
-
*
|
|
205
191
|
* Invite a new member to join your team. Provide an ID for existing users, or
|
|
206
192
|
* invite unregistered users using an email or phone number. If initiated from
|
|
207
193
|
* a Client SDK, Appwrite will send an email or sms with a link to join the
|
|
@@ -234,7 +220,7 @@ export class Teams extends Service {
|
|
|
234
220
|
* @throws {AppwriteException}
|
|
235
221
|
* @returns {Promise}
|
|
236
222
|
*/
|
|
237
|
-
|
|
223
|
+
createMembership(teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise<Models.Membership> {
|
|
238
224
|
if (typeof teamId === 'undefined') {
|
|
239
225
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
240
226
|
}
|
|
@@ -271,14 +257,12 @@ export class Teams extends Service {
|
|
|
271
257
|
}
|
|
272
258
|
|
|
273
259
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
274
|
-
return
|
|
260
|
+
return this.client.call('post', uri, {
|
|
275
261
|
'content-type': 'application/json',
|
|
276
262
|
}, payload);
|
|
277
263
|
}
|
|
278
264
|
|
|
279
265
|
/**
|
|
280
|
-
* Get team membership
|
|
281
|
-
*
|
|
282
266
|
* Get a team member by the membership unique id. All team members have read
|
|
283
267
|
* access for this resource. Hide sensitive attributes from the response by
|
|
284
268
|
* toggling membership privacy in the Console.
|
|
@@ -288,7 +272,7 @@ export class Teams extends Service {
|
|
|
288
272
|
* @throws {AppwriteException}
|
|
289
273
|
* @returns {Promise}
|
|
290
274
|
*/
|
|
291
|
-
|
|
275
|
+
getMembership(teamId: string, membershipId: string): Promise<Models.Membership> {
|
|
292
276
|
if (typeof teamId === 'undefined') {
|
|
293
277
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
294
278
|
}
|
|
@@ -301,14 +285,12 @@ export class Teams extends Service {
|
|
|
301
285
|
const payload: Payload = {};
|
|
302
286
|
|
|
303
287
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
304
|
-
return
|
|
288
|
+
return this.client.call('get', uri, {
|
|
305
289
|
'content-type': 'application/json',
|
|
306
290
|
}, payload);
|
|
307
291
|
}
|
|
308
292
|
|
|
309
293
|
/**
|
|
310
|
-
* Update membership
|
|
311
|
-
*
|
|
312
294
|
* Modify the roles of a team member. Only team members with the owner role
|
|
313
295
|
* have access to this endpoint. Learn more about [roles and
|
|
314
296
|
* permissions](https://appwrite.io/docs/permissions).
|
|
@@ -320,7 +302,7 @@ export class Teams extends Service {
|
|
|
320
302
|
* @throws {AppwriteException}
|
|
321
303
|
* @returns {Promise}
|
|
322
304
|
*/
|
|
323
|
-
|
|
305
|
+
updateMembership(teamId: string, membershipId: string, roles: string[]): Promise<Models.Membership> {
|
|
324
306
|
if (typeof teamId === 'undefined') {
|
|
325
307
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
326
308
|
}
|
|
@@ -341,14 +323,12 @@ export class Teams extends Service {
|
|
|
341
323
|
}
|
|
342
324
|
|
|
343
325
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
344
|
-
return
|
|
326
|
+
return this.client.call('patch', uri, {
|
|
345
327
|
'content-type': 'application/json',
|
|
346
328
|
}, payload);
|
|
347
329
|
}
|
|
348
330
|
|
|
349
331
|
/**
|
|
350
|
-
* Delete team membership
|
|
351
|
-
*
|
|
352
332
|
* This endpoint allows a user to leave a team or for a team owner to delete
|
|
353
333
|
* the membership of any other team member. You can also use this endpoint to
|
|
354
334
|
* delete a user membership even if it is not accepted.
|
|
@@ -358,7 +338,7 @@ export class Teams extends Service {
|
|
|
358
338
|
* @throws {AppwriteException}
|
|
359
339
|
* @returns {Promise}
|
|
360
340
|
*/
|
|
361
|
-
|
|
341
|
+
deleteMembership(teamId: string, membershipId: string): Promise<{}> {
|
|
362
342
|
if (typeof teamId === 'undefined') {
|
|
363
343
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
364
344
|
}
|
|
@@ -371,14 +351,12 @@ export class Teams extends Service {
|
|
|
371
351
|
const payload: Payload = {};
|
|
372
352
|
|
|
373
353
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
374
|
-
return
|
|
354
|
+
return this.client.call('delete', uri, {
|
|
375
355
|
'content-type': 'application/json',
|
|
376
356
|
}, payload);
|
|
377
357
|
}
|
|
378
358
|
|
|
379
359
|
/**
|
|
380
|
-
* Update team membership status
|
|
381
|
-
*
|
|
382
360
|
* Use this endpoint to allow a user to accept an invitation to join a team
|
|
383
361
|
* after being redirected back to your app from the invitation email received
|
|
384
362
|
* by the user.
|
|
@@ -394,7 +372,7 @@ export class Teams extends Service {
|
|
|
394
372
|
* @throws {AppwriteException}
|
|
395
373
|
* @returns {Promise}
|
|
396
374
|
*/
|
|
397
|
-
|
|
375
|
+
updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise<Models.Membership> {
|
|
398
376
|
if (typeof teamId === 'undefined') {
|
|
399
377
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
400
378
|
}
|
|
@@ -423,14 +401,12 @@ export class Teams extends Service {
|
|
|
423
401
|
}
|
|
424
402
|
|
|
425
403
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
426
|
-
return
|
|
404
|
+
return this.client.call('patch', uri, {
|
|
427
405
|
'content-type': 'application/json',
|
|
428
406
|
}, payload);
|
|
429
407
|
}
|
|
430
408
|
|
|
431
409
|
/**
|
|
432
|
-
* Get team preferences
|
|
433
|
-
*
|
|
434
410
|
* Get the team's shared preferences by its unique ID. If a preference doesn't
|
|
435
411
|
* need to be shared by all team members, prefer storing them in [user
|
|
436
412
|
* preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
|
|
@@ -439,7 +415,7 @@ export class Teams extends Service {
|
|
|
439
415
|
* @throws {AppwriteException}
|
|
440
416
|
* @returns {Promise}
|
|
441
417
|
*/
|
|
442
|
-
|
|
418
|
+
getPrefs<Preferences extends Models.Preferences>(teamId: string): Promise<Preferences> {
|
|
443
419
|
if (typeof teamId === 'undefined') {
|
|
444
420
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
445
421
|
}
|
|
@@ -448,14 +424,12 @@ export class Teams extends Service {
|
|
|
448
424
|
const payload: Payload = {};
|
|
449
425
|
|
|
450
426
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
451
|
-
return
|
|
427
|
+
return this.client.call('get', uri, {
|
|
452
428
|
'content-type': 'application/json',
|
|
453
429
|
}, payload);
|
|
454
430
|
}
|
|
455
431
|
|
|
456
432
|
/**
|
|
457
|
-
* Update preferences
|
|
458
|
-
*
|
|
459
433
|
* Update the team's preferences by its unique ID. The object you pass is
|
|
460
434
|
* stored as is and replaces any previous value. The maximum allowed prefs
|
|
461
435
|
* size is 64kB and throws an error if exceeded.
|
|
@@ -465,7 +439,7 @@ export class Teams extends Service {
|
|
|
465
439
|
* @throws {AppwriteException}
|
|
466
440
|
* @returns {Promise}
|
|
467
441
|
*/
|
|
468
|
-
|
|
442
|
+
updatePrefs<Preferences extends Models.Preferences>(teamId: string, prefs: object): Promise<Preferences> {
|
|
469
443
|
if (typeof teamId === 'undefined') {
|
|
470
444
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
471
445
|
}
|
|
@@ -482,7 +456,7 @@ export class Teams extends Service {
|
|
|
482
456
|
}
|
|
483
457
|
|
|
484
458
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
485
|
-
return
|
|
459
|
+
return this.client.call('put', uri, {
|
|
486
460
|
'content-type': 'application/json',
|
|
487
461
|
}, payload);
|
|
488
462
|
}
|