@appwrite.io/console 1.9.0 → 1.10.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 (55) hide show
  1. package/.github/workflows/publish.yml +1 -1
  2. package/CHANGELOG.md +45 -6
  3. package/README.md +82 -2
  4. package/dist/cjs/sdk.js +246 -193
  5. package/dist/cjs/sdk.js.map +1 -1
  6. package/dist/esm/sdk.js +246 -193
  7. package/dist/esm/sdk.js.map +1 -1
  8. package/dist/iife/sdk.js +246 -193
  9. package/docs/examples/databases/create-document.md +1 -3
  10. package/docs/examples/databases/create-documents.md +1 -1
  11. package/docs/examples/functions/create-execution.md +1 -1
  12. package/docs/examples/organizations/get-available-credits.md +13 -0
  13. package/docs/examples/organizations/update-projects.md +14 -0
  14. package/docs/examples/vcs/get-repository-contents.md +2 -1
  15. package/package.json +1 -1
  16. package/src/client.ts +1 -1
  17. package/src/models.ts +241 -9
  18. package/src/services/account.ts +97 -36
  19. package/src/services/avatars.ts +26 -20
  20. package/src/services/backups.ts +11 -0
  21. package/src/services/console.ts +8 -1
  22. package/src/services/databases.ts +97 -33
  23. package/src/services/domains.ts +111 -69
  24. package/src/services/functions.ts +37 -8
  25. package/src/services/graphql.ts +1 -0
  26. package/src/services/health.ts +26 -1
  27. package/src/services/locale.ts +9 -2
  28. package/src/services/messaging.ts +53 -8
  29. package/src/services/migrations.ts +12 -0
  30. package/src/services/organizations.ts +106 -16
  31. package/src/services/project.ts +5 -0
  32. package/src/services/projects.ts +50 -0
  33. package/src/services/proxy.ts +7 -0
  34. package/src/services/sites.ts +32 -4
  35. package/src/services/storage.ts +23 -9
  36. package/src/services/teams.ts +30 -17
  37. package/src/services/tokens.ts +4 -0
  38. package/src/services/users.ts +69 -27
  39. package/src/services/vcs.ts +16 -4
  40. package/types/models.d.ts +228 -192
  41. package/types/services/account.d.ts +36 -36
  42. package/types/services/avatars.d.ts +20 -20
  43. package/types/services/console.d.ts +1 -1
  44. package/types/services/databases.d.ts +43 -33
  45. package/types/services/domains.d.ts +69 -69
  46. package/types/services/functions.d.ts +8 -8
  47. package/types/services/health.d.ts +1 -1
  48. package/types/services/locale.d.ts +2 -2
  49. package/types/services/messaging.d.ts +8 -8
  50. package/types/services/organizations.d.ts +33 -16
  51. package/types/services/sites.d.ts +4 -4
  52. package/types/services/storage.d.ts +9 -9
  53. package/types/services/teams.d.ts +17 -17
  54. package/types/services/users.d.ts +27 -27
  55. package/types/services/vcs.d.ts +4 -4
