@appwrite.io/console 1.8.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 (105) 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 +532 -200
  5. package/dist/cjs/sdk.js.map +1 -1
  6. package/dist/esm/sdk.js +533 -201
  7. package/dist/esm/sdk.js.map +1 -1
  8. package/dist/iife/sdk.js +532 -200
  9. package/docs/examples/databases/create-document.md +1 -3
  10. package/docs/examples/databases/create-documents.md +1 -1
  11. package/docs/examples/databases/decrement-document-attribute.md +18 -0
  12. package/docs/examples/databases/increment-document-attribute.md +18 -0
  13. package/docs/examples/databases/upsert-documents.md +1 -1
  14. package/docs/examples/domains/create-record-a-a-a-a.md +1 -1
  15. package/docs/examples/domains/create-record-a.md +1 -1
  16. package/docs/examples/domains/create-record-alias.md +1 -1
  17. package/docs/examples/domains/create-record-c-a-a.md +1 -1
  18. package/docs/examples/domains/create-record-c-n-a-m-e.md +1 -1
  19. package/docs/examples/domains/create-record-h-t-t-p-s.md +1 -1
  20. package/docs/examples/domains/create-record-m-x.md +1 -1
  21. package/docs/examples/domains/create-record-n-s.md +1 -1
  22. package/docs/examples/domains/create-record-s-r-v.md +1 -1
  23. package/docs/examples/domains/create-record-t-x-t.md +1 -1
  24. package/docs/examples/domains/update-record-a-a-a-a.md +1 -1
  25. package/docs/examples/domains/update-record-a.md +1 -1
  26. package/docs/examples/domains/update-record-alias.md +1 -1
  27. package/docs/examples/domains/update-record-c-a-a.md +1 -1
  28. package/docs/examples/domains/update-record-c-n-a-m-e.md +1 -1
  29. package/docs/examples/domains/update-record-h-t-t-p-s.md +1 -1
  30. package/docs/examples/domains/update-record-m-x.md +1 -1
  31. package/docs/examples/domains/update-record-n-s.md +1 -1
  32. package/docs/examples/domains/update-record-s-r-v.md +1 -1
  33. package/docs/examples/domains/update-record-t-x-t.md +1 -1
  34. package/docs/examples/functions/create-execution.md +1 -1
  35. package/docs/examples/health/{get-queue-stats-usage-dump.md → get-queue-billing-project-aggregation.md} +2 -2
  36. package/docs/examples/health/{get-queue-billing-aggregation.md → get-queue-billing-team-aggregation.md} +1 -1
  37. package/docs/examples/organizations/cancel-downgrade.md +13 -0
  38. package/docs/examples/organizations/estimation-create-organization.md +16 -0
  39. package/docs/examples/organizations/estimation-delete-organization.md +13 -0
  40. package/docs/examples/organizations/estimation-update-plan.md +16 -0
  41. package/docs/examples/organizations/get-available-credits.md +13 -0
  42. package/docs/examples/organizations/get-usage.md +1 -1
  43. package/docs/examples/organizations/update-projects.md +14 -0
  44. package/docs/examples/organizations/validate-payment.md +14 -0
  45. package/docs/examples/proxy/create-redirect-rule.md +4 -2
  46. package/docs/examples/vcs/get-repository-contents.md +2 -1
  47. package/package.json +1 -1
  48. package/src/client.ts +5 -4
  49. package/src/enums/build-runtime.ts +2 -0
  50. package/src/enums/image-format.ts +1 -0
  51. package/src/enums/proxy-resource-type.ts +4 -0
  52. package/src/enums/runtime.ts +2 -0
  53. package/src/index.ts +1 -0
  54. package/src/models.ts +513 -11
  55. package/src/services/account.ts +97 -36
  56. package/src/services/avatars.ts +26 -20
  57. package/src/services/backups.ts +11 -0
  58. package/src/services/console.ts +8 -1
  59. package/src/services/databases.ts +190 -31
  60. package/src/services/domains.ts +111 -69
  61. package/src/services/functions.ts +37 -8
  62. package/src/services/graphql.ts +1 -0
  63. package/src/services/health.ts +54 -4
  64. package/src/services/locale.ts +9 -2
  65. package/src/services/messaging.ts +53 -8
  66. package/src/services/migrations.ts +12 -0
  67. package/src/services/organizations.ts +301 -14
  68. package/src/services/project.ts +5 -0
  69. package/src/services/projects.ts +50 -0
  70. package/src/services/proxy.ts +23 -1
  71. package/src/services/sites.ts +32 -4
  72. package/src/services/storage.ts +23 -9
  73. package/src/services/teams.ts +30 -17
  74. package/src/services/tokens.ts +4 -0
  75. package/src/services/users.ts +69 -27
  76. package/src/services/vcs.ts +16 -4
  77. package/types/enums/build-runtime.d.ts +3 -1
  78. package/types/enums/image-format.d.ts +2 -1
  79. package/types/enums/proxy-resource-type.d.ts +4 -0
  80. package/types/enums/runtime.d.ts +3 -1
  81. package/types/index.d.ts +1 -0
  82. package/types/models.d.ts +494 -188
  83. package/types/services/account.d.ts +36 -36
  84. package/types/services/avatars.d.ts +20 -20
  85. package/types/services/console.d.ts +1 -1
  86. package/types/services/databases.d.ts +67 -31
  87. package/types/services/domains.d.ts +69 -69
  88. package/types/services/functions.d.ts +8 -8
  89. package/types/services/health.d.ts +11 -3
  90. package/types/services/locale.d.ts +2 -2
  91. package/types/services/messaging.d.ts +8 -8
  92. package/types/services/organizations.d.ts +88 -14
  93. package/types/services/proxy.d.ts +4 -1
  94. package/types/services/sites.d.ts +4 -4
  95. package/types/services/storage.d.ts +9 -9
  96. package/types/services/teams.d.ts +17 -17
  97. package/types/services/users.d.ts +27 -27
  98. package/types/services/vcs.d.ts +4 -4
  99. package/docs/examples/functions/create-build.md +0 -15
  100. package/docs/examples/functions/get-function-usage.md +0 -14
  101. package/docs/examples/functions/update-deployment-build.md +0 -14
  102. package/docs/examples/functions/update-deployment.md +0 -14
  103. package/docs/examples/proxy/create-rule.md +0 -15
  104. package/src/enums/resource-type.ts +0 -4
  105. package/types/enums/resource-type.d.ts +0 -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,49 @@ export class Organizations {
107
108
  payload
108
109
  );
