@appwrite.io/console 3.0.0 → 4.0.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 (69) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/sdk.js +470 -83
  4. package/dist/cjs/sdk.js.map +1 -1
  5. package/dist/esm/sdk.js +471 -84
  6. package/dist/esm/sdk.js.map +1 -1
  7. package/dist/iife/sdk.js +470 -83
  8. package/docs/examples/databases/list-documents.md +2 -1
  9. package/docs/examples/domains/create-purchase.md +25 -0
  10. package/docs/examples/domains/create-transfer-in.md +18 -0
  11. package/docs/examples/domains/create-transfer-out.md +16 -0
  12. package/docs/examples/domains/get-transfer-status.md +15 -0
  13. package/docs/examples/health/get-console-pausing.md +16 -0
  14. package/docs/examples/migrations/create-appwrite-migration.md +2 -2
  15. package/docs/examples/migrations/create-firebase-migration.md +2 -2
  16. package/docs/examples/migrations/create-n-host-migration.md +2 -2
  17. package/docs/examples/migrations/create-supabase-migration.md +2 -2
  18. package/docs/examples/migrations/get-appwrite-report.md +2 -2
  19. package/docs/examples/migrations/get-firebase-report.md +2 -2
  20. package/docs/examples/migrations/get-n-host-report.md +2 -2
  21. package/docs/examples/migrations/get-supabase-report.md +2 -2
  22. package/docs/examples/organizations/get-scopes.md +2 -1
  23. package/docs/examples/projects/update-console-access.md +15 -0
  24. package/docs/examples/projects/update-status.md +16 -0
  25. package/docs/examples/sites/create-deployment.md +2 -2
  26. package/docs/examples/tablesdb/list-rows.md +2 -1
  27. package/package.json +1 -1
  28. package/src/channel.ts +19 -15
  29. package/src/client.ts +7 -2
  30. package/src/enums/appwrite-migration-resource.ts +21 -0
  31. package/src/enums/domain-transfer-status-status.ts +10 -0
  32. package/src/enums/firebase-migration-resource.ts +12 -0
  33. package/src/enums/{resources.ts → n-host-migration-resource.ts} +1 -1
  34. package/src/enums/status.ts +3 -0
  35. package/src/enums/supabase-migration-resource.ts +13 -0
  36. package/src/index.ts +6 -1
  37. package/src/models.ts +124 -3
  38. package/src/query.ts +26 -0
  39. package/src/services/account.ts +2 -2
  40. package/src/services/databases.ts +100 -93
  41. package/src/services/domains.ts +350 -0
  42. package/src/services/health.ts +61 -0
  43. package/src/services/messaging.ts +2 -2
  44. package/src/services/migrations.ts +68 -65
  45. package/src/services/organizations.ts +14 -6
  46. package/src/services/projects.ts +120 -0
  47. package/src/services/sites.ts +13 -16
  48. package/src/services/tables-db.ts +14 -7
  49. package/src/services/teams.ts +4 -4
  50. package/types/channel.d.ts +9 -9
  51. package/types/enums/appwrite-migration-resource.d.ts +21 -0
  52. package/types/enums/domain-transfer-status-status.d.ts +10 -0
  53. package/types/enums/firebase-migration-resource.d.ts +12 -0
  54. package/types/enums/{resources.d.ts → n-host-migration-resource.d.ts} +1 -1
  55. package/types/enums/status.d.ts +3 -0
  56. package/types/enums/supabase-migration-resource.d.ts +13 -0
  57. package/types/index.d.ts +6 -1
  58. package/types/models.d.ts +122 -3
  59. package/types/query.d.ts +22 -0
  60. package/types/services/databases.d.ts +40 -37
  61. package/types/services/domains.d.ts +118 -0
  62. package/types/services/health.d.ts +24 -0
  63. package/types/services/messaging.d.ts +2 -2
  64. package/types/services/migrations.d.ts +36 -33
  65. package/types/services/organizations.d.ts +4 -1
  66. package/types/services/projects.d.ts +46 -0
  67. package/types/services/sites.d.ts +4 -4
  68. package/types/services/tables-db.d.ts +4 -1
  69. package/types/services/teams.d.ts +4 -4
