@appwrite.io/console 1.0.0 → 1.1.0-rc.1

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 (116) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/sdk.js +4844 -3627
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +4843 -3628
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/dist/iife/sdk.js +4844 -3627
  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 +5 -20
  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 +412 -20
  75. package/src/services/assistant.ts +2 -0
  76. package/src/services/avatars.ts +36 -0
  77. package/src/services/backups.ts +425 -0
  78. package/src/services/console.ts +122 -0
  79. package/src/services/databases.ts +49 -0
  80. package/src/services/functions.ts +41 -189
  81. package/src/services/graphql.ts +3 -0
  82. package/src/services/health.ts +24 -0
  83. package/src/services/locale.ts +9 -0
  84. package/src/services/messaging.ts +47 -0
  85. package/src/services/migrations.ts +17 -0
  86. package/src/services/organizations.ts +896 -0
  87. package/src/services/project.ts +7 -0
  88. package/src/services/projects.ts +42 -105
  89. package/src/services/proxy.ts +6 -0
  90. package/src/services/storage.ts +28 -0
  91. package/src/services/teams.ts +15 -0
  92. package/src/services/users.ts +43 -36
  93. package/src/services/vcs.ts +9 -34
  94. package/types/client.d.ts +0 -1
  95. package/types/enums/billing-plan.d.ts +5 -0
  96. package/types/enums/email-template-type.d.ts +1 -3
  97. package/types/enums/platform-type.d.ts +1 -3
  98. package/types/enums/runtime.d.ts +1 -2
  99. package/types/index.d.ts +4 -1
  100. package/types/models.d.ts +956 -282
  101. package/types/services/account.d.ts +105 -1
  102. package/types/services/backups.d.ts +128 -0
  103. package/types/services/console.d.ts +38 -0
  104. package/types/services/functions.d.ts +8 -67
  105. package/types/services/organizations.d.ts +273 -0
  106. package/types/services/projects.d.ts +1 -32
  107. package/types/services/users.d.ts +0 -12
  108. package/types/services/vcs.d.ts +0 -11
  109. package/docs/examples/functions/delete-execution.md +0 -14
  110. package/docs/examples/functions/list-templates.md +0 -16
  111. package/docs/examples/functions/update-deployment-build.md +0 -14
  112. package/docs/examples/projects/create-j-w-t.md +0 -15
  113. package/docs/examples/projects/update-mock-numbers.md +0 -14
  114. package/docs/examples/projects/update-session-alerts.md +0 -14
  115. package/docs/examples/users/create-j-w-t.md +0 -15
  116. package/docs/examples/vcs/get-repository-contents.md +0 -15
@@ -1,3 +1,4 @@
1
+ import { Service } from '../service';
1
2
  import { AppwriteException, Client, type Payload, UploadProgress } from '../client';
2
3
  import type { Models } from '../models';
3
4
  import { AuthenticatorType } from '../enums/authenticator-type';
@@ -28,6 +29,7 @@ export class Account {
28
29
  'content-type': 'application/json',
29
30
  }
30
31
 
