@appwrite.io/console 1.0.1 → 1.1.0-rc.2

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 (103) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/sdk.js +3565 -2411
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +3564 -2412
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/dist/iife/sdk.js +3565 -2411
  7. package/docs/examples/{functions/list-specifications.md → account/create-payment-method.md} +3 -3
  8. package/docs/examples/account/delete-mfa-authenticator.md +2 -1
  9. package/docs/examples/account/delete-payment-method.md +13 -0
  10. package/docs/examples/account/get-billing-address.md +13 -0
  11. package/docs/examples/account/get-payment-method.md +13 -0
  12. package/docs/examples/{functions/get-template.md → account/list-billing-addresses.md} +4 -4
  13. package/docs/examples/account/list-credits.md +14 -0
  14. package/docs/examples/account/list-invoices.md +13 -0
  15. package/docs/examples/account/list-payment-methods.md +13 -0
  16. package/docs/examples/account/update-payment-method-mandate-options.md +13 -0
  17. package/docs/examples/account/update-payment-method-provider.md +15 -0
  18. package/docs/examples/account/update-payment-method.md +15 -0
  19. package/docs/examples/backups/create-archive.md +14 -0
  20. package/docs/examples/backups/create-policy.md +19 -0
  21. package/docs/examples/backups/create-restoration.md +16 -0
  22. package/docs/examples/backups/delete-archive.md +13 -0
  23. package/docs/examples/backups/delete-policy.md +13 -0
  24. package/docs/examples/backups/get-archive.md +13 -0
  25. package/docs/examples/backups/get-policy.md +13 -0
  26. package/docs/examples/backups/get-restoration.md +13 -0
  27. package/docs/examples/backups/list-archives.md +13 -0
  28. package/docs/examples/backups/list-policies.md +13 -0
  29. package/docs/examples/backups/list-restorations.md +13 -0
  30. package/docs/examples/backups/update-policy.md +17 -0
  31. package/docs/examples/console/create-source.md +17 -0
  32. package/docs/examples/console/get-copon.md +13 -0
  33. package/docs/examples/console/plans.md +11 -0
  34. package/docs/examples/console/regions.md +11 -0
  35. package/docs/examples/functions/create-build.md +1 -1
  36. package/docs/examples/functions/create-execution.md +1 -2
  37. package/docs/examples/functions/create.md +1 -3
  38. package/docs/examples/functions/{get-deployment-download.md → download-deployment.md} +1 -1
  39. package/docs/examples/functions/update.md +1 -3
  40. package/docs/examples/organizations/add-credit.md +14 -0
  41. package/docs/examples/organizations/create-invoice-payment.md +15 -0
  42. package/docs/examples/organizations/create.md +17 -0
  43. package/docs/examples/organizations/delete-backup-payment-method.md +13 -0
  44. package/docs/examples/organizations/delete-billing-address.md +13 -0
  45. package/docs/examples/organizations/delete-default-payment-method.md +13 -0
  46. package/docs/examples/organizations/delete.md +13 -0
  47. package/docs/examples/organizations/get-aggregation.md +14 -0
  48. package/docs/examples/organizations/get-billing-address.md +14 -0
  49. package/docs/examples/organizations/get-credit.md +14 -0
  50. package/docs/examples/organizations/get-invoice-download.md +14 -0
  51. package/docs/examples/organizations/get-invoice-view.md +14 -0
  52. package/docs/examples/organizations/get-invoice.md +14 -0
  53. package/docs/examples/organizations/get-payment-method.md +14 -0
  54. package/docs/examples/organizations/get-plan.md +13 -0
  55. package/docs/examples/organizations/get-usage.md +15 -0
  56. package/docs/examples/organizations/list-aggregations.md +14 -0
  57. package/docs/examples/organizations/list-invoices.md +14 -0
  58. package/docs/examples/organizations/list.md +14 -0
  59. package/docs/examples/organizations/set-backup-payment-method.md +14 -0
  60. package/docs/examples/organizations/set-billing-address.md +14 -0
  61. package/docs/examples/organizations/set-billing-email.md +14 -0
  62. package/docs/examples/organizations/set-billing-tax-id.md +14 -0
  63. package/docs/examples/organizations/set-default-payment-method.md +14 -0
  64. package/docs/examples/organizations/update-budget.md +15 -0
  65. package/docs/examples/organizations/update-plan.md +16 -0
  66. package/package.json +1 -1
  67. package/src/client.ts +2 -2
  68. package/src/enums/billing-plan.ts +5 -0
  69. package/src/enums/email-template-type.ts +0 -2
  70. package/src/enums/platform-type.ts +0 -2
  71. package/src/enums/runtime.ts +0 -1
  72. package/src/index.ts +4 -1
  73. package/src/models.ts +956 -282
  74. package/src/services/account.ts +345 -2
  75. package/src/services/backups.ts +425 -0
  76. package/src/services/console.ts +120 -0
  77. package/src/services/functions.ts +14 -195
  78. package/src/services/organizations.ts +896 -0
  79. package/src/services/projects.ts +1 -110
  80. package/src/services/users.ts +0 -37
  81. package/src/services/vcs.ts +0 -36
  82. package/types/enums/billing-plan.d.ts +5 -0
  83. package/types/enums/email-template-type.d.ts +1 -3
  84. package/types/enums/platform-type.d.ts +1 -3
  85. package/types/enums/runtime.d.ts +1 -2
  86. package/types/index.d.ts +4 -1
  87. package/types/models.d.ts +956 -282
  88. package/types/services/account.d.ts +105 -1
  89. package/types/services/backups.d.ts +128 -0
  90. package/types/services/console.d.ts +38 -0
  91. package/types/services/functions.d.ts +8 -67
  92. package/types/services/organizations.d.ts +273 -0
  93. package/types/services/projects.d.ts +1 -32
  94. package/types/services/users.d.ts +0 -12
  95. package/types/services/vcs.d.ts +0 -11
  96. package/docs/examples/functions/delete-execution.md +0 -14
  97. package/docs/examples/functions/list-templates.md +0 -16
  98. package/docs/examples/functions/update-deployment-build.md +0 -14
  99. package/docs/examples/projects/create-j-w-t.md +0 -15
  100. package/docs/examples/projects/update-mock-numbers.md +0 -14
  101. package/docs/examples/projects/update-session-alerts.md +0 -14
  102. package/docs/examples/users/create-j-w-t.md +0 -15
  103. package/docs/examples/vcs/get-repository-contents.md +0 -15
