node-appwrite 6.0.0 → 7.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 (148) hide show
  1. package/README.md +2 -2
  2. package/docs/examples/account/create-phone-verification.md +20 -0
  3. package/docs/examples/account/create-recovery.md +3 -3
  4. package/docs/examples/account/create-verification.md +3 -3
  5. package/docs/examples/account/delete-session.md +3 -3
  6. package/docs/examples/account/delete-sessions.md +3 -3
  7. package/docs/examples/account/get-logs.md +3 -3
  8. package/docs/examples/account/get-prefs.md +3 -3
  9. package/docs/examples/account/get-session.md +3 -3
  10. package/docs/examples/account/get-sessions.md +3 -3
  11. package/docs/examples/account/get.md +3 -3
  12. package/docs/examples/account/update-email.md +3 -3
  13. package/docs/examples/account/update-name.md +3 -3
  14. package/docs/examples/account/update-password.md +3 -3
  15. package/docs/examples/account/update-phone-verification.md +20 -0
  16. package/docs/examples/{database/create-ip-attribute.md → account/update-phone.md} +4 -4
  17. package/docs/examples/account/update-prefs.md +3 -3
  18. package/docs/examples/account/update-recovery.md +3 -3
  19. package/docs/examples/account/update-session.md +3 -3
  20. package/docs/examples/account/update-status.md +3 -3
  21. package/docs/examples/account/update-verification.md +3 -3
  22. package/docs/examples/avatars/get-browser.md +3 -3
  23. package/docs/examples/avatars/get-credit-card.md +3 -3
  24. package/docs/examples/avatars/get-favicon.md +3 -3
  25. package/docs/examples/avatars/get-flag.md +3 -3
  26. package/docs/examples/avatars/get-image.md +3 -3
  27. package/docs/examples/avatars/get-initials.md +3 -3
  28. package/docs/examples/avatars/get-q-r.md +3 -3
  29. package/docs/examples/databases/create-boolean-attribute.md +20 -0
  30. package/docs/examples/{database → databases}/create-collection.md +3 -3
  31. package/docs/examples/databases/create-document.md +20 -0
  32. package/docs/examples/{database/create-boolean-attribute.md → databases/create-email-attribute.md} +3 -3
  33. package/docs/examples/databases/create-enum-attribute.md +20 -0
  34. package/docs/examples/databases/create-float-attribute.md +20 -0
  35. package/docs/examples/{database → databases}/create-index.md +3 -3
  36. package/docs/examples/{database → databases}/create-integer-attribute.md +3 -3
  37. package/docs/examples/{database/create-float-attribute.md → databases/create-ip-attribute.md} +3 -3
  38. package/docs/examples/{database → databases}/create-string-attribute.md +3 -3
  39. package/docs/examples/{database → databases}/create-url-attribute.md +3 -3
  40. package/docs/examples/{database/delete-attribute.md → databases/create.md} +3 -3
  41. package/docs/examples/databases/delete-attribute.md +20 -0
  42. package/docs/examples/databases/delete-collection.md +20 -0
  43. package/docs/examples/databases/delete-document.md +20 -0
  44. package/docs/examples/{database/create-email-attribute.md → databases/delete-index.md} +3 -3
  45. package/docs/examples/{database/delete-index.md → databases/delete.md} +3 -3
  46. package/docs/examples/databases/get-attribute.md +20 -0
  47. package/docs/examples/{database → databases}/get-collection.md +3 -3
  48. package/docs/examples/{database/delete-document.md → databases/get-document.md} +3 -3
  49. package/docs/examples/{database/create-enum-attribute.md → databases/get-index.md} +3 -3
  50. package/docs/examples/{database/get-index.md → databases/get.md} +3 -3
  51. package/docs/examples/{database → databases}/list-attributes.md +3 -3
  52. package/docs/examples/databases/list-collections.md +20 -0
  53. package/docs/examples/{database/create-document.md → databases/list-documents.md} +3 -3
  54. package/docs/examples/{database → databases}/list-indexes.md +3 -3
  55. package/docs/examples/{database/list-documents.md → databases/list.md} +3 -3
  56. package/docs/examples/{database → databases}/update-collection.md +3 -3
  57. package/docs/examples/{database → databases}/update-document.md +3 -3
  58. package/docs/examples/databases/update.md +20 -0
  59. package/docs/examples/functions/create-deployment.md +3 -3
  60. package/docs/examples/functions/create-execution.md +3 -3
  61. package/docs/examples/functions/create.md +3 -3
  62. package/docs/examples/functions/delete-deployment.md +3 -3
  63. package/docs/examples/functions/delete.md +3 -3
  64. package/docs/examples/functions/get-deployment.md +3 -3
  65. package/docs/examples/functions/get-execution.md +3 -3
  66. package/docs/examples/functions/get.md +3 -3
  67. package/docs/examples/functions/list-deployments.md +3 -3
  68. package/docs/examples/functions/list-executions.md +3 -3
  69. package/docs/examples/functions/list-runtimes.md +3 -3
  70. package/docs/examples/functions/list.md +3 -3
  71. package/docs/examples/functions/retry-build.md +3 -3
  72. package/docs/examples/functions/update-deployment.md +3 -3
  73. package/docs/examples/functions/update.md +3 -3
  74. package/docs/examples/health/get-antivirus.md +3 -3
  75. package/docs/examples/health/get-cache.md +3 -3
  76. package/docs/examples/health/get-d-b.md +3 -3
  77. package/docs/examples/health/get-queue-certificates.md +3 -3
  78. package/docs/examples/health/get-queue-functions.md +3 -3
  79. package/docs/examples/health/get-queue-logs.md +3 -3
  80. package/docs/examples/health/get-queue-webhooks.md +3 -3
  81. package/docs/examples/health/get-storage-local.md +3 -3
  82. package/docs/examples/health/get-time.md +3 -3
  83. package/docs/examples/health/get.md +3 -3
  84. package/docs/examples/locale/get-continents.md +3 -3
  85. package/docs/examples/locale/get-countries-e-u.md +3 -3
  86. package/docs/examples/locale/get-countries-phones.md +3 -3
  87. package/docs/examples/locale/get-countries.md +3 -3
  88. package/docs/examples/locale/get-currencies.md +3 -3
  89. package/docs/examples/locale/get-languages.md +3 -3
  90. package/docs/examples/locale/get.md +3 -3
  91. package/docs/examples/storage/create-bucket.md +3 -3
  92. package/docs/examples/storage/create-file.md +3 -3
  93. package/docs/examples/storage/delete-bucket.md +3 -3
  94. package/docs/examples/storage/delete-file.md +3 -3
  95. package/docs/examples/storage/get-bucket.md +3 -3
  96. package/docs/examples/storage/get-file-download.md +3 -3
  97. package/docs/examples/storage/get-file-preview.md +3 -3
  98. package/docs/examples/storage/get-file-view.md +3 -3
  99. package/docs/examples/storage/get-file.md +3 -3
  100. package/docs/examples/storage/list-buckets.md +3 -3
  101. package/docs/examples/storage/list-files.md +3 -3
  102. package/docs/examples/storage/update-bucket.md +3 -3
  103. package/docs/examples/storage/update-file.md +3 -3
  104. package/docs/examples/teams/create-membership.md +3 -3
  105. package/docs/examples/teams/create.md +3 -3
  106. package/docs/examples/teams/delete-membership.md +3 -3
  107. package/docs/examples/teams/delete.md +3 -3
  108. package/docs/examples/teams/get-membership.md +3 -3
  109. package/docs/examples/teams/get-memberships.md +3 -3
  110. package/docs/examples/teams/get.md +3 -3
  111. package/docs/examples/teams/list.md +3 -3
  112. package/docs/examples/teams/update-membership-roles.md +3 -3
  113. package/docs/examples/teams/update-membership-status.md +3 -3
  114. package/docs/examples/teams/update.md +3 -3
  115. package/docs/examples/users/create.md +3 -3
  116. package/docs/examples/users/delete-session.md +3 -3
  117. package/docs/examples/users/delete-sessions.md +3 -3
  118. package/docs/examples/users/delete.md +3 -3
  119. package/docs/examples/users/get-logs.md +3 -3
  120. package/docs/examples/users/get-memberships.md +3 -3
  121. package/docs/examples/users/get-prefs.md +3 -3
  122. package/docs/examples/users/get-sessions.md +3 -3
  123. package/docs/examples/users/get.md +3 -3
  124. package/docs/examples/users/list.md +3 -3
  125. package/docs/examples/{database/get-attribute.md → users/update-email-verification.md} +3 -3
  126. package/docs/examples/users/update-email.md +3 -3
  127. package/docs/examples/users/update-name.md +3 -3
  128. package/docs/examples/users/update-password.md +3 -3
  129. package/docs/examples/{database/delete-collection.md → users/update-phone-verification.md} +3 -3
  130. package/docs/examples/{database/list-collections.md → users/update-phone.md} +3 -3
  131. package/docs/examples/users/update-prefs.md +3 -3
  132. package/docs/examples/users/update-status.md +3 -3
  133. package/index.d.ts +296 -121
  134. package/index.js +4 -2
  135. package/lib/client.js +9 -3
  136. package/lib/inputFile.js +47 -0
  137. package/lib/services/account.js +103 -2
  138. package/lib/services/avatars.js +2 -0
  139. package/lib/services/{database.js → databases.js} +183 -87
  140. package/lib/services/functions.js +99 -41
  141. package/lib/services/health.js +2 -0
  142. package/lib/services/locale.js +2 -0
  143. package/lib/services/storage.js +108 -50
  144. package/lib/services/teams.js +2 -0
  145. package/lib/services/users.js +65 -1
  146. package/package.json +1 -1
  147. package/docs/examples/database/get-document.md +0 -20
  148. package/docs/examples/users/update-verification.md +0 -20