package/src/models.ts CHANGED
@@ -12,6 +12,7 @@ import { ProxyRuleDeploymentResourceType } from "./enums/proxy-rule-deployment-r
12
12
  import { ProxyRuleStatus } from "./enums/proxy-rule-status"
13
13
  import { MessageStatus } from "./enums/message-status"
14
14
  import { BillingPlanGroup } from "./enums/billing-plan-group"
15
+ import { DomainTransferStatusStatus } from "./enums/domain-transfer-status-status"
15
16
 
16
17
  /**
17
18
  * Appwrite Models
@@ -2627,7 +2628,7 @@ export namespace Models {
2627
2628
  */
2628
2629
  $id: string;
2629
2630
  /**
2630
- * Row automatically incrementing ID.
2631
+ * Row sequence ID.
2631
2632
  */
2632
2633
  $sequence: number;
2633
2634
  /**
@@ -2666,7 +2667,7 @@ export namespace Models {
2666
2667
  */
2667
2668
  $id: string;
2668
2669
  /**
2669
- * Document automatically incrementing ID.
2670
+ * Document sequence ID.
2670
2671
  */
2671
2672
  $sequence: number;
2672
2673
  /**
@@ -4015,6 +4016,14 @@ export namespace Models {
4015
4016
  * VCS (Version Control System) repository's default branch name.
4016
4017
  */
4017
4018
  defaultBranch: string;
4019
+ /**
4020
+ * VCS (Version Control System) installation ID.
4021
+ */
4022
+ providerInstallationId: string;
4023
+ /**
4024
+ * Is VCS (Version Control System) repository authorized for the installation?
4025
+ */
4026
+ authorized: boolean;
4018
4027
  /**
4019
4028
  * Last commit date in ISO 8601 format.
4020
4029
  */
