@appwrite.io/console 1.1.0-rc.2 → 1.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.
Files changed (115) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/sdk.js +2196 -3306
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +2197 -3305
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/dist/iife/sdk.js +2196 -3306
  7. package/docs/examples/account/delete-mfa-authenticator.md +1 -2
  8. package/docs/examples/databases/update-boolean-attribute.md +2 -1
  9. package/docs/examples/databases/update-datetime-attribute.md +2 -1
  10. package/docs/examples/databases/update-email-attribute.md +2 -1
  11. package/docs/examples/databases/update-enum-attribute.md +2 -1
  12. package/docs/examples/databases/update-float-attribute.md +2 -1
  13. package/docs/examples/databases/update-integer-attribute.md +2 -1
  14. package/docs/examples/databases/update-ip-attribute.md +2 -1
  15. package/docs/examples/databases/update-relationship-attribute.md +2 -1
  16. package/docs/examples/databases/update-string-attribute.md +3 -1
  17. package/docs/examples/databases/update-url-attribute.md +2 -1
  18. package/docs/examples/functions/create-build.md +1 -1
  19. package/docs/examples/functions/create-execution.md +2 -1
  20. package/docs/examples/functions/create.md +3 -1
  21. package/docs/examples/functions/delete-execution.md +14 -0
  22. package/docs/examples/functions/{download-deployment.md → get-deployment-download.md} +1 -1
  23. package/docs/examples/{account/list-billing-addresses.md → functions/get-template.md} +4 -4
  24. package/docs/examples/{account/create-payment-method.md → functions/list-specifications.md} +3 -3
  25. package/docs/examples/functions/list-templates.md +16 -0
  26. package/docs/examples/functions/update-deployment-build.md +14 -0
  27. package/docs/examples/functions/update.md +3 -1
  28. package/docs/examples/projects/create-j-w-t.md +15 -0
  29. package/docs/examples/projects/update-mock-numbers.md +14 -0
  30. package/docs/examples/projects/update-session-alerts.md +14 -0
  31. package/docs/examples/users/create-j-w-t.md +15 -0
  32. package/docs/examples/vcs/get-repository-contents.md +15 -0
  33. package/package.json +1 -1
  34. package/src/client.ts +2 -2
  35. package/src/enums/email-template-type.ts +2 -0
  36. package/src/enums/platform-type.ts +2 -0
  37. package/src/enums/runtime.ts +1 -0
  38. package/src/index.ts +1 -4
  39. package/src/models.ts +286 -960
  40. package/src/services/account.ts +2 -345
  41. package/src/services/console.ts +0 -120
  42. package/src/services/databases.ts +54 -10
  43. package/src/services/functions.ts +195 -14
  44. package/src/services/projects.ts +110 -1
  45. package/src/services/users.ts +37 -0
  46. package/src/services/vcs.ts +36 -0
  47. package/types/enums/email-template-type.d.ts +3 -1
  48. package/types/enums/platform-type.d.ts +3 -1
  49. package/types/enums/runtime.d.ts +2 -1
  50. package/types/index.d.ts +1 -4
  51. package/types/models.d.ts +286 -960
  52. package/types/services/account.d.ts +1 -105
  53. package/types/services/console.d.ts +0 -38
  54. package/types/services/databases.d.ts +21 -10
  55. package/types/services/functions.d.ts +67 -8
  56. package/types/services/projects.d.ts +32 -1
  57. package/types/services/users.d.ts +12 -0
  58. package/types/services/vcs.d.ts +11 -0
  59. package/docs/examples/account/delete-payment-method.md +0 -13
  60. package/docs/examples/account/get-billing-address.md +0 -13
  61. package/docs/examples/account/get-payment-method.md +0 -13
  62. package/docs/examples/account/list-credits.md +0 -14
  63. package/docs/examples/account/list-invoices.md +0 -13
  64. package/docs/examples/account/list-payment-methods.md +0 -13
  65. package/docs/examples/account/update-payment-method-mandate-options.md +0 -13
  66. package/docs/examples/account/update-payment-method-provider.md +0 -15
  67. package/docs/examples/account/update-payment-method.md +0 -15
  68. package/docs/examples/backups/create-archive.md +0 -14
  69. package/docs/examples/backups/create-policy.md +0 -19
  70. package/docs/examples/backups/create-restoration.md +0 -16
  71. package/docs/examples/backups/delete-archive.md +0 -13
  72. package/docs/examples/backups/delete-policy.md +0 -13
  73. package/docs/examples/backups/get-archive.md +0 -13
  74. package/docs/examples/backups/get-policy.md +0 -13
  75. package/docs/examples/backups/get-restoration.md +0 -13
  76. package/docs/examples/backups/list-archives.md +0 -13
  77. package/docs/examples/backups/list-policies.md +0 -13
  78. package/docs/examples/backups/list-restorations.md +0 -13
  79. package/docs/examples/backups/update-policy.md +0 -17
  80. package/docs/examples/console/create-source.md +0 -17
  81. package/docs/examples/console/get-copon.md +0 -13
  82. package/docs/examples/console/plans.md +0 -11
  83. package/docs/examples/console/regions.md +0 -11
  84. package/docs/examples/organizations/add-credit.md +0 -14
  85. package/docs/examples/organizations/create-invoice-payment.md +0 -15
  86. package/docs/examples/organizations/create.md +0 -17
  87. package/docs/examples/organizations/delete-backup-payment-method.md +0 -13
  88. package/docs/examples/organizations/delete-billing-address.md +0 -13
  89. package/docs/examples/organizations/delete-default-payment-method.md +0 -13
  90. package/docs/examples/organizations/delete.md +0 -13
  91. package/docs/examples/organizations/get-aggregation.md +0 -14
  92. package/docs/examples/organizations/get-billing-address.md +0 -14
  93. package/docs/examples/organizations/get-credit.md +0 -14
  94. package/docs/examples/organizations/get-invoice-download.md +0 -14
  95. package/docs/examples/organizations/get-invoice-view.md +0 -14
  96. package/docs/examples/organizations/get-invoice.md +0 -14
  97. package/docs/examples/organizations/get-payment-method.md +0 -14
  98. package/docs/examples/organizations/get-plan.md +0 -13
  99. package/docs/examples/organizations/get-usage.md +0 -15
  100. package/docs/examples/organizations/list-aggregations.md +0 -14
  101. package/docs/examples/organizations/list-invoices.md +0 -14
  102. package/docs/examples/organizations/list.md +0 -14
  103. package/docs/examples/organizations/set-backup-payment-method.md +0 -14
  104. package/docs/examples/organizations/set-billing-address.md +0 -14
  105. package/docs/examples/organizations/set-billing-email.md +0 -14
  106. package/docs/examples/organizations/set-billing-tax-id.md +0 -14
  107. package/docs/examples/organizations/set-default-payment-method.md +0 -14
  108. package/docs/examples/organizations/update-budget.md +0 -15
  109. package/docs/examples/organizations/update-plan.md +0 -16
  110. package/src/enums/billing-plan.ts +0 -5
  111. package/src/services/backups.ts +0 -425
  112. package/src/services/organizations.ts +0 -896
  113. package/types/enums/billing-plan.d.ts +0 -5
  114. package/types/services/backups.d.ts +0 -128
  115. package/types/services/organizations.d.ts +0 -273
