node-appwrite 8.1.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 (43) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +5 -5
  3. package/docs/examples/account/update-password.md +1 -1
  4. package/docs/examples/account/update-phone.md +1 -1
  5. package/docs/examples/databases/create-relationship-attribute.md +20 -0
  6. package/docs/examples/databases/update-boolean-attribute.md +20 -0
  7. package/docs/examples/{locale/get-continents.md → databases/update-datetime-attribute.md} +2 -2
  8. package/docs/examples/databases/update-email-attribute.md +20 -0
  9. package/docs/examples/databases/update-enum-attribute.md +20 -0
  10. package/docs/examples/databases/update-float-attribute.md +20 -0
  11. package/docs/examples/databases/update-integer-attribute.md +20 -0
  12. package/docs/examples/{locale/get-countries-phones.md → databases/update-ip-attribute.md} +2 -2
  13. package/docs/examples/{locale/get-countries-e-u.md → databases/update-relationship-attribute.md} +2 -2
  14. package/docs/examples/databases/update-string-attribute.md +20 -0
  15. package/docs/examples/databases/update-url-attribute.md +20 -0
  16. package/docs/examples/functions/{retry-build.md → create-build.md} +1 -1
  17. package/docs/examples/functions/create.md +1 -1
  18. package/docs/examples/functions/update.md +1 -1
  19. package/docs/examples/{locale/get-currencies.md → graphql/mutation.md} +2 -2
  20. package/docs/examples/{locale/get-languages.md → graphql/query.md} +2 -2
  21. package/docs/examples/teams/create-membership.md +1 -1
  22. package/docs/examples/{account/get-logs.md → teams/get-prefs.md} +2 -2
  23. package/docs/examples/teams/{get-memberships.md → update-name.md} +1 -1
  24. package/docs/examples/{account/get-sessions.md → teams/update-prefs.md} +2 -2
  25. package/docs/examples/users/update-password.md +1 -1
  26. package/docs/examples/users/update-phone.md +1 -1
  27. package/index.d.ts +406 -136
  28. package/index.js +2 -0
  29. package/lib/client.js +2 -1
  30. package/lib/inputFile.js +6 -8
  31. package/lib/query.js +18 -0
  32. package/lib/services/account.js +12 -12
  33. package/lib/services/databases.js +721 -107
  34. package/lib/services/functions.js +48 -50
  35. package/lib/services/graphql.js +72 -0
  36. package/lib/services/storage.js +44 -37
  37. package/lib/services/teams.js +88 -23
  38. package/package.json +6 -4
  39. package/docs/examples/locale/get-countries.md +0 -20
  40. package/docs/examples/teams/update.md +0 -20
  41. package/docs/examples/users/get-logs.md +0 -20
  42. package/docs/examples/users/get-memberships.md +0 -20
  43. package/docs/examples/users/get-sessions.md +0 -20
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
  */
