@appwrite.io/console 1.2.1 → 1.3.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 (85) hide show
  1. package/.github/workflows/autoclose.yml +1 -1
  2. package/README.md +1 -1
  3. package/dist/cjs/sdk.js +4877 -3337
  4. package/dist/cjs/sdk.js.map +1 -1
  5. package/dist/esm/sdk.js +4876 -3338
  6. package/dist/esm/sdk.js.map +1 -1
  7. package/dist/iife/sdk.js +4877 -3337
  8. package/docs/examples/account/create-payment-method.md +11 -0
  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/account/list-billing-addresses.md +13 -0
  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-campaign.md +13 -0
  33. package/docs/examples/console/get-copon.md +13 -0
  34. package/docs/examples/console/plans.md +11 -0
  35. package/docs/examples/console/regions.md +11 -0
  36. package/docs/examples/health/get-queue-billing-aggregation.md +13 -0
  37. package/docs/examples/health/get-queue-priority-builds.md +13 -0
  38. package/docs/examples/organizations/add-credit.md +14 -0
  39. package/docs/examples/organizations/create-invoice-payment.md +15 -0
  40. package/docs/examples/organizations/create.md +17 -0
  41. package/docs/examples/organizations/delete-backup-payment-method.md +13 -0
  42. package/docs/examples/organizations/delete-billing-address.md +13 -0
  43. package/docs/examples/organizations/delete-default-payment-method.md +13 -0
  44. package/docs/examples/organizations/delete.md +13 -0
  45. package/docs/examples/organizations/get-aggregation.md +14 -0
  46. package/docs/examples/organizations/get-billing-address.md +14 -0
  47. package/docs/examples/organizations/get-credit.md +14 -0
  48. package/docs/examples/organizations/get-invoice-download.md +14 -0
  49. package/docs/examples/organizations/get-invoice-view.md +14 -0
  50. package/docs/examples/organizations/get-invoice.md +14 -0
  51. package/docs/examples/organizations/get-payment-method.md +14 -0
  52. package/docs/examples/organizations/get-plan.md +13 -0
  53. package/docs/examples/organizations/get-scopes.md +13 -0
  54. package/docs/examples/organizations/get-usage.md +15 -0
  55. package/docs/examples/organizations/list-aggregations.md +14 -0
  56. package/docs/examples/organizations/list-invoices.md +14 -0
  57. package/docs/examples/organizations/list.md +14 -0
  58. package/docs/examples/organizations/set-backup-payment-method.md +14 -0
  59. package/docs/examples/organizations/set-billing-address.md +14 -0
  60. package/docs/examples/organizations/set-billing-email.md +14 -0
  61. package/docs/examples/organizations/set-billing-tax-id.md +14 -0
  62. package/docs/examples/organizations/set-default-payment-method.md +14 -0
  63. package/docs/examples/organizations/update-budget.md +15 -0
  64. package/docs/examples/organizations/update-plan.md +16 -0
  65. package/package.json +1 -1
  66. package/src/client.ts +1 -1
  67. package/src/enums/billing-plan.ts +5 -0
  68. package/src/enums/runtime.ts +2 -5
  69. package/src/index.ts +3 -0
  70. package/src/models.ts +1120 -1
  71. package/src/services/account.ts +336 -0
  72. package/src/services/backups.ts +425 -0
  73. package/src/services/console.ts +148 -0
  74. package/src/services/health.ts +56 -0
  75. package/src/services/organizations.ts +924 -0
  76. package/types/enums/billing-plan.d.ts +5 -0
  77. package/types/enums/runtime.d.ts +2 -5
  78. package/types/index.d.ts +3 -0
  79. package/types/models.d.ts +1120 -1
  80. package/types/services/account.d.ts +103 -0
  81. package/types/services/backups.d.ts +128 -0
  82. package/types/services/console.d.ts +47 -0
  83. package/types/services/health.d.ts +18 -0
  84. package/types/services/organizations.d.ts +282 -0
  85. package/.travis.yml +0 -32