109
110
  }
111
+
112
+ /**
113
+ * Get estimation for creating an organization.
114
+ *
115
+ * @param {BillingPlan} billingPlan
116
+ * @param {string} paymentMethodId
117
+ * @param {string[]} invites
118
+ * @param {string} couponId
119
+ * @throws {AppwriteException}
120
+ * @returns {Promise<Models.Estimation>}
121
+ */
122
+ estimationCreateOrganization(billingPlan: BillingPlan, paymentMethodId?: string, invites?: string[], couponId?: string): Promise<Models.Estimation> {
123
+ if (typeof billingPlan === 'undefined') {
124
+ throw new AppwriteException('Missing required parameter: "billingPlan"');
125
+ }
126
+ const apiPath = '/organizations/estimations/create-organization';
127
+ const payload: Payload = {};
128
+ if (typeof billingPlan !== 'undefined') {
129
+ payload['billingPlan'] = billingPlan;
130
+ }
131
+ if (typeof paymentMethodId !== 'undefined') {
132
+ payload['paymentMethodId'] = paymentMethodId;
133
+ }
134
+ if (typeof invites !== 'undefined') {
135
+ payload['invites'] = invites;
136
+ }
137
+ if (typeof couponId !== 'undefined') {
138
+ payload['couponId'] = couponId;
139
+ }
140
+ const uri = new URL(this.client.config.endpoint + apiPath);
141
+
142
+ const apiHeaders: { [header: string]: string } = {
143
+ 'content-type': 'application/json',
144
+ }
145
+
146
+ return this.client.call(
147
+ 'patch',
148
+ uri,
149
+ apiHeaders,
150
+ payload
151
+ );
152
+ }
153
+
110
154
  /**
111
155
  * Delete an organization.
112
156
  *
@@ -133,6 +177,7 @@ export class Organizations {
133
177
  payload
134
178
  );
135
179
  }
180
+
136
181
  /**
137
182
  * Get a list of all aggregations for an organization.
138
183
  *
@@ -162,6 +207,7 @@ export class Organizations {
162
207
  payload
163
208
  );
164
209
  }
210
+
165
211
  /**
166
212
  * Get a specific aggregation using it&#039;s aggregation ID.
167
213
  *
@@ -191,6 +237,7 @@ export class Organizations {
191
237
  payload
192
238
  );
193
239
  }
240
+
194
241
  /**
195
242
  * Set a billing address for an organization.
196
243
  *
@@ -199,7 +246,7 @@ export class Organizations {
199
246
  * @throws {AppwriteException}
200
247
  * @returns {Promise<Models.Organization<Preferences>>}
201
248
  */