32
+
31
33
  return await this.client.call(
32
34
  'get',
33
35
  uri,
@@ -77,6 +79,7 @@ export class Account {
77
79
  'content-type': 'application/json',
78
80
  }
79
81
 
82
+
80
83
  return await this.client.call(
81
84
  'post',
82
85
  uri,
@@ -101,6 +104,7 @@ export class Account {
101
104
  'content-type': 'application/json',
102
105
  }
103
106
 
107
+
104
108
  return await this.client.call(
105
109
  'delete',
106
110
  uri,
@@ -108,6 +112,62 @@ export class Account {
108
112
  payload
109
113
  );
110
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
+ }
111
171
  /**
112
172
  * Update email
113
173
  *
@@ -141,6 +201,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
141
201
  'content-type': 'application/json',
142
202
  }
143
203
 
204
+
144
205
  return await this.client.call(
145
206
  'patch',
146
207
  uri,
@@ -169,6 +230,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
169
230
  'content-type': 'application/json',
170
231
  }
171
232
 
233
+
172
234
  return await this.client.call(
173
235
  'get',
174
236
  uri,
@@ -197,6 +259,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
197
259
  'content-type': 'application/json',
198
260
  }
199
261
 
262
+
200
263
  return await this.client.call(
201
264
  'delete',
202
265
  uri,
@@ -204,6 +267,34 @@ This endpoint can also be used to convert an anonymous account to a normal one,
204
267
  payload
205
268
  );
206
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
+ }
207
298
  /**
208
299
  * Create JWT
209
300
  *
@@ -213,7 +304,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
213
304
  * @returns {Promise<Models.Jwt>}
214
305
  */
215
306
  async createJWT(): Promise<Models.Jwt> {
216
- const apiPath = '/account/jwts';
307
+ const apiPath = '/account/jwt';
217
308
  const payload: Payload = {};
218
309
  const uri = new URL(this.client.config.endpoint + apiPath);
219
310
 
@@ -221,6 +312,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
221
312
  'content-type': 'application/json',
222
313
  }
223
314
 
315
+
224
316
  return await this.client.call(
225
317
  'post',
226
318
  uri,
@@ -249,6 +341,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
249
341
  'content-type': 'application/json',
250
342
  }
251
343
 
344
+
252
345
  return await this.client.call(
253
346
  'get',
254
347
  uri,
@@ -280,6 +373,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
280
373
  'content-type': 'application/json',
281
374
  }
282
375
 
376
+
283
377
  return await this.client.call(
284
378
  'patch',
285
379
  uri,
@@ -308,6 +402,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
308
402
  'content-type': 'application/json',
309
403
  }
310
404
 
405
+
311
406
  return await this.client.call(
312
407
  'post',
313
408
  uri,
@@ -343,6 +438,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
343
438
  'content-type': 'application/json',
344
439
  }
345
440
 
441
+
346
442
  return await this.client.call(
347
443
  'put',
348
444
  uri,
@@ -356,21 +452,29 @@ This endpoint can also be used to convert an anonymous account to a normal one,
356
452
  * Delete an authenticator for a user by ID.
357
453
  *
358
454
  * @param {AuthenticatorType} type
455
+ * @param {string} otp
359
456
  * @throws {AppwriteException}
360
457
  * @returns {Promise<{}>}
361
458
  */
362
- async deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}> {
459
+ async deleteMfaAuthenticator(type: AuthenticatorType, otp: string): Promise<{}> {
363
460
  if (typeof type === 'undefined') {
364
461
  throw new AppwriteException('Missing required parameter: "type"');
365
462
  }
463
+ if (typeof otp === 'undefined') {
464
+ throw new AppwriteException('Missing required parameter: "otp"');
465
+ }
366
466
  const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
367
467
  const payload: Payload = {};
468
+ if (typeof otp !== 'undefined') {
469
+ payload['otp'] = otp;
470
+ }
368
471
  const uri = new URL(this.client.config.endpoint + apiPath);
369
472
 
370
473
  const apiHeaders: { [header: string]: string } = {
371
474
  'content-type': 'application/json',
372
475
  }
373
476
 
477
+
374
478
  return await this.client.call(
375
479
  'delete',
376
480
  uri,
@@ -402,6 +506,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
402
506
  'content-type': 'application/json',
403
507
  }
404
508
 
509
+
405
510
  return await this.client.call(
406
511
  'post',
407
512
  uri,
@@ -440,6 +545,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
440
545
  'content-type': 'application/json',
441
546
  }
442
547
 
548
+
443
549
  return await this.client.call(
444
550
  'put',
445
551
  uri,
@@ -464,6 +570,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
464
570
  'content-type': 'application/json',
465
571
  }
466
572
 
573
+
467
574
  return await this.client.call(
468
575
  'get',
469
576
  uri,
@@ -488,6 +595,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
488
595
  'content-type': 'application/json',
489
596
  }
490
597
 
598
+
491
599
  return await this.client.call(
492
600
  'get',
493
601
  uri,
@@ -512,6 +620,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
512
620
  'content-type': 'application/json',
513
621
  }
514
622
 
623
+
515
624
  return await this.client.call(
516
625
  'post',
517
626
  uri,
@@ -536,6 +645,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
536
645
  'content-type': 'application/json',
537
646
  }
538
647
 
648
+
539
649
  return await this.client.call(
540
650
  'patch',
541
651
  uri,
@@ -567,6 +677,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
567
677
  'content-type': 'application/json',
568
678
  }
569
679
 
680
+
570
681
  return await this.client.call(
571
682
  'patch',
572
683
  uri,
@@ -602,6 +713,227 @@ This endpoint can also be used to convert an anonymous account to a normal one,
602
713
  'content-type': 'application/json',
603
714
  }
604
715
 
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
+
605
937
  return await this.client.call(
606
938
  'patch',
607
939
  uri,
@@ -640,6 +972,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
640
972
  'content-type': 'application/json',
641
973
  }
642
974
 
975
+
643
976
  return await this.client.call(
644
977
  'patch',
645
978
  uri,
@@ -664,6 +997,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
664
997
  'content-type': 'application/json',
665
998
  }
666
999
 
1000
+
667
1001
  return await this.client.call(
668
1002
  'get',
669
1003
  uri,
@@ -695,6 +1029,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
695
1029
  'content-type': 'application/json',
696
1030
  }
697
1031
 
1032
+
698
1033
  return await this.client.call(
699
1034
  'patch',
700
1035
  uri,
@@ -733,6 +1068,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
733
1068
  'content-type': 'application/json',
734
1069
  }
735
1070
 
1071
+
736
1072
  return await this.client.call(
737
1073
  'post',
738
1074
  uri,
@@ -780,6 +1116,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
780
1116
  'content-type': 'application/json',
781
1117
  }
782
1118
 
1119
+
783
1120
  return await this.client.call(
784
1121
  'put',
785
1122
  uri,
@@ -804,6 +1141,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
804
1141
  'content-type': 'application/json',
805
1142
  }
806
1143
 
1144
+
807
1145
  return await this.client.call(
808
1146
  'get',
809
1147
  uri,
@@ -828,6 +1166,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
828
1166
  'content-type': 'application/json',
829
1167
  }
830
1168
 
1169
+
831
1170
  return await this.client.call(
832
1171
  'delete',
833
1172
  uri,
@@ -852,6 +1191,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
852
1191
  'content-type': 'application/json',
853
1192
  }
854
1193
 
1194
+
855
1195
  return await this.client.call(
856
1196
  'post',
857
1197
  uri,
@@ -892,6 +1232,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
892
1232
  'content-type': 'application/json',
893
1233
  }
894
1234
 
1235
+
895
1236
  return await this.client.call(
896
1237
  'post',
897
1238
  uri,
@@ -930,6 +1271,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
930
1271
  'content-type': 'application/json',
931
1272
  }
932
1273
 
1274
+
933
1275
  return await this.client.call(
934
1276
  'put',
935
1277
  uri,
@@ -975,16 +1317,17 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
975
1317
  'content-type': 'application/json',
976
1318
  }
977
1319
 
978
- const location = await this.client.redirect(
979
- 'get',
980
- uri,
981
- apiHeaders,
982
- payload
983
- );
984
- if (typeof window !== 'undefined') {
985
- window.location.href = location;
1320
+ payload['project'] = this.client.config.project;
1321
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
1322
+ uri.searchParams.append(key, value);
1323
+ }
1324
+
1325
+ if (typeof window !== 'undefined' && window?.location) {
1326
+ window.location.href = uri.toString();
1327
+ return;
1328
+ } else {
1329
+ return uri.toString();
986
1330
  }
987
- return location.toString();
988
1331
  }
989
1332
  /**
990
1333
  * Update phone session
@@ -1017,6 +1360,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1017
1360
  'content-type': 'application/json',
1018
1361
  }
1019
1362
 
1363
+
1020
1364
  return await this.client.call(
1021
1365
  'put',
1022
1366
  uri,
@@ -1055,6 +1399,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1055
1399
  'content-type': 'application/json',
1056
1400
  }
1057
1401
 
1402
+
1058
1403
  return await this.client.call(
1059
1404
  'post',
1060
1405
  uri,
@@ -1083,6 +1428,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1083
1428
  'content-type': 'application/json',
1084
1429
  }
1085
1430
 
1431
+
1086
1432
  return await this.client.call(
1087
1433
  'get',
1088
1434
  uri,
@@ -1111,6 +1457,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1111
1457
  'content-type': 'application/json',
1112
1458
  }
1113
1459
 
1460
+
1114
1461
  return await this.client.call(
1115
1462
  'patch',
1116
1463
  uri,
@@ -1139,6 +1486,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1139
1486
  'content-type': 'application/json',
1140
1487
  }
1141
1488
 
1489
+
1142
1490
  return await this.client.call(
1143
1491
  'delete',
1144
1492
  uri,
@@ -1163,6 +1511,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1163
1511
  'content-type': 'application/json',
1164
1512
  }
1165
1513
 
1514
+
1166
1515
  return await this.client.call(
1167
1516
  'patch',
1168
1517
  uri,
@@ -1204,6 +1553,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1204
1553
  'content-type': 'application/json',
1205
1554
  }
1206
1555
 
1556
+
1207
1557
  return await this.client.call(
1208
1558
  'post',
1209
1559
  uri,
@@ -1238,6 +1588,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1238
1588
  'content-type': 'application/json',
1239
1589
  }
1240
1590
 
1591
+
1241
1592
  return await this.client.call(
1242
1593
  'put',
1243
1594
  uri,
@@ -1265,6 +1616,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1265
1616
  'content-type': 'application/json',
1266
1617
  }
1267
1618
 
1619
+
1268
1620
  return await this.client.call(
1269
1621
  'delete',
1270
1622
  uri,
@@ -1309,6 +1661,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1309
1661
  'content-type': 'application/json',
1310
1662
  }
1311
1663
 
1664
+
1312
1665
  return await this.client.call(
1313
1666
  'post',
1314
1667
  uri,
@@ -1358,6 +1711,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1358
1711
  'content-type': 'application/json',
1359
1712
  }
1360
1713
 
1714
+
1361
1715
  return await this.client.call(
1362
1716
  'post',
1363
1717
  uri,
@@ -1402,16 +1756,17 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1402
1756
  'content-type': 'application/json',
1403
1757
  }
1404
1758
 
1405
- const location = await this.client.redirect(
1406
- 'get',
1407
- uri,
1408
- apiHeaders,
1409
- payload
1410
- );
1411
- if (typeof window !== 'undefined') {
1412
- window.location.href = location;
1759
+ payload['project'] = this.client.config.project;
1760
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
1761
+ uri.searchParams.append(key, value);
1762
+ }
1763
+
1764
+ if (typeof window !== 'undefined' && window?.location) {
1765
+ window.location.href = uri.toString();
1766
+ return;
1767
+ } else {
1768
+ return uri.toString();
1413
1769
  }
1414
- return location.toString();
1415
1770
  }
1416
1771
  /**
1417
1772
  * Create phone token
@@ -1446,6 +1801,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
1446
1801
  'content-type': 'application/json',
1447
1802
  }
1448
1803
 
1804
+
1449
1805
  return await this.client.call(
1450
1806
  'post',
1451
1807
  uri,
@@ -1480,6 +1836,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
1480
1836
  'content-type': 'application/json',
1481
1837
  }
1482
1838
 
1839
+
1483
1840
  return await this.client.call(
1484
1841
  'post',
1485
1842
  uri,
@@ -1518,6 +1875,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
1518
1875
  'content-type': 'application/json',
1519
1876
  }
1520
1877
 
1878
+
1521
1879
  return await this.client.call(
1522
1880
  'put',
1523
1881
  uri,
@@ -1542,6 +1900,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
1542
1900
  'content-type': 'application/json',
1543
1901
  }
1544
1902
 
1903
+
1545
1904
  return await this.client.call(
1546
1905
  'post',
1547
1906
  uri,
@@ -1580,6 +1939,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
1580
1939
  'content-type': 'application/json',
1581
1940
  }
1582
1941
 
1942
+
1583
1943
  return await this.client.call(
1584
1944
  'put',
1585
1945
  uri,
@@ -1587,4 +1947,36 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
1587
1947
  payload
1588
1948
  );
1589
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
+ }
1590
1982
  }