@@ -4053,6 +4062,14 @@ export namespace Models {
4053
4062
  * VCS (Version Control System) repository's default branch name.
4054
4063
  */
4055
4064
  defaultBranch: string;
4065
+ /**
4066
+ * VCS (Version Control System) installation ID.
4067
+ */
4068
+ providerInstallationId: string;
4069
+ /**
4070
+ * Is VCS (Version Control System) repository authorized for the installation?
4071
+ */
4072
+ authorized: boolean;
4056
4073
  /**
4057
4074
  * Last commit date in ISO 8601 format.
4058
4075
  */
@@ -4095,6 +4112,14 @@ export namespace Models {
4095
4112
  * VCS (Version Control System) repository's default branch name.
4096
4113
  */
4097
4114
  defaultBranch: string;
4115
+ /**
4116
+ * VCS (Version Control System) installation ID.
4117
+ */
4118
+ providerInstallationId: string;
4119
+ /**
4120
+ * Is VCS (Version Control System) repository authorized for the installation?
4121
+ */
4122
+ authorized: boolean;
4098
4123
  /**
4099
4124
  * Last commit date in ISO 8601 format.
4100
4125
  */
@@ -4753,6 +4778,10 @@ export namespace Models {
4753
4778
  * Project blocks information
4754
4779
  */
4755
4780
  blocks: Block[];
4781
+ /**
4782
+ * Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused.
4783
+ */
4784
+ consoleAccessedAt: string;
4756
4785
  }
4757
4786
 
4758
4787
  /**
@@ -6401,6 +6430,50 @@ export namespace Models {
6401
6430
  * Comma-separated list of nameservers.
6402
6431
  */
6403
6432
  _APP_DOMAINS_NAMESERVERS: string;
6433
+ /**
6434
+ * Database adapter in use.
6435
+ */
6436
+ _APP_DB_ADAPTER: string;
6437
+ /**
6438
+ * Whether the database adapter supports relationships.
6439
+ */
6440
+ supportForRelationships: boolean;
6441
+ /**
6442
+ * Whether the database adapter supports operators.
6443
+ */
6444
+ supportForOperators: boolean;
6445
+ /**
6446
+ * Whether the database adapter supports spatial attributes.
6447
+ */
6448
+ supportForSpatials: boolean;
6449
+ /**
6450
+ * Whether the database adapter supports spatial indexes on nullable columns.
6451
+ */
6452
+ supportForSpatialIndexNull: boolean;
6453
+ /**
6454
+ * Whether the database adapter supports fulltext wildcard search.
6455
+ */
6456
+ supportForFulltextWildcard: boolean;
6457
+ /**
6458
+ * Whether the database adapter supports multiple fulltext indexes per collection.
6459
+ */
6460
+ supportForMultipleFulltextIndexes: boolean;
6461
+ /**
6462
+ * Whether the database adapter supports resizing attributes.
6463
+ */
6464
+ supportForAttributeResizing: boolean;
6465
+ /**
6466
+ * Whether the database adapter supports fixed schemas with row width limits.
6467
+ */
6468
+ supportForSchemas: boolean;
6469
+ /**
6470
+ * Maximum index length supported by the database adapter.
6471
+ */
6472
+ maxIndexLength: number;
6473
+ /**
6474
+ * Whether the database adapter uses integer sequence IDs.
6475
+ */
6476
+ supportForIntegerIds: boolean;
6404
6477
  }
6405
6478
 
6406
6479
  /**
@@ -6813,6 +6886,10 @@ export namespace Models {
6813
6886
  * Number of functions to be migrated.
6814
6887
  */
6815
6888
  function: number;
6889
+ /**
6890
+ * Number of sites to be migrated.
6891
+ */
6892
+ site: number;
6816
6893
  /**
6817
6894
  * Size of files to be migrated in mb.
6818
6895
  */
@@ -7355,6 +7432,10 @@ export namespace Models {
7355
7432
  * Log days
7356
7433
  */
7357
7434
  logs: number;
7435
+ /**
7436
+ * Number of days of console inactivity before a project is paused. 0 means pausing is disabled.
7437
+ */
7438
+ projectInactivityDays: number;
7358
7439
  /**
7359
7440
  * Alert threshold percentage
7360
7441
  */
@@ -8567,6 +8648,10 @@ export namespace Models {
8567
8648
  * Domain registrar (e.g. "appwrite" or "third_party").
8568
8649
  */
8569
8650
  registrar: string;
8651
+ /**
8652
+ * Payment status for domain purchase.
8653
+ */
8654
+ paymentStatus: string;
8570
8655
  /**
8571
8656
  * Nameservers setting. "Appwrite" or empty string.
8572
8657
  */
@@ -8584,7 +8669,7 @@ export namespace Models {
8584
8669
  */
8585
8670
  autoRenewal: boolean;
8586
8671
  /**
8587
- * Renewal price (in USD).
8672
+ * Renewal price (in cents).
8588
8673
  */
8589
8674
  renewalPrice: number;
8590
8675
  /**
@@ -8595,6 +8680,10 @@ export namespace Models {
8595
8680
  * Dns records
8596
8681
  */
8597
8682
  dnsRecords: DnsRecord[];
8683
+ /**
8684
+ * Domain transfer status (e.g., "pending", "completed", "failed").
8685
+ */
8686
+ transferStatus: string;
8598
8687
  }
8599
8688
 
8600
8689
  /**
@@ -8851,6 +8940,10 @@ export namespace Models {
8851
8940
  * Price period in years.
8852
8941
  */
8853
8942
  periodYears: number;
8943
+ /**
8944
+ * Whether the domain is a premium domain.
8945
+ */
8946
+ premium: boolean;
8854
8947
  }
8855
8948
 
8856
8949
  /**
@@ -8875,6 +8968,34 @@ export namespace Models {
8875
8968
  available: boolean;
8876
8969
  }
8877
8970
 
8971
+ /**
8972
+ * domainTransferOut
8973
+ */
8974
+ export type DomainTransferOut = {
8975
+ /**
8976
+ * Domain transfer authorization code.
8977
+ */
8978
+ authCode: string;
8979
+ }
8980
+
8981
+ /**
8982
+ * domainTransferStatus
8983
+ */
8984
+ export type DomainTransferStatus = {
8985
+ /**
8986
+ * Transfer status.
8987
+ */
8988
+ status: DomainTransferStatusStatus;
8989
+ /**
8990
+ * Additional transfer status information.
8991
+ */
8992
+ reason: string;
8993
+ /**
8994
+ * Transfer status timestamp in ISO 8601 format.
8995
+ */
8996
+ timestamp: string;
8997
+ }
8998
+
8878
8999
  /**
8879
9000
  * Activity event list
8880
9001
  */
package/src/query.ts CHANGED
@@ -272,7 +272,9 @@ export class Query {
272
272
 
273
273
  /**
274
274
  * Filter resources where attribute contains the specified value.
275
+ * For string attributes, checks if the string contains the substring.
275
276
  *
277
+ * Note: For array attributes, use {@link containsAny} or {@link containsAll} instead.
276
278
  * @param {string} attribute
277
279
  * @param {string | string[]} value
278
280
  * @returns {string}
@@ -280,6 +282,30 @@ export class Query {
280
282
  static contains = (attribute: string, value: string | any[]): string =>
281
283
  new Query("contains", attribute, value).toString();
282
284
 
285
+ /**
286
+ * Filter resources where attribute contains ANY of the specified values.
287
+ * For array and relationship attributes, matches documents where the attribute
288
+ * contains at least one of the given values.
289
+ *
290
+ * @param {string} attribute
291
+ * @param {any[]} value
292
+ * @returns {string}
293
+ */
294
+ static containsAny = (attribute: string, value: any[]): string =>
295
+ new Query("containsAny", attribute, value).toString();
296
+
297
+ /**
298
+ * Filter resources where attribute contains ALL of the specified values.
299
+ * For array and relationship attributes, matches documents where the attribute
300
+ * contains every one of the given values.
301
+ *
302
+ * @param {string} attribute
303
+ * @param {any[]} value
304
+ * @returns {string}
305
+ */
306
+ static containsAll = (attribute: string, value: any[]): string =>
307
+ new Query("containsAll", attribute, value).toString();
308
+
283
309
  /**
284
310
  * Filter resources where attribute does not contain the specified value.
285
311
  *
@@ -835,7 +835,7 @@ export class Account {
835
835
  }
836
836
 
837
837
  /**
838
- * Get a list of all API keys from the current account.
838
+ * Get a list of all API keys from the current account.
839
839
  *
840
840
  * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
841
841
  * @throws {AppwriteException}
@@ -843,7 +843,7 @@ export class Account {
843
843
  */
844
844
  listKeys(params?: { total?: boolean }): Promise<Models.KeyList>;
845
845
  /**
846
- * Get a list of all API keys from the current account.
846
+ * Get a list of all API keys from the current account.
847
847
  *
848
848
  * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
849
849
  * @throws {AppwriteException}
@@ -1188,7 +1188,7 @@ export class Databases {
1188
1188
  *
1189
1189
  *
1190
1190
  * @param {string} params.databaseId - Database ID.
1191
- * @param {string} params.collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1191
+ * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1192
1192
  * @param {string} params.key - Attribute Key.
1193
1193
  * @param {boolean} params.required - Is attribute required?
1194
1194
  * @param {boolean} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required.
@@ -1203,7 +1203,7 @@ export class Databases {
1203
1203
  *
1204
1204
  *
1205
1205
  * @param {string} databaseId - Database ID.
1206
- * @param {string} collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1206
+ * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1207
1207
  * @param {string} key - Attribute Key.
1208
1208
  * @param {boolean} required - Is attribute required?
1209
1209
  * @param {boolean} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required.
@@ -3660,6 +3660,90 @@ export class Databases {
3660
3660
  );
3661
3661
  }
3662
3662
 
3663
+ /**
3664
+ * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
3665
+ *
3666
+ *
3667
+ * @param {string} params.databaseId - Database ID.
3668
+ * @param {string} params.collectionId - Collection ID.
3669
+ * @param {string} params.key - Attribute Key.
3670
+ * @param {RelationMutate} params.onDelete - Constraints option
3671
+ * @param {string} params.newKey - New Attribute Key.
3672
+ * @throws {AppwriteException}
3673
+ * @returns {Promise<Models.AttributeRelationship>}
3674
+ * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead.
3675
+ */
3676
+ updateRelationshipAttribute(params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise<Models.AttributeRelationship>;
3677
+ /**
3678
+ * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
3679
+ *
3680
+ *
3681
+ * @param {string} databaseId - Database ID.
3682
+ * @param {string} collectionId - Collection ID.
3683
+ * @param {string} key - Attribute Key.
3684
+ * @param {RelationMutate} onDelete - Constraints option
3685
+ * @param {string} newKey - New Attribute Key.
3686
+ * @throws {AppwriteException}
3687
+ * @returns {Promise<Models.AttributeRelationship>}
3688
+ * @deprecated Use the object parameter style method for a better developer experience.
3689
+ */
3690
+ updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise<Models.AttributeRelationship>;
3691
+ updateRelationshipAttribute(
3692
+ paramsOrFirst: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string,
3693
+ ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?]
3694
+ ): Promise<Models.AttributeRelationship> {
3695
+ let params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string };
3696
+
3697
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3698
+ params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string };
3699
+ } else {
3700
+ params = {
3701
+ databaseId: paramsOrFirst as string,
3702
+ collectionId: rest[0] as string,
3703
+ key: rest[1] as string,
3704
+ onDelete: rest[2] as RelationMutate,
3705
+ newKey: rest[3] as string
3706
+ };
3707
+ }
3708
+
3709
+ const databaseId = params.databaseId;
3710
+ const collectionId = params.collectionId;
3711
+ const key = params.key;
3712
+ const onDelete = params.onDelete;
3713
+ const newKey = params.newKey;
3714
+
3715
+ if (typeof databaseId === 'undefined') {
3716
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3717
+ }
3718
+ if (typeof collectionId === 'undefined') {
3719
+ throw new AppwriteException('Missing required parameter: "collectionId"');
3720
+ }
3721
+ if (typeof key === 'undefined') {
3722
+ throw new AppwriteException('Missing required parameter: "key"');
3723
+ }
3724
+
3725
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
3726
+ const payload: Payload = {};
3727
+ if (typeof onDelete !== 'undefined') {
3728
+ payload['onDelete'] = onDelete;
3729
+ }
3730
+ if (typeof newKey !== 'undefined') {
3731
+ payload['newKey'] = newKey;
3732
+ }
3733
+ const uri = new URL(this.client.config.endpoint + apiPath);
3734
+
3735
+ const apiHeaders: { [header: string]: string } = {
3736
+ 'content-type': 'application/json',
3737
+ }
3738
+
3739
+ return this.client.call(
3740
+ 'patch',
3741
+ uri,
3742
+ apiHeaders,
3743
+ payload
3744
+ );
3745
+ }
3746
+
3663
3747
  /**
3664
3748
  * Create a string attribute.
3665
3749
  *
@@ -4622,90 +4706,6 @@ export class Databases {
4622
4706
  );
4623
4707
  }
4624
4708
 
4625
- /**
4626
- * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
4627
- *
4628
- *
4629
- * @param {string} params.databaseId - Database ID.
4630
- * @param {string} params.collectionId - Collection ID.
4631
- * @param {string} params.key - Attribute Key.
4632
- * @param {RelationMutate} params.onDelete - Constraints option
4633
- * @param {string} params.newKey - New Attribute Key.
4634
- * @throws {AppwriteException}
4635
- * @returns {Promise<Models.AttributeRelationship>}
4636
- * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead.
4637
- */
4638
- updateRelationshipAttribute(params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise<Models.AttributeRelationship>;
4639
- /**
4640
- * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
4641
- *
4642
- *
4643
- * @param {string} databaseId - Database ID.
4644
- * @param {string} collectionId - Collection ID.
4645
- * @param {string} key - Attribute Key.
4646
- * @param {RelationMutate} onDelete - Constraints option
4647
- * @param {string} newKey - New Attribute Key.
4648
- * @throws {AppwriteException}
4649
- * @returns {Promise<Models.AttributeRelationship>}
4650
- * @deprecated Use the object parameter style method for a better developer experience.
4651
- */
4652
- updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise<Models.AttributeRelationship>;
4653
- updateRelationshipAttribute(
4654
- paramsOrFirst: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string,
4655
- ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?]
4656
- ): Promise<Models.AttributeRelationship> {
4657
- let params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string };
4658
-
4659
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4660
- params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string };
4661
- } else {
4662
- params = {
4663
- databaseId: paramsOrFirst as string,
4664
- collectionId: rest[0] as string,
4665
- key: rest[1] as string,
4666
- onDelete: rest[2] as RelationMutate,
4667
- newKey: rest[3] as string
4668
- };
4669
- }
4670
-
4671
- const databaseId = params.databaseId;
4672
- const collectionId = params.collectionId;
4673
- const key = params.key;
4674
- const onDelete = params.onDelete;
4675
- const newKey = params.newKey;
4676
-
4677
- if (typeof databaseId === 'undefined') {
4678
- throw new AppwriteException('Missing required parameter: "databaseId"');
4679
- }
4680
- if (typeof collectionId === 'undefined') {
4681
- throw new AppwriteException('Missing required parameter: "collectionId"');
4682
- }
4683
- if (typeof key === 'undefined') {
4684
- throw new AppwriteException('Missing required parameter: "key"');
4685
- }
4686
-
4687
- const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
4688
- const payload: Payload = {};
4689
- if (typeof onDelete !== 'undefined') {
4690
- payload['onDelete'] = onDelete;
4691
- }
4692
- if (typeof newKey !== 'undefined') {
4693
- payload['newKey'] = newKey;
4694
- }
4695
- const uri = new URL(this.client.config.endpoint + apiPath);
4696
-
4697
- const apiHeaders: { [header: string]: string } = {
4698
- 'content-type': 'application/json',
4699
- }
4700
-
4701
- return this.client.call(
4702
- 'patch',
4703
- uri,
4704
- apiHeaders,
4705
- payload
4706
- );
4707
- }
4708
-
4709
4709
  /**
4710
4710
  * Get a list of all the user's documents in a given collection. You can use the query params to filter your results.
4711
4711
  *
@@ -4714,11 +4714,12 @@ export class Databases {
4714
4714
  * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
4715
4715
  * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction.
4716
4716
  * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
4717
+ * @param {number} params.ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).
4717
4718
  * @throws {AppwriteException}
4718
4719
  * @returns {Promise<Models.DocumentList<Document>>}
4719
4720
  * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead.
4720
4721
  */