202
- 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>> {
203
250
  if (typeof organizationId === 'undefined') {
204
251
  throw new AppwriteException('Missing required parameter: "organizationId"');
205
252
  }
@@ -224,6 +271,7 @@ export class Organizations {
224
271
  payload
225
272
  );
226
273
  }
274
+
227
275
  /**
228
276
  * Delete a team&#039;s billing address.
229
277
  *
@@ -250,6 +298,7 @@ export class Organizations {
250
298
  payload
251
299
  );
252
300
  }
301
+
253
302
  /**
254
303
  * Get a billing address using it&#039;s ID.
255
304
  *
@@ -279,6 +328,7 @@ export class Organizations {
279
328
  payload
280
329
  );
281
330
  }
331
+
282
332
  /**
283
333
  * Set the current billing email for the organization.
284
334
  *
@@ -287,7 +337,7 @@ export class Organizations {
287
337
  * @throws {AppwriteException}
288
338
  * @returns {Promise<Models.Organization<Preferences>>}
289
339
  */
290
- 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>> {
291
341
  if (typeof organizationId === 'undefined') {
292
342
  throw new AppwriteException('Missing required parameter: "organizationId"');
293
343
  }
@@ -312,6 +362,7 @@ export class Organizations {
312
362
  payload
313
363
  );
314
364
  }
365
+
315
366
  /**
316
367
  * Update the budget limit for an organization.
317
368
  *
@@ -321,7 +372,7 @@ export class Organizations {
321
372
  * @throws {AppwriteException}
322
373
  * @returns {Promise<Models.Organization<Preferences>>}
323
374
  */
324
- 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>> {
325
376
  if (typeof organizationId === 'undefined') {
326
377
  throw new AppwriteException('Missing required parameter: "organizationId"');
327
378
  }
@@ -349,9 +400,10 @@ export class Organizations {
349
400
  payload
350
401
  );
351
402
  }
