@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
@@ -112,6 +112,62 @@ export class Account {
112
112
  payload
113
113
  );
114
114
  }
115
+ /**
116
+ * List billing addresses
117
+ *
118
+ *
119
+ * @param {string[]} queries
120
+ * @throws {AppwriteException}
121
+ * @returns {Promise<Models.BillingAddress>}
122
+ */
123
+ async listBillingAddresses(queries?: string[]): Promise<Models.BillingAddress> {
124
+ const apiPath = '/account/billing-addresses';
125
+ const payload: Payload = {};
126
+ if (typeof queries !== 'undefined') {
127
+ payload['queries'] = queries;
128
+ }
129
+ const uri = new URL(this.client.config.endpoint + apiPath);
130
+
131
+ const apiHeaders: { [header: string]: string } = {
132
+ 'content-type': 'application/json',
133
+ }
134
+
135
+
136
+ return await this.client.call(
137
+ 'get',
138
+ uri,
139
+ apiHeaders,
140
+ payload
141
+ );
142
+ }
143
+ /**
144
+ * Get billing address
145
+ *
146
+ *
147
+ * @param {string} billingAddressId
148
+ * @throws {AppwriteException}
149
+ * @returns {Promise<Models.BillingAddress>}
150
+ */
151
+ async getBillingAddress(billingAddressId: string): Promise<Models.BillingAddress> {
152
+ if (typeof billingAddressId === 'undefined') {
153
+ throw new AppwriteException('Missing required parameter: "billingAddressId"');
154
+ }
155
+ const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
156
+ const payload: Payload = {};
157
+ const uri = new URL(this.client.config.endpoint + apiPath);
158
+
159
+ const apiHeaders: { [header: string]: string } = {
160
+ 'content-type': 'application/json',
161
+ }
162
+
163
+
164
+ return await this.client.call(
165
+ 'get',
166
+ uri,
167
+ apiHeaders,
168
+ payload
169
+ );
170
+ }
115
171
  /**
116
172
  * Update email
117
173
  *
@@ -211,6 +267,34 @@ This endpoint can also be used to convert an anonymous account to a normal one,
211
267
  payload
212
268
  );
213
269
  }
270
+ /**
271
+ * List invoices
272
+ *
273
+ *
274
+ * @param {string[]} queries
275
+ * @throws {AppwriteException}
276
+ * @returns {Promise<Models.InvoiceList>}
277
+ */
278
+ async listInvoices(queries?: string[]): Promise<Models.InvoiceList> {
279
+ const apiPath = '/account/invoices';
280
+ const payload: Payload = {};
281
+ if (typeof queries !== 'undefined') {
282
+ payload['queries'] = queries;
283
+ }
284
+ const uri = new URL(this.client.config.endpoint + apiPath);
285
+
286
+ const apiHeaders: { [header: string]: string } = {
287
+ 'content-type': 'application/json',
288
+ }
289
+
290
+
291
+ return await this.client.call(
292
+ 'get',
293
+ uri,
294
+ apiHeaders,
295
+ payload
296
+ );
297
+ }
214
298
  /**
215
299
  * Create JWT
216
300
  *
@@ -220,7 +304,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
220
304
  * @returns {Promise<Models.Jwt>}
221
305
  */
