@appwrite.io/console 1.8.0 → 1.9.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 (67) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/sdk.js +287 -8
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +288 -9
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/dist/iife/sdk.js +287 -8
  7. package/docs/examples/databases/decrement-document-attribute.md +18 -0
  8. package/docs/examples/databases/increment-document-attribute.md +18 -0
  9. package/docs/examples/databases/upsert-documents.md +1 -1
  10. package/docs/examples/domains/create-record-a-a-a-a.md +1 -1
  11. package/docs/examples/domains/create-record-a.md +1 -1
  12. package/docs/examples/domains/create-record-alias.md +1 -1
  13. package/docs/examples/domains/create-record-c-a-a.md +1 -1
  14. package/docs/examples/domains/create-record-c-n-a-m-e.md +1 -1
  15. package/docs/examples/domains/create-record-h-t-t-p-s.md +1 -1
  16. package/docs/examples/domains/create-record-m-x.md +1 -1
  17. package/docs/examples/domains/create-record-n-s.md +1 -1
  18. package/docs/examples/domains/create-record-s-r-v.md +1 -1
  19. package/docs/examples/domains/create-record-t-x-t.md +1 -1
  20. package/docs/examples/domains/update-record-a-a-a-a.md +1 -1
  21. package/docs/examples/domains/update-record-a.md +1 -1
  22. package/docs/examples/domains/update-record-alias.md +1 -1
  23. package/docs/examples/domains/update-record-c-a-a.md +1 -1
  24. package/docs/examples/domains/update-record-c-n-a-m-e.md +1 -1
  25. package/docs/examples/domains/update-record-h-t-t-p-s.md +1 -1
  26. package/docs/examples/domains/update-record-m-x.md +1 -1
  27. package/docs/examples/domains/update-record-n-s.md +1 -1
  28. package/docs/examples/domains/update-record-s-r-v.md +1 -1
  29. package/docs/examples/domains/update-record-t-x-t.md +1 -1
  30. package/docs/examples/health/{get-queue-stats-usage-dump.md → get-queue-billing-project-aggregation.md} +2 -2
  31. package/docs/examples/health/{get-queue-billing-aggregation.md → get-queue-billing-team-aggregation.md} +1 -1
  32. package/docs/examples/organizations/cancel-downgrade.md +13 -0
  33. package/docs/examples/organizations/estimation-create-organization.md +16 -0
  34. package/docs/examples/organizations/estimation-delete-organization.md +13 -0
  35. package/docs/examples/organizations/estimation-update-plan.md +16 -0
  36. package/docs/examples/organizations/get-usage.md +1 -1
  37. package/docs/examples/organizations/validate-payment.md +14 -0
  38. package/docs/examples/proxy/create-redirect-rule.md +4 -2
  39. package/package.json +1 -1
  40. package/src/client.ts +5 -4
  41. package/src/enums/build-runtime.ts +2 -0
  42. package/src/enums/image-format.ts +1 -0
  43. package/src/enums/proxy-resource-type.ts +4 -0
  44. package/src/enums/runtime.ts +2 -0
  45. package/src/index.ts +1 -0
  46. package/src/models.ts +272 -2
  47. package/src/services/databases.ts +96 -1
  48. package/src/services/health.ts +28 -3
  49. package/src/services/organizations.ts +197 -0
  50. package/src/services/proxy.ts +16 -1
  51. package/types/enums/build-runtime.d.ts +3 -1
  52. package/types/enums/image-format.d.ts +2 -1
  53. package/types/enums/proxy-resource-type.d.ts +4 -0
  54. package/types/enums/runtime.d.ts +3 -1
  55. package/types/index.d.ts +1 -0
  56. package/types/models.d.ts +272 -2
  57. package/types/services/databases.d.ts +27 -1
  58. package/types/services/health.d.ts +10 -2
  59. package/types/services/organizations.d.ts +57 -0
  60. package/types/services/proxy.d.ts +4 -1
  61. package/docs/examples/functions/create-build.md +0 -15
  62. package/docs/examples/functions/get-function-usage.md +0 -14
  63. package/docs/examples/functions/update-deployment-build.md +0 -14
  64. package/docs/examples/functions/update-deployment.md +0 -14
  65. package/docs/examples/proxy/create-rule.md +0 -15
  66. package/src/enums/resource-type.ts +0 -4
  67. package/types/enums/resource-type.d.ts +0 -4