403
+
352
404
  /**
353
405
  * List all credits for an organization.
354
-
406
+ *
355
407
  *
356
408
  * @param {string} organizationId
357
409
  * @param {string[]} queries
@@ -379,6 +431,7 @@ export class Organizations {
379
431
  payload
380
432
  );
381
433
  }
434
+
382
435
  /**
383
436
  * Add credit to an organization using a coupon.
384
437
  *
@@ -412,6 +465,33 @@ export class Organizations {
412
465
  payload
413
466
  );
414
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
+
415
495
  /**
416
496
  * Get credit details.
417
497
  *
@@ -441,6 +521,76 @@ export class Organizations {
441
521
  payload
442
522
  );
443
523
  }
524
+
525
+ /**
526
+ * Get estimation for deleting an organization.
527
+ *
528
+ * @param {string} organizationId
529
+ * @throws {AppwriteException}
530
+ * @returns {Promise<Models.EstimationDeleteOrganization>}
531
+ */
532
+ estimationDeleteOrganization(organizationId: string): Promise<Models.EstimationDeleteOrganization> {
533
+ if (typeof organizationId === 'undefined') {
534
+ throw new AppwriteException('Missing required parameter: "organizationId"');
535
+ }
536
+ const apiPath = '/organizations/{organizationId}/estimations/delete-organization'.replace('{organizationId}', organizationId);
537
+ const payload: Payload = {};
538
+ const uri = new URL(this.client.config.endpoint + apiPath);
539
+
540
+ const apiHeaders: { [header: string]: string } = {
541
+ 'content-type': 'application/json',
542
+ }
543
+
544
+ return this.client.call(
545
+ 'patch',
546
+ uri,
547
+ apiHeaders,
548
+ payload
549
+ );
550
+ }
551
+
552
+ /**
553
+ * Get estimation for updating the organization plan.
554
+ *
555
+ * @param {string} organizationId
556
+ * @param {BillingPlan} billingPlan
557
+ * @param {string[]} invites
558
+ * @param {string} couponId
559
+ * @throws {AppwriteException}
560
+ * @returns {Promise<Models.EstimationUpdatePlan>}
561
+ */
562
+ estimationUpdatePlan(organizationId: string, billingPlan: BillingPlan, invites?: string[], couponId?: string): Promise<Models.EstimationUpdatePlan> {
563
+ if (typeof organizationId === 'undefined') {
564
+ throw new AppwriteException('Missing required parameter: "organizationId"');
565
+ }
566
+ if (typeof billingPlan === 'undefined') {
567
+ throw new AppwriteException('Missing required parameter: "billingPlan"');
568
+ }
569
+ const apiPath = '/organizations/{organizationId}/estimations/update-plan'.replace('{organizationId}', organizationId);
570
+ const payload: Payload = {};
571
+ if (typeof billingPlan !== 'undefined') {
572
+ payload['billingPlan'] = billingPlan;
573
+ }
574
+ if (typeof invites !== 'undefined') {
575
+ payload['invites'] = invites;
576
+ }
577
+ if (typeof couponId !== 'undefined') {
578
+ payload['couponId'] = couponId;
579
+ }
580
+ const uri = new URL(this.client.config.endpoint + apiPath);
581
+
582
+ const apiHeaders: { [header: string]: string } = {
583
+ 'content-type': 'application/json',
584
+ }
585
+
586
+ return this.client.call(
587
+ 'patch',
588
+ uri,
589
+ apiHeaders,
590
+ payload
591
+ );
592
+ }
593
+
444
594
  /**
445
595
  * List all invoices for an organization.
446
596
  *
@@ -470,6 +620,7 @@ export class Organizations {
470
620
  payload
471
621
  );
472
622
  }
623
+
473
624
  /**
474
625
  * Get an invoice by its unique ID.
475
626
  *
@@ -499,6 +650,7 @@ export class Organizations {
499
650
  payload
500
651
  );
501
652
  }
653
+
502
654
  /**
503
655
  * Download invoice in PDF
504
656
  *
@@ -528,6 +680,7 @@ export class Organizations {
528
680
  payload
529
681
  );
530
682
  }
683
+
531
684
  /**
532
685
  * Initiate payment for failed invoice to pay live from console
533
686
  *
@@ -565,6 +718,7 @@ export class Organizations {
565
718
  payload
566
719
  );
567
720
  }
721
+
568
722
  /**
569
723
  * Validates the payment linked with the invoice and updates the invoice status if the payment status is changed.
570
724
  *
@@ -595,6 +749,7 @@ export class Organizations {
595
749
  payload
596
750
  );
597
751
  }
752
+
598
753
  /**
599
754
  * View invoice in PDF
600
755
  *
@@ -624,6 +779,7 @@ export class Organizations {
624
779
  payload
625
780
  );
626
781
  }
782
+
627
783
  /**
628
784
  * Set a organization&#039;s default payment method.
629
785
  *
@@ -632,7 +788,7 @@ export class Organizations {
632
788
  * @throws {AppwriteException}
633
789
  * @returns {Promise<Models.Organization<Preferences>>}
634
790
  */