@@ -0,0 +1,924 @@
1
+ import { Service } from '../service';
2
+ import { AppwriteException, Client, type Payload, UploadProgress } from '../client';
3
+ import type { Models } from '../models';
4
+ import { BillingPlan } from '../enums/billing-plan';
5
+
6
+ export class Organizations {
7
+ client: Client;
8
+
9
+ constructor(client: Client) {
10
+ this.client = client;
11
+ }
12
+
13
+ /**
14
+ * List Orgnizations
15
+ *
16
+ * Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.
17
+ *
18
+ * @param {string[]} queries
19
+ * @param {string} search
20
+ * @throws {AppwriteException}
21
+ * @returns {Promise<Models.TeamList<Preferences>>}
22
+ */
23
+ async list<Preferences extends Models.Preferences>(queries?: string[], search?: string): Promise<Models.TeamList<Preferences>> {
24
+ const apiPath = '/organizations';
25
+ const payload: Payload = {};
26
+ if (typeof queries !== 'undefined') {
27
+ payload['queries'] = queries;
28
+ }
29
+ if (typeof search !== 'undefined') {
30
+ payload['search'] = search;
31
+ }
32
+ const uri = new URL(this.client.config.endpoint + apiPath);
33
+
34
+ const apiHeaders: { [header: string]: string } = {
35
+ 'content-type': 'application/json',
36
+ }
37
+
38
+
39
+ return await this.client.call(
40
+ 'get',
41
+ uri,
42
+ apiHeaders,
43
+ payload
44
+ );
45
+ }
46
+ /**
47
+ * Create Organization
48
+ *
49
+ * Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.
50
+ *
51
+ * @param {string} organizationId
52
+ * @param {string} name
53
+ * @param {BillingPlan} billingPlan
54
+ * @param {string} paymentMethodId
55
+ * @param {string} billingAddressId
56
+ * @throws {AppwriteException}
57
+ * @returns {Promise<Models.Organization<Preferences>>}
58
+ */
59
+ async create<Preferences extends Models.Preferences>(organizationId: string, name: string, billingPlan: BillingPlan, paymentMethodId?: string, billingAddressId?: string): Promise<Models.Organization<Preferences>> {
60
+ if (typeof organizationId === 'undefined') {
61
+ throw new AppwriteException('Missing required parameter: "organizationId"');
62
+ }
63
+ if (typeof name === 'undefined') {
64
+ throw new AppwriteException('Missing required parameter: "name"');
65
+ }
66
+ if (typeof billingPlan === 'undefined') {
67
+ throw new AppwriteException('Missing required parameter: "billingPlan"');
68
+ }
69
+ const apiPath = '/organizations';
70
+ const payload: Payload = {};
71
+ if (typeof organizationId !== 'undefined') {
72
+ payload['organizationId'] = organizationId;
73
+ }
74
+ if (typeof name !== 'undefined') {
75
+ payload['name'] = name;
76
+ }
77
+ if (typeof billingPlan !== 'undefined') {
78
+ payload['billingPlan'] = billingPlan;
79
+ }
80
+ if (typeof paymentMethodId !== 'undefined') {
81
+ payload['paymentMethodId'] = paymentMethodId;
82
+ }
83
+ if (typeof billingAddressId !== 'undefined') {
84
+ payload['billingAddressId'] = billingAddressId;
85
+ }
86
+ const uri = new URL(this.client.config.endpoint + apiPath);
87
+
88
+ const apiHeaders: { [header: string]: string } = {
89
+ 'content-type': 'application/json',
90
+ }
91
+
92
+
93
+ return await this.client.call(
94
+ 'post',
95
+ uri,
96
+ apiHeaders,
97
+ payload
98
+ );
99
+ }
100
+ /**
101
+ * Delete team
102
+ *
103
+ * Delete a team using its ID. Only team members with the owner role can delete the team.
104
+ *
105
+ * @param {string} organizationId
106
+ * @throws {AppwriteException}
107
+ * @returns {Promise<{}>}
108
+ */
109
+ async delete(organizationId: string): Promise<{}> {
110
+ if (typeof organizationId === 'undefined') {
111
+ throw new AppwriteException('Missing required parameter: "organizationId"');
112
+ }
113
+ const apiPath = '/organizations/{organizationId}'.replace('{organizationId}', organizationId);
114
+ const payload: Payload = {};
115
+ const uri = new URL(this.client.config.endpoint + apiPath);
116
+
117
+ const apiHeaders: { [header: string]: string } = {
118
+ 'content-type': 'application/json',
119
+ }
120
+
121
+
122
+ return await this.client.call(
123
+ 'delete',
124
+ uri,
125
+ apiHeaders,
126
+ payload
127
+ );
128
+ }
129
+ /**
130
+ * List aggregations
131
+ *
132
+ *
133
+ * @param {string} organizationId
134
+ * @param {string[]} queries
135
+ * @throws {AppwriteException}
136
+ * @returns {Promise<Models.AggregationTeamList>}
137
+ */
138
+ async listAggregations(organizationId: string, queries?: string[]): Promise<Models.AggregationTeamList> {
139
+ if (typeof organizationId === 'undefined') {
140
+ throw new AppwriteException('Missing required parameter: "organizationId"');
141
+ }
142
+ const apiPath = '/organizations/{organizationId}/aggregations'.replace('{organizationId}', organizationId);
143
+ const payload: Payload = {};
144
+ if (typeof queries !== 'undefined') {
145
+ payload['queries'] = queries;
146
+ }
147
+ const uri = new URL(this.client.config.endpoint + apiPath);
148
+
149
+ const apiHeaders: { [header: string]: string } = {
150
+ 'content-type': 'application/json',
151
+ }
152
+
153
+
154
+ return await this.client.call(
155
+ 'get',
156
+ uri,
157
+ apiHeaders,
158
+ payload
159
+ );
160
+ }
161
+ /**
162
+ * Get invoice
163
+ *
164
+ *
165
+ * @param {string} organizationId
166
+ * @param {string} aggregationId
167
+ * @throws {AppwriteException}
168
+ * @returns {Promise<Models.Invoice>}
169
+ */
170
+ async getAggregation(organizationId: string, aggregationId: string): Promise<Models.Invoice> {
171
+ if (typeof organizationId === 'undefined') {
172
+ throw new AppwriteException('Missing required parameter: "organizationId"');
173
+ }
174
+ if (typeof aggregationId === 'undefined') {
175
+ throw new AppwriteException('Missing required parameter: "aggregationId"');
176
+ }
177
+ const apiPath = '/organizations/{organizationId}/aggregations/{aggregationId}'.replace('{organizationId}', organizationId).replace('{aggregationId}', aggregationId);
178
+ const payload: Payload = {};
179
+ const uri = new URL(this.client.config.endpoint + apiPath);
180
+
181
+ const apiHeaders: { [header: string]: string } = {
182
+ 'content-type': 'application/json',
183
+ }
184
+
185
+
186
+ return await this.client.call(
187
+ 'get',
188
+ uri,
189
+ apiHeaders,
190
+ payload
191
+ );
192
+ }
193
+ /**
194
+ * Set team&#039;s billing address
195
+ *
196
+ *
197
+ * @param {string} organizationId
198
+ * @param {string} billingAddressId
199
+ * @throws {AppwriteException}
200
+ * @returns {Promise<Models.Organization<Preferences>>}
201
+ */
202
+ async setBillingAddress<Preferences extends Models.Preferences>(organizationId: string, billingAddressId: string): Promise<Models.Organization<Preferences>> {
203
+ if (typeof organizationId === 'undefined') {
204
+ throw new AppwriteException('Missing required parameter: "organizationId"');
205
+ }
206
+ if (typeof billingAddressId === 'undefined') {
207
+ throw new AppwriteException('Missing required parameter: "billingAddressId"');
208
+ }
209
+ const apiPath = '/organizations/{organizationId}/billing-address'.replace('{organizationId}', organizationId);
210
+ const payload: Payload = {};
211
+ if (typeof billingAddressId !== 'undefined') {
212
+ payload['billingAddressId'] = billingAddressId;
213
+ }
214
+ const uri = new URL(this.client.config.endpoint + apiPath);
215
+
216
+ const apiHeaders: { [header: string]: string } = {
217
+ 'content-type': 'application/json',
218
+ }
219
+
220
+
221
+ return await this.client.call(
222
+ 'patch',
223
+ uri,
224
+ apiHeaders,
225
+ payload
226
+ );
227
+ }
228
+ /**
229
+ * Delete team&#039;s billing address
230
+ *
231
+ *
232
+ * @param {string} organizationId
233
+ * @throws {AppwriteException}
234
+ * @returns {Promise<{}>}
235
+ */
236
+ async deleteBillingAddress(organizationId: string): Promise<{}> {
237
+ if (typeof organizationId === 'undefined') {
238
+ throw new AppwriteException('Missing required parameter: "organizationId"');
239
+ }
240
+ const apiPath = '/organizations/{organizationId}/billing-address'.replace('{organizationId}', organizationId);
241
+ const payload: Payload = {};
242
+ const uri = new URL(this.client.config.endpoint + apiPath);
243
+
244
+ const apiHeaders: { [header: string]: string } = {
245
+ 'content-type': 'application/json',
246
+ }
247
+
248
+
249
+ return await this.client.call(
250
+ 'delete',
251
+ uri,
252
+ apiHeaders,
253
+ payload
254
+ );
255
+ }
256
+ /**
257
+ * Get billing address
258
+ *
259
+ *
260
+ * @param {string} organizationId
261
+ * @param {string} billingAddressId
262
+ * @throws {AppwriteException}
263
+ * @returns {Promise<Models.BillingAddress>}
264
+ */
265
+ async getBillingAddress(organizationId: string, billingAddressId: string): Promise<Models.BillingAddress> {
266
+ if (typeof organizationId === 'undefined') {
267
+ throw new AppwriteException('Missing required parameter: "organizationId"');
268
+ }
269
+ if (typeof billingAddressId === 'undefined') {
270
+ throw new AppwriteException('Missing required parameter: "billingAddressId"');
271
+ }
272
+ const apiPath = '/organizations/{organizationId}/billing-addresses/{billingAddressId}'.replace('{organizationId}', organizationId).replace('{billingAddressId}', billingAddressId);
273
+ const payload: Payload = {};
274
+ const uri = new URL(this.client.config.endpoint + apiPath);
275
+
276
+ const apiHeaders: { [header: string]: string } = {
277
+ 'content-type': 'application/json',
278
+ }
279
+
280
+
281
+ return await this.client.call(
282
+ 'get',
283
+ uri,
284
+ apiHeaders,
285
+ payload
286
+ );
287
+ }
288
+ /**
289
+ * Set team&#039;s billing email
290
+ *
291
+ *
292
+ * @param {string} organizationId
293
+ * @param {string} billingEmail
294
+ * @throws {AppwriteException}
295
+ * @returns {Promise<Models.Organization<Preferences>>}
296
+ */
297
+ async setBillingEmail<Preferences extends Models.Preferences>(organizationId: string, billingEmail: string): Promise<Models.Organization<Preferences>> {
298
+ if (typeof organizationId === 'undefined') {
299
+ throw new AppwriteException('Missing required parameter: "organizationId"');
300
+ }
301
+ if (typeof billingEmail === 'undefined') {
302
+ throw new AppwriteException('Missing required parameter: "billingEmail"');
303
+ }
304
+ const apiPath = '/organizations/{organizationId}/billing-email'.replace('{organizationId}', organizationId);
305
+ const payload: Payload = {};
306
+ if (typeof billingEmail !== 'undefined') {
307
+ payload['billingEmail'] = billingEmail;
308
+ }
309
+ const uri = new URL(this.client.config.endpoint + apiPath);
310
+
311
+ const apiHeaders: { [header: string]: string } = {
312
+ 'content-type': 'application/json',
313
+ }
314
+
315
+
316
+ return await this.client.call(
317
+ 'patch',
318
+ uri,
319
+ apiHeaders,
320
+ payload
321
+ );
322
+ }
323
+ /**
324
+ * Update organization budget
325
+ *
326
+ *
327
+ * @param {string} organizationId
328
+ * @param {number} budget
329
+ * @param {number[]} alerts
330
+ * @throws {AppwriteException}
331
+ * @returns {Promise<Models.Organization<Preferences>>}
332
+ */
333
+ async updateBudget<Preferences extends Models.Preferences>(organizationId: string, budget: number, alerts?: number[]): Promise<Models.Organization<Preferences>> {
334
+ if (typeof organizationId === 'undefined') {
335
+ throw new AppwriteException('Missing required parameter: "organizationId"');
336
+ }
337
+ if (typeof budget === 'undefined') {
338
+ throw new AppwriteException('Missing required parameter: "budget"');
339
+ }
340
+ const apiPath = '/organizations/{organizationId}/budget'.replace('{organizationId}', organizationId);
341
+ const payload: Payload = {};
342
+ if (typeof budget !== 'undefined') {
343
+ payload['budget'] = budget;
344
+ }
345
+ if (typeof alerts !== 'undefined') {
346
+ payload['alerts'] = alerts;
347
+ }
348
+ const uri = new URL(this.client.config.endpoint + apiPath);
349
+
350
+ const apiHeaders: { [header: string]: string } = {
351
+ 'content-type': 'application/json',
352
+ }
353
+
354
+
355
+ return await this.client.call(
356
+ 'patch',
357
+ uri,
358
+ apiHeaders,
359
+ payload
360
+ );
361
+ }
362
+ /**
363
+ * Add credits from coupon
364
+ *
365
+ *
366
+ * @param {string} organizationId
367
+ * @param {string} couponId
368
+ * @throws {AppwriteException}
369
+ * @returns {Promise<Models.Credit>}
370
+ */
371
+ async addCredit(organizationId: string, couponId: string): Promise<Models.Credit> {
372
+ if (typeof organizationId === 'undefined') {
373
+ throw new AppwriteException('Missing required parameter: "organizationId"');
374
+ }
375
+ if (typeof couponId === 'undefined') {
376
+ throw new AppwriteException('Missing required parameter: "couponId"');
377
+ }
378
+ const apiPath = '/organizations/{organizationId}/credits'.replace('{organizationId}', organizationId);
379
+ const payload: Payload = {};
380
+ if (typeof couponId !== 'undefined') {
381
+ payload['couponId'] = couponId;
382
+ }
383
+ const uri = new URL(this.client.config.endpoint + apiPath);
384
+
385
+ const apiHeaders: { [header: string]: string } = {
386
+ 'content-type': 'application/json',
387
+ }
388
+
389
+
390
+ return await this.client.call(
391
+ 'post',
392
+ uri,
393
+ apiHeaders,
394
+ payload
395
+ );
396
+ }
397
+ /**
398
+ * Get credit details
399
+ *
400
+ *
401
+ * @param {string} organizationId
402
+ * @param {string} creditId
403
+ * @throws {AppwriteException}
404
+ * @returns {Promise<Models.Credit>}
405
+ */
406
+ async getCredit(organizationId: string, creditId: string): Promise<Models.Credit> {
407
+ if (typeof organizationId === 'undefined') {
408
+ throw new AppwriteException('Missing required parameter: "organizationId"');
409
+ }
410
+ if (typeof creditId === 'undefined') {
411
+ throw new AppwriteException('Missing required parameter: "creditId"');
412
+ }
413
+ const apiPath = '/organizations/{organizationId}/credits/{creditId}'.replace('{organizationId}', organizationId).replace('{creditId}', creditId);
414
+ const payload: Payload = {};
415
+ const uri = new URL(this.client.config.endpoint + apiPath);
416
+
417
+ const apiHeaders: { [header: string]: string } = {
418
+ 'content-type': 'application/json',
419
+ }
420
+
421
+
422
+ return await this.client.call(
423
+ 'get',
424
+ uri,
425
+ apiHeaders,
426
+ payload
427
+ );
428
+ }
429
+ /**
430
+ * List invoices
431
+ *
432
+ *
433
+ * @param {string} organizationId
434
+ * @param {string[]} queries
435
+ * @throws {AppwriteException}
436
+ * @returns {Promise<Models.InvoiceList>}
437
+ */
438
+ async listInvoices(organizationId: string, queries?: string[]): Promise<Models.InvoiceList> {
439
+ if (typeof organizationId === 'undefined') {
440
+ throw new AppwriteException('Missing required parameter: "organizationId"');
441
+ }
442
+ const apiPath = '/organizations/{organizationId}/invoices'.replace('{organizationId}', organizationId);
443
+ const payload: Payload = {};
444
+ if (typeof queries !== 'undefined') {
445
+ payload['queries'] = queries;
446
+ }
447
+ const uri = new URL(this.client.config.endpoint + apiPath);
448
+
449
+ const apiHeaders: { [header: string]: string } = {
450
+ 'content-type': 'application/json',
451
+ }
452
+
453
+
454
+ return await this.client.call(
455
+ 'get',
456
+ uri,
457
+ apiHeaders,
458
+ payload
459
+ );
460
+ }
461
+ /**
462
+ * Get invoice
463
+ *
464
+ *
465
+ * @param {string} organizationId
466
+ * @param {string} invoiceId
467
+ * @throws {AppwriteException}
468
+ * @returns {Promise<Models.Invoice>}
469
+ */
470
+ async getInvoice(organizationId: string, invoiceId: string): Promise<Models.Invoice> {
471
+ if (typeof organizationId === 'undefined') {
472
+ throw new AppwriteException('Missing required parameter: "organizationId"');
473
+ }
474
+ if (typeof invoiceId === 'undefined') {
475
+ throw new AppwriteException('Missing required parameter: "invoiceId"');
476
+ }
477
+ const apiPath = '/organizations/{organizationId}/invoices/{invoiceId}'.replace('{organizationId}', organizationId).replace('{invoiceId}', invoiceId);
478
+ const payload: Payload = {};
479
+ const uri = new URL(this.client.config.endpoint + apiPath);
480
+
481
+ const apiHeaders: { [header: string]: string } = {
482
+ 'content-type': 'application/json',
483
+ }
484
+
485
+
486
+ return await this.client.call(
487
+ 'get',
488
+ uri,
489
+ apiHeaders,
490
+ payload
491
+ );
492
+ }
493
+ /**
494
+ * View invoice in PDF
495
+ *
496
+ *
497
+ * @param {string} organizationId
498
+ * @param {string} invoiceId
499
+ * @throws {AppwriteException}
500
+ * @returns {Promise<Models.PaymentMethod>}
501
+ */
502
+ async getInvoiceDownload(organizationId: string, invoiceId: string): Promise<Models.PaymentMethod> {
503
+ if (typeof organizationId === 'undefined') {
504
+ throw new AppwriteException('Missing required parameter: "organizationId"');
505
+ }
506
+ if (typeof invoiceId === 'undefined') {
507
+ throw new AppwriteException('Missing required parameter: "invoiceId"');
508
+ }
509
+ const apiPath = '/organizations/{organizationId}/invoices/{invoiceId}/download'.replace('{organizationId}', organizationId).replace('{invoiceId}', invoiceId);
510
+ const payload: Payload = {};
511
+ const uri = new URL(this.client.config.endpoint + apiPath);
512
+
513
+ const apiHeaders: { [header: string]: string } = {
514
+ 'content-type': 'application/json',
515
+ }
516
+
517
+
518
+ return await this.client.call(
519
+ 'get',
520
+ uri,
521
+ apiHeaders,
522
+ payload
523
+ );
524
+ }
525
+ /**
526
+ * Initiate payment for failed invoice to pay live from console
527
+ *
528
+ *
529
+ * @param {string} organizationId
530
+ * @param {string} invoiceId
531
+ * @param {string} paymentMethodId
532
+ * @throws {AppwriteException}
533
+ * @returns {Promise<Models.Invoice>}
534
+ */
535
+ async createInvoicePayment(organizationId: string, invoiceId: string, paymentMethodId: string): Promise<Models.Invoice> {
536
+ if (typeof organizationId === 'undefined') {
537
+ throw new AppwriteException('Missing required parameter: "organizationId"');
538
+ }
539
+ if (typeof invoiceId === 'undefined') {
540
+ throw new AppwriteException('Missing required parameter: "invoiceId"');
541
+ }
542
+ if (typeof paymentMethodId === 'undefined') {
543
+ throw new AppwriteException('Missing required parameter: "paymentMethodId"');
544
+ }
545
+ const apiPath = '/organizations/{organizationId}/invoices/{invoiceId}/payments'.replace('{organizationId}', organizationId).replace('{invoiceId}', invoiceId);
546
+ const payload: Payload = {};
547
+ if (typeof paymentMethodId !== 'undefined') {
548
+ payload['paymentMethodId'] = paymentMethodId;
549
+ }
550
+ const uri = new URL(this.client.config.endpoint + apiPath);
551
+
552
+ const apiHeaders: { [header: string]: string } = {
553
+ 'content-type': 'application/json',
554
+ }
555
+
556
+
557
+ return await this.client.call(
558
+ 'post',
559
+ uri,
560
+ apiHeaders,
561
+ payload
562
+ );
563
+ }
564
+ /**
565
+ * View invoice in PDF
566
+ *
567
+ *
568
+ * @param {string} organizationId
569
+ * @param {string} invoiceId
570
+ * @throws {AppwriteException}
571
+ * @returns {Promise<Models.PaymentMethod>}
572
+ */
573
+ async getInvoiceView(organizationId: string, invoiceId: string): Promise<Models.PaymentMethod> {
574
+ if (typeof organizationId === 'undefined') {
575
+ throw new AppwriteException('Missing required parameter: "organizationId"');
576
+ }
577
+ if (typeof invoiceId === 'undefined') {
578
+ throw new AppwriteException('Missing required parameter: "invoiceId"');
579
+ }
580
+ const apiPath = '/organizations/{organizationId}/invoices/{invoiceId}/view'.replace('{organizationId}', organizationId).replace('{invoiceId}', invoiceId);
581
+ const payload: Payload = {};
582
+ const uri = new URL(this.client.config.endpoint + apiPath);
583
+
584
+ const apiHeaders: { [header: string]: string } = {
585
+ 'content-type': 'application/json',
586
+ }
587
+
588
+
589
+ return await this.client.call(
590
+ 'get',
591
+ uri,
592
+ apiHeaders,
593
+ payload
594
+ );
595
+ }
596
+ /**
597
+ * Set team&#039;s payment method
598
+ *
599
+ *
600
+ * @param {string} organizationId
601
+ * @param {string} paymentMethodId
602
+ * @throws {AppwriteException}
603
+ * @returns {Promise<Models.Organization<Preferences>>}
604
+ */
605
+ async setDefaultPaymentMethod<Preferences extends Models.Preferences>(organizationId: string, paymentMethodId: string): Promise<Models.Organization<Preferences>> {
606
+ if (typeof organizationId === 'undefined') {
607
+ throw new AppwriteException('Missing required parameter: "organizationId"');
608
+ }
609
+ if (typeof paymentMethodId === 'undefined') {
610
+ throw new AppwriteException('Missing required parameter: "paymentMethodId"');
611
+ }
612
+ const apiPath = '/organizations/{organizationId}/payment-method'.replace('{organizationId}', organizationId);
613
+ const payload: Payload = {};
614
+ if (typeof paymentMethodId !== 'undefined') {
615
+ payload['paymentMethodId'] = paymentMethodId;
616
+ }
617
+ const uri = new URL(this.client.config.endpoint + apiPath);
618
+
619
+ const apiHeaders: { [header: string]: string } = {
620
+ 'content-type': 'application/json',
621
+ }
622
+
623
+
624
+ return await this.client.call(
625
+ 'patch',
626
+ uri,
627
+ apiHeaders,
628
+ payload
629
+ );
630
+ }
631
+ /**
632
+ * Delete team&#039;s default payment method
633
+ *
634
+ *
635
+ * @param {string} organizationId
636
+ * @throws {AppwriteException}
637
+ * @returns {Promise<Models.Organization<Preferences>>}
638
+ */
639
+ async deleteDefaultPaymentMethod<Preferences extends Models.Preferences>(organizationId: string): Promise<Models.Organization<Preferences>> {
640
+ if (typeof organizationId === 'undefined') {
641
+ throw new AppwriteException('Missing required parameter: "organizationId"');
642
+ }
643
+ const apiPath = '/organizations/{organizationId}/payment-method'.replace('{organizationId}', organizationId);
644
+ const payload: Payload = {};
645
+ const uri = new URL(this.client.config.endpoint + apiPath);
646
+
647
+ const apiHeaders: { [header: string]: string } = {
648
+ 'content-type': 'application/json',
649
+ }
650
+
651
+
652
+ return await this.client.call(
653
+ 'delete',
654
+ uri,
655
+ apiHeaders,
656
+ payload
657
+ );
658
+ }
659
+ /**
660
+ * Set team&#039;s backup payment method
661
+ *
662
+ *
663
+ * @param {string} organizationId
664
+ * @param {string} paymentMethodId
665
+ * @throws {AppwriteException}
666
+ * @returns {Promise<Models.Organization<Preferences>>}
667
+ */
668
+ async setBackupPaymentMethod<Preferences extends Models.Preferences>(organizationId: string, paymentMethodId: string): Promise<Models.Organization<Preferences>> {
669
+ if (typeof organizationId === 'undefined') {
670
+ throw new AppwriteException('Missing required parameter: "organizationId"');
671
+ }
672
+ if (typeof paymentMethodId === 'undefined') {
673
+ throw new AppwriteException('Missing required parameter: "paymentMethodId"');
674
+ }
675
+ const apiPath = '/organizations/{organizationId}/payment-method/backup'.replace('{organizationId}', organizationId);
676
+ const payload: Payload = {};
677
+ if (typeof paymentMethodId !== 'undefined') {
678
+ payload['paymentMethodId'] = paymentMethodId;
679
+ }
680
+ const uri = new URL(this.client.config.endpoint + apiPath);
681
+
682
+ const apiHeaders: { [header: string]: string } = {
683
+ 'content-type': 'application/json',
684
+ }
685
+
686
+
687
+ return await this.client.call(
688
+ 'patch',
689
+ uri,
690
+ apiHeaders,
691
+ payload
692
+ );
693
+ }
694
+ /**
695
+ * Delete team&#039;s backup payment method
696
+ *
697
+ *
698
+ * @param {string} organizationId
699
+ * @throws {AppwriteException}
700
+ * @returns {Promise<Models.Organization<Preferences>>}
701
+ */
702
+ async deleteBackupPaymentMethod<Preferences extends Models.Preferences>(organizationId: string): Promise<Models.Organization<Preferences>> {
703
+ if (typeof organizationId === 'undefined') {
704
+ throw new AppwriteException('Missing required parameter: "organizationId"');
705
+ }
706
+ const apiPath = '/organizations/{organizationId}/payment-method/backup'.replace('{organizationId}', organizationId);
707
+ const payload: Payload = {};
708
+ const uri = new URL(this.client.config.endpoint + apiPath);
709
+
710
+ const apiHeaders: { [header: string]: string } = {
711
+ 'content-type': 'application/json',
712
+ }
713
+
714
+
715
+ return await this.client.call(
716
+ 'delete',
717
+ uri,
718
+ apiHeaders,
719
+ payload
720
+ );
721
+ }
722
+ /**
723
+ * Get payment method
724
+ *
725
+ *
726
+ * @param {string} organizationId
727
+ * @param {string} paymentMethodId
728
+ * @throws {AppwriteException}
729
+ * @returns {Promise<Models.PaymentMethod>}
730
+ */
731
+ async getPaymentMethod(organizationId: string, paymentMethodId: string): Promise<Models.PaymentMethod> {
732
+ if (typeof organizationId === 'undefined') {
733
+ throw new AppwriteException('Missing required parameter: "organizationId"');
734
+ }
735
+ if (typeof paymentMethodId === 'undefined') {
736
+ throw new AppwriteException('Missing required parameter: "paymentMethodId"');
737
+ }
738
+ const apiPath = '/organizations/{organizationId}/payment-methods/{paymentMethodId}'.replace('{organizationId}', organizationId).replace('{paymentMethodId}', paymentMethodId);
739
+ const payload: Payload = {};
740
+ const uri = new URL(this.client.config.endpoint + apiPath);
741
+
742
+ const apiHeaders: { [header: string]: string } = {
743
+ 'content-type': 'application/json',
744
+ }
745
+
746
+
747
+ return await this.client.call(
748
+ 'get',
749
+ uri,
750
+ apiHeaders,
751
+ payload
752
+ );
753
+ }
754
+ /**
755
+ * Get organization billing plan details
756
+ *
757
+ *
758
+ * @param {string} organizationId
759
+ * @throws {AppwriteException}
760
+ * @returns {Promise<Models.BillingPlan>}
761
+ */
762
+ async getPlan(organizationId: string): Promise<Models.BillingPlan> {
763
+ if (typeof organizationId === 'undefined') {
764
+ throw new AppwriteException('Missing required parameter: "organizationId"');
765
+ }
766
+ const apiPath = '/organizations/{organizationId}/plan'.replace('{organizationId}', organizationId);
767
+ const payload: Payload = {};
768
+ const uri = new URL(this.client.config.endpoint + apiPath);
769
+
770
+ const apiHeaders: { [header: string]: string } = {
771
+ 'content-type': 'application/json',
772
+ }
773
+
774
+
775
+ return await this.client.call(
776
+ 'get',
777
+ uri,
778
+ apiHeaders,
779
+ payload
780
+ );
781
+ }
782
+ /**
783
+ * Update organization billing plan
784
+ *
785
+ *
786
+ * @param {string} organizationId
787
+ * @param {BillingPlan} billingPlan
788
+ * @param {string} paymentMethodId
789
+ * @param {string} billingAddressId
790
+ * @throws {AppwriteException}
791
+ * @returns {Promise<Models.Organization<Preferences>>}
792
+ */
793
+ async updatePlan<Preferences extends Models.Preferences>(organizationId: string, billingPlan: BillingPlan, paymentMethodId?: string, billingAddressId?: string): Promise<Models.Organization<Preferences>> {
794
+ if (typeof organizationId === 'undefined') {
795
+ throw new AppwriteException('Missing required parameter: "organizationId"');
796
+ }
797
+ if (typeof billingPlan === 'undefined') {
798
+ throw new AppwriteException('Missing required parameter: "billingPlan"');
799
+ }
800
+ const apiPath = '/organizations/{organizationId}/plan'.replace('{organizationId}', organizationId);
801
+ const payload: Payload = {};
802
+ if (typeof billingPlan !== 'undefined') {
803
+ payload['billingPlan'] = billingPlan;
804
+ }
805
+ if (typeof paymentMethodId !== 'undefined') {
806
+ payload['paymentMethodId'] = paymentMethodId;
807
+ }
808
+ if (typeof billingAddressId !== 'undefined') {
809
+ payload['billingAddressId'] = billingAddressId;
810
+ }
811
+ const uri = new URL(this.client.config.endpoint + apiPath);
812
+
813
+ const apiHeaders: { [header: string]: string } = {
814
+ 'content-type': 'application/json',
815
+ }
816
+
817
+
818
+ return await this.client.call(
819
+ 'patch',
820
+ uri,
821
+ apiHeaders,
822
+ payload
823
+ );
824
+ }
825
+ /**
826
+ * Get Scopes
827
+ *
828
+ *
829
+ * @param {string} organizationId
830
+ * @throws {AppwriteException}
831
+ * @returns {Promise<Models.Roles>}
832
+ */
833
+ async getScopes(organizationId: string): Promise<Models.Roles> {
834
+ if (typeof organizationId === 'undefined') {
835
+ throw new AppwriteException('Missing required parameter: "organizationId"');
836
+ }
837
+ const apiPath = '/organizations/{organizationId}/roles'.replace('{organizationId}', organizationId);
838
+ const payload: Payload = {};
839
+ const uri = new URL(this.client.config.endpoint + apiPath);
840
+
841
+ const apiHeaders: { [header: string]: string } = {
842
+ 'content-type': 'application/json',
843
+ }
844
+
845
+
846
+ return await this.client.call(
847
+ 'get',
848
+ uri,
849
+ apiHeaders,
850
+ payload
851
+ );
852
+ }
853
+ /**
854
+ * Set team&#039;s tax Id
855
+ *
856
+ *
857
+ * @param {string} organizationId
858
+ * @param {string} taxId
859
+ * @throws {AppwriteException}
860
+ * @returns {Promise<Models.Organization<Preferences>>}
861
+ */
862
+ async setBillingTaxId<Preferences extends Models.Preferences>(organizationId: string, taxId: string): Promise<Models.Organization<Preferences>> {
863
+ if (typeof organizationId === 'undefined') {
864
+ throw new AppwriteException('Missing required parameter: "organizationId"');
865
+ }
866
+ if (typeof taxId === 'undefined') {
867
+ throw new AppwriteException('Missing required parameter: "taxId"');
868
+ }
869
+ const apiPath = '/organizations/{organizationId}/taxId'.replace('{organizationId}', organizationId);
870
+ const payload: Payload = {};
871
+ if (typeof taxId !== 'undefined') {
872
+ payload['taxId'] = taxId;
873
+ }
874
+ const uri = new URL(this.client.config.endpoint + apiPath);
875
+
876
+ const apiHeaders: { [header: string]: string } = {
877
+ 'content-type': 'application/json',
878
+ }
879
+
880
+
881
+ return await this.client.call(
882
+ 'patch',
883
+ uri,
884
+ apiHeaders,
885
+ payload
886
+ );
887
+ }
888
+ /**
889
+ * Get team&#039;s usage data
890
+ *
891
+ *
892
+ * @param {string} organizationId
893
+ * @param {string} startDate
894
+ * @param {string} endDate
895
+ * @throws {AppwriteException}
896
+ * @returns {Promise<Models.UsageOrganization>}
897
+ */
898
+ async getUsage(organizationId: string, startDate?: string, endDate?: string): Promise<Models.UsageOrganization> {
899
+ if (typeof organizationId === 'undefined') {
900
+ throw new AppwriteException('Missing required parameter: "organizationId"');
901
+ }
902
+ const apiPath = '/organizations/{organizationId}/usage'.replace('{organizationId}', organizationId);
903
+ const payload: Payload = {};
904
+ if (typeof startDate !== 'undefined') {
905
+ payload['startDate'] = startDate;
906
+ }
907
+ if (typeof endDate !== 'undefined') {
908
+ payload['endDate'] = endDate;
909
+ }
910
+ const uri = new URL(this.client.config.endpoint + apiPath);
911
+
912
+ const apiHeaders: { [header: string]: string } = {
913
+ 'content-type': 'application/json',
914
+ }
915
+
916
+
917
+ return await this.client.call(
918
+ 'get',
919
+ uri,
920
+ apiHeaders,
921
+ payload
922
+ );
923
+ }
924
+ }