@@ -18,7 +18,7 @@ export class Organizations {
18
18
  * @throws {AppwriteException}
19
19
  * @returns {Promise<Models.OrganizationList<Preferences>>}
20
20
  */
21
- list<Preferences extends Models.Preferences>(queries?: string[], search?: string): Promise<Models.OrganizationList<Preferences>> {
21
+ list<Preferences extends Models.Preferences = Models.DefaultPreferences>(queries?: string[], search?: string): Promise<Models.OrganizationList<Preferences>> {
22
22
  const apiPath = '/organizations';
23
23
  const payload: Payload = {};
24
24
  if (typeof queries !== 'undefined') {
@@ -39,9 +39,10 @@ export class Organizations {
39
39
  payload
40
40
  );
41
41
  }
42
+
42
43
  /**
43
44
  * Create a new organization.
44
-
45
+ *
45
46
  *
46
47
  * @param {string} organizationId
47
48
  * @param {string} name
@@ -55,7 +56,7 @@ export class Organizations {
55
56
  * @throws {AppwriteException}
56
57
  * @returns {Promise<Models.Organization<Preferences>>}
57
58
  */
58
- create<Preferences extends Models.Preferences>(organizationId: string, name: string, billingPlan: BillingPlan, paymentMethodId?: string, billingAddressId?: string, invites?: string[], couponId?: string, taxId?: string, budget?: number): Promise<Models.Organization<Preferences>> {
59
+ create<Preferences extends Models.Preferences = Models.DefaultPreferences>(organizationId: string, name: string, billingPlan: BillingPlan, paymentMethodId?: string, billingAddressId?: string, invites?: string[], couponId?: string, taxId?: string, budget?: number): Promise<Models.Organization<Preferences>> {
59
60
  if (typeof organizationId === 'undefined') {
60
61
  throw new AppwriteException('Missing required parameter: "organizationId"');
61
62
  }
@@ -107,6 +108,7 @@ export class Organizations {
107
108
  payload
108
109
  );
109
110
  }
111
+
110
112
  /**
111
113
  * Get estimation for creating an organization.
112
114
  *
@@ -148,6 +150,7 @@ export class Organizations {
148
150
  payload
149
151
  );
150
152
  }
153
+
151
154
  /**
152
155
  * Delete an organization.
153
156
  *
@@ -174,6 +177,7 @@ export class Organizations {
174
177
  payload
175
178
  );
176
179
  }
180
+
177
181
  /**
178
182
  * Get a list of all aggregations for an organization.
179
183
  *
@@ -203,6 +207,7 @@ export class Organizations {
203
207
  payload
204
208
  );
205
209
  }
210
+
206
211
  /**
207
212
  * Get a specific aggregation using it&#039;s aggregation ID.
208
213
  *
@@ -232,6 +237,7 @@ export class Organizations {
232
237
  payload
233
238
  );
234
239
  }
240
+
235
241
  /**
236
242
  * Set a billing address for an organization.
237
243
  *
@@ -240,7 +246,7 @@ export class Organizations {
240
246
  * @throws {AppwriteException}
241
247
  * @returns {Promise<Models.Organization<Preferences>>}
242
248
  */
243
- setBillingAddress<Preferences extends Models.Preferences>(organizationId: string, billingAddressId: string): Promise<Models.Organization<Preferences>> {
249
+ setBillingAddress<Preferences extends Models.Preferences = Models.DefaultPreferences>(organizationId: string, billingAddressId: string): Promise<Models.Organization<Preferences>> {
244
250
  if (typeof organizationId === 'undefined') {
245
251
  throw new AppwriteException('Missing required parameter: "organizationId"');
246
252
  }
@@ -265,6 +271,7 @@ export class Organizations {
265
271
  payload
266
272
  );
267
273
  }
274
+
268
275
  /**
269
276
  * Delete a team&#039;s billing address.
270
277
  *
@@ -291,6 +298,7 @@ export class Organizations {
291
298
  payload
292
299
  );
293
300
  }
301
+
294
302
  /**
295
303
  * Get a billing address using it&#039;s ID.
296
304
  *
@@ -320,6 +328,7 @@ export class Organizations {
320
328
  payload
321
329
  );
322
330
  }
331
+
323
332
  /**
324
333
  * Set the current billing email for the organization.
325
334
  *
@@ -328,7 +337,7 @@ export class Organizations {
328
337
  * @throws {AppwriteException}
329
338
  * @returns {Promise<Models.Organization<Preferences>>}
330
339
  */
331
- setBillingEmail<Preferences extends Models.Preferences>(organizationId: string, billingEmail: string): Promise<Models.Organization<Preferences>> {
340
+ setBillingEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(organizationId: string, billingEmail: string): Promise<Models.Organization<Preferences>> {
332
341
  if (typeof organizationId === 'undefined') {
333
342
  throw new AppwriteException('Missing required parameter: "organizationId"');
334
343
  }
@@ -353,6 +362,7 @@ export class Organizations {
353
362
  payload
354
363
  );
355
364
  }
365
+
356
366
  /**
357
367
  * Update the budget limit for an organization.
358
368
  *
@@ -362,7 +372,7 @@ export class Organizations {
362
372
  * @throws {AppwriteException}
363
373
  * @returns {Promise<Models.Organization<Preferences>>}
364
374
  */
365
- updateBudget<Preferences extends Models.Preferences>(organizationId: string, budget?: number, alerts?: number[]): Promise<Models.Organization<Preferences>> {
375
+ updateBudget<Preferences extends Models.Preferences = Models.DefaultPreferences>(organizationId: string, budget?: number, alerts?: number[]): Promise<Models.Organization<Preferences>> {
366
376
  if (typeof organizationId === 'undefined') {
367
377
  throw new AppwriteException('Missing required parameter: "organizationId"');
368
378
  }
@@ -390,9 +400,10 @@ export class Organizations {
390
400
  payload
391
401
  );
392
402
  }
403
+
393
404
  /**
394
405
  * List all credits for an organization.
395
-
406
+ *
396
407
  *
397
408
  * @param {string} organizationId
398
409
  * @param {string[]} queries
@@ -420,6 +431,7 @@ export class Organizations {
420
431
  payload
421
432
  );
422
433
  }
434
+
423
435
  /**
424
436
  * Add credit to an organization using a coupon.
425
437
  *
@@ -453,6 +465,33 @@ export class Organizations {
453
465
  payload
454
466
  );
455
467
  }
468
+
469
+ /**
470
+ * Get total available valid credits for an organization.
471
+ *
472
+ * @param {string} organizationId
473
+ * @throws {AppwriteException}
474
+ * @returns {Promise<Models.CreditAvailable>}
475
+ */
476
+ getAvailableCredits(organizationId: string): Promise<Models.CreditAvailable> {
477
+ if (typeof organizationId === 'undefined') {
478
+ throw new AppwriteException('Missing required parameter: "organizationId"');
479
+ }
480
+ const apiPath = '/organizations/{organizationId}/credits/available'.replace('{organizationId}', organizationId);
481
+ const payload: Payload = {};
482
+ const uri = new URL(this.client.config.endpoint + apiPath);
483
+
484
+ const apiHeaders: { [header: string]: string } = {
485
+ }
486
+
487
+ return this.client.call(
488
+ 'get',
489
+ uri,
490
+ apiHeaders,
491
+ payload
492
+ );
493
+ }
494
+
456
495
  /**
457
496
  * Get credit details.
458
497
  *
@@ -482,6 +521,7 @@ export class Organizations {
482
521
  payload
483
522
  );
484
523
  }
524
+
485
525
  /**
486
526
  * Get estimation for deleting an organization.
487
527
  *
@@ -508,6 +548,7 @@ export class Organizations {
508
548
  payload
509
549
  );
510
550
  }
551
+
511
552
  /**
512
553
  * Get estimation for updating the organization plan.
513
554
  *
@@ -549,6 +590,7 @@ export class Organizations {
549
590
  payload
550
591
  );
551
592
  }
593
+
552
594
  /**
553
595
  * List all invoices for an organization.
554
596
  *
@@ -578,6 +620,7 @@ export class Organizations {
578
620
  payload
579
621
  );
580
622
  }
623
+
581
624
  /**
582
625
  * Get an invoice by its unique ID.
583
626
  *
@@ -607,6 +650,7 @@ export class Organizations {
607
650
  payload
608
651
  );
609
652
  }
653
+
610
654
  /**
611
655
  * Download invoice in PDF
612
656
  *
@@ -636,6 +680,7 @@ export class Organizations {
636
680
  payload
637
681
  );
638
682
  }
683
+
639
684
  /**
640
685
  * Initiate payment for failed invoice to pay live from console
641
686
  *
@@ -673,6 +718,7 @@ export class Organizations {
673
718
  payload
674
719
  );
675
720
  }
721
+
676
722
  /**
677
723
  * Validates the payment linked with the invoice and updates the invoice status if the payment status is changed.
678
724
  *
@@ -703,6 +749,7 @@ export class Organizations {
703
749
  payload
704
750
  );
705
751
  }
752
+
706
753
  /**
707
754
  * View invoice in PDF
708
755
  *
@@ -732,6 +779,7 @@ export class Organizations {
732
779
  payload
733
780
  );
734
781
  }
782
+
735
783
  /**
736
784
  * Set a organization&#039;s default payment method.
737
785
  *
@@ -740,7 +788,7 @@ export class Organizations {
740
788
  * @throws {AppwriteException}
741
789
  * @returns {Promise<Models.Organization<Preferences>>}
742
790
  */
743
- setDefaultPaymentMethod<Preferences extends Models.Preferences>(organizationId: string, paymentMethodId: string): Promise<Models.Organization<Preferences>> {
791
+ setDefaultPaymentMethod<Preferences extends Models.Preferences = Models.DefaultPreferences>(organizationId: string, paymentMethodId: string): Promise<Models.Organization<Preferences>> {
744
792
  if (typeof organizationId === 'undefined') {
745
793
  throw new AppwriteException('Missing required parameter: "organizationId"');
746
794
  }
@@ -765,6 +813,7 @@ export class Organizations {
765
813
  payload
766
814
  );
767
815
  }
816
+
768
817
  /**
769
818
  * Delete the default payment method for an organization.
770
819
  *
@@ -772,7 +821,7 @@ export class Organizations {
772
821
  * @throws {AppwriteException}
773
822
  * @returns {Promise<Models.Organization<Preferences>>}
774
823
  */
775
- deleteDefaultPaymentMethod<Preferences extends Models.Preferences>(organizationId: string): Promise<Models.Organization<Preferences>> {
824
+ deleteDefaultPaymentMethod<Preferences extends Models.Preferences = Models.DefaultPreferences>(organizationId: string): Promise<Models.Organization<Preferences>> {
776
825
  if (typeof organizationId === 'undefined') {
777
826
  throw new AppwriteException('Missing required parameter: "organizationId"');
778
827
  }
@@ -791,16 +840,17 @@ export class Organizations {
791
840
  payload
792
841
  );
793
842
  }
843
+
794
844
  /**
795
845
  * Set an organization&#039;s backup payment method.
796
-
846
+ *
797
847
  *
798
848
  * @param {string} organizationId
799
849
  * @param {string} paymentMethodId
800
850
  * @throws {AppwriteException}
801
851
  * @returns {Promise<Models.Organization<Preferences>>}
802
852
  */
803
- setBackupPaymentMethod<Preferences extends Models.Preferences>(organizationId: string, paymentMethodId: string): Promise<Models.Organization<Preferences>> {
853
+ setBackupPaymentMethod<Preferences extends Models.Preferences = Models.DefaultPreferences>(organizationId: string, paymentMethodId: string): Promise<Models.Organization<Preferences>> {
804
854
  if (typeof organizationId === 'undefined') {
805
855
  throw new AppwriteException('Missing required parameter: "organizationId"');
806
856
  }
@@ -825,6 +875,7 @@ export class Organizations {
825
875
  payload
826
876
  );
827
877
  }
878
+
828
879
  /**
829
880
  * Delete a backup payment method for an organization.
830
881
  *
@@ -832,7 +883,7 @@ export class Organizations {
832
883
  * @throws {AppwriteException}
833
884
  * @returns {Promise<Models.Organization<Preferences>>}
834
885
  */
835
- deleteBackupPaymentMethod<Preferences extends Models.Preferences>(organizationId: string): Promise<Models.Organization<Preferences>> {
886
+ deleteBackupPaymentMethod<Preferences extends Models.Preferences = Models.DefaultPreferences>(organizationId: string): Promise<Models.Organization<Preferences>> {
836
887
  if (typeof organizationId === 'undefined') {
837
888
  throw new AppwriteException('Missing required parameter: "organizationId"');
838
889
  }
@@ -851,6 +902,7 @@ export class Organizations {
851
902
  payload
852
903
  );
853
904
  }
905
+
854
906
  /**
855
907
  * Get an organization&#039;s payment method using it&#039;s payment method ID.
856
908
  *
@@ -880,6 +932,7 @@ export class Organizations {
880
932
  payload
881
933
  );
882
934
  }
935
+
883
936
  /**
884
937
  * Get the details of the current billing plan for an organization.
885
938
  *
@@ -905,6 +958,7 @@ export class Organizations {
905
958
  payload
906
959
  );
907
960
  }
961
+
908
962
  /**
909
963
  * Update the billing plan for an organization.
910
964
  *
@@ -919,7 +973,7 @@ export class Organizations {
919
973
  * @throws {AppwriteException}
920
974
  * @returns {Promise<Models.Organization<Preferences>>}
921
975
  */
922
- updatePlan<Preferences extends Models.Preferences>(organizationId: string, billingPlan: BillingPlan, paymentMethodId?: string, billingAddressId?: string, invites?: string[], couponId?: string, taxId?: string, budget?: number): Promise<Models.Organization<Preferences>> {
976
+ updatePlan<Preferences extends Models.Preferences = Models.DefaultPreferences>(organizationId: string, billingPlan: BillingPlan, paymentMethodId?: string, billingAddressId?: string, invites?: string[], couponId?: string, taxId?: string, budget?: number): Promise<Models.Organization<Preferences>> {
923
977
  if (typeof organizationId === 'undefined') {
924
978
  throw new AppwriteException('Missing required parameter: "organizationId"');
925
979
  }
@@ -962,6 +1016,7 @@ export class Organizations {
962
1016
  payload
963
1017
  );
964
1018
  }
1019
+
965
1020
  /**
966
1021
  * Cancel the downgrade initiated for an organization.
967
1022
  *
@@ -969,7 +1024,7 @@ export class Organizations {
969
1024
  * @throws {AppwriteException}
970
1025
  * @returns {Promise<Models.Organization<Preferences>>}
971
1026
  */
972
- cancelDowngrade<Preferences extends Models.Preferences>(organizationId: string): Promise<Models.Organization<Preferences>> {
1027
+ cancelDowngrade<Preferences extends Models.Preferences = Models.DefaultPreferences>(organizationId: string): Promise<Models.Organization<Preferences>> {
973
1028
  if (typeof organizationId === 'undefined') {
974
1029
  throw new AppwriteException('Missing required parameter: "organizationId"');
975
1030
  }
@@ -988,6 +1043,38 @@ export class Organizations {
988
1043
  payload
989
1044
  );
990
1045
  }
1046
+
1047
+ /**
1048
+ * Update selected projects to keep in the organization.
1049
+ *
1050
+ * @param {string} organizationId
1051
+ * @param {string[]} projects
1052
+ * @throws {AppwriteException}
1053
+ * @returns {Promise<Models.Organization<Preferences>>}
1054
+ */
1055
+ updateProjects<Preferences extends Models.Preferences = Models.DefaultPreferences>(organizationId: string, projects?: string[]): Promise<Models.Organization<Preferences>> {
1056
+ if (typeof organizationId === 'undefined') {
1057
+ throw new AppwriteException('Missing required parameter: "organizationId"');
1058
+ }
1059
+ const apiPath = '/organizations/{organizationId}/projects'.replace('{organizationId}', organizationId);
1060
+ const payload: Payload = {};
1061
+ if (typeof projects !== 'undefined') {
1062
+ payload['projects'] = projects;
1063
+ }
1064
+ const uri = new URL(this.client.config.endpoint + apiPath);
1065
+
1066
+ const apiHeaders: { [header: string]: string } = {
1067
+ 'content-type': 'application/json',
1068
+ }
1069
+
1070
+ return this.client.call(
1071
+ 'patch',
1072
+ uri,
1073
+ apiHeaders,
1074
+ payload
1075
+ );
1076
+ }
1077
+
991
1078
  /**
992
1079
  * Get Scopes
993
1080
  *
@@ -1013,6 +1100,7 @@ export class Organizations {
1013
1100
  payload
1014
1101
  );
1015
1102
  }
1103
+
1016
1104
  /**
1017
1105
  * Set an organization&#039;s billing tax ID.
1018
1106
  *
@@ -1021,7 +1109,7 @@ export class Organizations {
1021
1109
  * @throws {AppwriteException}
1022
1110
  * @returns {Promise<Models.Organization<Preferences>>}
1023
1111
  */
1024
- setBillingTaxId<Preferences extends Models.Preferences>(organizationId: string, taxId: string): Promise<Models.Organization<Preferences>> {
1112
+ setBillingTaxId<Preferences extends Models.Preferences = Models.DefaultPreferences>(organizationId: string, taxId: string): Promise<Models.Organization<Preferences>> {
1025
1113
  if (typeof organizationId === 'undefined') {
1026
1114
  throw new AppwriteException('Missing required parameter: "organizationId"');
1027
1115
  }
@@ -1046,6 +1134,7 @@ export class Organizations {
1046
1134
  payload
1047
1135
  );
1048
1136
  }
1137
+
1049
1138
  /**
1050
1139
  * Get the usage data for an organization.
1051
1140
  *
@@ -1079,6 +1168,7 @@ export class Organizations {
1079
1168
  payload
1080
1169
  );
1081
1170
  }
1171
+
1082
1172
  /**
1083
1173
  * Validate payment for team after creation or upgrade.
1084
1174
  *
@@ -1087,7 +1177,7 @@ export class Organizations {
1087
1177
  * @throws {AppwriteException}
1088
1178
  * @returns {Promise<Models.Organization<Preferences>>}
1089
1179
  */
1090
- validatePayment<Preferences extends Models.Preferences>(organizationId: string, invites?: string[]): Promise<Models.Organization<Preferences>> {
1180
+ validatePayment<Preferences extends Models.Preferences = Models.DefaultPreferences>(organizationId: string, invites?: string[]): Promise<Models.Organization<Preferences>> {
1091
1181
  if (typeof organizationId === 'undefined') {
1092
1182
  throw new AppwriteException('Missing required parameter: "organizationId"');
1093
1183
  }
@@ -49,6 +49,7 @@ export class Project {
49
49
  payload
50
50
  );
51
51
  }
52
+
52
53
  /**
53
54
  * Get a list of all project variables. These variables will be accessible in all Appwrite Functions at runtime.
54
55
  *
@@ -70,6 +71,7 @@ export class Project {
70
71
  payload
71
72
  );
72
73
  }
74
+
73
75
  /**
74
76
  * Create a new project variable. This variable will be accessible in all Appwrite Functions at runtime.
75
77
  *
@@ -110,6 +112,7 @@ export class Project {
110
112
  payload
111
113
  );
112
114
  }
115
+
113
116
  /**
114
117
  * Get a project variable by its unique ID.
115
118
  *
@@ -135,6 +138,7 @@ export class Project {
135
138
  payload
136
139
  );
137
140
  }
141
+
138
142
  /**
139
143
  * Update project variable by its unique ID. This variable will be accessible in all Appwrite Functions at runtime.
140
144
  *
@@ -176,6 +180,7 @@ export class Project {
176
180
  payload
177
181
  );
178
182
  }
183
+
179
184
  /**
180
185
  * Delete a project variable by its unique ID.
181
186
  *