@@ -1,14 +0,0 @@
1
- import { Client, Organizations } from "@appwrite.io/console";
2
-
3
- const client = new Client()
4
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
- .setProject('<YOUR_PROJECT_ID>'); // Your project ID
6
-
7
- const organizations = new Organizations(client);
8
-
9
- const result = await organizations.setDefaultPaymentMethod(
10
- '<ORGANIZATION_ID>', // organizationId
11
- '<PAYMENT_METHOD_ID>' // paymentMethodId
12
- );
13
-
14
- console.log(result);
@@ -1,15 +0,0 @@
1
- import { Client, Organizations } from "@appwrite.io/console";
2
-
3
- const client = new Client()
4
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
- .setProject('<YOUR_PROJECT_ID>'); // Your project ID
6
-
7
- const organizations = new Organizations(client);
8
-
9
- const result = await organizations.updateBudget(
10
- '<ORGANIZATION_ID>', // organizationId
11
- 0, // budget
12
- [] // alerts (optional)
13
- );
14
-
15
- console.log(result);
@@ -1,16 +0,0 @@
1
- import { Client, Organizations, } from "@appwrite.io/console";
2
-
3
- const client = new Client()
4
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
- .setProject('<YOUR_PROJECT_ID>'); // Your project ID
6
-
7
- const organizations = new Organizations(client);
8
-
9
- const result = await organizations.updatePlan(
10
- '<ORGANIZATION_ID>', // organizationId
11
- .Tier0, // billingPlan
12
- '<PAYMENT_METHOD_ID>', // paymentMethodId (optional)
13
- '<BILLING_ADDRESS_ID>' // billingAddressId (optional)
14
- );
15
-
16
- console.log(result);
@@ -1,5 +0,0 @@
1
- export enum BillingPlan {
2
- Tier0 = 'tier-0',
3
- Tier1 = 'tier-1',
4
- Tier2 = 'tier-2',
5
- }
@@ -1,425 +0,0 @@
1
- import { Service } from '../service';
2
- import { AppwriteException, Client, type Payload, UploadProgress } from '../client';
3
- import type { Models } from '../models';
4
-
5
- export class Backups {
6
- client: Client;
7
-
8
- constructor(client: Client) {
9
- this.client = client;
10
- }
11
-
12
- /**
13
- * Create archive
14
- *
15
- *
16
- * @param {string[]} services
17
- * @param {string} resourceId
18
- * @throws {AppwriteException}
19
- * @returns {Promise<Models.BackupArchive>}
20
- */
21
- async createArchive(services: string[], resourceId?: string): Promise<Models.BackupArchive> {
22
- if (typeof services === 'undefined') {
23
- throw new AppwriteException('Missing required parameter: "services"');
24
- }
25
- const apiPath = '/backups/archive';
26
- const payload: Payload = {};
27
- if (typeof services !== 'undefined') {
28
- payload['services'] = services;
29
- }
30
- if (typeof resourceId !== 'undefined') {
31
- payload['resourceId'] = resourceId;
32
- }
33
- const uri = new URL(this.client.config.endpoint + apiPath);
34
-
35
- const apiHeaders: { [header: string]: string } = {
36
- 'content-type': 'application/json',
37
- }
38
-
39
-
40
- return await this.client.call(
41
- 'post',
42
- uri,
43
- apiHeaders,
44
- payload
45
- );
46
- }
47
- /**
48
- * Delete archive
49
- *
50
- *
51
- * @param {string} archiveId
52
- * @throws {AppwriteException}
53
- * @returns {Promise<{}>}
54
- */
55
- async deleteArchive(archiveId: string): Promise<{}> {
56
- if (typeof archiveId === 'undefined') {
57
- throw new AppwriteException('Missing required parameter: "archiveId"');
58
- }
59
- const apiPath = '/backups/archive/{archiveId}'.replace('{archiveId}', archiveId);
60
- const payload: Payload = {};
61
- const uri = new URL(this.client.config.endpoint + apiPath);
62
-
63
- const apiHeaders: { [header: string]: string } = {
64
- 'content-type': 'application/json',
65
- }
66
-
67
-
68
- return await this.client.call(
69
- 'delete',
70
- uri,
71
- apiHeaders,
72
- payload
73
- );
74
- }
75
- /**
76
- * List archives
77
- *
78
- *
79
- * @param {string[]} queries
80
- * @throws {AppwriteException}
81
- * @returns {Promise<Models.BackupArchiveList>}
82
- */
83
- async listArchives(queries?: string[]): Promise<Models.BackupArchiveList> {
84
- const apiPath = '/backups/archives';
85
- const payload: Payload = {};
86
- if (typeof queries !== 'undefined') {
87
- payload['queries'] = queries;
88
- }
89
- const uri = new URL(this.client.config.endpoint + apiPath);
90
-
91
- const apiHeaders: { [header: string]: string } = {
92
- 'content-type': 'application/json',
93
- }
94
-
95
-
96
- return await this.client.call(
97
- 'get',
98
- uri,
99
- apiHeaders,
100
- payload
101
- );
102
- }
103
- /**
104
- * Get backup archive
105
- *
106
- *
107
- * @param {string} archiveId
108
- * @throws {AppwriteException}
109
- * @returns {Promise<Models.BackupArchive>}
110
- */
111
- async getArchive(archiveId: string): Promise<Models.BackupArchive> {
112
- if (typeof archiveId === 'undefined') {
113
- throw new AppwriteException('Missing required parameter: "archiveId"');
114
- }
115
- const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId);
116
- const payload: Payload = {};
117
- const uri = new URL(this.client.config.endpoint + apiPath);
118
-
119
- const apiHeaders: { [header: string]: string } = {
120
- 'content-type': 'application/json',
121
- }
122
-
123
-
124
- return await this.client.call(
125
- 'get',
126
- uri,
127
- apiHeaders,
128
- payload
129
- );
130
- }
131
- /**
132
- * List backup policies
133
- *
134
- *
135
- * @param {string[]} queries
136
- * @throws {AppwriteException}
137
- * @returns {Promise<Models.BackupPolicyList>}
138
- */
139
- async listPolicies(queries?: string[]): Promise<Models.BackupPolicyList> {
140
- const apiPath = '/backups/policies';
141
- const payload: Payload = {};
142
- if (typeof queries !== 'undefined') {
143
- payload['queries'] = queries;
144
- }
145
- const uri = new URL(this.client.config.endpoint + apiPath);
146
-
147
- const apiHeaders: { [header: string]: string } = {
148
- 'content-type': 'application/json',
149
- }
150
-
151
-
152
- return await this.client.call(
153
- 'get',
154
- uri,
155
- apiHeaders,
156
- payload
157
- );
158
- }
159
- /**
160
- * Create backup policy
161
- *
162
- *
163
- * @param {string} policyId
164
- * @param {string[]} services
165
- * @param {number} retention
166
- * @param {string} schedule
167
- * @param {string} name
168
- * @param {string} resourceId
169
- * @param {boolean} enabled
170
- * @throws {AppwriteException}
171
- * @returns {Promise<Models.BackupPolicy>}
172
- */
173
- async createPolicy(policyId: string, services: string[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean): Promise<Models.BackupPolicy> {
174
- if (typeof policyId === 'undefined') {
175
- throw new AppwriteException('Missing required parameter: "policyId"');
176
- }
177
- if (typeof services === 'undefined') {
178
- throw new AppwriteException('Missing required parameter: "services"');
179
- }
180
- if (typeof retention === 'undefined') {
181
- throw new AppwriteException('Missing required parameter: "retention"');
182
- }
183
- if (typeof schedule === 'undefined') {
184
- throw new AppwriteException('Missing required parameter: "schedule"');
185
- }
186
- const apiPath = '/backups/policies';
187
- const payload: Payload = {};
188
- if (typeof policyId !== 'undefined') {
189
- payload['policyId'] = policyId;
190
- }
191
- if (typeof name !== 'undefined') {
192
- payload['name'] = name;
193
- }
194
- if (typeof services !== 'undefined') {
195
- payload['services'] = services;
196
- }
197
- if (typeof resourceId !== 'undefined') {
198
- payload['resourceId'] = resourceId;
199
- }
200
- if (typeof enabled !== 'undefined') {
201
- payload['enabled'] = enabled;
202
- }
203
- if (typeof retention !== 'undefined') {
204
- payload['retention'] = retention;
205
- }
206
- if (typeof schedule !== 'undefined') {
207
- payload['schedule'] = schedule;
208
- }
209
- const uri = new URL(this.client.config.endpoint + apiPath);
210
-
211
- const apiHeaders: { [header: string]: string } = {
212
- 'content-type': 'application/json',
213
- }
214
-
215
-
216
- return await this.client.call(
217
- 'post',
218
- uri,
219
- apiHeaders,
220
- payload
221
- );
222
- }
223
- /**
224
- * Get backup policy
225
- *
226
- *
227
- * @param {string} policyId
228
- * @throws {AppwriteException}
229
- * @returns {Promise<Models.BackupPolicy>}
230
- */
231
- async getPolicy(policyId: string): Promise<Models.BackupPolicy> {
232
- if (typeof policyId === 'undefined') {
233
- throw new AppwriteException('Missing required parameter: "policyId"');
234
- }
235
- const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId);
236
- const payload: Payload = {};
237
- const uri = new URL(this.client.config.endpoint + apiPath);
238
-
239
- const apiHeaders: { [header: string]: string } = {
240
- 'content-type': 'application/json',
241
- }
242
-
243
-
244
- return await this.client.call(
245
- 'get',
246
- uri,
247
- apiHeaders,
248
- payload
249
- );
250
- }
251
- /**
252
- * Update backup policy
253
- *
254
- *
255
- * @param {string} policyId
256
- * @param {string} name
257
- * @param {number} retention
258
- * @param {string} schedule
259
- * @param {boolean} enabled
260
- * @throws {AppwriteException}
261
- * @returns {Promise<Models.BackupPolicy>}
262
- */
263
- async updatePolicy(policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean): Promise<Models.BackupPolicy> {
264
- if (typeof policyId === 'undefined') {
265
- throw new AppwriteException('Missing required parameter: "policyId"');
266
- }
267
- const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId);
268
- const payload: Payload = {};
269
- if (typeof name !== 'undefined') {
270
- payload['name'] = name;
271
- }
272
- if (typeof retention !== 'undefined') {
273
- payload['retention'] = retention;
274
- }
275
- if (typeof schedule !== 'undefined') {
276
- payload['schedule'] = schedule;
277
- }
278
- if (typeof enabled !== 'undefined') {
279
- payload['enabled'] = enabled;
280
- }
281
- const uri = new URL(this.client.config.endpoint + apiPath);
282
-
283
- const apiHeaders: { [header: string]: string } = {
284
- 'content-type': 'application/json',
285
- }
286
-
287
-
288
- return await this.client.call(
289
- 'patch',
290
- uri,
291
- apiHeaders,
292
- payload
293
- );
294
- }
295
- /**
296
- * Delete backup policy
297
- *
298
- *
299
- * @param {string} policyId
300
- * @throws {AppwriteException}
301
- * @returns {Promise<{}>}
302
- */
303
- async deletePolicy(policyId: string): Promise<{}> {
304
- if (typeof policyId === 'undefined') {
305
- throw new AppwriteException('Missing required parameter: "policyId"');
306
- }
307
- const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId);
308
- const payload: Payload = {};
309
- const uri = new URL(this.client.config.endpoint + apiPath);
310
-
311
- const apiHeaders: { [header: string]: string } = {
312
- 'content-type': 'application/json',
313
- }
314
-
315
-
316
- return await this.client.call(
317
- 'delete',
318
- uri,
319
- apiHeaders,
320
- payload
321
- );
322
- }
323
- /**
324
- * Create restoration
325
- *
326
- *
327
- * @param {string} archiveId
328
- * @param {string[]} services
329
- * @param {string} newResourceId
330
- * @param {string} newResourceName
331
- * @throws {AppwriteException}
332
- * @returns {Promise<Models.BackupRestoration>}
333
- */
334
- async createRestoration(archiveId: string, services: string[], newResourceId?: string, newResourceName?: string): Promise<Models.BackupRestoration> {
335
- if (typeof archiveId === 'undefined') {
336
- throw new AppwriteException('Missing required parameter: "archiveId"');
337
- }
338
- if (typeof services === 'undefined') {
339
- throw new AppwriteException('Missing required parameter: "services"');
340
- }
341
- const apiPath = '/backups/restoration';
342
- const payload: Payload = {};
343
- if (typeof archiveId !== 'undefined') {
344
- payload['archiveId'] = archiveId;
345
- }
346
- if (typeof services !== 'undefined') {
347
- payload['services'] = services;
348
- }
349
- if (typeof newResourceId !== 'undefined') {
350
- payload['newResourceId'] = newResourceId;
351
- }
352
- if (typeof newResourceName !== 'undefined') {
353
- payload['newResourceName'] = newResourceName;
354
- }
355
- const uri = new URL(this.client.config.endpoint + apiPath);
356
-
357
- const apiHeaders: { [header: string]: string } = {
358
- 'content-type': 'application/json',
359
- }
360
-
361
-
362
- return await this.client.call(
363
- 'post',
364
- uri,
365
- apiHeaders,
366
- payload
367
- );
368
- }
369
- /**
370
- * List restorations
371
- *
372
- *
373
- * @param {string[]} queries
374
- * @throws {AppwriteException}
375
- * @returns {Promise<Models.BackupRestorationList>}
376
- */
377
- async listRestorations(queries?: string[]): Promise<Models.BackupRestorationList> {
378
- const apiPath = '/backups/restorations';
379
- const payload: Payload = {};
380
- if (typeof queries !== 'undefined') {
381
- payload['queries'] = queries;
382
- }
383
- const uri = new URL(this.client.config.endpoint + apiPath);
384
-
385
- const apiHeaders: { [header: string]: string } = {
386
- 'content-type': 'application/json',
387
- }
388
-
389
-
390
- return await this.client.call(
391
- 'get',
392
- uri,
393
- apiHeaders,
394
- payload
395
- );
396
- }
397
- /**
398
- * Get backup restoration
399
- *
400
- *
401
- * @param {string} restorationId
402
- * @throws {AppwriteException}
403
- * @returns {Promise<Models.BackupArchive>}
404
- */
405
- async getRestoration(restorationId: string): Promise<Models.BackupArchive> {
406
- if (typeof restorationId === 'undefined') {
407
- throw new AppwriteException('Missing required parameter: "restorationId"');
408
- }
409
- const apiPath = '/backups/restorations/{restorationId}'.replace('{restorationId}', restorationId);
410
- const payload: Payload = {};
411
- const uri = new URL(this.client.config.endpoint + apiPath);
412
-
413
- const apiHeaders: { [header: string]: string } = {
414
- 'content-type': 'application/json',
415
- }
416
-
417
-
418
- return await this.client.call(
419
- 'get',
420
- uri,
421
- apiHeaders,
422
- payload
423
- );
424
- }
425
- }