222
306
  async createJWT(): Promise<Models.Jwt> {
223
- const apiPath = '/account/jwts';
307
+ const apiPath = '/account/jwt';
224
308
  const payload: Payload = {};
225
309
  const uri = new URL(this.client.config.endpoint + apiPath);
226
310
 
@@ -368,15 +452,22 @@ This endpoint can also be used to convert an anonymous account to a normal one,
368
452
  * Delete an authenticator for a user by ID.
369
453
  *
370
454
  * @param {AuthenticatorType} type
455
+ * @param {string} otp
371
456
  * @throws {AppwriteException}
372
457
  * @returns {Promise<{}>}
373
458
  */
374
- async deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}> {
459
+ async deleteMfaAuthenticator(type: AuthenticatorType, otp: string): Promise<{}> {
375
460
  if (typeof type === 'undefined') {
376
461
  throw new AppwriteException('Missing required parameter: "type"');
377
462
  }
463
+ if (typeof otp === 'undefined') {
464
+ throw new AppwriteException('Missing required parameter: "otp"');
465
+ }
378
466
  const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
379
467
  const payload: Payload = {};
468
+ if (typeof otp !== 'undefined') {
469
+ payload['otp'] = otp;
470
+ }
380
471
  const uri = new URL(this.client.config.endpoint + apiPath);
381
472
 
382
473
  const apiHeaders: { [header: string]: string } = {
@@ -623,6 +714,226 @@ This endpoint can also be used to convert an anonymous account to a normal one,
623
714
  }
624
715
 
625
716
 
717
+ return await this.client.call(
718
+ 'patch',
719
+ uri,
720
+ apiHeaders,
721
+ payload
722
+ );
723
+ }
724
+ /**
725
+ * List payment methods
726
+ *
727
+ *
728
+ * @param {string[]} queries
729
+ * @throws {AppwriteException}
730
+ * @returns {Promise<Models.PaymentMethodList>}
731
+ */
732
+ async listPaymentMethods(queries?: string[]): Promise<Models.PaymentMethodList> {
733
+ const apiPath = '/account/payment-methods';
734
+ const payload: Payload = {};
735
+ if (typeof queries !== 'undefined') {
736
+ payload['queries'] = queries;
737
+ }
738
+ const uri = new URL(this.client.config.endpoint + apiPath);
739
+
740
+ const apiHeaders: { [header: string]: string } = {
741
+ 'content-type': 'application/json',
742
+ }
743
+
744
+
745
+ return await this.client.call(
746
+ 'get',
747
+ uri,
748
+ apiHeaders,
749
+ payload
750
+ );
751
+ }
752
+ /**
753
+ * Create new payment method
754
+ *
755
+ *
756
+ * @throws {AppwriteException}
757
+ * @returns {Promise<Models.PaymentMethod>}
758
+ */
759
+ async createPaymentMethod(): Promise<Models.PaymentMethod> {
760
+ const apiPath = '/account/payment-methods';
761
+ const payload: Payload = {};
762
+ const uri = new URL(this.client.config.endpoint + apiPath);
763
+
764
+ const apiHeaders: { [header: string]: string } = {
765
+ 'content-type': 'application/json',
766
+ }
767
+
768
+
769
+ return await this.client.call(
770
+ 'post',
771
+ uri,
772
+ apiHeaders,
773
+ payload
774
+ );
775
+ }
776
+ /**
777
+ * Get payment method
778
+ *
779
+ *
780
+ * @param {string} paymentMethodId
781
+ * @throws {AppwriteException}
782
+ * @returns {Promise<Models.PaymentMethod>}
783
+ */
784
+ async getPaymentMethod(paymentMethodId: string): Promise<Models.PaymentMethod> {
785
+ if (typeof paymentMethodId === 'undefined') {
786
+ throw new AppwriteException('Missing required parameter: "paymentMethodId"');
787
+ }
788
+ const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId);
789
+ const payload: Payload = {};
790
+ const uri = new URL(this.client.config.endpoint + apiPath);
791
+
792
+ const apiHeaders: { [header: string]: string } = {
793
+ 'content-type': 'application/json',
794
+ }
795
+
796
+
797
+ return await this.client.call(
798
+ 'get',
799
+ uri,
800
+ apiHeaders,
801
+ payload
802
+ );
803
+ }
804
+ /**
805
+ * Update payment method
806
+ *
807
+ *
808
+ * @param {string} paymentMethodId
809
+ * @param {number} expiryMonth
810
+ * @param {number} expiryYear
811
+ * @throws {AppwriteException}
812
+ * @returns {Promise<Models.PaymentMethod>}
813
+ */
814
+ async updatePaymentMethod(paymentMethodId: string, expiryMonth: number, expiryYear: number): Promise<Models.PaymentMethod> {
815
+ if (typeof paymentMethodId === 'undefined') {
816
+ throw new AppwriteException('Missing required parameter: "paymentMethodId"');
817
+ }
818
+ if (typeof expiryMonth === 'undefined') {
819
+ throw new AppwriteException('Missing required parameter: "expiryMonth"');
820
+ }
821
+ if (typeof expiryYear === 'undefined') {
822
+ throw new AppwriteException('Missing required parameter: "expiryYear"');
823
+ }
824
+ const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId);
825
+ const payload: Payload = {};
826
+ if (typeof expiryMonth !== 'undefined') {
827
+ payload['expiryMonth'] = expiryMonth;
828
+ }
829
+ if (typeof expiryYear !== 'undefined') {
830
+ payload['expiryYear'] = expiryYear;
831
+ }
832
+ const uri = new URL(this.client.config.endpoint + apiPath);
833
+
834
+ const apiHeaders: { [header: string]: string } = {
835
+ 'content-type': 'application/json',
836
+ }
837
+
838
+
839
+ return await this.client.call(
840
+ 'patch',
841
+ uri,
842
+ apiHeaders,
843
+ payload
844
+ );
845
+ }
846
+ /**
847
+ * Delete payment method
848
+ *
849
+ *
850
+ * @param {string} paymentMethodId
851
+ * @throws {AppwriteException}
852
+ * @returns {Promise<{}>}
853
+ */
854
+ async deletePaymentMethod(paymentMethodId: string): Promise<{}> {
855
+ if (typeof paymentMethodId === 'undefined') {
856
+ throw new AppwriteException('Missing required parameter: "paymentMethodId"');
857
+ }
858
+ const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId);
859
+ const payload: Payload = {};
860
+ const uri = new URL(this.client.config.endpoint + apiPath);
861
+
862
+ const apiHeaders: { [header: string]: string } = {
863
+ 'content-type': 'application/json',
864
+ }
865
+
866
+
867
+ return await this.client.call(
868
+ 'delete',
869
+ uri,
870
+ apiHeaders,
871
+ payload
872
+ );
873
+ }
874
+ /**
875
+ * Update payment method provider id
876
+ *
877
+ *
878
+ * @param {string} paymentMethodId
879
+ * @param {string} providerMethodId
880
+ * @param {string} name
881
+ * @throws {AppwriteException}
882
+ * @returns {Promise<Models.PaymentMethod>}
883
+ */
884
+ async updatePaymentMethodProvider(paymentMethodId: string, providerMethodId: string, name: string): Promise<Models.PaymentMethod> {
885
+ if (typeof paymentMethodId === 'undefined') {
886
+ throw new AppwriteException('Missing required parameter: "paymentMethodId"');
887
+ }
888
+ if (typeof providerMethodId === 'undefined') {
889
+ throw new AppwriteException('Missing required parameter: "providerMethodId"');
890
+ }
891
+ if (typeof name === 'undefined') {
892
+ throw new AppwriteException('Missing required parameter: "name"');
893
+ }
894
+ const apiPath = '/account/payment-methods/{paymentMethodId}/provider'.replace('{paymentMethodId}', paymentMethodId);
895
+ const payload: Payload = {};
896
+ if (typeof providerMethodId !== 'undefined') {
897
+ payload['providerMethodId'] = providerMethodId;
898
+ }
899
+ if (typeof name !== 'undefined') {
900
+ payload['name'] = name;
901
+ }
902
+ const uri = new URL(this.client.config.endpoint + apiPath);
903
+
904
+ const apiHeaders: { [header: string]: string } = {
905
+ 'content-type': 'application/json',
906
+ }
907
+
908
+
909
+ return await this.client.call(
910
+ 'patch',
911
+ uri,
912
+ apiHeaders,
913
+ payload
914
+ );
915
+ }
916
+ /**
917
+ * Update payment method with new setup with mandates for indian cards
918
+ *
919
+ *
920
+ * @param {string} paymentMethodId
921
+ * @throws {AppwriteException}
922
+ * @returns {Promise<Models.PaymentMethod>}
923
+ */
924
+ async updatePaymentMethodMandateOptions(paymentMethodId: string): Promise<Models.PaymentMethod> {
925
+ if (typeof paymentMethodId === 'undefined') {
926
+ throw new AppwriteException('Missing required parameter: "paymentMethodId"');
927
+ }
928
+ const apiPath = '/account/payment-methods/{paymentMethodId}/setup'.replace('{paymentMethodId}', paymentMethodId);
929
+ const payload: Payload = {};
930
+ const uri = new URL(this.client.config.endpoint + apiPath);
931
+
932
+ const apiHeaders: { [header: string]: string } = {
933
+ 'content-type': 'application/json',
934
+ }
935
+
936
+
626
937
  return await this.client.call(
627
938
  'patch',
628
939
  uri,
@@ -1636,4 +1947,36 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
1636
1947
  payload
1637
1948
  );
1638
1949
  }
1950
+ /**
1951
+ * List credits
1952
+ *
1953
+ *
1954
+ * @param {string} organizationId
1955
+ * @param {string[]} queries
1956
+ * @throws {AppwriteException}
1957
+ * @returns {Promise<Models.CreditList>}
1958
+ */
1959
+ async listCredits(organizationId: string, queries?: string[]): Promise<Models.CreditList> {
1960
+ if (typeof organizationId === 'undefined') {
1961
+ throw new AppwriteException('Missing required parameter: "organizationId"');
1962
+ }
1963
+ const apiPath = '/organizations/{organizationId}/credits'.replace('{organizationId}', organizationId);
1964
+ const payload: Payload = {};
1965
+ if (typeof queries !== 'undefined') {
1966
+ payload['queries'] = queries;
1967
+ }
1968
+ const uri = new URL(this.client.config.endpoint + apiPath);
1969
+
1970
+ const apiHeaders: { [header: string]: string } = {
1971
+ 'content-type': 'application/json',
1972
+ }
1973
+
1974
+
1975
+ return await this.client.call(
1976
+ 'get',
1977
+ uri,
1978
+ apiHeaders,
1979
+ payload
1980
+ );
1981
+ }
1639
1982
  }