package/index.d.ts CHANGED
@@ -27,6 +27,19 @@ declare module "node-appwrite" {
27
27
  collections: Collection[];
28
28
  }
29
29
  /**
30
+ * Databases List
31
+ */
32
+ export type DatabaseList = {
33
+ /**
34
+ * Total number of databases documents that matched your query.
35
+ */
36
+ total: number;
37
+ /**
38
+ * List of databases.
39
+ */
40
+ databases: Database[];
41
+ }
42
+ /**
30
43
  * Indexes List
31
44
  */
32
45
  export type IndexList = {
@@ -248,6 +261,19 @@ declare module "node-appwrite" {
248
261
  phones: Phone[];
249
262
  }
250
263
  /**
264
+ * Database
265
+ */
266
+ export type Database = {
267
+ /**
268
+ * Database ID.
269
+ */
270
+ $id: string;
271
+ /**
272
+ * Database name.
273
+ */
274
+ name: string;
275
+ }
276
+ /**
251
277
  * Collection
252
278
  */
253
279
  export type Collection = {
@@ -256,6 +282,14 @@ declare module "node-appwrite" {
256
282
  */
257
283
  $id: string;
258
284
  /**
285
+ * Collection creation date in Unix timestamp.
286
+ */
287
+ $createdAt: number;
288
+ /**
289
+ * Collection update date in Unix timestamp.
290
+ */
291
+ $updatedAt: number;
292
+ /**
259
293
  * Collection read permissions.
260
294
  */
261
295
  $read: string[];
@@ -264,6 +298,10 @@ declare module "node-appwrite" {
264
298
  */
265
299
  $write: string[];
266
300
  /**
301
+ * Database ID.
302
+ */
303
+ databaseId: string;
304
+ /**
267
305
  * Collection name.
268
306
  */
269
307
  name: string;
@@ -607,6 +645,14 @@ declare module "node-appwrite" {
607
645
  */
608
646
  $collection: string;
609
647
  /**
648
+ * Document creation date in Unix timestamp.
649
+ */
650
+ $createdAt: number;
651
+ /**
652
+ * Document update date in Unix timestamp.
653
+ */
654
+ $updatedAt: number;
655
+ /**
610
656
  * Document read permissions.
611
657
  */
612
658
  $read: string[];
@@ -713,6 +759,14 @@ declare module "node-appwrite" {
713
759
  */
714
760
  $id: string;
715
761
  /**
762
+ * User creation date in Unix timestamp.
763
+ */
764
+ $createdAt: number;
765
+ /**
766
+ * User update date in Unix timestamp.
767
+ */
768
+ $updatedAt: number;
769
+ /**
716
770
  * User name.
717
771
  */
718
772
  name: string;
@@ -733,10 +787,18 @@ declare module "node-appwrite" {
733
787
  */
734
788
  email: string;
735
789
  /**
790
+ * User phone number in E.164 format.
791
+ */
792
+ phone: string;
793
+ /**
736
794
  * Email verification status.
737
795
  */
738
796
  emailVerification: boolean;
739
797
  /**
798
+ * Phone verification status.
799
+ */
800
+ phoneVerification: boolean;
801
+ /**
740
802
  * User preferences as a key-value object
741
803
  */
742
804
  prefs: Preferences;
@@ -755,6 +817,10 @@ declare module "node-appwrite" {
755
817
  */
756
818
  $id: string;
757
819
  /**
820
+ * Session creation date in Unix timestamp.
821
+ */
822
+ $createdAt: number;
823
+ /**
758
824
  * User ID.
759
825
  */
760
826
  userId: string;
@@ -856,6 +922,10 @@ declare module "node-appwrite" {
856
922
  */
857
923
  $id: string;
858
924
  /**
925
+ * Token creation date in Unix timestamp.
926
+ */
927
+ $createdAt: number;
928
+ /**
859
929
  * User ID.
860
930
  */
861
931
  userId: string;
@@ -914,6 +984,14 @@ declare module "node-appwrite" {
914
984
  */
915
985
  bucketId: string;
916
986
  /**
987
+ * File creation date in Unix timestamp.
988
+ */
989
+ $createdAt: number;
990
+ /**
991
+ * File update date in Unix timestamp.
992
+ */
993
+ $updatedAt: number;
994
+ /**
917
995
  * File read permissions.
918
996
  */
919
997
  $read: string[];
@@ -926,10 +1004,6 @@ declare module "node-appwrite" {
926
1004
  */
927
1005
  name: string;
928
1006
  /**
929
- * File creation date in Unix timestamp.
930
- */
931
- dateCreated: number;
932
- /**
933
1007
  * File MD5 signature.
934
1008
  */
935
1009
  signature: string;
@@ -959,6 +1033,14 @@ declare module "node-appwrite" {
959
1033
  */
960
1034
  $id: string;
961
1035
  /**
1036
+ * Bucket creation date in Unix timestamp.
1037
+ */
1038
+ $createdAt: number;
1039
+ /**
1040
+ * Bucket update date in Unix timestamp.
1041
+ */
1042
+ $updatedAt: number;
1043
+ /**
962
1044
  * File read permissions.
963
1045
  */
964
1046
  $read: string[];
@@ -971,14 +1053,6 @@ declare module "node-appwrite" {
971
1053
  */
972
1054
  permission: string;
973
1055
  /**
974
- * Bucket creation date in Unix timestamp.
975
- */
976
- dateCreated: number;
977
- /**
978
- * Bucket update date in Unix timestamp.
979
- */
980
- dateUpdated: number;
981
- /**
982
1056
  * Bucket name.
983
1057
  */
984
1058
  name: string;
@@ -1012,13 +1086,17 @@ declare module "node-appwrite" {
1012
1086
  */
1013
1087
  $id: string;
1014
1088
  /**
1015
- * Team name.
1089
+ * Team creation date in Unix timestamp.
1016
1090
  */
1017
- name: string;
1091
+ $createdAt: number;
1018
1092
  /**
1019
- * Team creation date in Unix timestamp.
1093
+ * Team update date in Unix timestamp.
1094
+ */
1095
+ $updatedAt: number;
1096
+ /**
1097
+ * Team name.
1020
1098
  */
1021
- dateCreated: number;
1099
+ name: string;
1022
1100
  /**
1023
1101
  * Total number of team members.
1024
1102
  */
@@ -1033,6 +1111,14 @@ declare module "node-appwrite" {
1033
1111
  */
1034
1112
  $id: string;
1035
1113
  /**
1114
+ * Membership creation date in Unix timestamp.
1115
+ */
1116
+ $createdAt: number;
1117
+ /**
1118
+ * Membership update date in Unix timestamp.
1119
+ */
1120
+ $updatedAt: number;
1121
+ /**
1036
1122
  * User ID.
1037
1123
  */
1038
1124
  userId: string;
@@ -1078,21 +1164,21 @@ declare module "node-appwrite" {
1078
1164
  */
1079
1165
  $id: string;
1080
1166
  /**
1081
- * Execution permissions.
1167
+ * Function creation date in Unix timestamp.
1082
1168
  */
1083
- execute: string[];
1169
+ $createdAt: number;
1084
1170
  /**
1085
- * Function name.
1171
+ * Function update date in Unix timestamp.
1086
1172
  */
1087
- name: string;
1173
+ $updatedAt: number;
1088
1174
  /**
1089
- * Function creation date in Unix timestamp.
1175
+ * Execution permissions.
1090
1176
  */
1091
- dateCreated: number;
1177
+ execute: string[];
1092
1178
  /**
1093
- * Function update date in Unix timestamp.
1179
+ * Function name.
1094
1180
  */
1095
- dateUpdated: number;
1181
+ name: string;
1096
1182
  /**
1097
1183
  * Function status. Possible values: `disabled`, `enabled`
1098
1184
  */
@@ -1172,6 +1258,14 @@ declare module "node-appwrite" {
1172
1258
  */
1173
1259
  $id: string;
1174
1260
  /**
1261
+ * Deployment creation date in Unix timestamp.
1262
+ */
1263
+ $createdAt: number;
1264
+ /**
1265
+ * Deployment update date in Unix timestamp.
1266
+ */
1267
+ $updatedAt: number;
1268
+ /**
1175
1269
  * Resource ID.
1176
1270
  */
1177
1271
  resourceId: string;
@@ -1180,10 +1274,6 @@ declare module "node-appwrite" {
1180
1274
  */
1181
1275
  resourceType: string;
1182
1276
  /**
1183
- * The deployment creation date in Unix timestamp.
1184
- */
1185
- dateCreated: number;
1186
- /**
1187
1277
  * The entrypoint file to use to execute the deployment code.
1188
1278
  */
1189
1279
  entrypoint: string;
@@ -1221,6 +1311,14 @@ declare module "node-appwrite" {
1221
1311
  */
1222
1312
  $id: string;
1223
1313
  /**
1314
+ * Execution creation date in Unix timestamp.
1315
+ */
1316
+ $createdAt: number;
1317
+ /**
1318
+ * Execution update date in Unix timestamp.
1319
+ */
1320
+ $updatedAt: number;
1321
+ /**
1224
1322
  * Execution read permissions.
1225
1323
  */
1226
1324
  $read: string[];
@@ -1229,10 +1327,6 @@ declare module "node-appwrite" {
1229
1327
  */
1230
1328
  functionId: string;
1231
1329
  /**
1232
- * The execution creation date in Unix timestamp.
1233
- */
1234
- dateCreated: number;
1235
- /**
1236
1330
  * The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`.
1237
1331
  */
1238
1332
  trigger: string;
@@ -1563,6 +1657,20 @@ declare module "node-appwrite" {
1563
1657
  * @returns {Promise}
1564
1658
  */
1565
1659
  updatePassword<Preferences extends Models.Preferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>>;
1660
+ /**
1661
+ * Update Account Phone
1662
+ *
1663
+ * Update currently logged in user account phone number. After changing phone
1664
+ * number, the user confirmation status will get reset. A new confirmation SMS
1665
+ * is not sent automatically however you can use the phone confirmation
1666
+ * endpoint again to send the confirmation SMS.
1667
+ *
1668
+ * @param {string} number
1669
+ * @param {string} password
1670
+ * @throws {AppwriteException}
1671
+ * @returns {Promise}
1672
+ */
1673
+ updatePhone<Preferences extends Models.Preferences>(number: string, password: string): Promise<Models.User<Preferences>>;
1566
1674
  /**
1567
1675
  * Get Account Preferences
1568
1676
  *
@@ -1700,8 +1808,8 @@ declare module "node-appwrite" {
1700
1808
  * should redirect the user back to your app and allow you to complete the
1701
1809
  * verification process by verifying both the **userId** and **secret**
1702
1810
  * parameters. Learn more about how to [complete the verification
1703
- * process](/docs/client/account#accountUpdateVerification). The verification
1704
- * link sent to the user's email address is valid for 7 days.
1811
+ * process](/docs/client/account#accountUpdateEmailVerification). The
1812
+ * verification link sent to the user's email address is valid for 7 days.
1705
1813
  *
1706
1814
  * Please note that in order to avoid a [Redirect
1707
1815
  * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
@@ -1728,6 +1836,35 @@ declare module "node-appwrite" {
1728
1836
  * @returns {Promise}
1729
1837
  */
1730
1838
  updateVerification(userId: string, secret: string): Promise<Models.Token>;
1839
+ /**
1840
+ * Create Phone Verification
1841
+ *
1842
+ * Use this endpoint to send a verification message to your user's phone
1843
+ * number to confirm they are the valid owners of that address. The provided
1844
+ * secret should allow you to complete the verification process by verifying
1845
+ * both the **userId** and **secret** parameters. Learn more about how to
1846
+ * [complete the verification
1847
+ * process](/docs/client/account#accountUpdatePhoneVerification). The
1848
+ * verification link sent to the user's phone number is valid for 15 minutes.
1849
+ *
1850
+ * @throws {AppwriteException}
1851
+ * @returns {Promise}
1852
+ */
1853
+ createPhoneVerification(): Promise<Models.Token>;
1854
+ /**
1855
+ * Create Phone Verification (confirmation)
1856
+ *
1857
+ * Use this endpoint to complete the user phone verification process. Use the
1858
+ * **userId** and **secret** that were sent to your user's phone number to
1859
+ * verify the user email ownership. If confirmed this route will return a 200
1860
+ * status code.
1861
+ *
1862
+ * @param {string} userId
1863
+ * @param {string} secret
1864
+ * @throws {AppwriteException}
1865
+ * @returns {Promise}
1866
+ */
1867
+ updatePhoneVerification(userId: string, secret: string): Promise<Models.Token>;
1731
1868
  }
1732
1869
  export class Avatars extends Service {
1733
1870
  /**
@@ -1871,15 +2008,58 @@ declare module "node-appwrite" {
1871
2008
  */
1872
2009
  getQR(text: string, size?: number, margin?: number, download?: boolean): Promise<Buffer>;
1873
2010
  }
1874
- export class Database extends Service {
2011
+ export class Databases extends Service {
1875
2012
  /**
1876
- * List Collections
2013
+ * List Databases
2014
+ *
2015
+ * @param {string} search
2016
+ * @param {number} limit
2017
+ * @param {number} offset
2018
+ * @param {string} cursor
2019
+ * @param {string} cursorDirection
2020
+ * @param {string} orderType
2021
+ * @throws {AppwriteException}
2022
+ * @returns {Promise}
2023
+ */
2024
+ list(search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.DatabaseList>;
2025
+ /**
2026
+ * Create Database
2027
+ *
2028
+ * @param {string} databaseId
2029
+ * @param {string} name
2030
+ * @throws {AppwriteException}
2031
+ * @returns {Promise}
2032
+ */
2033
+ create(databaseId: string, name: string): Promise<Models.Database>;
2034
+ /**
2035
+ * Get Database
2036
+ *
2037
+ * @param {string} databaseId
2038
+ * @throws {AppwriteException}
2039
+ * @returns {Promise}
2040
+ */
2041
+ get(databaseId: string): Promise<Models.Collection>;
2042
+ /**
2043
+ * Update Database
2044
+ *
2045
+ * @param {string} databaseId
2046
+ * @param {string} name
2047
+ * @throws {AppwriteException}
2048
+ * @returns {Promise}
2049
+ */
2050
+ update(databaseId: string, name: string): Promise<Models.Collection>;
2051
+ /**
2052
+ * Delete Database
1877
2053
  *
1878
- * Get a list of all the user collections. You can use the query params to
1879
- * filter your results. On admin mode, this endpoint will return a list of all
1880
- * of the project's collections. [Learn more about different API
1881
- * modes](/docs/admin).
2054
+ * @param {string} databaseId
2055
+ * @throws {AppwriteException}
2056
+ * @returns {Promise}
2057
+ */
2058
+ delete(databaseId: string): Promise<Response>;
2059
+ /**
2060
+ * List Collections
1882
2061
  *
2062
+ * @param {string} databaseId
1883
2063
  * @param {string} search
1884
2064
  * @param {number} limit
1885
2065
  * @param {number} offset
@@ -1889,12 +2069,11 @@ declare module "node-appwrite" {
1889
2069
  * @throws {AppwriteException}
1890
2070
  * @returns {Promise}
1891
2071
  */
1892
- listCollections(search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.CollectionList>;
2072
+ listCollections(databaseId: string, search?: string, limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderType?: string): Promise<Models.CollectionList>;
1893
2073
  /**
1894
2074
  * Create Collection
1895
2075
  *
1896
- * Create a new Collection.
1897
- *
2076
+ * @param {string} databaseId
1898
2077
  * @param {string} collectionId
1899
2078
  * @param {string} name
1900
2079
  * @param {string} permission
@@ -1903,23 +2082,20 @@ declare module "node-appwrite" {
1903
2082
  * @throws {AppwriteException}
1904
2083
  * @returns {Promise}
1905
2084
  */
1906
- createCollection(collectionId: string, name: string, permission: string, read: string[], write: string[]): Promise<Models.Collection>;
2085
+ createCollection(databaseId: string, collectionId: string, name: string, permission: string, read: string[], write: string[]): Promise<Models.Collection>;
1907
2086
  /**
1908
2087
  * Get Collection
1909
2088
  *
1910
- * Get a collection by its unique ID. This endpoint response returns a JSON
1911
- * object with the collection metadata.
1912
- *
2089
+ * @param {string} databaseId
1913
2090
  * @param {string} collectionId
1914
2091
  * @throws {AppwriteException}
1915
2092
  * @returns {Promise}
1916
2093
  */
1917
- getCollection(collectionId: string): Promise<Models.Collection>;
2094
+ getCollection(databaseId: string, collectionId: string): Promise<Models.Collection>;
1918
2095
  /**
1919
2096
  * Update Collection
1920
2097
  *
1921
- * Update a collection by its unique ID.
1922
- *
2098
+ * @param {string} databaseId
1923
2099
  * @param {string} collectionId
1924
2100
  * @param {string} name
1925
2101
  * @param {string} permission
@@ -1929,32 +2105,29 @@ declare module "node-appwrite" {
1929
2105
  * @throws {AppwriteException}
1930
2106
  * @returns {Promise}
1931
2107
  */
1932
- updateCollection(collectionId: string, name: string, permission: string, read?: string[], write?: string[], enabled?: boolean): Promise<Models.Collection>;
2108
+ updateCollection(databaseId: string, collectionId: string, name: string, permission: string, read?: string[], write?: string[], enabled?: boolean): Promise<Models.Collection>;
1933
2109
  /**
1934
2110
  * Delete Collection
1935
2111
  *
1936
- * Delete a collection by its unique ID. Only users with write permissions
1937
- * have access to delete this resource.
1938
- *
2112
+ * @param {string} databaseId
1939
2113
  * @param {string} collectionId
1940
2114
  * @throws {AppwriteException}
1941
2115
  * @returns {Promise}
1942
2116
  */
1943
- deleteCollection(collectionId: string): Promise<Response>;
2117
+ deleteCollection(databaseId: string, collectionId: string): Promise<Response>;
1944
2118
  /**
1945
2119
  * List Attributes
1946
2120
  *
2121
+ * @param {string} databaseId
1947
2122
  * @param {string} collectionId
1948
2123
  * @throws {AppwriteException}
1949
2124
  * @returns {Promise}
1950
2125
  */
1951
- listAttributes(collectionId: string): Promise<Models.AttributeList>;
2126
+ listAttributes(databaseId: string, collectionId: string): Promise<Models.AttributeList>;
1952
2127
  /**
1953
2128
  * Create Boolean Attribute
1954
2129
  *
1955
- * Create a boolean attribute.
1956
- *
1957
- *
2130
+ * @param {string} databaseId
1958
2131
  * @param {string} collectionId
1959
2132
  * @param {string} key
1960
2133
  * @param {boolean} required
@@ -1963,13 +2136,11 @@ declare module "node-appwrite" {
1963
2136
  * @throws {AppwriteException}
1964
2137
  * @returns {Promise}
1965
2138
  */
1966
- createBooleanAttribute(collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.AttributeBoolean>;
2139
+ createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.AttributeBoolean>;
1967
2140
  /**
1968
2141
  * Create Email Attribute
1969
2142
  *
1970
- * Create an email attribute.
1971
- *
1972
- *
2143
+ * @param {string} databaseId
1973
2144
  * @param {string} collectionId
1974
2145
  * @param {string} key
1975
2146
  * @param {boolean} required
@@ -1978,10 +2149,11 @@ declare module "node-appwrite" {
1978
2149
  * @throws {AppwriteException}
1979
2150
  * @returns {Promise}
1980
2151
  */
1981
- createEmailAttribute(collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEmail>;
2152
+ createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEmail>;
1982
2153
  /**
1983
2154
  * Create Enum Attribute
1984
2155
  *
2156
+ * @param {string} databaseId
1985
2157
  * @param {string} collectionId
1986
2158
  * @param {string} key
1987
2159
  * @param {string[]} elements
@@ -1991,14 +2163,11 @@ declare module "node-appwrite" {
1991
2163
  * @throws {AppwriteException}
1992
2164
  * @returns {Promise}
1993
2165
  */
1994
- createEnumAttribute(collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEnum>;
2166
+ createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEnum>;
1995
2167
  /**
1996
2168
  * Create Float Attribute
1997
2169
  *
1998
- * Create a float attribute. Optionally, minimum and maximum values can be
1999
- * provided.
2000
- *
2001
- *
2170
+ * @param {string} databaseId
2002
2171
  * @param {string} collectionId
2003
2172
  * @param {string} key
2004
2173
  * @param {boolean} required
@@ -2009,14 +2178,11 @@ declare module "node-appwrite" {
2009
2178
  * @throws {AppwriteException}
2010
2179
  * @returns {Promise}
2011
2180
  */
2012
- createFloatAttribute(collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat>;
2181
+ createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat>;
2013
2182
  /**
2014
2183
  * Create Integer Attribute
2015
2184
  *
2016
- * Create an integer attribute. Optionally, minimum and maximum values can be
2017
- * provided.
2018
- *
2019
- *
2185
+ * @param {string} databaseId
2020
2186
  * @param {string} collectionId
2021
2187
  * @param {string} key
2022
2188
  * @param {boolean} required
@@ -2027,13 +2193,11 @@ declare module "node-appwrite" {
2027
2193
  * @throws {AppwriteException}
2028
2194
  * @returns {Promise}
2029
2195
  */
2030
- createIntegerAttribute(collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeInteger>;
2196
+ createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeInteger>;
2031
2197
  /**
2032
2198
  * Create IP Address Attribute
2033
2199
  *
2034
- * Create IP address attribute.
2035
- *
2036
- *
2200
+ * @param {string} databaseId
2037
2201
  * @param {string} collectionId
2038
2202
  * @param {string} key
2039
2203
  * @param {boolean} required
@@ -2042,13 +2206,11 @@ declare module "node-appwrite" {
2042
2206
  * @throws {AppwriteException}
2043
2207
  * @returns {Promise}
2044
2208
  */
2045
- createIpAttribute(collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeIp>;
2209
+ createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeIp>;
2046
2210
  /**
2047
2211
  * Create String Attribute
2048
2212
  *
2049
- * Create a string attribute.
2050
- *
2051
- *
2213
+ * @param {string} databaseId
2052
2214
  * @param {string} collectionId
2053
2215
  * @param {string} key
2054
2216
  * @param {number} size
@@ -2058,13 +2220,11 @@ declare module "node-appwrite" {
2058
2220
  * @throws {AppwriteException}
2059
2221
  * @returns {Promise}
2060
2222
  */
2061
- createStringAttribute(collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeString>;
2223
+ createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeString>;
2062
2224
  /**
2063
2225
  * Create URL Attribute
2064
2226
  *
2065
- * Create a URL attribute.
2066
- *
2067
- *
2227
+ * @param {string} databaseId
2068
2228
  * @param {string} collectionId
2069
2229
  * @param {string} key
2070
2230
  * @param {boolean} required
@@ -2073,33 +2233,31 @@ declare module "node-appwrite" {
2073
2233
  * @throws {AppwriteException}
2074
2234
  * @returns {Promise}
2075
2235
  */
2076
- createUrlAttribute(collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeUrl>;
2236
+ createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeUrl>;
2077
2237
  /**
2078
2238
  * Get Attribute
2079
2239
  *
2240
+ * @param {string} databaseId
2080
2241
  * @param {string} collectionId
2081
2242
  * @param {string} key
2082
2243
  * @throws {AppwriteException}
2083
2244
  * @returns {Promise}
2084
2245
  */
2085
- getAttribute(collectionId: string, key: string): Promise<Response>;
2246
+ getAttribute(databaseId: string, collectionId: string, key: string): Promise<Response>;
2086
2247
  /**
2087
2248
  * Delete Attribute
2088
2249
  *
2250
+ * @param {string} databaseId
2089
2251
  * @param {string} collectionId
2090
2252
  * @param {string} key
2091
2253
  * @throws {AppwriteException}
2092
2254
  * @returns {Promise}
2093
2255
  */
2094
- deleteAttribute(collectionId: string, key: string): Promise<Response>;
2256
+ deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<Response>;
2095
2257
  /**
2096
2258
  * List Documents
2097
2259
  *
2098
- * Get a list of all the user documents. You can use the query params to
2099
- * filter your results. On admin mode, this endpoint will return a list of all
2100
- * of the project's documents. [Learn more about different API
2101
- * modes](/docs/admin).
2102
- *
2260
+ * @param {string} databaseId
2103
2261
  * @param {string} collectionId
2104
2262
  * @param {string[]} queries
2105
2263
  * @param {number} limit
@@ -2111,15 +2269,11 @@ declare module "node-appwrite" {
2111
2269
  * @throws {AppwriteException}
2112
2270
  * @returns {Promise}
2113
2271
  */
2114
- listDocuments<Document extends Models.Document>(collectionId: string, queries?: string[], limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderAttributes?: string[], orderTypes?: string[]): Promise<Models.DocumentList<Document>>;
2272
+ listDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, queries?: string[], limit?: number, offset?: number, cursor?: string, cursorDirection?: string, orderAttributes?: string[], orderTypes?: string[]): Promise<Models.DocumentList<Document>>;
2115
2273
  /**
2116
2274
  * Create Document
2117
2275
  *
2118
- * Create a new Document. Before using this route, you should create a new
2119
- * collection resource using either a [server
2120
- * integration](/docs/server/database#databaseCreateCollection) API or
2121
- * directly from your database console.
2122
- *
2276
+ * @param {string} databaseId
2123
2277
  * @param {string} collectionId
2124
2278
  * @param {string} documentId
2125
2279
  * @param {object} data
@@ -2128,25 +2282,21 @@ declare module "node-appwrite" {
2128
2282
  * @throws {AppwriteException}
2129
2283
  * @returns {Promise}
2130
2284
  */
2131
- createDocument<Document extends Models.Document>(collectionId: string, documentId: string, data: object, read?: string[], write?: string[]): Promise<Document>;
2285
+ createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: object, read?: string[], write?: string[]): Promise<Document>;
2132
2286
  /**
2133
2287
  * Get Document
2134
2288
  *
2135
- * Get a document by its unique ID. This endpoint response returns a JSON
2136
- * object with the document data.
2137
- *
2289
+ * @param {string} databaseId
2138
2290
  * @param {string} collectionId
2139
2291
  * @param {string} documentId
2140
2292
  * @throws {AppwriteException}
2141
2293
  * @returns {Promise}
2142
2294
  */
2143
- getDocument<Document extends Models.Document>(collectionId: string, documentId: string): Promise<Document>;
2295
+ getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string): Promise<Document>;
2144
2296
  /**
2145
2297
  * Update Document
2146
2298
  *
2147
- * Update a document by its unique ID. Using the patch method you can pass
2148
- * only specific fields that will get updated.
2149
- *
2299
+ * @param {string} databaseId
2150
2300
  * @param {string} collectionId
2151
2301
  * @param {string} documentId
2152
2302
  * @param {object} data
@@ -2155,29 +2305,30 @@ declare module "node-appwrite" {
2155
2305
  * @throws {AppwriteException}
2156
2306
  * @returns {Promise}
2157
2307
  */
2158
- updateDocument<Document extends Models.Document>(collectionId: string, documentId: string, data: object, read?: string[], write?: string[]): Promise<Document>;
2308
+ updateDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data?: object, read?: string[], write?: string[]): Promise<Document>;
2159
2309
  /**
2160
2310
  * Delete Document
2161
2311
  *
2162
- * Delete a document by its unique ID.
2163
- *
2312
+ * @param {string} databaseId
2164
2313
  * @param {string} collectionId
2165
2314
  * @param {string} documentId
2166
2315
  * @throws {AppwriteException}
2167
2316
  * @returns {Promise}
2168
2317
  */
2169
- deleteDocument(collectionId: string, documentId: string): Promise<Response>;
2318
+ deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<Response>;
2170
2319
  /**
2171
2320
  * List Indexes
2172
2321
  *
2322
+ * @param {string} databaseId
2173
2323
  * @param {string} collectionId
2174
2324
  * @throws {AppwriteException}
2175
2325
  * @returns {Promise}
2176
2326
  */
2177
- listIndexes(collectionId: string): Promise<Models.IndexList>;
2327
+ listIndexes(databaseId: string, collectionId: string): Promise<Models.IndexList>;
2178
2328
  /**
2179
2329
  * Create Index
2180
2330
  *
2331
+ * @param {string} databaseId
2181
2332
  * @param {string} collectionId
2182
2333
  * @param {string} key
2183
2334
  * @param {string} type
@@ -2186,25 +2337,27 @@ declare module "node-appwrite" {
2186
2337
  * @throws {AppwriteException}
2187
2338
  * @returns {Promise}
2188
2339
  */
2189
- createIndex(collectionId: string, key: string, type: string, attributes: string[], orders?: string[]): Promise<Models.Index>;
2340
+ createIndex(databaseId: string, collectionId: string, key: string, type: string, attributes: string[], orders?: string[]): Promise<Models.Index>;
2190
2341
  /**
2191
2342
  * Get Index
2192
2343
  *
2344
+ * @param {string} databaseId
2193
2345
  * @param {string} collectionId
2194
2346
  * @param {string} key
2195
2347
  * @throws {AppwriteException}
2196
2348
  * @returns {Promise}
2197
2349
  */
2198
- getIndex(collectionId: string, key: string): Promise<Models.Index>;
2350
+ getIndex(databaseId: string, collectionId: string, key: string): Promise<Models.Index>;
2199
2351
  /**
2200
2352
  * Delete Index
2201
2353
  *
2354
+ * @param {string} databaseId
2202
2355
  * @param {string} collectionId
2203
2356
  * @param {string} key
2204
2357
  * @throws {AppwriteException}
2205
2358
  * @returns {Promise}
2206
2359
  */
2207
- deleteIndex(collectionId: string, key: string): Promise<Response>;
2360
+ deleteIndex(databaseId: string, collectionId: string, key: string): Promise<Response>;
2208
2361
  }
2209
2362
  export class Functions extends Service {
2210
2363
  /**
@@ -2320,12 +2473,12 @@ declare module "node-appwrite" {
2320
2473
  *
2321
2474
  * @param {string} functionId
2322
2475
  * @param {string} entrypoint
2323
- * @param {string} code
2476
+ * @param {InputFile} code
2324
2477
  * @param {boolean} activate
2325
2478
  * @throws {AppwriteException}
2326
2479
  * @returns {Promise}
2327
2480
  */
2328
- createDeployment(functionId: string, entrypoint: string, code: string, activate: boolean): Promise<Models.Deployment>;
2481
+ createDeployment(functionId: string, entrypoint: string, code: InputFile, activate: boolean): Promise<Models.Deployment>;
2329
2482
  /**
2330
2483
  * Get Deployment
2331
2484
  *
@@ -2712,13 +2865,13 @@ declare module "node-appwrite" {
2712
2865
  *
2713
2866
  * @param {string} bucketId
2714
2867
  * @param {string} fileId
2715
- * @param {string} file
2868
+ * @param {InputFile} file
2716
2869
  * @param {string[]} read
2717
2870
  * @param {string[]} write
2718
2871
  * @throws {AppwriteException}
2719
2872
  * @returns {Promise}
2720
2873
  */
2721
- createFile(bucketId: string, fileId: string, file: string, read?: string[], write?: string[]): Promise<Models.File>;
2874
+ createFile(bucketId: string, fileId: string, file: InputFile, read?: string[], write?: string[]): Promise<Models.File>;
2722
2875
  /**
2723
2876
  * Get File
2724
2877
  *
@@ -3090,6 +3243,17 @@ declare module "node-appwrite" {
3090
3243
  * @returns {Promise}
3091
3244
  */
3092
3245
  updatePassword<Preferences extends Models.Preferences>(userId: string, password: string): Promise<Models.User<Preferences>>;
3246
+ /**
3247
+ * Update Phone
3248
+ *
3249
+ * Update the user phone by its unique ID.
3250
+ *
3251
+ * @param {string} userId
3252
+ * @param {string} number
3253
+ * @throws {AppwriteException}
3254
+ * @returns {Promise}
3255
+ */
3256
+ updatePhone<Preferences extends Models.Preferences>(userId: string, number: string): Promise<Models.User<Preferences>>;
3093
3257
  /**
3094
3258
  * Get User Preferences
3095
3259
  *
@@ -3166,6 +3330,17 @@ declare module "node-appwrite" {
3166
3330
  * @throws {AppwriteException}
3167
3331
  * @returns {Promise}
3168
3332
  */
3169
- updateVerification<Preferences extends Models.Preferences>(userId: string, emailVerification: boolean): Promise<Models.User<Preferences>>;
3333
+ updateEmailVerification<Preferences extends Models.Preferences>(userId: string, emailVerification: boolean): Promise<Models.User<Preferences>>;
3334
+ /**
3335
+ * Update Phone Verification
3336
+ *
3337
+ * Update the user phone verification status by its unique ID.
3338
+ *
3339
+ * @param {string} userId
3340
+ * @param {boolean} phoneVerification
3341
+ * @throws {AppwriteException}
3342
+ * @returns {Promise}
3343
+ */
3344
+ updatePhoneVerification<Preferences extends Models.Preferences>(userId: string, phoneVerification: boolean): Promise<Models.User<Preferences>>;
3170
3345
  }
3171
3346
  }