@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
@@ -20,8 +20,8 @@ export class Migrations extends Service {
20
20
  * @returns {Promise}
21
21
  */
22
22
  async list(queries?: string, search?: string): Promise<Models.MigrationList> {
23
- let path = '/migrations';
24
- let payload: Payload = {};
23
+ const apiPath = '/migrations';
24
+ const payload: Payload = {};
25
25
 
26
26
  if (typeof queries !== 'undefined') {
27
27
  payload['queries'] = queries;
@@ -31,7 +31,7 @@ export class Migrations extends Service {
31
31
  payload['search'] = search;
32
32
  }
33
33
 
34
- const uri = new URL(this.client.config.endpoint + path);
34
+ const uri = new URL(this.client.config.endpoint + apiPath);
35
35
  return await this.client.call('get', uri, {
36
36
  'content-type': 'application/json',
37
37
  }, payload);
@@ -65,8 +65,8 @@ export class Migrations extends Service {
65
65
  throw new AppwriteException('Missing required parameter: "apiKey"');
66
66
  }
67
67
 
68
- let path = '/migrations/appwrite';
69
- let payload: Payload = {};
68
+ const apiPath = '/migrations/appwrite';
69
+ const payload: Payload = {};
70
70
 
71
71
  if (typeof resources !== 'undefined') {
72
72
  payload['resources'] = resources;
@@ -84,7 +84,7 @@ export class Migrations extends Service {
84
84
  payload['apiKey'] = apiKey;
85
85
  }
86
86
 
87
- const uri = new URL(this.client.config.endpoint + path);
87
+ const uri = new URL(this.client.config.endpoint + apiPath);
88
88
  return await this.client.call('post', uri, {
89
89
  'content-type': 'application/json',
90
90
  }, payload);
@@ -118,8 +118,8 @@ export class Migrations extends Service {
118
118
  throw new AppwriteException('Missing required parameter: "key"');
119
119
  }
120
120
 
121
- let path = '/migrations/appwrite/report';
122
- let payload: Payload = {};
121
+ const apiPath = '/migrations/appwrite/report';
122
+ const payload: Payload = {};
123
123
 
124
124
  if (typeof resources !== 'undefined') {
125
125
  payload['resources'] = resources;
@@ -137,7 +137,7 @@ export class Migrations extends Service {
137
137
  payload['key'] = key;
138
138
  }
139
139
 
140
- const uri = new URL(this.client.config.endpoint + path);
140
+ const uri = new URL(this.client.config.endpoint + apiPath);
141
141
  return await this.client.call('get', uri, {
142
142
  'content-type': 'application/json',
143
143
  }, payload);
@@ -161,8 +161,8 @@ export class Migrations extends Service {
161
161
  throw new AppwriteException('Missing required parameter: "serviceAccount"');
162
162
  }
163
163
 
164
- let path = '/migrations/firebase';
165
- let payload: Payload = {};
164
+ const apiPath = '/migrations/firebase';
165
+ const payload: Payload = {};
166
166
 
167
167
  if (typeof resources !== 'undefined') {
168
168
  payload['resources'] = resources;
@@ -172,7 +172,7 @@ export class Migrations extends Service {
172
172
  payload['serviceAccount'] = serviceAccount;
173
173
  }
174
174
 
175
- const uri = new URL(this.client.config.endpoint + path);
175
+ const uri = new URL(this.client.config.endpoint + apiPath);
176
176
  return await this.client.call('post', uri, {
177
177
  'content-type': 'application/json',
178
178
  }, payload);
@@ -186,10 +186,10 @@ export class Migrations extends Service {
186
186
  * @returns {Promise}
187
187
  */
188
188
  async deleteFirebaseAuth(): Promise<{}> {
189
- let path = '/migrations/firebase/deauthorize';
190
- let payload: Payload = {};
189
+ const apiPath = '/migrations/firebase/deauthorize';
190
+ const payload: Payload = {};
191
191
 
192
- const uri = new URL(this.client.config.endpoint + path);
192
+ const uri = new URL(this.client.config.endpoint + apiPath);
193
193
  return await this.client.call('get', uri, {
194
194
  'content-type': 'application/json',
195
195
  }, payload);
@@ -213,8 +213,8 @@ export class Migrations extends Service {
213
213
  throw new AppwriteException('Missing required parameter: "projectId"');
214
214
  }
215
215
 
216
- let path = '/migrations/firebase/oauth';
217
- let payload: Payload = {};
216
+ const apiPath = '/migrations/firebase/oauth';
217
+ const payload: Payload = {};
218
218
 
219
219
  if (typeof resources !== 'undefined') {
220
220
  payload['resources'] = resources;
@@ -224,7 +224,7 @@ export class Migrations extends Service {
224
224
  payload['projectId'] = projectId;
225
225
  }
226
226
 
227
- const uri = new URL(this.client.config.endpoint + path);
227
+ const uri = new URL(this.client.config.endpoint + apiPath);
228
228
  return await this.client.call('post', uri, {
229
229
  'content-type': 'application/json',
230
230
  }, payload);
@@ -238,10 +238,10 @@ export class Migrations extends Service {
238
238
  * @returns {Promise}
239
239
  */
240
240
  async listFirebaseProjects(): Promise<Models.FirebaseProjectList> {
241
- let path = '/migrations/firebase/projects';
242
- let payload: Payload = {};
241
+ const apiPath = '/migrations/firebase/projects';
242
+ const payload: Payload = {};
243
243
 
244
- const uri = new URL(this.client.config.endpoint + path);
244
+ const uri = new URL(this.client.config.endpoint + apiPath);
245
245
  return await this.client.call('get', uri, {
246
246
  'content-type': 'application/json',
247
247
  }, payload);
@@ -265,8 +265,8 @@ export class Migrations extends Service {
265
265
  throw new AppwriteException('Missing required parameter: "serviceAccount"');
266
266
  }
267
267
 
268
- let path = '/migrations/firebase/report';
269
- let payload: Payload = {};
268
+ const apiPath = '/migrations/firebase/report';
269
+ const payload: Payload = {};
270
270
 
271
271
  if (typeof resources !== 'undefined') {
272
272
  payload['resources'] = resources;
@@ -276,7 +276,7 @@ export class Migrations extends Service {
276
276
  payload['serviceAccount'] = serviceAccount;
277
277
  }
278
278
 
279
- const uri = new URL(this.client.config.endpoint + path);
279
+ const uri = new URL(this.client.config.endpoint + apiPath);
280
280
  return await this.client.call('get', uri, {
281
281
  'content-type': 'application/json',
282
282
  }, payload);
@@ -300,8 +300,8 @@ export class Migrations extends Service {
300
300
  throw new AppwriteException('Missing required parameter: "projectId"');
301
301
  }
302
302
 
303
- let path = '/migrations/firebase/report/oauth';
304
- let payload: Payload = {};
303
+ const apiPath = '/migrations/firebase/report/oauth';
304
+ const payload: Payload = {};
305
305
 
306
306
  if (typeof resources !== 'undefined') {
307
307
  payload['resources'] = resources;
@@ -311,7 +311,7 @@ export class Migrations extends Service {
311
311
  payload['projectId'] = projectId;
312
312
  }
313
313
 
314
- const uri = new URL(this.client.config.endpoint + path);
314
+ const uri = new URL(this.client.config.endpoint + apiPath);
315
315
  return await this.client.call('get', uri, {
316
316
  'content-type': 'application/json',
317
317
  }, payload);
@@ -361,8 +361,8 @@ export class Migrations extends Service {
361
361
  throw new AppwriteException('Missing required parameter: "password"');
362
362
  }
363
363
 
364
- let path = '/migrations/nhost';
365
- let payload: Payload = {};
364
+ const apiPath = '/migrations/nhost';
365
+ const payload: Payload = {};
366
366
 
367
367
  if (typeof resources !== 'undefined') {
368
368
  payload['resources'] = resources;
@@ -396,7 +396,7 @@ export class Migrations extends Service {
396
396
  payload['port'] = port;
397
397
  }
398
398
 
399
- const uri = new URL(this.client.config.endpoint + path);
399
+ const uri = new URL(this.client.config.endpoint + apiPath);
400
400
  return await this.client.call('post', uri, {
401
401
  'content-type': 'application/json',
402
402
  }, payload);
@@ -446,8 +446,8 @@ export class Migrations extends Service {
446
446
  throw new AppwriteException('Missing required parameter: "password"');
447
447
  }
448
448
 
449
- let path = '/migrations/nhost/report';
450
- let payload: Payload = {};
449
+ const apiPath = '/migrations/nhost/report';
450
+ const payload: Payload = {};
451
451
 
452
452
  if (typeof resources !== 'undefined') {
453
453
  payload['resources'] = resources;
@@ -481,7 +481,7 @@ export class Migrations extends Service {
481
481
  payload['port'] = port;
482
482
  }
483
483
 
484
- const uri = new URL(this.client.config.endpoint + path);
484
+ const uri = new URL(this.client.config.endpoint + apiPath);
485
485
  return await this.client.call('get', uri, {
486
486
  'content-type': 'application/json',
487
487
  }, payload);
@@ -526,8 +526,8 @@ export class Migrations extends Service {
526
526
  throw new AppwriteException('Missing required parameter: "password"');
527
527
  }
528
528
 
529
- let path = '/migrations/supabase';
530
- let payload: Payload = {};
529
+ const apiPath = '/migrations/supabase';
530
+ const payload: Payload = {};
531
531
 
532
532
  if (typeof resources !== 'undefined') {
533
533
  payload['resources'] = resources;
@@ -557,7 +557,7 @@ export class Migrations extends Service {
557
557
  payload['port'] = port;
558
558
  }
559
559
 
560
- const uri = new URL(this.client.config.endpoint + path);
560
+ const uri = new URL(this.client.config.endpoint + apiPath);
561
561
  return await this.client.call('post', uri, {
562
562
  'content-type': 'application/json',
563
563
  }, payload);
@@ -602,8 +602,8 @@ export class Migrations extends Service {
602
602
  throw new AppwriteException('Missing required parameter: "password"');
603
603
  }
604
604
 
605
- let path = '/migrations/supabase/report';
606
- let payload: Payload = {};
605
+ const apiPath = '/migrations/supabase/report';
606
+ const payload: Payload = {};
607
607
 
608
608
  if (typeof resources !== 'undefined') {
609
609
  payload['resources'] = resources;
@@ -633,7 +633,7 @@ export class Migrations extends Service {
633
633
  payload['port'] = port;
634
634
  }
635
635
 
636
- const uri = new URL(this.client.config.endpoint + path);
636
+ const uri = new URL(this.client.config.endpoint + apiPath);
637
637
  return await this.client.call('get', uri, {
638
638
  'content-type': 'application/json',
639
639
  }, payload);
@@ -652,10 +652,10 @@ export class Migrations extends Service {
652
652
  throw new AppwriteException('Missing required parameter: "migrationId"');
653
653
  }
654
654
 
655
- let path = '/migrations/{migrationId}'.replace('{migrationId}', migrationId);
656
- let payload: Payload = {};
655
+ const apiPath = '/migrations/{migrationId}'.replace('{migrationId}', migrationId);
656
+ const payload: Payload = {};
657
657
 
658
- const uri = new URL(this.client.config.endpoint + path);
658
+ const uri = new URL(this.client.config.endpoint + apiPath);
659
659
  return await this.client.call('get', uri, {
660
660
  'content-type': 'application/json',
661
661
  }, payload);
@@ -674,10 +674,10 @@ export class Migrations extends Service {
674
674
  throw new AppwriteException('Missing required parameter: "migrationId"');
675
675
  }
676
676
 
677
- let path = '/migrations/{migrationId}'.replace('{migrationId}', migrationId);
678
- let payload: Payload = {};
677
+ const apiPath = '/migrations/{migrationId}'.replace('{migrationId}', migrationId);
678
+ const payload: Payload = {};
679
679
 
680
- const uri = new URL(this.client.config.endpoint + path);
680
+ const uri = new URL(this.client.config.endpoint + apiPath);
681
681
  return await this.client.call('patch', uri, {
682
682
  'content-type': 'application/json',
683
683
  }, payload);
@@ -696,10 +696,10 @@ export class Migrations extends Service {
696
696
  throw new AppwriteException('Missing required parameter: "migrationId"');
697
697
  }
698
698
 
699
- let path = '/migrations/{migrationId}'.replace('{migrationId}', migrationId);
700
- let payload: Payload = {};
699
+ const apiPath = '/migrations/{migrationId}'.replace('{migrationId}', migrationId);
700
+ const payload: Payload = {};
701
701
 
702
- const uri = new URL(this.client.config.endpoint + path);
702
+ const uri = new URL(this.client.config.endpoint + apiPath);
703
703
  return await this.client.call('delete', uri, {
704
704
  'content-type': 'application/json',
705
705
  }, payload);
@@ -14,19 +14,37 @@ export class Project extends Service {
14
14
  * Get usage stats for a project
15
15
  *
16
16
  *
17
- * @param {string} range
17
+ * @param {string} startDate
18
+ * @param {string} endDate
19
+ * @param {string} period
18
20
  * @throws {AppwriteException}
19
21
  * @returns {Promise}
20
22
  */
21
- async getUsage(range?: string): Promise<Models.UsageProject> {
22
- let path = '/project/usage';
23
- let payload: Payload = {};
23
+ async getUsage(startDate: string, endDate: string, period?: string): Promise<Models.UsageProject> {
24
+ if (typeof startDate === 'undefined') {
25
+ throw new AppwriteException('Missing required parameter: "startDate"');
26
+ }
27
+
28
+ if (typeof endDate === 'undefined') {
29
+ throw new AppwriteException('Missing required parameter: "endDate"');
30
+ }
31
+
32
+ const apiPath = '/project/usage';
33
+ const payload: Payload = {};
34
+
35
+ if (typeof startDate !== 'undefined') {
36
+ payload['startDate'] = startDate;
37
+ }
38
+
39
+ if (typeof endDate !== 'undefined') {
40
+ payload['endDate'] = endDate;
41
+ }
24
42
 
25
- if (typeof range !== 'undefined') {
26
- payload['range'] = range;
43
+ if (typeof period !== 'undefined') {
44
+ payload['period'] = period;
27
45
  }
28
46
 
29
- const uri = new URL(this.client.config.endpoint + path);
47
+ const uri = new URL(this.client.config.endpoint + apiPath);
30
48
  return await this.client.call('get', uri, {
31
49
  'content-type': 'application/json',
32
50
  }, payload);
@@ -42,10 +60,10 @@ export class Project extends Service {
42
60
  * @returns {Promise}
43
61
  */
44
62
  async listVariables(): Promise<Models.VariableList> {
45
- let path = '/project/variables';
46
- let payload: Payload = {};
63
+ const apiPath = '/project/variables';
64
+ const payload: Payload = {};
47
65
 
48
- const uri = new URL(this.client.config.endpoint + path);
66
+ const uri = new URL(this.client.config.endpoint + apiPath);
49
67
  return await this.client.call('get', uri, {
50
68
  'content-type': 'application/json',
51
69
  }, payload);
@@ -71,8 +89,8 @@ export class Project extends Service {
71
89
  throw new AppwriteException('Missing required parameter: "value"');
72
90
  }
73
91
 
74
- let path = '/project/variables';
75
- let payload: Payload = {};
92
+ const apiPath = '/project/variables';
93
+ const payload: Payload = {};
76
94
 
77
95
  if (typeof key !== 'undefined') {
78
96
  payload['key'] = key;
@@ -82,7 +100,7 @@ export class Project extends Service {
82
100
  payload['value'] = value;
83
101
  }
84
102
 
85
- const uri = new URL(this.client.config.endpoint + path);
103
+ const uri = new URL(this.client.config.endpoint + apiPath);
86
104
  return await this.client.call('post', uri, {
87
105
  'content-type': 'application/json',
88
106
  }, payload);
@@ -102,10 +120,10 @@ export class Project extends Service {
102
120
  throw new AppwriteException('Missing required parameter: "variableId"');
103
121
  }
104
122
 
105
- let path = '/project/variables/{variableId}'.replace('{variableId}', variableId);
106
- let payload: Payload = {};
123
+ const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId);
124
+ const payload: Payload = {};
107
125
 
108
- const uri = new URL(this.client.config.endpoint + path);
126
+ const uri = new URL(this.client.config.endpoint + apiPath);
109
127
  return await this.client.call('get', uri, {
110
128
  'content-type': 'application/json',
111
129
  }, payload);
@@ -132,8 +150,8 @@ export class Project extends Service {
132
150
  throw new AppwriteException('Missing required parameter: "key"');
133
151
  }
134
152
 
135
- let path = '/project/variables/{variableId}'.replace('{variableId}', variableId);
136
- let payload: Payload = {};
153
+ const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId);
154
+ const payload: Payload = {};
137
155
 
138
156
  if (typeof key !== 'undefined') {
139
157
  payload['key'] = key;
@@ -143,7 +161,7 @@ export class Project extends Service {
143
161
  payload['value'] = value;
144
162
  }
145
163
 
146
- const uri = new URL(this.client.config.endpoint + path);
164
+ const uri = new URL(this.client.config.endpoint + apiPath);
147
165
  return await this.client.call('put', uri, {
148
166
  'content-type': 'application/json',
149
167
  }, payload);
@@ -163,10 +181,10 @@ export class Project extends Service {
163
181
  throw new AppwriteException('Missing required parameter: "variableId"');
164
182
  }
165
183
 
166
- let path = '/project/variables/{variableId}'.replace('{variableId}', variableId);
167
- let payload: Payload = {};
184
+ const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId);
185
+ const payload: Payload = {};
168
186
 
169
- const uri = new URL(this.client.config.endpoint + path);
187
+ const uri = new URL(this.client.config.endpoint + apiPath);
170
188
  return await this.client.call('delete', uri, {
171
189
  'content-type': 'application/json',
172
190
  }, payload);