@@ -11,7 +11,7 @@ const result = await domains.updateRecordSRV(
11
11
  '<RECORD_ID>', // recordId
12
12
  '<NAME>', // name
13
13
  '<VALUE>', // value
14
- null, // ttl
14
+ 1, // ttl
15
15
  null, // priority
16
16
  null, // weight
17
17
  null, // port
@@ -11,7 +11,7 @@ const result = await domains.updateRecordTXT(
11
11
  '<RECORD_ID>', // recordId
12
12
  '<NAME>', // name
13
13
  '<VALUE>', // value
14
- null, // ttl
14
+ 1, // ttl
15
15
  '<COMMENT>' // comment (optional)
16
16
  );
17
17
 
@@ -1,12 +1,12 @@
1
1
  import { Client, Health } from "@appwrite.io/console";
2
2
 
3
3
  const client = new Client()
4
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
4
+ .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5
5
  .setProject('<YOUR_PROJECT_ID>'); // Your project ID
6
6
 
7
7
  const health = new Health(client);
8
8
 
9
- const result = await health.getQueueStatsUsageDump(
9
+ const result = await health.getQueueBillingProjectAggregation(
10
10
  null // threshold (optional)
11
11
  );
12
12
 
@@ -6,7 +6,7 @@ const client = new Client()
6
6
 
7
7
  const health = new Health(client);
8
8
 
9
- const result = await health.getQueueBillingAggregation(
9
+ const result = await health.getQueueBillingTeamAggregation(
10
10
  null // threshold (optional)
11
11
  );
12
12
 
@@ -0,0 +1,13 @@
1
+ import { Client, Organizations } from "@appwrite.io/console";
2
+
3
+ const client = new Client()
4
+ .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('<YOUR_PROJECT_ID>'); // Your project ID
6
+
7
+ const organizations = new Organizations(client);
8
+
9
+ const result = await organizations.cancelDowngrade(
10
+ '<ORGANIZATION_ID>' // organizationId
11
+ );
12
+
13
+ console.log(result);
@@ -0,0 +1,16 @@
1
+ import { Client, Organizations, } from "@appwrite.io/console";
2
+
3
+ const client = new Client()
4
+ .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('<YOUR_PROJECT_ID>'); // Your project ID
6
+
7
+ const organizations = new Organizations(client);
8
+
9
+ const result = await organizations.estimationCreateOrganization(
10
+ .Tier0, // billingPlan
11
+ '<PAYMENT_METHOD_ID>', // paymentMethodId (optional)
12
+ [], // invites (optional)
13
+ '<COUPON_ID>' // couponId (optional)
14
+ );
15
+
16
+ console.log(result);
@@ -0,0 +1,13 @@
1
+ import { Client, Organizations } from "@appwrite.io/console";
2
+
3
+ const client = new Client()
4
+ .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('<YOUR_PROJECT_ID>'); // Your project ID
6
+
7
+ const organizations = new Organizations(client);
8
+
9
+ const result = await organizations.estimationDeleteOrganization(
10
+ '<ORGANIZATION_ID>' // organizationId
11
+ );
12
+
13
+ console.log(result);
@@ -0,0 +1,16 @@
1
+ import { Client, Organizations, } from "@appwrite.io/console";
2
+
3
+ const client = new Client()
4
+ .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('<YOUR_PROJECT_ID>'); // Your project ID
6
+
7
+ const organizations = new Organizations(client);
8
+
9
+ const result = await organizations.estimationUpdatePlan(
10
+ '<ORGANIZATION_ID>', // organizationId
11
+ .Tier0, // billingPlan
12
+ [], // invites (optional)
13
+ '<COUPON_ID>' // couponId (optional)
14
+ );
15
+
16
+ console.log(result);
@@ -1,7 +1,7 @@
1
1
  import { Client, Organizations } from "@appwrite.io/console";
2
2
 
3
3
  const client = new Client()
4
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
4
+ .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5
5
  .setProject('<YOUR_PROJECT_ID>'); // Your project ID
6
6
 
7
7
  const organizations = new Organizations(client);
@@ -0,0 +1,14 @@
1
+ import { Client, Organizations } from "@appwrite.io/console";
2
+
3
+ const client = new Client()
4
+ .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('<YOUR_PROJECT_ID>'); // Your project ID
6
+
7
+ const organizations = new Organizations(client);
8
+
9
+ const result = await organizations.validatePayment(
10
+ '<ORGANIZATION_ID>', // organizationId
11
+ [] // invites (optional)
12
+ );
13
+
14
+ console.log(result);
@@ -1,4 +1,4 @@
1
- import { Client, Proxy, } from "@appwrite.io/console";
1
+ import { Client, Proxy, , ProxyResourceType } from "@appwrite.io/console";
2
2
 
3
3
  const client = new Client()
4
4
  .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
@@ -9,7 +9,9 @@ const proxy = new Proxy(client);
9
9
  const result = await proxy.createRedirectRule(
10
10
  '', // domain
11
11
  'https://example.com', // url
12
- .MovedPermanently301 // statusCode
12
+ .MovedPermanently301, // statusCode
13
+ '<RESOURCE_ID>', // resourceId
14
+ ProxyResourceType.Site // resourceType
13
15
  );
14
16
 
15
17
  console.log(result);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@appwrite.io/console",
3
3
  "homepage": "https://appwrite.io/support",
4
4
  "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
5
- "version": "1.8.0",
5
+ "version": "1.9.0",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "dist/cjs/sdk.js",
8
8
  "exports": {
package/src/client.ts CHANGED
@@ -316,7 +316,7 @@ class Client {
316
316
  'x-sdk-name': 'Console',
317
317
  'x-sdk-platform': 'console',
318
318
  'x-sdk-language': 'web',
319
- 'x-sdk-version': '1.8.0',
319
+ 'x-sdk-version': '1.9.0',
320
320
  'X-Appwrite-Response-Format': '1.7.0',
321
321
  };
322
322
 
@@ -677,9 +677,9 @@ class Client {
677
677
  }
678
678
 
679
679
  async chunkedUpload(method: string, url: URL, headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void) {
680
- const file = Object.values(originalPayload).find((value) => value instanceof File);
680
+ const [fileParam, file] = Object.entries(originalPayload).find(([_, value]) => value instanceof File) ?? [];
681
681
 
682
- if (!file) {
682
+ if (!file || !fileParam) {
683
683
  throw new Error('File not found in payload');
684
684
  }
685
685
 
@@ -699,7 +699,8 @@ class Client {
699
699
  headers['content-range'] = `bytes ${start}-${end-1}/${file.size}`;
700
700
  const chunk = file.slice(start, end);
701
701
 
702
- let payload = { ...originalPayload, file: new File([chunk], file.name)};
702
+ let payload = { ...originalPayload };
703
+ payload[fileParam] = new File([chunk], file.name);
703
704
 
704
705
  response = await this.call(method, url, headers, payload);
705
706
 
@@ -33,6 +33,7 @@ export enum BuildRuntime {
33
33
  Dart31 = 'dart-3.1',
34
34
  Dart33 = 'dart-3.3',
35
35
  Dart35 = 'dart-3.5',
36
+ Dart38 = 'dart-3.8',
36
37
  Dotnet60 = 'dotnet-6.0',
37
38
  Dotnet70 = 'dotnet-7.0',
38
39
  Dotnet80 = 'dotnet-8.0',
@@ -59,4 +60,5 @@ export enum BuildRuntime {
59
60
  Flutter324 = 'flutter-3.24',
60
61
  Flutter327 = 'flutter-3.27',
61
62
  Flutter329 = 'flutter-3.29',
63
+ Flutter332 = 'flutter-3.32',
62
64
  }
@@ -5,4 +5,5 @@ export enum ImageFormat {
5
5
  Webp = 'webp',
6
6
  Heic = 'heic',
7
7
  Avif = 'avif',
8
+ Gif = 'gif',
8
9
  }
@@ -0,0 +1,4 @@
1
+ export enum ProxyResourceType {
2
+ Site = 'site',
3
+ Function = 'function',
4
+ }
@@ -33,6 +33,7 @@ export enum Runtime {
33
33
  Dart31 = 'dart-3.1',
34
34
  Dart33 = 'dart-3.3',
35
35
  Dart35 = 'dart-3.5',
36
+ Dart38 = 'dart-3.8',
36
37
  Dotnet60 = 'dotnet-6.0',
37
38
  Dotnet70 = 'dotnet-7.0',
38
39
  Dotnet80 = 'dotnet-8.0',
@@ -59,4 +60,5 @@ export enum Runtime {
59
60
  Flutter324 = 'flutter-3.24',
60
61
  Flutter327 = 'flutter-3.27',
61
62
  Flutter329 = 'flutter-3.29',
63
+ Flutter332 = 'flutter-3.32',
62
64
  }
package/src/index.ts CHANGED
@@ -66,6 +66,7 @@ export { EmailTemplateLocale } from './enums/email-template-locale';
66
66
  export { SmsTemplateType } from './enums/sms-template-type';
67
67
  export { SmsTemplateLocale } from './enums/sms-template-locale';
68
68
  export { StatusCode } from './enums/status-code';
69
+ export { ProxyResourceType } from './enums/proxy-resource-type';
69
70
  export { Framework } from './enums/framework';
70
71
  export { BuildRuntime } from './enums/build-runtime';
71
72
  export { Adapter } from './enums/adapter';
package/src/models.ts CHANGED
@@ -1218,6 +1218,10 @@ export namespace Models {
1218
1218
  * Document ID.
1219
1219
  */
1220
1220
  $id: string;
1221
+ /**
1222
+ * Document automatically incrementing ID.
1223
+ */
1224
+ $sequence: number;
1221
1225
  /**
1222
1226
  * Collection ID.
1223
1227
  */
@@ -5374,6 +5378,10 @@ export namespace Models {
5374
5378
  * Does plan support mock numbers
5375
5379
  */
5376
5380
  supportsMockNumbers: boolean;
5381
+ /**
5382
+ * Does plan support organization roles
5383
+ */
5384
+ supportsOrganizationRoles: boolean;
5377
5385
  /**
5378
5386
  * Does plan support credit
5379
5387
  */
@@ -5394,6 +5402,10 @@ export namespace Models {
5394
5402
  * Maximum function and site deployment size in MB
5395
5403
  */
5396
5404
  buildSize: number;
5405
+ /**
5406
+ * Does the plan support encrypted string attributes or not.
5407
+ */
5408
+ databasesAllowEncrypt: boolean;
5397
5409
  }
5398
5410
  /**
5399
5411
  * BillingPlanAddon
@@ -5832,9 +5844,9 @@ export namespace Models {
5832
5844
  */
5833
5845
  billingLimits: BillingLimits;
5834
5846
  /**
5835
- * Billing plan downgrade
5847
+ * Billing plan selected for downgrade.
5836
5848
  */
5837
- billingPlanDowngrade: object;
5849
+ billingPlanDowngrade: string;
5838
5850
  /**
5839
5851
  * Tax Id
5840
5852
  */
@@ -6086,6 +6098,164 @@ export namespace Models {
6086
6098
  */
6087
6099
  roles: string[];
6088
6100
  }
6101
+ /**
6102
+ * UsageOrganization
6103
+ */
6104
+ export type UsageOrganization = {
6105
+ /**
6106
+ * Aggregated stats for number of requests.
6107
+ */
6108
+ bandwidth: Metric[];
6109
+ /**
6110
+ * Aggregated stats for consumed bandwidth.
6111
+ */
6112
+ users: Metric[];
6113
+ /**
6114
+ * Aggregated stats for function executions.
6115
+ */
6116
+ executions: Metric[];
6117
+ /**
6118
+ * Aggregated stats for database reads.
6119
+ */
6120
+ databasesReads: Metric[];
6121
+ /**
6122
+ * Aggregated stats for database writes.
6123
+ */
6124
+ databasesWrites: Metric[];
6125
+ /**
6126
+ * Aggregated stats for file transformations.
6127
+ */
6128
+ imageTransformations: Metric[];
6129
+ /**
6130
+ * Aggregated stats for total file transformations.
6131
+ */
6132
+ imageTransformationsTotal: number;
6133
+ /**
6134
+ * Aggregated stats for total users.
6135
+ */
6136
+ usersTotal: number;
6137
+ /**
6138
+ * Aggregated stats for total executions.
6139
+ */
6140
+ executionsTotal: number;
6141
+ /**
6142
+ * Aggregated stats for function executions in mb seconds.
6143
+ */
6144
+ executionsMBSecondsTotal: number;
6145
+ /**
6146
+ * Aggregated stats for function builds in mb seconds.
6147
+ */
6148
+ buildsMBSecondsTotal: number;
6149
+ /**
6150
+ * Aggregated stats for total file storage.
6151
+ */
6152
+ filesStorageTotal: number;
6153
+ /**
6154
+ * Aggregated stats for total builds storage.
6155
+ */
6156
+ buildsStorageTotal: number;
6157
+ /**
6158
+ * Aggregated stats for total deployments storage.
6159
+ */
6160
+ deploymentsStorageTotal: number;
6161
+ /**
6162
+ * Aggregated stats for total databases storage.
6163
+ */
6164
+ databasesStorageTotal: number;
6165
+ /**
6166
+ * Aggregated stats for total databases reads.
6167
+ */
6168
+ databasesReadsTotal: number;
6169
+ /**
6170
+ * Aggregated stats for total databases writes.
6171
+ */
6172
+ databasesWritesTotal: number;
6173
+ /**
6174
+ * Aggregated stats for total backups storage.
6175
+ */
6176
+ backupsStorageTotal: number;
6177
+ /**
6178
+ * Aggregated stats for total storage.
6179
+ */
6180
+ storageTotal: number;
6181
+ /**
6182
+ * Aggregated stats for total auth phone.
6183
+ */
6184
+ authPhoneTotal: number;
6185
+ /**
6186
+ * Aggregated stats for total auth phone estimation.
6187
+ */
6188
+ authPhoneEstimate: number;
6189
+ /**
6190
+ * Aggregated stats for each projects.
6191
+ */
6192
+ projects: UsageOrganizationProject[];
6193
+ }
6194
+ /**
6195
+ * UsageOrganizationProject
6196
+ */
6197
+ export type UsageOrganizationProject = {
6198
+ /**
6199
+ * projectId
6200
+ */
6201
+ projectId: string;
6202
+ /**
6203
+ * Aggregated stats for number of requests.
6204
+ */
6205
+ bandwidth: Metric[];
6206
+ /**
6207
+ * Aggregated stats for consumed bandwidth.
6208
+ */
6209
+ users: Metric[];
6210
+ /**
6211
+ * Aggregated stats for function executions.
6212
+ */
6213
+ executions: number;
6214
+ /**
6215
+ * Aggregated stats for database reads.
6216
+ */
6217
+ databasesReads: Metric[];
6218
+ /**
6219
+ * Aggregated stats for database writes.
6220
+ */
6221
+ databasesWrites: Metric[];
6222
+ /**
6223
+ * Aggregated stats for function executions in mb seconds.
6224
+ */
6225
+ executionsMBSeconds: number;
6226
+ /**
6227
+ * Aggregated stats for function builds in mb seconds.
6228
+ */
6229
+ buildsMBSeconds: number;
6230
+ /**
6231
+ * Aggregated stats for number of documents.
6232
+ */
6233
+ storage: number;
6234
+ /**
6235
+ * Aggregated stats for phone authentication.
6236
+ */
6237
+ authPhoneTotal: number;
6238
+ /**
6239
+ * Aggregated stats for phone authentication estimated cost.
6240
+ */
6241
+ authPhoneEstimate: number;
6242
+ /**
6243
+ * Aggregated stats for total databases reads.
6244
+ */
6245
+ databasesReadsTotal: number;
6246
+ /**
6247
+ * Aggregated stats for total databases writes.
6248
+ */
6249
+ databasesWritesTotal: number;
6250
+ /**
6251
+ * Aggregated stats for file transformations.
6252
+ */
6253
+ imageTransformations: Metric[];
6254
+ /**
6255
+ * Aggregated stats for total file transformations.
6256
+ */
6257
+ imageTransformationsTotal: number;
6258
+ }
6089
6259
  /**
6090
6260
  * Domain
6091
6261
  */
@@ -6254,6 +6424,106 @@ export namespace Models {
6254
6424
  */
6255
6425
  imageTransformations: AdditionalResource;
6256
6426
  }
6427
+ /**
6428
+ * Estimation
6429
+ */
6430
+ export type Estimation = {
6431
+ /**
6432
+ * Total amount
6433
+ */
6434
+ amount: number;
6435
+ /**
6436
+ * Gross payable amount
6437
+ */
6438
+ grossAmount: number;
6439
+ /**
6440
+ * Discount amount
6441
+ */
6442
+ discount: number;
6443
+ /**
6444
+ * Credits amount
6445
+ */
6446
+ credits: number;
6447
+ /**
6448
+ * Estimation items
6449
+ */
6450
+ items: EstimationItem[];
6451
+ /**
6452
+ * Estimation discount items
6453
+ */
6454
+ discounts: EstimationItem[];
6455
+ /**
6456
+ * Trial days
6457
+ */
6458
+ trialDays: number;
6459
+ /**
6460
+ * Trial end date
6461
+ */
6462
+ trialEndDate?: string;
6463
+ }
6464
+ /**
6465
+ * EstimationUpdatePlan
6466
+ */
6467
+ export type EstimationUpdatePlan = {
6468
+ /**
6469
+ * Total amount
6470
+ */
6471
+ amount: number;
6472
+ /**
6473
+ * Gross payable amount
6474
+ */
6475
+ grossAmount: number;
6476
+ /**
6477
+ * Discount amount
6478
+ */
6479
+ discount: number;
6480
+ /**
6481
+ * Credits amount
6482
+ */
6483
+ credits: number;
6484
+ /**
6485
+ * Estimation items
6486
+ */
6487
+ items: EstimationItem[];
6488
+ /**
6489
+ * Estimation discount items
6490
+ */
6491
+ discounts: EstimationItem[];
6492
+ /**
6493
+ * Trial days
6494
+ */
6495
+ trialDays: number;
6496
+ /**
6497
+ * Trial end date
6498
+ */
6499
+ trialEndDate?: string;
6500
+ /**
6501
+ * Organization&#039;s existing credits
6502
+ */
6503
+ organizationCredits: number;
6504
+ }
6505
+ /**
6506
+ * EstimationDeleteOrganization
6507
+ */
6508
+ export type EstimationDeleteOrganization = {
6509
+ /**
6510
+ * List of unpaid invoices
6511
+ */
6512
+ unpaidInvoices: Invoice[];
6513
+ }
6514
+ /**
6515
+ * EstimationItem
6516
+ */
6517
+ export type EstimationItem = {
6518
+ /**
6519
+ * Label
6520
+ */
6521
+ label: string;
6522
+ /**
6523
+ * Gross payable amount
6524
+ */
6525
+ value: number;
6526
+ }
6257
6527
  /**
6258
6528
  * Aggregation team list
6259
6529
  */
@@ -1733,13 +1733,16 @@ export class Databases {
1733
1733
  * @throws {AppwriteException}
1734
1734
  * @returns {Promise<Models.DocumentList<Document>>}
1735
1735
  */
1736
- upsertDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, documents?: object[]): Promise<Models.DocumentList<Document>> {
1736
+ upsertDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, documents: object[]): Promise<Models.DocumentList<Document>> {
1737
1737
  if (typeof databaseId === 'undefined') {
1738
1738
  throw new AppwriteException('Missing required parameter: "databaseId"');
1739
1739
  }
1740
1740
  if (typeof collectionId === 'undefined') {
1741
1741
  throw new AppwriteException('Missing required parameter: "collectionId"');
1742
1742
  }
1743
+ if (typeof documents === 'undefined') {
1744
+ throw new AppwriteException('Missing required parameter: "documents"');
1745
+ }
1743
1746
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1744
1747
  const payload: Payload = {};
1745
1748
  if (typeof documents !== 'undefined') {
@@ -2025,6 +2028,98 @@ export class Databases {
2025
2028
  payload
2026
2029
  );
2027
2030
  }
2031
+ /**
2032
+ * Decrement a specific attribute of a document by a given value.
2033
+ *
2034
+ * @param {string} databaseId
2035
+ * @param {string} collectionId
2036
+ * @param {string} documentId
2037
+ * @param {string} attribute
2038
+ * @param {number} value
2039
+ * @param {number} min
2040
+ * @throws {AppwriteException}
2041
+ * @returns {Promise<Document>}
2042
+ */
2043
+ decrementDocumentAttribute<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number): Promise<Document> {
2044
+ if (typeof databaseId === 'undefined') {
2045
+ throw new AppwriteException('Missing required parameter: "databaseId"');
2046
+ }
2047
+ if (typeof collectionId === 'undefined') {
2048
+ throw new AppwriteException('Missing required parameter: "collectionId"');
2049
+ }
2050
+ if (typeof documentId === 'undefined') {
2051
+ throw new AppwriteException('Missing required parameter: "documentId"');
2052
+ }
2053
+ if (typeof attribute === 'undefined') {
2054
+ throw new AppwriteException('Missing required parameter: "attribute"');
2055
+ }
2056
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
2057
+ const payload: Payload = {};
2058
+ if (typeof value !== 'undefined') {
2059
+ payload['value'] = value;
2060
+ }
2061
+ if (typeof min !== 'undefined') {
2062
+ payload['min'] = min;
2063
+ }
2064
+ const uri = new URL(this.client.config.endpoint + apiPath);
2065
+
2066
+ const apiHeaders: { [header: string]: string } = {
2067
+ 'content-type': 'application/json',
2068
+ }
2069
+
2070
+ return this.client.call(
2071
+ 'patch',
2072
+ uri,
2073
+ apiHeaders,
2074
+ payload
2075
+ );
2076
+ }
2077
+ /**
2078
+ * Increment a specific attribute of a document by a given value.
2079
+ *
2080
+ * @param {string} databaseId
2081
+ * @param {string} collectionId
2082
+ * @param {string} documentId
2083
+ * @param {string} attribute
2084
+ * @param {number} value
2085
+ * @param {number} max
2086
+ * @throws {AppwriteException}
2087
+ * @returns {Promise<Document>}
2088
+ */
2089
+ incrementDocumentAttribute<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number): Promise<Document> {
2090
+ if (typeof databaseId === 'undefined') {
2091
+ throw new AppwriteException('Missing required parameter: "databaseId"');
2092
+ }
2093
+ if (typeof collectionId === 'undefined') {
2094
+ throw new AppwriteException('Missing required parameter: "collectionId"');
2095
+ }
2096
+ if (typeof documentId === 'undefined') {
2097
+ throw new AppwriteException('Missing required parameter: "documentId"');
2098
+ }
2099
+ if (typeof attribute === 'undefined') {
2100
+ throw new AppwriteException('Missing required parameter: "attribute"');
2101
+ }
2102
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
2103
+ const payload: Payload = {};
2104
+ if (typeof value !== 'undefined') {
2105
+ payload['value'] = value;
2106
+ }
2107
+ if (typeof max !== 'undefined') {
2108
+ payload['max'] = max;
2109
+ }
2110
+ const uri = new URL(this.client.config.endpoint + apiPath);
2111
+
2112
+ const apiHeaders: { [header: string]: string } = {
2113
+ 'content-type': 'application/json',
2114
+ }
2115
+
2116
+ return this.client.call(
2117
+ 'patch',
2118
+ uri,
2119
+ apiHeaders,
2120
+ payload
2121
+ );
2122
+ }
2028
2123
  /**
2029
2124
  * List indexes in the collection.
2030
2125
  *