@@ -869,26 +918,46 @@ declare module "node-appwrite" {
869
918
  * AlgoMD5
870
919
  */
871
920
  export type AlgoMd5 = {
921
+ /**
922
+ * Algo type.
923
+ */
924
+ type: string;
872
925
  }
873
926
  /**
874
927
  * AlgoSHA
875
928
  */
876
929
  export type AlgoSha = {
930
+ /**
931
+ * Algo type.
932
+ */
933
+ type: string;
877
934
  }
878
935
  /**
879
936
  * AlgoPHPass
880
937
  */
881
938
  export type AlgoPhpass = {
939
+ /**
940
+ * Algo type.
941
+ */
942
+ type: string;
882
943
  }
883
944
  /**
884
945
  * AlgoBcrypt
885
946
  */
886
947
  export type AlgoBcrypt = {
948
+ /**
949
+ * Algo type.
950
+ */
951
+ type: string;
887
952
  }
888
953
  /**
889
954
  * AlgoScrypt
890
955
  */
891
956
  export type AlgoScrypt = {
957
+ /**
958
+ * Algo type.
959
+ */
960
+ type: string;
892
961
  /**
893
962
  * CPU complexity of computed hash.
894
963
  */
@@ -910,6 +979,10 @@ declare module "node-appwrite" {
910
979
  * AlgoScryptModified
911
980
  */
912
981
  export type AlgoScryptModified = {
982
+ /**
983
+ * Algo type.
984
+ */
985
+ type: string;
913
986
  /**
914
987
  * Salt used to compute hash.
915
988
  */
@@ -927,6 +1000,10 @@ declare module "node-appwrite" {
927
1000
  * AlgoArgon2
928
1001
  */
929
1002
  export type AlgoArgon2 = {
1003
+ /**
1004
+ * Algo type.
1005
+ */
1006
+ type: string;
930
1007
  /**
931
1008
  * Memory used to compute hash.
932
1009
  */
@@ -941,59 +1018,6 @@ declare module "node-appwrite" {
941
1018
  threads: number;
942
1019
  }
943
1020
  /**
944
- * Account
945
- */
946
- export type Account<Preferences extends Models.Preferences> = {
947
- /**
948
- * User ID.
949
- */
950
- $id: string;
951
- /**
952
- * User creation date in ISO 8601 format.
953
- */
954
- $createdAt: string;
955
- /**
956
- * User update date in ISO 8601 format.
957
- */
958
- $updatedAt: string;
959
- /**
960
- * User name.
961
- */
962
- name: string;
963
- /**
964
- * User registration date in ISO 8601 format.
965
- */
966
- registration: string;
967
- /**
968
- * User status. Pass `true` for enabled and `false` for disabled.
969
- */
970
- status: boolean;
971
- /**
972
- * Password update time in ISO 8601 format.
973
- */
974
- passwordUpdate: string;
975
- /**
976
- * User email address.
977
- */
978
- email: string;
979
- /**
980
- * User phone number in E.164 format.
981
- */
982
- phone: string;
983
- /**
984
- * Email verification status.
985
- */
986
- emailVerification: boolean;
987
- /**
988
- * Phone verification status.
989
- */
990
- phoneVerification: boolean;
991
- /**
992
- * User preferences as a key-value object
993
- */
994
- prefs: Preferences;
995
- }
996
- /**
997
1021
  * Preferences
998
1022
  */
999
1023
  export type Preferences = {
@@ -1153,7 +1177,7 @@ declare module "node-appwrite" {
1153
1177
  */
1154
1178
  continent: string;
1155
1179
  /**
1156
- * True if country is part of the Europian Union.
1180
+ * True if country is part of the European Union.
1157
1181
  */
1158
1182
  eu: boolean;
1159
1183
  /**
@@ -1266,7 +1290,7 @@ declare module "node-appwrite" {
1266
1290
  /**
1267
1291
  * Team
1268
1292
  */
1269
- export type Team = {
1293
+ export type Team<Preferences extends Models.Preferences> = {
1270
1294
  /**
1271
1295
  * Team ID.
1272
1296
  */
@@ -1287,6 +1311,10 @@ declare module "node-appwrite" {
1287
1311
  * Total number of team members.
1288
1312
  */
1289
1313
  total: number;
1314
+ /**
1315
+ * Team preferences as a key-value object
1316
+ */
1317
+ prefs: Preferences;
1290
1318
  }
1291
1319
  /**
1292
1320
  * Membership
@@ -1487,6 +1515,10 @@ declare module "node-appwrite" {
1487
1515
  * The build stderr.
1488
1516
  */
1489
1517
  buildStderr: string;
1518
+ /**
1519
+ * The current build time in seconds.
1520
+ */
1521
+ buildTime: number;
1490
1522
  }
1491
1523
  /**
1492
1524
  * Execution
@@ -1794,11 +1826,13 @@ declare module "node-appwrite" {
1794
1826
 
1795
1827
  static fromBuffer(buffer: Buffer, filename: string): InputFile;
1796
1828
 
1797
- static fromBlob(blob: Blob, filename: string): InputFile;
1829
+ static fromBlob(blob: Blob, filename: string): Promise<InputFile>;
1798
1830
 
1799
- static fromStream(stream: any, filename: string, size: number): InputFile;
1831
+ static fromStream(stream: NodeJS.ReadableStream, filename: string, size: number): InputFile;
1800
1832
 
1801
1833
  static fromPlainText(content: string, filename: string): InputFile;
1834
+
1835
+ constructor(stream: NodeJS.ReadableStream, filename: string, size: number);
1802
1836
  }
1803
1837
 
1804
1838
  type QueryTypesSingle = string | number | boolean;
@@ -1818,6 +1852,18 @@ declare module "node-appwrite" {
1818
1852
 
1819
1853
  static greaterThanEqual(attribute: string, value: QueryTypes): string;
1820
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
+
1821
1867
  static search(attribute: string, value: string): string;
1822
1868
 
1823
1869
  static orderDesc(attribute: string): string;
@@ -1870,9 +1916,9 @@ declare module "node-appwrite" {
1870
1916
  * @throws {AppwriteException}
1871
1917
  * @returns {Promise}
1872
1918
  */
1873
- get<Preferences extends Models.Preferences>(): Promise<Models.Account<Preferences>>;
1919
+ get<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>>;
1874
1920
  /**
1875
- * Update Account Email
1921
+ * Update Email
1876
1922
  *
1877
1923
  * Update currently logged in user account email address. After changing user
1878
1924
  * address, the user confirmation status will get reset. A new confirmation
@@ -1888,9 +1934,9 @@ declare module "node-appwrite" {
1888
1934
  * @throws {AppwriteException}
1889
1935
  * @returns {Promise}
1890
1936
  */
1891
- 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>>;
1892
1938
  /**
1893
- * List Account Logs
1939
+ * List Logs
1894
1940
  *
1895
1941
  * Get currently logged in user list of latest security activity logs. Each
1896
1942
  * log returns user IP address, location and date and time of log.
@@ -1901,7 +1947,7 @@ declare module "node-appwrite" {
1901
1947
  */
1902
1948
  listLogs(queries?: string[]): Promise<Models.LogList>;
1903
1949
  /**
1904
- * Update Account Name
1950
+ * Update Name
1905
1951
  *
1906
1952
  * Update currently logged in user account name.
1907
1953
  *
@@ -1909,9 +1955,9 @@ declare module "node-appwrite" {
1909
1955
  * @throws {AppwriteException}
1910
1956
  * @returns {Promise}
1911
1957
  */
1912
- updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.Account<Preferences>>;
1958
+ updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.User<Preferences>>;
1913
1959
  /**
1914
- * Update Account Password
1960
+ * Update Password
1915
1961
  *
1916
1962
  * Update currently logged in user password. For validation, user is required
1917
1963
  * to pass in the new password, and the old password. For users created with
@@ -1922,9 +1968,9 @@ declare module "node-appwrite" {
1922
1968
  * @throws {AppwriteException}
1923
1969
  * @returns {Promise}
1924
1970
  */
1925
- 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>>;
1926
1972
  /**
1927
- * Update Account Phone
1973
+ * Update Phone
1928
1974
  *
1929
1975
  * Update the currently logged in user's phone number. After updating the
1930
1976
  * phone number, the phone verification status will be reset. A confirmation
@@ -1937,7 +1983,7 @@ declare module "node-appwrite" {
1937
1983
  * @throws {AppwriteException}
1938
1984
  * @returns {Promise}
1939
1985
  */
1940
- 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>>;
1941
1987
  /**
1942
1988
  * Get Account Preferences
1943
1989
  *
@@ -1948,7 +1994,7 @@ declare module "node-appwrite" {
1948
1994
  */
1949
1995
  getPrefs<Preferences extends Models.Preferences>(): Promise<Preferences>;
1950
1996
  /**
1951
- * Update Account Preferences
1997
+ * Update Preferences
1952
1998
  *
1953
1999
  * Update currently logged in user account preferences. The object you pass is
1954
2000
  * stored as is, and replaces any previous value. The maximum allowed prefs
@@ -1958,7 +2004,7 @@ declare module "node-appwrite" {
1958
2004
  * @throws {AppwriteException}
1959
2005
  * @returns {Promise}
1960
2006
  */
1961
- updatePrefs<Preferences extends Models.Preferences>(prefs: object): Promise<Models.Account<Preferences>>;
2007
+ updatePrefs<Preferences extends Models.Preferences>(prefs: object): Promise<Models.User<Preferences>>;
1962
2008
  /**
1963
2009
  * Create Password Recovery
1964
2010
  *
@@ -1999,7 +2045,7 @@ declare module "node-appwrite" {
1999
2045
  */
2000
2046
  updateRecovery(userId: string, secret: string, password: string, passwordAgain: string): Promise<Models.Token>;
2001
2047
  /**
2002
- * List Account Sessions
2048
+ * List Sessions
2003
2049
  *
2004
2050
  * Get currently logged in user list of active sessions across different
2005
2051
  * devices.
@@ -2009,7 +2055,7 @@ declare module "node-appwrite" {
2009
2055
  */
2010
2056
  listSessions(): Promise<Models.SessionList>;
2011
2057
  /**
2012
- * Delete All Account Sessions
2058
+ * Delete Sessions
2013
2059
  *
2014
2060
  * Delete all sessions from the user account and remove any sessions cookies
2015
2061
  * from the end client.
@@ -2017,9 +2063,9 @@ declare module "node-appwrite" {
2017
2063
  * @throws {AppwriteException}
2018
2064
  * @returns {Promise}
2019
2065
  */
2020
- deleteSessions(): Promise<Response>;
2066
+ deleteSessions(): Promise<string>;
2021
2067
  /**
2022
- * Get Session By ID
2068
+ * Get Session
2023
2069
  *
2024
2070
  * Use this endpoint to get a logged in user's session using a Session ID.
2025
2071
  * Inputting 'current' will return the current session being used.
@@ -2030,7 +2076,7 @@ declare module "node-appwrite" {
2030
2076
  */
2031
2077
  getSession(sessionId: string): Promise<Models.Session>;
2032
2078
  /**
2033
- * Update Session (Refresh Tokens)
2079
+ * Update OAuth Session (Refresh Tokens)
2034
2080
  *
2035
2081
  * Access tokens have limited lifespan and expire to mitigate security risks.
2036
2082
  * If session was created using an OAuth provider, this route can be used to
@@ -2042,7 +2088,7 @@ declare module "node-appwrite" {
2042
2088
  */
2043
2089
  updateSession(sessionId: string): Promise<Models.Session>;
2044
2090
  /**
2045
- * Delete Account Session
2091
+ * Delete Session
2046
2092
  *
2047
2093
  * Use this endpoint to log out the currently logged in user from all their
2048
2094
  * account sessions across all of their different devices. When using the
@@ -2053,9 +2099,9 @@ declare module "node-appwrite" {
2053
2099
  * @throws {AppwriteException}
2054
2100
  * @returns {Promise}
2055
2101
  */
2056
- deleteSession(sessionId: string): Promise<Response>;
2102
+ deleteSession(sessionId: string): Promise<string>;
2057
2103
  /**
2058
- * Update Account Status
2104
+ * Update Status
2059
2105
  *
2060
2106
  * Block the currently logged in user account. Behind the scene, the user
2061
2107
  * record is not deleted but permanently blocked from any access. To
@@ -2064,7 +2110,7 @@ declare module "node-appwrite" {
2064
2110
  * @throws {AppwriteException}
2065
2111
  * @returns {Promise}
2066
2112
  */
2067
- updateStatus<Preferences extends Models.Preferences>(): Promise<Models.Account<Preferences>>;
2113
+ updateStatus<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>>;
2068
2114
  /**
2069
2115
  * Create Email Verification
2070
2116
  *
@@ -2335,7 +2381,7 @@ declare module "node-appwrite" {
2335
2381
  * @throws {AppwriteException}
2336
2382
  * @returns {Promise}
2337
2383
  */
2338
- delete(databaseId: string): Promise<Response>;
2384
+ delete(databaseId: string): Promise<string>;
2339
2385
  /**
2340
2386
  * List Collections
2341
2387
  *
@@ -2404,7 +2450,7 @@ declare module "node-appwrite" {
2404
2450
  * @throws {AppwriteException}
2405
2451
  * @returns {Promise}
2406
2452
  */
2407
- deleteCollection(databaseId: string, collectionId: string): Promise<Response>;
2453
+ deleteCollection(databaseId: string, collectionId: string): Promise<string>;
2408
2454
  /**
2409
2455
  * List Attributes
2410
2456
  *
@@ -2430,6 +2476,18 @@ declare module "node-appwrite" {
2430
2476
  * @returns {Promise}
2431
2477
  */
2432
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>;
2433
2491
  /**
2434
2492
  * Create DateTime Attribute
2435
2493
  *
@@ -2443,6 +2501,18 @@ declare module "node-appwrite" {
2443
2501
  * @returns {Promise}
2444
2502
  */
2445
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>;
2446
2516
  /**
2447
2517
  * Create Email Attribute
2448
2518
  *
@@ -2459,6 +2529,22 @@ declare module "node-appwrite" {
2459
2529
  * @returns {Promise}
2460
2530
  */
2461
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>;
2462
2548
  /**
2463
2549
  * Create Enum Attribute
2464
2550
  *
@@ -2473,6 +2559,23 @@ declare module "node-appwrite" {
2473
2559
  * @returns {Promise}
2474
2560
  */
2475
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>;
2476
2579
  /**
2477
2580
  * Create Float Attribute
2478
2581
  *
@@ -2492,6 +2595,24 @@ declare module "node-appwrite" {
2492
2595
  * @returns {Promise}
2493
2596
  */
2494
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>;
2495
2616
  /**
2496
2617
  * Create Integer Attribute
2497
2618
  *
@@ -2511,6 +2632,24 @@ declare module "node-appwrite" {
2511
2632
  * @returns {Promise}
2512
2633
  */
2513
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>;
2514
2653
  /**
2515
2654
  * Create IP Address Attribute
2516
2655
  *
@@ -2527,6 +2666,41 @@ declare module "node-appwrite" {
2527
2666
  * @returns {Promise}
2528
2667
  */
2529
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>;
2530
2704
  /**
2531
2705
  * Create String Attribute
2532
2706
  *
@@ -2544,6 +2718,22 @@ declare module "node-appwrite" {
2544
2718
  * @returns {Promise}
2545
2719
  */
2546
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>;
2547
2737
  /**
2548
2738
  * Create URL Attribute
2549
2739
  *
@@ -2560,6 +2750,22 @@ declare module "node-appwrite" {
2560
2750
  * @returns {Promise}
2561
2751
  */
2562
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>;
2563
2769
  /**
2564
2770
  * Get Attribute
2565
2771
  *
@@ -2569,7 +2775,7 @@ declare module "node-appwrite" {
2569
2775
  * @throws {AppwriteException}
2570
2776
  * @returns {Promise}
2571
2777
  */
2572
- getAttribute(databaseId: string, collectionId: string, key: string): Promise<Response>;
2778
+ getAttribute(databaseId: string, collectionId: string, key: string): Promise<any>;
2573
2779
  /**
2574
2780
  * Delete Attribute
2575
2781
  *
@@ -2579,14 +2785,27 @@ declare module "node-appwrite" {
2579
2785
  * @throws {AppwriteException}
2580
2786
  * @returns {Promise}
2581
2787
  */
2582
- 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>;
2583
2804
  /**
2584
2805
  * List Documents
2585
2806
  *
2586
2807
  * Get a list of all the user's documents in a given collection. You can use
2587
- * the query params to filter your results. On admin mode, this endpoint will
2588
- * return a list of all of documents belonging to the provided collectionId.
2589
- * [Learn more about different API modes](/docs/admin).
2808
+ * the query params to filter your results.
2590
2809
  *
2591
2810
  * @param {string} databaseId
2592
2811
  * @param {string} collectionId
@@ -2621,10 +2840,11 @@ declare module "node-appwrite" {
2621
2840
  * @param {string} databaseId
2622
2841
  * @param {string} collectionId
2623
2842
  * @param {string} documentId
2843
+ * @param {string[]} queries
2624
2844
  * @throws {AppwriteException}
2625
2845
  * @returns {Promise}
2626
2846
  */
2627
- 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>;
2628
2848
  /**
2629
2849
  * Update Document
2630
2850
  *
@@ -2651,7 +2871,7 @@ declare module "node-appwrite" {
2651
2871
  * @throws {AppwriteException}
2652
2872
  * @returns {Promise}
2653
2873
  */
2654
- deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<Response>;
2874
+ deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<string>;
2655
2875
  /**
2656
2876
  * List Indexes
2657
2877
  *
@@ -2693,7 +2913,7 @@ declare module "node-appwrite" {
2693
2913
  * @throws {AppwriteException}
2694
2914
  * @returns {Promise}
2695
2915
  */
2696
- deleteIndex(databaseId: string, collectionId: string, key: string): Promise<Response>;
2916
+ deleteIndex(databaseId: string, collectionId: string, key: string): Promise<string>;
2697
2917
  }
2698
2918
  export class Functions extends Service {
2699
2919
  constructor(client: Client);
@@ -2719,8 +2939,8 @@ declare module "node-appwrite" {
2719
2939
  *
2720
2940
  * @param {string} functionId
2721
2941
  * @param {string} name
2722
- * @param {string[]} execute
2723
2942
  * @param {string} runtime
2943
+ * @param {string[]} execute
2724
2944
  * @param {string[]} events
2725
2945
  * @param {string} schedule
2726
2946
  * @param {number} timeout
@@ -2728,7 +2948,7 @@ declare module "node-appwrite" {
2728
2948
  * @throws {AppwriteException}
2729
2949
  * @returns {Promise}
2730
2950
  */
2731
- 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>;
2732
2952
  /**
2733
2953
  * List runtimes
2734
2954
  *
@@ -2763,7 +2983,7 @@ declare module "node-appwrite" {
2763
2983
  * @throws {AppwriteException}
2764
2984
  * @returns {Promise}
2765
2985
  */
2766
- 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>;
2767
2987
  /**
2768
2988
  * Delete Function
2769
2989
  *
@@ -2773,7 +2993,7 @@ declare module "node-appwrite" {
2773
2993
  * @throws {AppwriteException}
2774
2994
  * @returns {Promise}
2775
2995
  */
2776
- delete(functionId: string): Promise<Response>;
2996
+ delete(functionId: string): Promise<string>;
2777
2997
  /**
2778
2998
  * List Deployments
2779
2999
  *
@@ -2843,9 +3063,9 @@ declare module "node-appwrite" {
2843
3063
  * @throws {AppwriteException}
2844
3064
  * @returns {Promise}
2845
3065
  */
2846
- deleteDeployment(functionId: string, deploymentId: string): Promise<Response>;
3066
+ deleteDeployment(functionId: string, deploymentId: string): Promise<string>;
2847
3067
  /**
2848
- * Retry Build
3068
+ * Create Build
2849
3069
  *
2850
3070
  * @param {string} functionId
2851
3071
  * @param {string} deploymentId
@@ -2853,14 +3073,12 @@ declare module "node-appwrite" {
2853
3073
  * @throws {AppwriteException}
2854
3074
  * @returns {Promise}
2855
3075
  */
2856
- retryBuild(functionId: string, deploymentId: string, buildId: string): Promise<Response>;
3076
+ createBuild(functionId: string, deploymentId: string, buildId: string): Promise<any>;
2857
3077
  /**
2858
3078
  * List Executions
2859
3079
  *
2860
3080
  * Get a list of all the current user function execution logs. You can use the
2861
- * query params to filter your results. On admin mode, this endpoint will
2862
- * return a list of all of the project's executions. [Learn more about
2863
- * different API modes](/docs/admin).
3081
+ * query params to filter your results.
2864
3082
  *
2865
3083
  * @param {string} functionId
2866
3084
  * @param {string[]} queries
@@ -2952,7 +3170,31 @@ declare module "node-appwrite" {
2952
3170
  * @throws {AppwriteException}
2953
3171
  * @returns {Promise}
2954
3172
  */
2955
- deleteVariable(functionId: string, variableId: string): Promise<Response>;
3173
+ deleteVariable(functionId: string, variableId: string): Promise<string>;
3174
+ }
3175
+ export class Graphql extends Service {
3176
+ constructor(client: Client);
3177
+
3178
+ /**
3179
+ * GraphQL Endpoint
3180
+ *
3181
+ * Execute a GraphQL mutation.
3182
+ *
3183
+ * @param {object} query
3184
+ * @throws {AppwriteException}
3185
+ * @returns {Promise}
3186
+ */
3187
+ query(query: object): Promise<any>;
3188
+ /**
3189
+ * GraphQL Endpoint
3190
+ *
3191
+ * Execute a GraphQL mutation.
3192
+ *
3193
+ * @param {object} query
3194
+ * @throws {AppwriteException}
3195
+ * @returns {Promise}
3196
+ */
3197
+ mutation(query: object): Promise<any>;
2956
3198
  }
2957
3199
  export class Health extends Service {
2958
3200
  constructor(client: Client);
@@ -3209,13 +3451,12 @@ declare module "node-appwrite" {
3209
3451
  * @throws {AppwriteException}
3210
3452
  * @returns {Promise}
3211
3453
  */
3212
- deleteBucket(bucketId: string): Promise<Response>;
3454
+ deleteBucket(bucketId: string): Promise<string>;
3213
3455
  /**
3214
3456
  * List Files
3215
3457
  *
3216
3458
  * Get a list of all the user files. You can use the query params to filter
3217
- * your results. On admin mode, this endpoint will return a list of all of the
3218
- * project's files. [Learn more about different API modes](/docs/admin).
3459
+ * your results.
3219
3460
  *
3220
3461
  * @param {string} bucketId
3221
3462
  * @param {string[]} queries
@@ -3290,7 +3531,7 @@ declare module "node-appwrite" {
3290
3531
  * @throws {AppwriteException}
3291
3532
  * @returns {Promise}
3292
3533
  */
3293
- deleteFile(bucketId: string, fileId: string): Promise<Response>;
3534
+ deleteFile(bucketId: string, fileId: string): Promise<string>;
3294
3535
  /**
3295
3536
  * Get File for Download
3296
3537
  *
@@ -3351,17 +3592,14 @@ declare module "node-appwrite" {
3351
3592
  * List Teams
3352
3593
  *
3353
3594
  * Get a list of all the teams in which the current user is a member. You can
3354
- * use the parameters to filter your results.
3355
- *
3356
- * In admin mode, this endpoint returns a list of all the teams in the current
3357
- * project. [Learn more about different API modes](/docs/admin).
3595
+ * use the parameters to filter your results.
3358
3596
  *
3359
3597
  * @param {string[]} queries
3360
3598
  * @param {string} search
3361
3599
  * @throws {AppwriteException}
3362
3600
  * @returns {Promise}
3363
3601
  */
3364
- list(queries?: string[], search?: string): Promise<Models.TeamList>;
3602
+ list<Preferences extends Models.Preferences>(queries?: string[], search?: string): Promise<Models.TeamList<Preferences>>;
3365
3603
  /**
3366
3604
  * Create Team
3367
3605
  *
@@ -3375,7 +3613,7 @@ declare module "node-appwrite" {
3375
3613
  * @throws {AppwriteException}
3376
3614
  * @returns {Promise}
3377
3615
  */
3378
- 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>>;
3379
3617
  /**
3380
3618
  * Get Team
3381
3619
  *
@@ -3385,19 +3623,18 @@ declare module "node-appwrite" {
3385
3623
  * @throws {AppwriteException}
3386
3624
  * @returns {Promise}
3387
3625
  */
3388
- get(teamId: string): Promise<Models.Team>;
3626
+ get<Preferences extends Models.Preferences>(teamId: string): Promise<Models.Team<Preferences>>;
3389
3627
  /**
3390
- * Update Team
3628
+ * Update Name
3391
3629
  *
3392
- * Update a team using its ID. Only members with the owner role can update the
3393
- * team.
3630
+ * Update the team's name by its unique ID.
3394
3631
  *
3395
3632
  * @param {string} teamId
3396
3633
  * @param {string} name
3397
3634
  * @throws {AppwriteException}
3398
3635
  * @returns {Promise}
3399
3636
  */
3400
- update(teamId: string, name: string): Promise<Models.Team>;
3637
+ updateName<Preferences extends Models.Preferences>(teamId: string, name: string): Promise<Models.Team<Preferences>>;
3401
3638
  /**
3402
3639
  * Delete Team
3403
3640
  *
@@ -3408,7 +3645,7 @@ declare module "node-appwrite" {
3408
3645
  * @throws {AppwriteException}
3409
3646
  * @returns {Promise}
3410
3647
  */
3411
- delete(teamId: string): Promise<Response>;
3648
+ delete(teamId: string): Promise<string>;
3412
3649
  /**
3413
3650
  * List Team Memberships
3414
3651
  *
@@ -3425,31 +3662,39 @@ declare module "node-appwrite" {
3425
3662
  /**
3426
3663
  * Create Team Membership
3427
3664
  *
3428
- * Invite a new member to join your team. If initiated from the client SDK, an
3429
- * email with a link to join the team will be sent to the member's email
3430
- * address and an account will be created for them should they not be signed
3431
- * up already. If initiated from server-side SDKs, the new member will
3432
- * 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.
3433
3671
  *
3434
- * Use the 'url' parameter to redirect the user from the invitation email back
3435
- * 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
3436
3678
  * Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
3437
3679
  * the user to accept the invitation to the team.
3438
3680
  *
3439
3681
  * Please note that to avoid a [Redirect
3440
3682
  * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
3441
- * the only valid redirect URL's are the once from domains you have set when
3442
- * 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
+ *
3443
3686
  *
3444
3687
  * @param {string} teamId
3445
- * @param {string} email
3446
3688
  * @param {string[]} roles
3447
3689
  * @param {string} url
3690
+ * @param {string} email
3691
+ * @param {string} userId
3692
+ * @param {string} phone
3448
3693
  * @param {string} name
3449
3694
  * @throws {AppwriteException}
3450
3695
  * @returns {Promise}
3451
3696
  */
3452
- 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>;
3453
3698
  /**
3454
3699
  * Get Team Membership
3455
3700
  *
@@ -3461,7 +3706,7 @@ declare module "node-appwrite" {
3461
3706
  * @throws {AppwriteException}
3462
3707
  * @returns {Promise}
3463
3708
  */
3464
- getMembership(teamId: string, membershipId: string): Promise<Models.MembershipList>;
3709
+ getMembership(teamId: string, membershipId: string): Promise<Models.Membership>;
3465
3710
  /**
3466
3711
  * Update Membership Roles
3467
3712
  *
@@ -3488,7 +3733,7 @@ declare module "node-appwrite" {
3488
3733
  * @throws {AppwriteException}
3489
3734
  * @returns {Promise}
3490
3735
  */
3491
- deleteMembership(teamId: string, membershipId: string): Promise<Response>;
3736
+ deleteMembership(teamId: string, membershipId: string): Promise<string>;
3492
3737
  /**
3493
3738
  * Update Team Membership Status
3494
3739
  *
@@ -3508,6 +3753,31 @@ declare module "node-appwrite" {
3508
3753
  * @returns {Promise}
3509
3754
  */
3510
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>;
3511
3781
  }
3512
3782
  export class Users extends Service {
3513
3783
  constructor(client: Client);
@@ -3682,7 +3952,7 @@ declare module "node-appwrite" {
3682
3952
  * @throws {AppwriteException}
3683
3953
  * @returns {Promise}
3684
3954
  */
3685
- delete(userId: string): Promise<Response>;
3955
+ delete(userId: string): Promise<string>;
3686
3956
  /**
3687
3957
  * Update Email
3688
3958
  *
@@ -3790,7 +4060,7 @@ declare module "node-appwrite" {
3790
4060
  * @throws {AppwriteException}
3791
4061
  * @returns {Promise}
3792
4062
  */
3793
- deleteSessions(userId: string): Promise<Response>;
4063
+ deleteSessions(userId: string): Promise<string>;
3794
4064
  /**
3795
4065
  * Delete User Session
3796
4066
  *
@@ -3801,7 +4071,7 @@ declare module "node-appwrite" {
3801
4071
  * @throws {AppwriteException}
3802
4072
  * @returns {Promise}
3803
4073
  */
3804
- deleteSession(userId: string, sessionId: string): Promise<Response>;
4074
+ deleteSession(userId: string, sessionId: string): Promise<string>;
3805
4075
  /**
3806
4076
  * Update User Status
3807
4077
  *