node-appwrite 8.2.0 → 9.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 (30) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +2 -2
  3. package/docs/examples/account/update-password.md +1 -1
  4. package/docs/examples/databases/create-relationship-attribute.md +20 -0
  5. package/docs/examples/databases/update-boolean-attribute.md +20 -0
  6. package/docs/examples/databases/update-datetime-attribute.md +20 -0
  7. package/docs/examples/databases/update-email-attribute.md +20 -0
  8. package/docs/examples/databases/update-enum-attribute.md +20 -0
  9. package/docs/examples/databases/update-float-attribute.md +20 -0
  10. package/docs/examples/databases/update-integer-attribute.md +20 -0
  11. package/docs/examples/databases/update-ip-attribute.md +20 -0
  12. package/docs/examples/databases/update-relationship-attribute.md +20 -0
  13. package/docs/examples/databases/update-string-attribute.md +20 -0
  14. package/docs/examples/databases/update-url-attribute.md +20 -0
  15. package/docs/examples/functions/create.md +1 -1
  16. package/docs/examples/functions/update.md +1 -1
  17. package/docs/examples/teams/create-membership.md +1 -1
  18. package/docs/examples/teams/get-prefs.md +20 -0
  19. package/docs/examples/teams/{update.md → update-name.md} +1 -1
  20. package/docs/examples/teams/update-prefs.md +20 -0
  21. package/docs/examples/users/update-password.md +1 -1
  22. package/index.d.ts +334 -112
  23. package/lib/client.js +2 -1
  24. package/lib/inputFile.js +6 -8
  25. package/lib/query.js +18 -0
  26. package/lib/services/databases.js +720 -104
  27. package/lib/services/functions.js +45 -45
  28. package/lib/services/storage.js +43 -35
  29. package/lib/services/teams.js +87 -19
  30. package/package.json +6 -4