@@ -61,7 +61,6 @@ export class Functions {
61
61
  * @param {boolean} logging
62
62
  * @param {string} entrypoint
63
63
  * @param {string} commands
64
- * @param {string[]} scopes
65
64
  * @param {string} installationId
66
65
  * @param {string} providerRepositoryId
67
66
  * @param {string} providerBranch
@@ -70,12 +69,11 @@ export class Functions {
70
69
  * @param {string} templateRepository
71
70
  * @param {string} templateOwner
72
71
  * @param {string} templateRootDirectory
73
- * @param {string} templateVersion
74
- * @param {string} specification
72
+ * @param {string} templateBranch
75
73
  * @throws {AppwriteException}
76
74
  * @returns {Promise<Models.Function>}
77
75
  */
78
- async create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, templateRepository?: string, templateOwner?: string, templateRootDirectory?: string, templateVersion?: string, specification?: string): Promise<Models.Function> {
76
+ async create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, templateRepository?: string, templateOwner?: string, templateRootDirectory?: string, templateBranch?: string): Promise<Models.Function> {
79
77
  if (typeof functionId === 'undefined') {
80
78
  throw new AppwriteException('Missing required parameter: "functionId"');
81
79
  }
@@ -120,9 +118,6 @@ export class Functions {
120
118
  if (typeof commands !== 'undefined') {
121
119
  payload['commands'] = commands;
122
120
  }
123
- if (typeof scopes !== 'undefined') {
124
- payload['scopes'] = scopes;
125
- }
126
121
  if (typeof installationId !== 'undefined') {
127
122
  payload['installationId'] = installationId;
128
123
  }
@@ -147,11 +142,8 @@ export class Functions {
147
142
  if (typeof templateRootDirectory !== 'undefined') {
148
143
  payload['templateRootDirectory'] = templateRootDirectory;
149
144
  }
150
- if (typeof templateVersion !== 'undefined') {
151
- payload['templateVersion'] = templateVersion;
152
- }
153
- if (typeof specification !== 'undefined') {
154
- payload['specification'] = specification;
145
+ if (typeof templateBranch !== 'undefined') {
146
+ payload['templateBranch'] = templateBranch;
155
147
  }
156
148
  const uri = new URL(this.client.config.endpoint + apiPath);
157
149
 
@@ -185,102 +177,6 @@ export class Functions {
185
177
  }
186
178
 
187
179
 
188
- return await this.client.call(
189
- 'get',
190
- uri,
191
- apiHeaders,
192
- payload
193
- );
194
- }
195
- /**
196
- * List available function runtime specifications
197
- *
198
- * List allowed function specifications for this instance.
199
-
200
- *
201
- * @throws {AppwriteException}
202
- * @returns {Promise<Models.SpecificationList>}
203
- */
204
- async listSpecifications(): Promise<Models.SpecificationList> {
205
- const apiPath = '/functions/specifications';
206
- const payload: Payload = {};
207
- const uri = new URL(this.client.config.endpoint + apiPath);
208
-
209
- const apiHeaders: { [header: string]: string } = {
210
- 'content-type': 'application/json',
211
- }
212
-
213
-
214
- return await this.client.call(
215
- 'get',
216
- uri,
217
- apiHeaders,
218
- payload
219
- );
220
- }
221
- /**
222
- * List function templates
223
- *
224
- * List available function templates. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method.
225
- *
226
- * @param {string[]} runtimes
227
- * @param {string[]} useCases
228
- * @param {number} limit
229
- * @param {number} offset
230
- * @throws {AppwriteException}
231
- * @returns {Promise<Models.TemplateFunctionList>}
232
- */
233
- async listTemplates(runtimes?: string[], useCases?: string[], limit?: number, offset?: number): Promise<Models.TemplateFunctionList> {
234
- const apiPath = '/functions/templates';
235
- const payload: Payload = {};
236
- if (typeof runtimes !== 'undefined') {
237
- payload['runtimes'] = runtimes;
238
- }
239
- if (typeof useCases !== 'undefined') {
240
- payload['useCases'] = useCases;
241
- }
242
- if (typeof limit !== 'undefined') {
243
- payload['limit'] = limit;
244
- }
245
- if (typeof offset !== 'undefined') {
246
- payload['offset'] = offset;
247
- }
248
- const uri = new URL(this.client.config.endpoint + apiPath);
249
-
250
- const apiHeaders: { [header: string]: string } = {
251
- 'content-type': 'application/json',
252
- }
253
-
254
-
255
- return await this.client.call(
256
- 'get',
257
- uri,
258
- apiHeaders,
259
- payload
260
- );
261
- }
262
- /**
263
- * Get function template
264
- *
265
- * Get a function template using ID. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method.
266
- *
267
- * @param {string} templateId
268
- * @throws {AppwriteException}
269
- * @returns {Promise<Models.TemplateFunction>}
270
- */
271
- async getTemplate(templateId: string): Promise<Models.TemplateFunction> {
272
- if (typeof templateId === 'undefined') {
273
- throw new AppwriteException('Missing required parameter: "templateId"');
274
- }
275
- const apiPath = '/functions/templates/{templateId}'.replace('{templateId}', templateId);
276
- const payload: Payload = {};
277
- const uri = new URL(this.client.config.endpoint + apiPath);
278
-
279
- const apiHeaders: { [header: string]: string } = {
280
- 'content-type': 'application/json',
281
- }
282
-
283
-
284
180
  return await this.client.call(
285
181
  'get',
286
182
  uri,
@@ -361,17 +257,15 @@ export class Functions {
361
257
  * @param {boolean} logging
362
258
  * @param {string} entrypoint
363
259
  * @param {string} commands
364
- * @param {string[]} scopes
365
260
  * @param {string} installationId
366
261
  * @param {string} providerRepositoryId
367
262
  * @param {string} providerBranch
368
263
  * @param {boolean} providerSilentMode
369
264
  * @param {string} providerRootDirectory
370
- * @param {string} specification
371
265
  * @throws {AppwriteException}
372
266
  * @returns {Promise<Models.Function>}
373
267
  */
374
- async update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string): Promise<Models.Function> {
268
+ async update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string): Promise<Models.Function> {
375
269
  if (typeof functionId === 'undefined') {
376
270
  throw new AppwriteException('Missing required parameter: "functionId"');
377
271
  }
@@ -410,9 +304,6 @@ export class Functions {
410
304
  if (typeof commands !== 'undefined') {
411
305
  payload['commands'] = commands;
412
306
  }
413
- if (typeof scopes !== 'undefined') {
414
- payload['scopes'] = scopes;
415
- }
416
307
  if (typeof installationId !== 'undefined') {
417
308
  payload['installationId'] = installationId;
418
309
  }
@@ -428,9 +319,6 @@ export class Functions {
428
319
  if (typeof providerRootDirectory !== 'undefined') {
429
320
  payload['providerRootDirectory'] = providerRootDirectory;
430
321
  }
431
- if (typeof specification !== 'undefined') {
432
- payload['specification'] = specification;
433
- }
434
322
  const uri = new URL(this.client.config.endpoint + apiPath);
435
323
 
436
324
  const apiHeaders: { [header: string]: string } = {
@@ -667,8 +555,9 @@ Use the &quot;command&quot; param to set the entrypoint used to execute your cod
667
555
  );
668
556
  }
669
557
  /**
670
- * Rebuild deployment
558
+ * Create build
671
559
  *
560
+ * Create a new build for an Appwrite Function deployment. This endpoint can be used to retry a failed build.
672
561
  *
673
562
  * @param {string} functionId
674
563
  * @param {string} deploymentId
@@ -676,49 +565,17 @@ Use the &quot;command&quot; param to set the entrypoint used to execute your cod
676
565
  * @throws {AppwriteException}
677
566
  * @returns {Promise<{}>}
678
567
  */
679
- async createBuild(functionId: string, deploymentId: string, buildId?: string): Promise<{}> {
568
+ async createBuild(functionId: string, deploymentId: string, buildId: string): Promise<{}> {
680
569
  if (typeof functionId === 'undefined') {
681
570
  throw new AppwriteException('Missing required parameter: "functionId"');
682
571
  }
683
572
  if (typeof deploymentId === 'undefined') {
684
573
  throw new AppwriteException('Missing required parameter: "deploymentId"');
685
574
  }
686
- const apiPath = '/functions/{functionId}/deployments/{deploymentId}/build'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
687
- const payload: Payload = {};
688
- if (typeof buildId !== 'undefined') {
689
- payload['buildId'] = buildId;
575
+ if (typeof buildId === 'undefined') {
576
+ throw new AppwriteException('Missing required parameter: "buildId"');
690
577
  }
691
- const uri = new URL(this.client.config.endpoint + apiPath);
692
-
693
- const apiHeaders: { [header: string]: string } = {
694
- 'content-type': 'application/json',
695
- }
696
-
697
-
698
- return await this.client.call(
699
- 'post',
700
- uri,
701
- apiHeaders,
702
- payload
703
- );
704
- }
705
- /**
706
- * Cancel deployment
707
- *
708
- *
709
- * @param {string} functionId
710
- * @param {string} deploymentId
711
- * @throws {AppwriteException}
712
- * @returns {Promise<Models.Build>}
713
- */
714
- async updateDeploymentBuild(functionId: string, deploymentId: string): Promise<Models.Build> {
715
- if (typeof functionId === 'undefined') {
716
- throw new AppwriteException('Missing required parameter: "functionId"');
717
- }
718
- if (typeof deploymentId === 'undefined') {
719
- throw new AppwriteException('Missing required parameter: "deploymentId"');
720
- }
721
- const apiPath = '/functions/{functionId}/deployments/{deploymentId}/build'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
578
+ const apiPath = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
722
579
  const payload: Payload = {};
723
580
  const uri = new URL(this.client.config.endpoint + apiPath);
724
581
 
@@ -728,7 +585,7 @@ Use the &quot;command&quot; param to set the entrypoint used to execute your cod
728
585
 
729
586
 
730
587
  return await this.client.call(
731
- 'patch',
588
+ 'post',
732
589
  uri,
733
590
  apiHeaders,
734
591
  payload
@@ -744,7 +601,7 @@ Use the &quot;command&quot; param to set the entrypoint used to execute your cod
744
601
  * @throws {AppwriteException}
745
602
  * @returns {string}
746
603
  */
747
- getDeploymentDownload(functionId: string, deploymentId: string): string {
604
+ downloadDeployment(functionId: string, deploymentId: string): string {
748
605
  if (typeof functionId === 'undefined') {
749
606
  throw new AppwriteException('Missing required parameter: "functionId"');
750
607
  }
@@ -820,11 +677,10 @@ Use the &quot;command&quot; param to set the entrypoint used to execute your cod
820
677
  * @param {string} xpath
821
678
  * @param {ExecutionMethod} method
822
679
  * @param {object} headers
823
- * @param {string} scheduledAt
824
680
  * @throws {AppwriteException}
825
681
  * @returns {Promise<Models.Execution>}
826
682
  */
827
- async createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise<Models.Execution> {
683
+ async createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object): Promise<Models.Execution> {
828
684
  if (typeof functionId === 'undefined') {
829
685
  throw new AppwriteException('Missing required parameter: "functionId"');
830
686
  }
@@ -845,9 +701,6 @@ Use the &quot;command&quot; param to set the entrypoint used to execute your cod
845
701
  if (typeof headers !== 'undefined') {
846
702
  payload['headers'] = headers;
847
703
  }
848
- if (typeof scheduledAt !== 'undefined') {
849
- payload['scheduledAt'] = scheduledAt;
850
- }
851
704
  const uri = new URL(this.client.config.endpoint + apiPath);
852
705
 
853
706
  const apiHeaders: { [header: string]: string } = {
@@ -895,40 +748,6 @@ Use the &quot;command&quot; param to set the entrypoint used to execute your cod
895
748
  payload
896
749
  );
897
750
  }
898
- /**
899
- * Delete execution
900
- *
901
- * Delete a function execution by its unique ID.
902
-
903
- *
904
- * @param {string} functionId
905
- * @param {string} executionId
906
- * @throws {AppwriteException}
907
- * @returns {Promise<{}>}
908
- */
909
- async deleteExecution(functionId: string, executionId: string): Promise<{}> {
910
- if (typeof functionId === 'undefined') {
911
- throw new AppwriteException('Missing required parameter: "functionId"');
912
- }
913
- if (typeof executionId === 'undefined') {
914
- throw new AppwriteException('Missing required parameter: "executionId"');
915
- }
916
- const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
917
- const payload: Payload = {};
918
- const uri = new URL(this.client.config.endpoint + apiPath);
919
-
920
- const apiHeaders: { [header: string]: string } = {
921
- 'content-type': 'application/json',
922
- }
923
-
924
-
925
- return await this.client.call(
926
- 'delete',
927
- uri,
928
- apiHeaders,
929
- payload
930
- );
931
- }
932
751
  /**
933
752
  * Get function usage
934
753
  *