@appwrite.io/console 0.3.0 → 0.4.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.
Files changed (54) hide show
  1. package/.github/workflows/publish.yml +2 -2
  2. package/README.md +3 -3
  3. package/dist/cjs/sdk.js +1354 -1197
  4. package/dist/cjs/sdk.js.map +1 -1
  5. package/dist/esm/sdk.js +1354 -1197
  6. package/dist/esm/sdk.js.map +1 -1
  7. package/dist/iife/sdk.js +1354 -1197
  8. package/docs/examples/functions/create.md +1 -1
  9. package/docs/examples/functions/update.md +1 -1
  10. package/docs/examples/{projects/get-usage.md → health/get-queue-builds.md} +3 -3
  11. package/docs/examples/{account/create-with-invite-code.md → health/get-queue-databases.md} +3 -3
  12. package/docs/examples/health/get-queue-deletes.md +18 -0
  13. package/docs/examples/health/get-queue-mails.md +18 -0
  14. package/docs/examples/health/get-queue-messaging.md +18 -0
  15. package/docs/examples/health/get-queue-migrations.md +18 -0
  16. package/docs/examples/project/get-usage.md +1 -1
  17. package/docs/examples/teams/create-membership.md +1 -1
  18. package/package.json +3 -2
  19. package/src/client.ts +1 -1
  20. package/src/models.ts +147 -279
  21. package/src/query.ts +1 -1
  22. package/src/role.ts +72 -6
  23. package/src/services/account.ts +154 -204
  24. package/src/services/assistant.ts +3 -3
  25. package/src/services/avatars.ts +32 -31
  26. package/src/services/console.ts +4 -4
  27. package/src/services/databases.ts +195 -195
  28. package/src/services/functions.ts +117 -126
  29. package/src/services/graphql.ts +8 -8
  30. package/src/services/health.ts +219 -50
  31. package/src/services/locale.ts +31 -31
  32. package/src/services/migrations.ts +48 -48
  33. package/src/services/project.ts +40 -22
  34. package/src/services/projects.ts +143 -170
  35. package/src/services/proxy.ts +15 -15
  36. package/src/services/storage.ts +74 -84
  37. package/src/services/teams.ts +62 -66
  38. package/src/services/users.ts +132 -135
  39. package/src/services/vcs.ts +27 -27
  40. package/types/models.d.ts +147 -279
  41. package/types/role.d.ts +62 -0
  42. package/types/services/account.d.ts +61 -70
  43. package/types/services/avatars.d.ts +11 -10
  44. package/types/services/console.d.ts +1 -1
  45. package/types/services/databases.d.ts +51 -51
  46. package/types/services/functions.d.ts +32 -27
  47. package/types/services/graphql.d.ts +2 -2
  48. package/types/services/health.d.ts +85 -14
  49. package/types/services/locale.d.ts +7 -7
  50. package/types/services/project.d.ts +4 -2
  51. package/types/services/projects.d.ts +26 -36
  52. package/types/services/storage.d.ts +13 -13
  53. package/types/services/teams.d.ts +20 -20
  54. package/types/services/users.d.ts +45 -44
@@ -11,7 +11,7 @@ export class Teams extends Service {
11
11
  }
12
12
 
13
13
  /**
14
- * List Teams
14
+ * List teams
15
15
  *
16
16
  * Get a list of all the teams in which the current user is a member. You can
17
17
  * use the parameters to filter your results.
@@ -22,8 +22,8 @@ export class Teams extends Service {
22
22
  * @returns {Promise}
23
23
  */