package/index.d.ts CHANGED
@@ -120,7 +120,7 @@ declare module "node-appwrite" {
120
120
  /**
121
121
  * Teams List
122
122
  */
123
- export type TeamList = {
123
+ export type TeamList<Preferences extends Models.Preferences> = {
124
124
  /**
125
125
  * Total number of teams documents that matched your query.
126
126
  */
@@ -128,7 +128,7 @@ declare module "node-appwrite" {
128
128
  /**
129
129
  * List of teams.
130
130
  */
131
- teams: Team[];
131
+ teams: Team<Preferences>[];
132
132
  }
133
133
  /**
134
134
  * Memberships List
@@ -658,6 +658,55 @@ declare module "node-appwrite" {
658
658
  xdefault?: string;
659
659
  }
660
660
  /**
661
+ * AttributeRelationship
662
+ */
663
+ export type AttributeRelationship = {
664
+ /**
665
+ * Attribute Key.
666
+ */
667
+ key: string;
668
+ /**
669
+ * Attribute type.
670
+ */
671
+ type: string;
672
+ /**
673
+ * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
674
+ */
675
+ status: string;
676
+ /**
677
+ * Is attribute required?
678
+ */
679
+ required: boolean;
680
+ /**
681
+ * Is attribute an array?
682
+ */
683
+ array?: boolean;
684
+ /**
685
+ * The ID of the related collection.
686
+ */
687
+ relatedCollection: string;
688
+ /**
689
+ * The type of the relationship.
690
+ */
691
+ relationType: string;
692
+ /**
693
+ * Is the relationship two-way?
694
+ */
695
+ twoWay: boolean;
696
+ /**
697
+ * The key of the two-way relationship.
698
+ */
699
+ twoWayKey: string;
700
+ /**
701
+ * How deleting the parent document will propagate to child documents.
702
+ */
703
+ onDelete: string;
704
+ /**
705
+ * Whether this is the parent or child side of the relationship
706
+ */
707
+ side: string;
708
+ }
709
+ /**
661
710
  * Index
662
711
  */
663
712
  export type Index = {
@@ -823,15 +872,15 @@ declare module "node-appwrite" {
823
872
  /**
824
873
  * Hashed user password.
825
874
  */
826
- password: string;
875
+ password?: string;
827
876
  /**
828
877
  * Password hashing algorithm.
829
878
  */
830
- hash: string;
879
+ hash?: string;
831
880
  /**
832
881
  * Password hashing algorithm configuration.
833
882
  */
834
- hashOptions: object;
883
+ hashOptions?: object;
835
884
  /**
836
885
  * User registration date in ISO 8601 format.
837
886
  */
@@ -969,59 +1018,6 @@ declare module "node-appwrite" {
969
1018
  threads: number;
970
1019
  }
971
1020
  /**
972
- * Account
973
- */
974
- export type Account<Preferences extends Models.Preferences> = {
975
- /**
976
- * User ID.
977
- */
978
- $id: string;
979
- /**
980
- * User creation date in ISO 8601 format.
981
- */
982
- $createdAt: string;
983
- /**
984
- * User update date in ISO 8601 format.
985
- */
986
- $updatedAt: string;
987
- /**
988
- * User name.
989
- */
990
- name: string;
991
- /**
992
- * User registration date in ISO 8601 format.
993
- */
994
- registration: string;
995
- /**
996
- * User status. Pass `true` for enabled and `false` for disabled.
997
- */
998
- status: boolean;
999
- /**
1000
- * Password update time in ISO 8601 format.
1001
- */
1002
- passwordUpdate: string;
1003
- /**
1004
- * User email address.
1005
- */
1006
- email: string;
1007
- /**
1008
- * User phone number in E.164 format.
1009
- */
1010
- phone: string;
1011
- /**
1012
- * Email verification status.
1013
- */
1014
- emailVerification: boolean;
1015
- /**
1016
- * Phone verification status.
1017
- */
1018
- phoneVerification: boolean;
1019
- /**
1020
- * User preferences as a key-value object
1021
- */
1022
- prefs: Preferences;
1023
- }
1024
- /**
1025
1021
  * Preferences
1026
1022
  */
1027
1023
  export type Preferences = {
@@ -1181,7 +1177,7 @@ declare module "node-appwrite" {
1181
1177
  */
1182
1178
  continent: string;
1183
1179
  /**
1184
- * True if country is part of the Europian Union.
1180
+ * True if country is part of the European Union.
1185
1181
  */
1186
1182
  eu: boolean;
1187
1183
  /**
@@ -1294,7 +1290,7 @@ declare module "node-appwrite" {
1294
1290
  /**
1295
1291
  * Team
1296
1292
  */
1297
- export type Team = {
1293
+ export type Team<Preferences extends Models.Preferences> = {
1298
1294
  /**
1299
1295
  * Team ID.
1300
1296
  */
@@ -1315,6 +1311,10 @@ declare module "node-appwrite" {
1315
1311
  * Total number of team members.
1316
1312
  */
1317
1313
  total: number;
1314
+ /**
1315
+ * Team preferences as a key-value object
1316
+ */
1317
+ prefs: Preferences;
1318
1318
  }
1319
1319
  /**
1320
1320
  * Membership
@@ -1826,11 +1826,13 @@ declare module "node-appwrite" {
1826
1826
 
1827
1827
  static fromBuffer(buffer: Buffer, filename: string): InputFile;
1828
1828
 
1829
- static fromBlob(blob: Blob, filename: string): InputFile;
1829
+ static fromBlob(blob: Blob, filename: string): Promise<InputFile>;
1830
1830
 
1831
- static fromStream(stream: any, filename: string, size: number): InputFile;
1831
+ static fromStream(stream: NodeJS.ReadableStream, filename: string, size: number): InputFile;
1832
1832
 
1833
1833
  static fromPlainText(content: string, filename: string): InputFile;
1834
+
1835
+ constructor(stream: NodeJS.ReadableStream, filename: string, size: number);
1834
1836
  }
1835
1837
 
1836
1838
  type QueryTypesSingle = string | number | boolean;
@@ -1850,6 +1852,18 @@ declare module "node-appwrite" {
1850
1852
 
1851
1853
  static greaterThanEqual(attribute: string, value: QueryTypes): string;
1852
1854
 
1855
+ static isNull(attribute: string): string;
1856
+
1857
+ static isNotNull(attribute: string): string;
1858
+
1859
+ static between<T extends string | number>(attribute: string, start: T, end: T): string;
1860
+
1861
+ static startsWith(attribute: string, value: string): string;
1862
+
1863
+ static endsWith(attribute: string, value: string): string;
1864
+
1865
+ static select(attributes: string[]): string;
1866
+
1853
1867
  static search(attribute: string, value: string): string;
1854
1868
 
1855
1869
  static orderDesc(attribute: string): string;
@@ -1902,7 +1916,7 @@ declare module "node-appwrite" {
1902
1916
  * @throws {AppwriteException}
1903
1917
  * @returns {Promise}
1904
1918
  */
1905
- get<Preferences extends Models.Preferences>(): Promise<Models.Account<Preferences>>;
1919
+ get<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>>;
1906
1920
  /**
1907
1921
  * Update Email
1908
1922
  *
@@ -1920,7 +1934,7 @@ declare module "node-appwrite" {
1920
1934
  * @throws {AppwriteException}
1921
1935
  * @returns {Promise}
1922
1936
  */
1923
- updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.Account<Preferences>>;
1937
+ updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.User<Preferences>>;
1924
1938
  /**
1925
1939
  * List Logs
1926
1940
  *
@@ -1941,7 +1955,7 @@ declare module "node-appwrite" {
1941
1955
  * @throws {AppwriteException}
1942
1956
  * @returns {Promise}
1943
1957
  */
1944
- updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.Account<Preferences>>;
1958
+ updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.User<Preferences>>;
1945
1959
  /**
1946
1960
  * Update Password
1947
1961
  *
@@ -1954,7 +1968,7 @@ declare module "node-appwrite" {
1954
1968
  * @throws {AppwriteException}
1955
1969
  * @returns {Promise}
1956
1970
  */
1957
- updatePassword<Preferences extends Models.Preferences>(password: string, oldPassword?: string): Promise<Models.Account<Preferences>>;
1971
+ updatePassword<Preferences extends Models.Preferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>>;
1958
1972
  /**
1959
1973
  * Update Phone
1960
1974
  *
@@ -1969,7 +1983,7 @@ declare module "node-appwrite" {
1969
1983
  * @throws {AppwriteException}
1970
1984
  * @returns {Promise}
1971
1985
  */
1972
- updatePhone<Preferences extends Models.Preferences>(phone: string, password: string): Promise<Models.Account<Preferences>>;
1986
+ updatePhone<Preferences extends Models.Preferences>(phone: string, password: string): Promise<Models.User<Preferences>>;
1973
1987
  /**
1974
1988
  * Get Account Preferences
1975
1989
  *
@@ -1990,7 +2004,7 @@ declare module "node-appwrite" {
1990
2004
  * @throws {AppwriteException}
1991
2005
  * @returns {Promise}
1992
2006
  */
1993
- updatePrefs<Preferences extends Models.Preferences>(prefs: object): Promise<Models.Account<Preferences>>;
2007
+ updatePrefs<Preferences extends Models.Preferences>(prefs: object): Promise<Models.User<Preferences>>;
1994
2008
  /**
1995
2009
  * Create Password Recovery
1996
2010
  *
@@ -2049,7 +2063,7 @@ declare module "node-appwrite" {
2049
2063
  * @throws {AppwriteException}
2050
2064
  * @returns {Promise}
2051
2065
  */
2052
- deleteSessions(): Promise<Response>;
2066
+ deleteSessions(): Promise<string>;
2053
2067
  /**
2054
2068
  * Get Session
2055
2069
  *
@@ -2085,7 +2099,7 @@ declare module "node-appwrite" {
2085
2099
  * @throws {AppwriteException}
2086
2100
  * @returns {Promise}
2087
2101
  */
2088
- deleteSession(sessionId: string): Promise<Response>;
2102
+ deleteSession(sessionId: string): Promise<string>;
2089
2103
  /**
2090
2104
  * Update Status
2091
2105
  *
@@ -2096,7 +2110,7 @@ declare module "node-appwrite" {
2096
2110
  * @throws {AppwriteException}
2097
2111
  * @returns {Promise}
2098
2112
  */
2099
- updateStatus<Preferences extends Models.Preferences>(): Promise<Models.Account<Preferences>>;
2113
+ updateStatus<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>>;
2100
2114
  /**
2101
2115
  * Create Email Verification
2102
2116
  *
@@ -2367,7 +2381,7 @@ declare module "node-appwrite" {
2367
2381
  * @throws {AppwriteException}
2368
2382
  * @returns {Promise}
2369
2383
  */
2370
- delete(databaseId: string): Promise<Response>;
2384
+ delete(databaseId: string): Promise<string>;
2371
2385
  /**
2372
2386
  * List Collections
2373
2387
  *
@@ -2436,7 +2450,7 @@ declare module "node-appwrite" {
2436
2450
  * @throws {AppwriteException}
2437
2451
  * @returns {Promise}
2438
2452
  */
2439
- deleteCollection(databaseId: string, collectionId: string): Promise<Response>;
2453
+ deleteCollection(databaseId: string, collectionId: string): Promise<string>;
2440
2454
  /**
2441
2455
  * List Attributes
2442
2456
  *
@@ -2462,6 +2476,18 @@ declare module "node-appwrite" {
2462
2476
  * @returns {Promise}
2463
2477
  */
2464
2478
  createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.AttributeBoolean>;
2479
+ /**
2480
+ * Update Boolean Attribute
2481
+ *
2482
+ * @param {string} databaseId
2483
+ * @param {string} collectionId
2484
+ * @param {string} key
2485
+ * @param {boolean} required
2486
+ * @param {boolean} default
2487
+ * @throws {AppwriteException}
2488
+ * @returns {Promise}
2489
+ */
2490
+ updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean): Promise<Models.AttributeBoolean>;
2465
2491
  /**
2466
2492
  * Create DateTime Attribute
2467
2493
  *
@@ -2475,6 +2501,18 @@ declare module "node-appwrite" {
2475
2501
  * @returns {Promise}
2476
2502
  */
2477
2503
  createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeDatetime>;
2504
+ /**
2505
+ * Update DateTime Attribute
2506
+ *
2507
+ * @param {string} databaseId
2508
+ * @param {string} collectionId
2509
+ * @param {string} key
2510
+ * @param {boolean} required
2511
+ * @param {string} default
2512
+ * @throws {AppwriteException}
2513
+ * @returns {Promise}
2514
+ */
2515
+ updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeDatetime>;
2478
2516
  /**
2479
2517
  * Create Email Attribute
2480
2518
  *
@@ -2491,6 +2529,22 @@ declare module "node-appwrite" {
2491
2529
  * @returns {Promise}
2492
2530
  */
2493
2531
  createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEmail>;
2532
+ /**
2533
+ * Update Email Attribute
2534
+ *
2535
+ * Update an email attribute. Changing the `default` value will not update
2536
+ * already existing documents.
2537
+ *
2538
+ *
2539
+ * @param {string} databaseId
2540
+ * @param {string} collectionId
2541
+ * @param {string} key
2542
+ * @param {boolean} required
2543
+ * @param {string} default
2544
+ * @throws {AppwriteException}
2545
+ * @returns {Promise}
2546
+ */
2547
+ updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeEmail>;
2494
2548
  /**
2495
2549
  * Create Enum Attribute
2496
2550
  *
@@ -2505,6 +2559,23 @@ declare module "node-appwrite" {
2505
2559
  * @returns {Promise}
2506
2560
  */
2507
2561
  createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEnum>;
2562
+ /**
2563
+ * Update Enum Attribute
2564
+ *
2565
+ * Update an enum attribute. Changing the `default` value will not update
2566
+ * already existing documents.
2567
+ *
2568
+ *
2569
+ * @param {string} databaseId
2570
+ * @param {string} collectionId
2571
+ * @param {string} key
2572
+ * @param {string[]} elements
2573
+ * @param {boolean} required
2574
+ * @param {string} default
2575
+ * @throws {AppwriteException}
2576
+ * @returns {Promise}
2577
+ */
2578
+ updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string): Promise<Models.AttributeEnum>;
2508
2579
  /**
2509
2580
  * Create Float Attribute
2510
2581
  *
@@ -2524,6 +2595,24 @@ declare module "node-appwrite" {
2524
2595
  * @returns {Promise}
2525
2596
  */
2526
2597
  createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat>;
2598
+ /**
2599
+ * Update Float Attribute
2600
+ *
2601
+ * Update a float attribute. Changing the `default` value will not update
2602
+ * already existing documents.
2603
+ *
2604
+ *
2605
+ * @param {string} databaseId
2606
+ * @param {string} collectionId
2607
+ * @param {string} key
2608
+ * @param {boolean} required
2609
+ * @param {number} min
2610
+ * @param {number} max
2611
+ * @param {number} default
2612
+ * @throws {AppwriteException}
2613
+ * @returns {Promise}
2614
+ */
2615
+ updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise<Models.AttributeFloat>;
2527
2616
  /**
2528
2617
  * Create Integer Attribute
2529
2618
  *
@@ -2543,6 +2632,24 @@ declare module "node-appwrite" {
2543
2632
  * @returns {Promise}
2544
2633
  */
2545
2634
  createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeInteger>;
2635
+ /**
2636
+ * Update Integer Attribute
2637
+ *
2638
+ * Update an integer attribute. Changing the `default` value will not update
2639
+ * already existing documents.
2640
+ *
2641
+ *
2642
+ * @param {string} databaseId
2643
+ * @param {string} collectionId
2644
+ * @param {string} key
2645
+ * @param {boolean} required
2646
+ * @param {number} min
2647
+ * @param {number} max
2648
+ * @param {number} default
2649
+ * @throws {AppwriteException}
2650
+ * @returns {Promise}
2651
+ */
2652
+ updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise<Models.AttributeInteger>;
2546
2653
  /**
2547
2654
  * Create IP Address Attribute
2548
2655
  *
@@ -2559,6 +2666,41 @@ declare module "node-appwrite" {
2559
2666
  * @returns {Promise}
2560
2667
  */
2561
2668
  createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeIp>;
2669
+ /**
2670
+ * Update IP Address Attribute
2671
+ *
2672
+ * Update an ip attribute. Changing the `default` value will not update
2673
+ * already existing documents.
2674
+ *
2675
+ *
2676
+ * @param {string} databaseId
2677
+ * @param {string} collectionId
2678
+ * @param {string} key
2679
+ * @param {boolean} required
2680
+ * @param {string} default
2681
+ * @throws {AppwriteException}
2682
+ * @returns {Promise}
2683
+ */
2684
+ updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeIp>;
2685
+ /**
2686
+ * Create Relationship Attribute
2687
+ *
2688
+ * Create relationship attribute. [Learn more about relationship
2689
+ * attributes](/docs/databases-relationships#relationship-attributes).
2690
+ *
2691
+ *
2692
+ * @param {string} databaseId
2693
+ * @param {string} collectionId
2694
+ * @param {string} relatedCollectionId
2695
+ * @param {string} type
2696
+ * @param {boolean} twoWay
2697
+ * @param {string} key
2698
+ * @param {string} twoWayKey
2699
+ * @param {string} onDelete
2700
+ * @throws {AppwriteException}
2701
+ * @returns {Promise}
2702
+ */
2703
+ createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: string, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: string): Promise<Models.AttributeRelationship>;
2562
2704
  /**
2563
2705
  * Create String Attribute
2564
2706
  *
@@ -2576,6 +2718,22 @@ declare module "node-appwrite" {
2576
2718
  * @returns {Promise}
2577
2719
  */
2578
2720
  createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeString>;
2721
+ /**
2722
+ * Update String Attribute
2723
+ *
2724
+ * Update a string attribute. Changing the `default` value will not update
2725
+ * already existing documents.
2726
+ *
2727
+ *
2728
+ * @param {string} databaseId
2729
+ * @param {string} collectionId
2730
+ * @param {string} key
2731
+ * @param {boolean} required
2732
+ * @param {string} default
2733
+ * @throws {AppwriteException}
2734
+ * @returns {Promise}
2735
+ */
2736
+ updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeString>;
2579
2737
  /**
2580
2738
  * Create URL Attribute
2581
2739
  *
@@ -2592,6 +2750,22 @@ declare module "node-appwrite" {
2592
2750
  * @returns {Promise}
2593
2751
  */
2594
2752
  createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeUrl>;
2753
+ /**
2754
+ * Update URL Attribute
2755
+ *
2756
+ * Update an url attribute. Changing the `default` value will not update
2757
+ * already existing documents.
2758
+ *
2759
+ *
2760
+ * @param {string} databaseId
2761
+ * @param {string} collectionId
2762
+ * @param {string} key
2763
+ * @param {boolean} required
2764
+ * @param {string} default
2765
+ * @throws {AppwriteException}
2766
+ * @returns {Promise}
2767
+ */
2768
+ updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeUrl>;
2595
2769
  /**
2596
2770
  * Get Attribute
2597
2771
  *
@@ -2601,7 +2775,7 @@ declare module "node-appwrite" {
2601
2775
  * @throws {AppwriteException}
2602
2776
  * @returns {Promise}
2603
2777
  */
2604
- getAttribute(databaseId: string, collectionId: string, key: string): Promise<Response>;
2778
+ getAttribute(databaseId: string, collectionId: string, key: string): Promise<any>;
2605
2779
  /**
2606
2780
  * Delete Attribute
2607
2781
  *
@@ -2611,7 +2785,22 @@ declare module "node-appwrite" {
2611
2785
  * @throws {AppwriteException}
2612
2786
  * @returns {Promise}
2613
2787
  */
2614
- deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<Response>;
2788
+ deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<string>;
2789
+ /**
2790
+ * Update Relationship Attribute
2791
+ *
2792
+ * Update relationship attribute. [Learn more about relationship
2793
+ * attributes](/docs/databases-relationships#relationship-attributes).
2794
+ *
2795
+ *
2796
+ * @param {string} databaseId
2797
+ * @param {string} collectionId
2798
+ * @param {string} key
2799
+ * @param {string} onDelete
2800
+ * @throws {AppwriteException}
2801
+ * @returns {Promise}
2802
+ */
2803
+ updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: string): Promise<Models.AttributeRelationship>;
2615
2804
  /**
2616
2805
  * List Documents
2617
2806
  *
@@ -2651,10 +2840,11 @@ declare module "node-appwrite" {
2651
2840
  * @param {string} databaseId
2652
2841
  * @param {string} collectionId
2653
2842
  * @param {string} documentId
2843
+ * @param {string[]} queries
2654
2844
  * @throws {AppwriteException}
2655
2845
  * @returns {Promise}
2656
2846
  */
2657
- getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string): Promise<Document>;
2847
+ getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Document>;
2658
2848
  /**
2659
2849
  * Update Document
2660
2850
  *
@@ -2681,7 +2871,7 @@ declare module "node-appwrite" {
2681
2871
  * @throws {AppwriteException}
2682
2872
  * @returns {Promise}
2683
2873
  */
2684
- deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<Response>;
2874
+ deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<string>;
2685
2875
  /**
2686
2876
  * List Indexes
2687
2877
  *
@@ -2723,7 +2913,7 @@ declare module "node-appwrite" {
2723
2913
  * @throws {AppwriteException}
2724
2914
  * @returns {Promise}
2725
2915
  */
2726
- deleteIndex(databaseId: string, collectionId: string, key: string): Promise<Response>;
2916
+ deleteIndex(databaseId: string, collectionId: string, key: string): Promise<string>;
2727
2917
  }
2728
2918
  export class Functions extends Service {
2729
2919
  constructor(client: Client);
@@ -2749,8 +2939,8 @@ declare module "node-appwrite" {
2749
2939
  *
2750
2940
  * @param {string} functionId
2751
2941
  * @param {string} name
2752
- * @param {string[]} execute
2753
2942
  * @param {string} runtime
2943
+ * @param {string[]} execute
2754
2944
  * @param {string[]} events
2755
2945
  * @param {string} schedule
2756
2946
  * @param {number} timeout
@@ -2758,7 +2948,7 @@ declare module "node-appwrite" {
2758
2948
  * @throws {AppwriteException}
2759
2949
  * @returns {Promise}
2760
2950
  */
2761
- create(functionId: string, name: string, execute: string[], runtime: string, events?: string[], schedule?: string, timeout?: number, enabled?: boolean): Promise<Models.Function>;
2951
+ create(functionId: string, name: string, runtime: string, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean): Promise<Models.Function>;
2762
2952
  /**
2763
2953
  * List runtimes
2764
2954
  *
@@ -2793,7 +2983,7 @@ declare module "node-appwrite" {
2793
2983
  * @throws {AppwriteException}
2794
2984
  * @returns {Promise}
2795
2985
  */
2796
- update(functionId: string, name: string, execute: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean): Promise<Models.Function>;
2986
+ update(functionId: string, name: string, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean): Promise<Models.Function>;
2797
2987
  /**
2798
2988
  * Delete Function
2799
2989
  *
@@ -2803,7 +2993,7 @@ declare module "node-appwrite" {
2803
2993
  * @throws {AppwriteException}
2804
2994
  * @returns {Promise}
2805
2995
  */
2806
- delete(functionId: string): Promise<Response>;
2996
+ delete(functionId: string): Promise<string>;
2807
2997
  /**
2808
2998
  * List Deployments
2809
2999
  *
@@ -2873,7 +3063,7 @@ declare module "node-appwrite" {
2873
3063
  * @throws {AppwriteException}
2874
3064
  * @returns {Promise}
2875
3065
  */
2876
- deleteDeployment(functionId: string, deploymentId: string): Promise<Response>;
3066
+ deleteDeployment(functionId: string, deploymentId: string): Promise<string>;
2877
3067
  /**
2878
3068
  * Create Build
2879
3069
  *
@@ -2883,7 +3073,7 @@ declare module "node-appwrite" {
2883
3073
  * @throws {AppwriteException}
2884
3074
  * @returns {Promise}
2885
3075
  */
2886
- createBuild(functionId: string, deploymentId: string, buildId: string): Promise<Response>;
3076
+ createBuild(functionId: string, deploymentId: string, buildId: string): Promise<any>;
2887
3077
  /**
2888
3078
  * List Executions
2889
3079
  *
@@ -2980,7 +3170,7 @@ declare module "node-appwrite" {
2980
3170
  * @throws {AppwriteException}
2981
3171
  * @returns {Promise}
2982
3172
  */
2983
- deleteVariable(functionId: string, variableId: string): Promise<Response>;
3173
+ deleteVariable(functionId: string, variableId: string): Promise<string>;
2984
3174
  }
2985
3175
  export class Graphql extends Service {
2986
3176
  constructor(client: Client);
@@ -2994,7 +3184,7 @@ declare module "node-appwrite" {
2994
3184
  * @throws {AppwriteException}
2995
3185
  * @returns {Promise}
2996
3186
  */
2997
- query(query: object): Promise<Response>;
3187
+ query(query: object): Promise<any>;
2998
3188
  /**
2999
3189
  * GraphQL Endpoint
3000
3190
  *
@@ -3004,7 +3194,7 @@ declare module "node-appwrite" {
3004
3194
  * @throws {AppwriteException}
3005
3195
  * @returns {Promise}
3006
3196
  */
3007
- mutation(query: object): Promise<Response>;
3197
+ mutation(query: object): Promise<any>;
3008
3198
  }
3009
3199
  export class Health extends Service {
3010
3200
  constructor(client: Client);
@@ -3261,7 +3451,7 @@ declare module "node-appwrite" {
3261
3451
  * @throws {AppwriteException}
3262
3452
  * @returns {Promise}
3263
3453
  */
3264
- deleteBucket(bucketId: string): Promise<Response>;
3454
+ deleteBucket(bucketId: string): Promise<string>;
3265
3455
  /**
3266
3456
  * List Files
3267
3457
  *
@@ -3341,7 +3531,7 @@ declare module "node-appwrite" {
3341
3531
  * @throws {AppwriteException}
3342
3532
  * @returns {Promise}
3343
3533
  */
3344
- deleteFile(bucketId: string, fileId: string): Promise<Response>;
3534
+ deleteFile(bucketId: string, fileId: string): Promise<string>;
3345
3535
  /**
3346
3536
  * Get File for Download
3347
3537
  *
@@ -3409,7 +3599,7 @@ declare module "node-appwrite" {
3409
3599
  * @throws {AppwriteException}
3410
3600
  * @returns {Promise}
3411
3601
  */
3412
- list(queries?: string[], search?: string): Promise<Models.TeamList>;
3602
+ list<Preferences extends Models.Preferences>(queries?: string[], search?: string): Promise<Models.TeamList<Preferences>>;
3413
3603
  /**
3414
3604
  * Create Team
3415
3605
  *
@@ -3423,7 +3613,7 @@ declare module "node-appwrite" {
3423
3613
  * @throws {AppwriteException}
3424
3614
  * @returns {Promise}
3425
3615
  */
3426
- create(teamId: string, name: string, roles?: string[]): Promise<Models.Team>;
3616
+ create<Preferences extends Models.Preferences>(teamId: string, name: string, roles?: string[]): Promise<Models.Team<Preferences>>;
3427
3617
  /**
3428
3618
  * Get Team
3429
3619
  *
@@ -3433,19 +3623,18 @@ declare module "node-appwrite" {
3433
3623
  * @throws {AppwriteException}
3434
3624
  * @returns {Promise}
3435
3625
  */
3436
- get(teamId: string): Promise<Models.Team>;
3626
+ get<Preferences extends Models.Preferences>(teamId: string): Promise<Models.Team<Preferences>>;
3437
3627
  /**
3438
- * Update Team
3628
+ * Update Name
3439
3629
  *
3440
- * Update a team using its ID. Only members with the owner role can update the
3441
- * team.
3630
+ * Update the team's name by its unique ID.
3442
3631
  *
3443
3632
  * @param {string} teamId
3444
3633
  * @param {string} name
3445
3634
  * @throws {AppwriteException}
3446
3635
  * @returns {Promise}
3447
3636
  */
3448
- update(teamId: string, name: string): Promise<Models.Team>;
3637
+ updateName<Preferences extends Models.Preferences>(teamId: string, name: string): Promise<Models.Team<Preferences>>;
3449
3638
  /**
3450
3639
  * Delete Team
3451
3640
  *
@@ -3456,7 +3645,7 @@ declare module "node-appwrite" {
3456
3645
  * @throws {AppwriteException}
3457
3646
  * @returns {Promise}
3458
3647
  */
3459
- delete(teamId: string): Promise<Response>;
3648
+ delete(teamId: string): Promise<string>;
3460
3649
  /**
3461
3650
  * List Team Memberships
3462
3651
  *
@@ -3473,31 +3662,39 @@ declare module "node-appwrite" {
3473
3662
  /**
3474
3663
  * Create Team Membership
3475
3664
  *
3476
- * Invite a new member to join your team. If initiated from the client SDK, an
3477
- * email with a link to join the team will be sent to the member's email
3478
- * address and an account will be created for them should they not be signed
3479
- * up already. If initiated from server-side SDKs, the new member will
3480
- * automatically be added to the team.
3665
+ * Invite a new member to join your team. Provide an ID for existing users, or
3666
+ * invite unregistered users using an email or phone number. If initiated from
3667
+ * a Client SDK, Appwrite will send an email or sms with a link to join the
3668
+ * team to the invited user, and an account will be created for them if one
3669
+ * doesn't exist. If initiated from a Server SDK, the new member will be added
3670
+ * automatically to the team.
3481
3671
  *
3482
- * Use the 'url' parameter to redirect the user from the invitation email back
3483
- * to your app. When the user is redirected, use the [Update Team Membership
3672
+ * You only need to provide one of a user ID, email, or phone number. Appwrite
3673
+ * will prioritize accepting the user ID > email > phone number if you provide
3674
+ * more than one of these parameters.
3675
+ *
3676
+ * Use the `url` parameter to redirect the user from the invitation email to
3677
+ * your app. After the user is redirected, use the [Update Team Membership
3484
3678
  * Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
3485
3679
  * the user to accept the invitation to the team.
3486
3680
  *
3487
3681
  * Please note that to avoid a [Redirect
3488
3682
  * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
3489
- * the only valid redirect URL's are the once from domains you have set when
3490
- * adding your platforms in the console interface.
3683
+ * Appwrite will accept the only redirect URLs under the domains you have
3684
+ * added as a platform on the Appwrite Console.
3685
+ *
3491
3686
  *
3492
3687
  * @param {string} teamId
3493
- * @param {string} email
3494
3688
  * @param {string[]} roles
3495
3689
  * @param {string} url
3690
+ * @param {string} email
3691
+ * @param {string} userId
3692
+ * @param {string} phone
3496
3693
  * @param {string} name
3497
3694
  * @throws {AppwriteException}
3498
3695
  * @returns {Promise}
3499
3696
  */
3500
- createMembership(teamId: string, email: string, roles: string[], url: string, name?: string): Promise<Models.Membership>;
3697
+ createMembership(teamId: string, roles: string[], url: string, email?: string, userId?: string, phone?: string, name?: string): Promise<Models.Membership>;
3501
3698
  /**
3502
3699
  * Get Team Membership
3503
3700
  *
@@ -3536,7 +3733,7 @@ declare module "node-appwrite" {
3536
3733
  * @throws {AppwriteException}
3537
3734
  * @returns {Promise}
3538
3735
  */
3539
- deleteMembership(teamId: string, membershipId: string): Promise<Response>;
3736
+ deleteMembership(teamId: string, membershipId: string): Promise<string>;
3540
3737
  /**
3541
3738
  * Update Team Membership Status
3542
3739
  *
@@ -3556,6 +3753,31 @@ declare module "node-appwrite" {
3556
3753
  * @returns {Promise}
3557
3754
  */
3558
3755
  updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise<Models.Membership>;
3756
+ /**
3757
+ * Get Team Preferences
3758
+ *
3759
+ * Get the team's shared preferences by its unique ID. If a preference doesn't
3760
+ * need to be shared by all team members, prefer storing them in [user
3761
+ * preferences](/docs/client/account#accountGetPrefs).
3762
+ *
3763
+ * @param {string} teamId
3764
+ * @throws {AppwriteException}
3765
+ * @returns {Promise}
3766
+ */
3767
+ getPrefs<Preferences extends Models.Preferences>(teamId: string): Promise<Preferences>;
3768
+ /**
3769
+ * Update Preferences
3770
+ *
3771
+ * Update the team's preferences by its unique ID. The object you pass is
3772
+ * stored as is and replaces any previous value. The maximum allowed prefs
3773
+ * size is 64kB and throws an error if exceeded.
3774
+ *
3775
+ * @param {string} teamId
3776
+ * @param {object} prefs
3777
+ * @throws {AppwriteException}
3778
+ * @returns {Promise}
3779
+ */
3780
+ updatePrefs<Preferences extends Models.Preferences>(teamId: string, prefs: object): Promise<Preferences>;
3559
3781
  }
3560
3782
  export class Users extends Service {
3561
3783
  constructor(client: Client);
@@ -3730,7 +3952,7 @@ declare module "node-appwrite" {
3730
3952
  * @throws {AppwriteException}
3731
3953
  * @returns {Promise}
3732
3954
  */
3733
- delete(userId: string): Promise<Response>;
3955
+ delete(userId: string): Promise<string>;
3734
3956
  /**
3735
3957
  * Update Email
3736
3958
  *
@@ -3838,7 +4060,7 @@ declare module "node-appwrite" {
3838
4060
  * @throws {AppwriteException}
3839
4061
  * @returns {Promise}
3840
4062
  */
3841
- deleteSessions(userId: string): Promise<Response>;
4063
+ deleteSessions(userId: string): Promise<string>;
3842
4064
  /**
3843
4065
  * Delete User Session
3844
4066
  *
@@ -3849,7 +4071,7 @@ declare module "node-appwrite" {
3849
4071
  * @throws {AppwriteException}
3850
4072
  * @returns {Promise}
3851
4073
  */
3852
- deleteSession(userId: string, sessionId: string): Promise<Response>;
4074
+ deleteSession(userId: string, sessionId: string): Promise<string>;
3853
4075
  /**
3854
4076
  * Update User Status
3855
4077
  *