635
- 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>> {
636
792
  if (typeof organizationId === 'undefined') {
637
793
  throw new AppwriteException('Missing required parameter: "organizationId"');
638
794
  }
@@ -657,6 +813,7 @@ export class Organizations {
657
813
  payload
658
814
  );
659
815
  }
816
+
660
817
  /**
661
818
  * Delete the default payment method for an organization.
662
819
  *
@@ -664,7 +821,7 @@ export class Organizations {
664
821
  * @throws {AppwriteException}
665
822
  * @returns {Promise<Models.Organization<Preferences>>}
666
823
  */
667
- 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>> {
668
825
  if (typeof organizationId === 'undefined') {
669
826
  throw new AppwriteException('Missing required parameter: "organizationId"');
670
827
  }
@@ -683,16 +840,17 @@ export class Organizations {
683
840
  payload
684
841
  );
685
842
  }
843
+
686
844
  /**
687
845
  * Set an organization&#039;s backup payment method.
688
-
846
+ *
689
847
  *
690
848
  * @param {string} organizationId
691
849
  * @param {string} paymentMethodId
692
850
  * @throws {AppwriteException}
693
851
  * @returns {Promise<Models.Organization<Preferences>>}
694
852
  */
695
- 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>> {
696
854
  if (typeof organizationId === 'undefined') {
697
855
  throw new AppwriteException('Missing required parameter: "organizationId"');
698
856
  }
@@ -717,6 +875,7 @@ export class Organizations {
717
875
  payload
718
876
  );
719
877
  }
878
+
720
879
  /**
721
880
  * Delete a backup payment method for an organization.
722
881
  *
@@ -724,7 +883,7 @@ export class Organizations {
724
883
  * @throws {AppwriteException}
725
884
  * @returns {Promise<Models.Organization<Preferences>>}
726
885
  */
727
- 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>> {
728
887
  if (typeof organizationId === 'undefined') {
729
888
  throw new AppwriteException('Missing required parameter: "organizationId"');
730
889
  }
@@ -743,6 +902,7 @@ export class Organizations {
743
902
  payload
744
903
  );
745
904
  }
905
+
746
906
  /**
747
907
  * Get an organization&#039;s payment method using it&#039;s payment method ID.
748
908
  *
@@ -772,6 +932,7 @@ export class Organizations {
772
932
  payload
773
933
  );
774
934
  }
935
+
775
936
  /**
776
937
  * Get the details of the current billing plan for an organization.
777
938
  *
@@ -797,6 +958,7 @@ export class Organizations {
797
958
  payload
798
959
  );
799
960
  }
961
+
800
962
  /**
801
963
  * Update the billing plan for an organization.
802
964
  *
@@ -811,7 +973,7 @@ export class Organizations {
811
973
  * @throws {AppwriteException}
812
974
  * @returns {Promise<Models.Organization<Preferences>>}
813
975
  */
814
- 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>> {
815
977
  if (typeof organizationId === 'undefined') {
816
978
  throw new AppwriteException('Missing required parameter: "organizationId"');
817
979
  }
@@ -854,6 +1016,65 @@ export class Organizations {
854
1016
  payload
855
1017
  );
856
1018
  }