24
24
  async list<Preferences extends Models.Preferences>(queries?: string[], search?: string): Promise<Models.TeamList<Preferences>> {
25
- let path = '/teams';
26
- let payload: Payload = {};
25
+ const apiPath = '/teams';
26
+ const payload: Payload = {};
27
27
 
28
28
  if (typeof queries !== 'undefined') {
29
29
  payload['queries'] = queries;
@@ -33,14 +33,14 @@ export class Teams extends Service {
33
33
  payload['search'] = search;
34
34
  }
35
35
 
36
- const uri = new URL(this.client.config.endpoint + path);
36
+ const uri = new URL(this.client.config.endpoint + apiPath);
37
37
  return await this.client.call('get', uri, {
38
38
  'content-type': 'application/json',
39
39
  }, payload);
40
40
  }
41
41
 
42
42
  /**
43
- * Create Team
43
+ * Create team
44
44
  *
45
45
  * Create a new team. The user who creates the team will automatically be
46
46
  * assigned as the owner of the team. Only the users with the owner role can
@@ -61,8 +61,8 @@ export class Teams extends Service {
61
61
  throw new AppwriteException('Missing required parameter: "name"');
62
62
  }
63
63
 
64
- let path = '/teams';
65
- let payload: Payload = {};
64
+ const apiPath = '/teams';
65
+ const payload: Payload = {};
66
66
 
67
67
  if (typeof teamId !== 'undefined') {
68
68
  payload['teamId'] = teamId;
@@ -76,14 +76,14 @@ export class Teams extends Service {
76
76
  payload['roles'] = roles;
77
77
  }
78
78
 
79
- const uri = new URL(this.client.config.endpoint + path);
79
+ const uri = new URL(this.client.config.endpoint + apiPath);
80
80
  return await this.client.call('post', uri, {
81
81
  'content-type': 'application/json',
82
82
  }, payload);
83
83
  }
84
84
 
85
85
  /**
86
- * Get Team
86
+ * Get team
87
87
  *
88
88
  * Get a team by its ID. All team members have read access for this resource.
89
89
  *
@@ -96,17 +96,17 @@ export class Teams extends Service {
96
96
  throw new AppwriteException('Missing required parameter: "teamId"');
97
97
  }
98
98
 
99
- let path = '/teams/{teamId}'.replace('{teamId}', teamId);
100
- let payload: Payload = {};
99
+ const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
100
+ const payload: Payload = {};
101
101
 
102
- const uri = new URL(this.client.config.endpoint + path);
102
+ const uri = new URL(this.client.config.endpoint + apiPath);
103
103
  return await this.client.call('get', uri, {
104
104
  'content-type': 'application/json',
105
105
  }, payload);
106
106
  }
107
107
 
108
108
  /**
109
- * Update Name
109
+ * Update name
110
110
  *
111
111
  * Update the team's name by its unique ID.
112
112
  *
@@ -124,21 +124,21 @@ export class Teams extends Service {
124
124
  throw new AppwriteException('Missing required parameter: "name"');
125
125
  }
126
126
 
127
- let path = '/teams/{teamId}'.replace('{teamId}', teamId);
128
- let payload: Payload = {};
127
+ const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
128
+ const payload: Payload = {};
129
129
 
130
130
  if (typeof name !== 'undefined') {
131
131
  payload['name'] = name;
132
132
  }
133
133
 
134
- const uri = new URL(this.client.config.endpoint + path);
134
+ const uri = new URL(this.client.config.endpoint + apiPath);
135
135
  return await this.client.call('put', uri, {
136
136
  'content-type': 'application/json',
137
137
  }, payload);
138
138
  }
139
139
 
140
140
  /**
141
- * Delete Team
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.
@@ -152,17 +152,17 @@ export class Teams extends Service {
152
152
  throw new AppwriteException('Missing required parameter: "teamId"');
153
153
  }
154
154
 
155
- let path = '/teams/{teamId}'.replace('{teamId}', teamId);
156
- let payload: Payload = {};
155
+ const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
156
+ const payload: Payload = {};
157
157
 
158
- const uri = new URL(this.client.config.endpoint + path);
158
+ const uri = new URL(this.client.config.endpoint + apiPath);
159
159
  return await this.client.call('delete', uri, {
160
160
  'content-type': 'application/json',
161
161
  }, payload);
162
162
  }
163
163
 
164
164
  /**
165
- * List Team Logs
165
+ * List team logs
166
166
  *
167
167
  * Get the team activity logs list by its unique ID.
168
168
  *
@@ -176,21 +176,21 @@ export class Teams extends Service {
176
176
  throw new AppwriteException('Missing required parameter: "teamId"');
177
177
  }
178
178
 
179
- let path = '/teams/{teamId}/logs'.replace('{teamId}', teamId);
180
- let payload: Payload = {};
179
+ const apiPath = '/teams/{teamId}/logs'.replace('{teamId}', teamId);
180
+ const payload: Payload = {};
181
181
 
182
182
  if (typeof queries !== 'undefined') {
183
183
  payload['queries'] = queries;
184
184
  }
185
185
 
186
- const uri = new URL(this.client.config.endpoint + path);
186
+ const uri = new URL(this.client.config.endpoint + apiPath);
187
187
  return await this.client.call('get', uri, {
188
188
  'content-type': 'application/json',
189
189
  }, payload);
190
190
  }
191
191
 
192
192
  /**
193
- * List Team Memberships
193
+ * List team memberships
194
194
  *
195
195
  * Use this endpoint to list a team's members using the team's ID. All team
196
196
  * members have read access to this endpoint.
@@ -206,8 +206,8 @@ export class Teams extends Service {
206
206
  throw new AppwriteException('Missing required parameter: "teamId"');
207
207
  }
208
208
 
209
- let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
210
- let payload: Payload = {};
209
+ const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
210
+ const payload: Payload = {};
211
211
 
212
212
  if (typeof queries !== 'undefined') {
213
213
  payload['queries'] = queries;
@@ -217,14 +217,14 @@ export class Teams extends Service {
217
217
  payload['search'] = search;
218
218
  }
219
219
 
220
- const uri = new URL(this.client.config.endpoint + path);
220
+ const uri = new URL(this.client.config.endpoint + apiPath);
221
221
  return await this.client.call('get', uri, {
222
222
  'content-type': 'application/json',
223
223
  }, payload);
224
224
  }
225
225
 
226
226
  /**
227
- * Create Team Membership
227
+ * Create team membership
228
228
  *
229
229
  * Invite a new member to join your team. Provide an ID for existing users, or
230
230
  * invite unregistered users using an email or phone number. If initiated from
@@ -239,8 +239,8 @@ export class Teams extends Service {
239
239
  *
240
240
  * Use the `url` parameter to redirect the user from the invitation email to
241
241
  * your app. After the user is redirected, use the [Update Team Membership
242
- * Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
243
- * the user to accept the invitation to the team.
242
+ * Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus)
243
+ * endpoint to allow the user to accept the invitation to the team.
244
244
  *
245
245
  * Please note that to avoid a [Redirect
246
246
  * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
@@ -250,15 +250,15 @@ export class Teams extends Service {
250
250
  *
251
251
  * @param {string} teamId
252
252
  * @param {string[]} roles
253
- * @param {string} url
254
253
  * @param {string} email
255
254
  * @param {string} userId
256
255
  * @param {string} phone
256
+ * @param {string} url
257
257
  * @param {string} name
258
258
  * @throws {AppwriteException}
259
259
  * @returns {Promise}
260
260
  */
261
- async createMembership(teamId: string, roles: string[], url: string, email?: string, userId?: string, phone?: string, name?: string): Promise<Models.Membership> {
261
+ async createMembership(teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise<Models.Membership> {
262
262
  if (typeof teamId === 'undefined') {
263
263
  throw new AppwriteException('Missing required parameter: "teamId"');
264
264
  }
@@ -267,12 +267,8 @@ export class Teams extends Service {
267
267
  throw new AppwriteException('Missing required parameter: "roles"');
268
268
  }
269
269
 
270
- if (typeof url === 'undefined') {
271
- throw new AppwriteException('Missing required parameter: "url"');
272
- }
273
-
274
- let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
275
- let payload: Payload = {};
270
+ const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
271
+ const payload: Payload = {};
276
272
 
277
273
  if (typeof email !== 'undefined') {
278
274
  payload['email'] = email;
@@ -298,14 +294,14 @@ export class Teams extends Service {
298
294
  payload['name'] = name;
299
295
  }
300
296
 
301
- const uri = new URL(this.client.config.endpoint + path);
297
+ const uri = new URL(this.client.config.endpoint + apiPath);
302
298
  return await this.client.call('post', uri, {
303
299
  'content-type': 'application/json',
304
300
  }, payload);
305
301
  }
306
302
 
307
303
  /**
308
- * Get Team Membership
304
+ * Get team membership
309
305
  *
310
306
  * Get a team member by the membership unique id. All team members have read
311
307
  * access for this resource.
@@ -324,21 +320,21 @@ export class Teams extends Service {
324
320
  throw new AppwriteException('Missing required parameter: "membershipId"');
325
321
  }
326
322
 
327
- let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
328
- let payload: Payload = {};
323
+ const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
324
+ const payload: Payload = {};
329
325
 
330
- const uri = new URL(this.client.config.endpoint + path);
326
+ const uri = new URL(this.client.config.endpoint + apiPath);
331
327
  return await this.client.call('get', uri, {
332
328
  'content-type': 'application/json',
333
329
  }, payload);
334
330
  }
335
331
 
336
332
  /**
337
- * Update Membership
333
+ * Update membership
338
334
  *
339
335
  * Modify the roles of a team member. Only team members with the owner role
340
336
  * have access to this endpoint. Learn more about [roles and
341
- * permissions](/docs/permissions).
337
+ * permissions](https://appwrite.io/docs/permissions).
342
338
  *
343
339
  *
344
340
  * @param {string} teamId
@@ -360,21 +356,21 @@ export class Teams extends Service {
360
356
  throw new AppwriteException('Missing required parameter: "roles"');
361
357
  }
362
358
 
363
- let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
364
- let payload: Payload = {};
359
+ const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
360
+ const payload: Payload = {};
365
361
 
366
362
  if (typeof roles !== 'undefined') {
367
363
  payload['roles'] = roles;
368
364
  }
369
365
 
370
- const uri = new URL(this.client.config.endpoint + path);
366
+ const uri = new URL(this.client.config.endpoint + apiPath);
371
367
  return await this.client.call('patch', uri, {
372
368
  'content-type': 'application/json',
373
369
  }, payload);
374
370
  }
375
371
 
376
372
  /**
377
- * Delete Team Membership
373
+ * Delete team membership
378
374
  *
379
375
  * This endpoint allows a user to leave a team or for a team owner to delete
380
376
  * the membership of any other team member. You can also use this endpoint to
@@ -394,17 +390,17 @@ export class Teams extends Service {
394
390
  throw new AppwriteException('Missing required parameter: "membershipId"');
395
391
  }
396
392
 
397
- let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
398
- let payload: Payload = {};
393
+ const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
394
+ const payload: Payload = {};
399
395
 
400
- const uri = new URL(this.client.config.endpoint + path);
396
+ const uri = new URL(this.client.config.endpoint + apiPath);
401
397
  return await this.client.call('delete', uri, {
402
398
  'content-type': 'application/json',
403
399
  }, payload);
404
400
  }
405
401
 
406
402
  /**
407
- * Update Team Membership Status
403
+ * Update team membership status
408
404
  *
409
405
  * Use this endpoint to allow a user to accept an invitation to join a team
410
406
  * after being redirected back to your app from the invitation email received
@@ -438,8 +434,8 @@ export class Teams extends Service {
438
434
  throw new AppwriteException('Missing required parameter: "secret"');
439
435
  }
440
436
 
441
- let path = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
442
- let payload: Payload = {};
437
+ const apiPath = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
438
+ const payload: Payload = {};
443
439
 
444
440
  if (typeof userId !== 'undefined') {
445
441
  payload['userId'] = userId;
@@ -449,18 +445,18 @@ export class Teams extends Service {
449
445
  payload['secret'] = secret;
450
446
  }
451
447
 
452
- const uri = new URL(this.client.config.endpoint + path);
448
+ const uri = new URL(this.client.config.endpoint + apiPath);
453
449
  return await this.client.call('patch', uri, {
454
450
  'content-type': 'application/json',
455
451
  }, payload);
456
452
  }
457
453
 
458
454
  /**
459
- * Get Team Preferences
455
+ * Get team preferences
460
456
  *
461
457
  * Get the team's shared preferences by its unique ID. If a preference doesn't
462
458
  * need to be shared by all team members, prefer storing them in [user
463
- * preferences](/docs/client/account#accountGetPrefs).
459
+ * preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
464
460
  *
465
461
  * @param {string} teamId
466
462
  * @throws {AppwriteException}
@@ -471,17 +467,17 @@ export class Teams extends Service {
471
467
  throw new AppwriteException('Missing required parameter: "teamId"');
472
468
  }
473
469
 
474
- let path = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
475
- let payload: Payload = {};
470
+ const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
471
+ const payload: Payload = {};
476
472
 
477
- const uri = new URL(this.client.config.endpoint + path);
473
+ const uri = new URL(this.client.config.endpoint + apiPath);
478
474
  return await this.client.call('get', uri, {
479
475
  'content-type': 'application/json',
480
476
  }, payload);
481
477
  }
482
478
 
483
479
  /**
484
- * Update Preferences
480
+ * Update preferences
485
481
  *
486
482
  * Update the team's preferences by its unique ID. The object you pass is
487
483
  * stored as is and replaces any previous value. The maximum allowed prefs
@@ -501,14 +497,14 @@ export class Teams extends Service {
501
497
  throw new AppwriteException('Missing required parameter: "prefs"');
502
498
  }
503
499
 
504
- let path = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
505
- let payload: Payload = {};
500
+ const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
501
+ const payload: Payload = {};
506
502
 
507
503
  if (typeof prefs !== 'undefined') {
508
504
  payload['prefs'] = prefs;
509
505
  }
510
506
 
511
- const uri = new URL(this.client.config.endpoint + path);
507
+ const uri = new URL(this.client.config.endpoint + apiPath);
512
508
  return await this.client.call('put', uri, {
513
509
  'content-type': 'application/json',
514
510
  }, payload);