4721
- listDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean }): Promise<Models.DocumentList<Document>>;
4722
+ listDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise<Models.DocumentList<Document>>;
4722
4723
  /**
4723
4724
  * Get a list of all the user's documents in a given collection. You can use the query params to filter your results.
4724
4725
  *
@@ -4727,26 +4728,28 @@ export class Databases {
4727
4728
  * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
4728
4729
  * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction.
4729
4730
  * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
4731
+ * @param {number} ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).
4730
4732
  * @throws {AppwriteException}
4731
4733
  * @returns {Promise<Models.DocumentList<Document>>}
4732
4734
  * @deprecated Use the object parameter style method for a better developer experience.
4733
4735
  */
4734
- listDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean): Promise<Models.DocumentList<Document>>;
4736
+ listDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise<Models.DocumentList<Document>>;
4735
4737
  listDocuments<Document extends Models.Document = Models.DefaultDocument>(
4736
- paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean } | string,
4737
- ...rest: [(string)?, (string[])?, (string)?, (boolean)?]
4738
+ paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string,
4739
+ ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?]
4738
4740
  ): Promise<Models.DocumentList<Document>> {
4739
- let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean };
4741
+ let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number };
4740
4742
 
4741
4743
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4742
- params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean };
4744
+ params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number };
4743
4745
  } else {
4744
4746
  params = {
4745
4747
  databaseId: paramsOrFirst as string,
4746
4748
  collectionId: rest[0] as string,
4747
4749
  queries: rest[1] as string[],
4748
4750
  transactionId: rest[2] as string,
4749
- total: rest[3] as boolean
4751
+ total: rest[3] as boolean,
4752
+ ttl: rest[4] as number
4750
4753
  };
4751
4754
  }
4752
4755
 
@@ -4755,6 +4758,7 @@ export class Databases {
4755
4758
  const queries = params.queries;
4756
4759
  const transactionId = params.transactionId;
4757
4760
  const total = params.total;
4761
+ const ttl = params.ttl;
4758
4762
 
4759
4763
  if (typeof databaseId === 'undefined') {
4760
4764
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -4774,6 +4778,9 @@ export class Databases {
4774
4778
  if (typeof total !== 'undefined') {
4775
4779
  payload['total'] = total;
4776
4780
  }
4781
+ if (typeof ttl !== 'undefined') {
4782
+ payload['ttl'] = ttl;
4783
+ }
4777
4784
  const uri = new URL(this.client.config.endpoint + apiPath);
4778
4785
 
4779
4786
  const apiHeaders: { [header: string]: string } = {