1019
+
1020
+ /**
1021
+ * Cancel the downgrade initiated for an organization.
1022
+ *
1023
+ * @param {string} organizationId
1024
+ * @throws {AppwriteException}
1025
+ * @returns {Promise<Models.Organization<Preferences>>}
1026
+ */
1027
+ cancelDowngrade<Preferences extends Models.Preferences = Models.DefaultPreferences>(organizationId: string): Promise<Models.Organization<Preferences>> {
1028
+ if (typeof organizationId === 'undefined') {
1029
+ throw new AppwriteException('Missing required parameter: "organizationId"');
1030
+ }
1031
+ const apiPath = '/organizations/{organizationId}/plan/cancel'.replace('{organizationId}', organizationId);
1032
+ const payload: Payload = {};
1033
+ const uri = new URL(this.client.config.endpoint + apiPath);
1034
+
1035
+ const apiHeaders: { [header: string]: string } = {
1036
+ 'content-type': 'application/json',
1037
+ }
1038
+
1039
+ return this.client.call(
1040
+ 'patch',
1041
+ uri,
1042
+ apiHeaders,
1043
+ payload
1044
+ );
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
+
857
1078
  /**
858
1079
  * Get Scopes
859
1080
  *
@@ -879,6 +1100,7 @@ export class Organizations {
879
1100
  payload
880
1101
  );
881
1102
  }
1103
+
882
1104
  /**
883
1105
  * Set an organization&#039;s billing tax ID.
884
1106
  *
@@ -887,7 +1109,7 @@ export class Organizations {
887
1109
  * @throws {AppwriteException}
888
1110
  * @returns {Promise<Models.Organization<Preferences>>}
889
1111
  */
890
- 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>> {
891
1113
  if (typeof organizationId === 'undefined') {
892
1114
  throw new AppwriteException('Missing required parameter: "organizationId"');
893
1115
  }
@@ -912,4 +1134,69 @@ export class Organizations {
912
1134
  payload
913
1135
  );
914
1136
  }
1137
+
1138
+ /**
1139
+ * Get the usage data for an organization.
1140
+ *
1141
+ * @param {string} organizationId
1142
+ * @param {string} startDate
1143
+ * @param {string} endDate
1144
+ * @throws {AppwriteException}
1145
+ * @returns {Promise<Models.UsageOrganization>}
1146
+ */
1147
+ getUsage(organizationId: string, startDate?: string, endDate?: string): Promise<Models.UsageOrganization> {
1148
+ if (typeof organizationId === 'undefined') {
1149
+ throw new AppwriteException('Missing required parameter: "organizationId"');
1150
+ }
1151
+ const apiPath = '/organizations/{organizationId}/usage'.replace('{organizationId}', organizationId);
1152
+ const payload: Payload = {};
1153
+ if (typeof startDate !== 'undefined') {
1154
+ payload['startDate'] = startDate;
1155
+ }
1156
+ if (typeof endDate !== 'undefined') {
1157
+ payload['endDate'] = endDate;
1158
+ }
1159
+ const uri = new URL(this.client.config.endpoint + apiPath);
1160
+
1161
+ const apiHeaders: { [header: string]: string } = {
1162
+ }
1163
+
1164
+ return this.client.call(
1165
+ 'get',
1166
+ uri,
1167
+ apiHeaders,
1168
+ payload
1169
+ );
1170
+ }
1171
+
1172
+ /**
1173
+ * Validate payment for team after creation or upgrade.
1174
+ *
1175
+ * @param {string} organizationId
1176
+ * @param {string[]} invites
1177
+ * @throws {AppwriteException}
1178
+ * @returns {Promise<Models.Organization<Preferences>>}
1179
+ */
1180
+ validatePayment<Preferences extends Models.Preferences = Models.DefaultPreferences>(organizationId: string, invites?: string[]): Promise<Models.Organization<Preferences>> {
1181
+ if (typeof organizationId === 'undefined') {
1182
+ throw new AppwriteException('Missing required parameter: "organizationId"');
1183
+ }
1184
+ const apiPath = '/organizations/{organizationId}/validate'.replace('{organizationId}', organizationId);
1185
+ const payload: Payload = {};
1186
+ if (typeof invites !== 'undefined') {
1187
+ payload['invites'] = invites;
1188
+ }
1189
+ const uri = new URL(this.client.config.endpoint + apiPath);
1190
+
1191
+ const apiHeaders: { [header: string]: string } = {
1192
+ 'content-type': 'application/json',
1193
+ }
1194
+
1195
+ return this.client.call(
1196
+ 'patch',
1197
+ uri,
1198
+ apiHeaders,
1199
+ payload
1200
+ );
1201
+ }
915
1202
  }
@@ -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
  *