node-appwrite 11.0.0 → 12.0.0-rc.4

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 (287) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +2 -2
  3. package/docs/examples/account/add-authenticator.md +12 -0
  4. package/docs/examples/account/create-anonymous-session.md +9 -0
  5. package/docs/examples/account/create-email-password-session.md +12 -0
  6. package/docs/examples/account/create-email-token.md +13 -0
  7. package/docs/examples/account/create-j-w-t.md +9 -0
  8. package/docs/examples/account/create-magic-u-r-l-token.md +14 -0
  9. package/docs/examples/account/create-o-auth2session.md +15 -0
  10. package/docs/examples/account/create-phone-token.md +12 -0
  11. package/docs/examples/account/create-phone-verification.md +4 -14
  12. package/docs/examples/account/create-recovery.md +7 -14
  13. package/docs/examples/account/create-session.md +12 -0
  14. package/docs/examples/account/create-verification.md +6 -14
  15. package/docs/examples/account/create.md +14 -0
  16. package/docs/examples/account/create2f-a-challenge.md +11 -0
  17. package/docs/examples/account/delete-authenticator.md +13 -0
  18. package/docs/examples/account/delete-identity.md +6 -14
  19. package/docs/examples/account/delete-session.md +6 -14
  20. package/docs/examples/account/delete-sessions.md +4 -14
  21. package/docs/examples/account/get-prefs.md +4 -14
  22. package/docs/examples/account/get-session.md +6 -14
  23. package/docs/examples/account/get.md +4 -14
  24. package/docs/examples/account/list-factors.md +10 -0
  25. package/docs/examples/account/list-identities.md +6 -14
  26. package/docs/examples/account/list-logs.md +6 -14
  27. package/docs/examples/account/list-sessions.md +4 -14
  28. package/docs/examples/account/update-challenge.md +13 -0
  29. package/docs/examples/account/update-email.md +7 -14
  30. package/docs/examples/account/update-m-f-a.md +12 -0
  31. package/docs/examples/account/update-magic-u-r-l-session.md +12 -0
  32. package/docs/examples/account/update-name.md +6 -14
  33. package/docs/examples/account/update-password.md +7 -14
  34. package/docs/examples/account/update-phone-verification.md +7 -14
  35. package/docs/examples/account/update-phone.md +7 -14
  36. package/docs/examples/account/update-prefs.md +6 -14
  37. package/docs/examples/account/update-recovery.md +8 -14
  38. package/docs/examples/account/update-session.md +6 -14
  39. package/docs/examples/account/update-status.md +4 -14
  40. package/docs/examples/account/update-verification.md +7 -14
  41. package/docs/examples/account/verify-authenticator.md +13 -0
  42. package/docs/examples/avatars/get-browser.md +9 -14
  43. package/docs/examples/avatars/get-credit-card.md +9 -14
  44. package/docs/examples/avatars/get-favicon.md +6 -14
  45. package/docs/examples/avatars/get-flag.md +9 -14
  46. package/docs/examples/avatars/get-image.md +8 -14
  47. package/docs/examples/avatars/get-initials.md +9 -14
  48. package/docs/examples/avatars/get-q-r.md +9 -14
  49. package/docs/examples/databases/create-boolean-attribute.md +11 -14
  50. package/docs/examples/databases/create-collection.md +11 -14
  51. package/docs/examples/databases/create-datetime-attribute.md +11 -14
  52. package/docs/examples/databases/create-document.md +10 -14
  53. package/docs/examples/databases/create-email-attribute.md +11 -14
  54. package/docs/examples/databases/create-enum-attribute.md +12 -14
  55. package/docs/examples/databases/create-float-attribute.md +13 -14
  56. package/docs/examples/databases/create-index.md +11 -14
  57. package/docs/examples/databases/create-integer-attribute.md +13 -14
  58. package/docs/examples/databases/create-ip-attribute.md +11 -14
  59. package/docs/examples/databases/create-relationship-attribute.md +13 -14
  60. package/docs/examples/databases/create-string-attribute.md +13 -14
  61. package/docs/examples/databases/create-url-attribute.md +11 -14
  62. package/docs/examples/databases/create.md +8 -14
  63. package/docs/examples/databases/delete-attribute.md +8 -14
  64. package/docs/examples/databases/delete-collection.md +7 -14
  65. package/docs/examples/databases/delete-document.md +8 -14
  66. package/docs/examples/databases/delete-index.md +8 -14
  67. package/docs/examples/databases/delete.md +6 -14
  68. package/docs/examples/databases/get-attribute.md +8 -14
  69. package/docs/examples/databases/get-collection.md +7 -14
  70. package/docs/examples/databases/get-document.md +9 -14
  71. package/docs/examples/databases/get-index.md +8 -14
  72. package/docs/examples/databases/get.md +6 -14
  73. package/docs/examples/databases/list-attributes.md +8 -14
  74. package/docs/examples/databases/list-collections.md +8 -14
  75. package/docs/examples/databases/list-documents.md +8 -14
  76. package/docs/examples/databases/list-indexes.md +8 -14
  77. package/docs/examples/databases/list.md +7 -14
  78. package/docs/examples/databases/update-boolean-attribute.md +10 -14
  79. package/docs/examples/databases/update-collection.md +11 -14
  80. package/docs/examples/databases/update-datetime-attribute.md +10 -14
  81. package/docs/examples/databases/update-document.md +10 -14
  82. package/docs/examples/databases/update-email-attribute.md +10 -14
  83. package/docs/examples/databases/update-enum-attribute.md +11 -14
  84. package/docs/examples/databases/update-float-attribute.md +12 -14
  85. package/docs/examples/databases/update-integer-attribute.md +12 -14
  86. package/docs/examples/databases/update-ip-attribute.md +10 -14
  87. package/docs/examples/databases/update-relationship-attribute.md +9 -14
  88. package/docs/examples/databases/update-string-attribute.md +10 -14
  89. package/docs/examples/databases/update-url-attribute.md +10 -14
  90. package/docs/examples/databases/update.md +8 -14
  91. package/docs/examples/functions/create-build.md +8 -14
  92. package/docs/examples/functions/create-deployment.md +10 -14
  93. package/docs/examples/functions/create-execution.md +11 -14
  94. package/docs/examples/functions/create-variable.md +8 -14
  95. package/docs/examples/functions/create.md +25 -14
  96. package/docs/examples/functions/delete-deployment.md +7 -14
  97. package/docs/examples/functions/delete-variable.md +7 -14
  98. package/docs/examples/functions/delete.md +6 -14
  99. package/docs/examples/functions/download-deployment.md +7 -14
  100. package/docs/examples/functions/get-deployment.md +7 -14
  101. package/docs/examples/functions/get-execution.md +7 -14
  102. package/docs/examples/functions/get-variable.md +7 -14
  103. package/docs/examples/functions/get.md +6 -14
  104. package/docs/examples/functions/list-deployments.md +8 -14
  105. package/docs/examples/functions/list-executions.md +8 -14
  106. package/docs/examples/functions/list-runtimes.md +4 -14
  107. package/docs/examples/functions/list-variables.md +6 -14
  108. package/docs/examples/functions/list.md +7 -14
  109. package/docs/examples/functions/update-deployment.md +7 -14
  110. package/docs/examples/functions/update-variable.md +9 -14
  111. package/docs/examples/functions/update.md +21 -14
  112. package/docs/examples/graphql/mutation.md +6 -14
  113. package/docs/examples/graphql/query.md +6 -14
  114. package/docs/examples/health/get-antivirus.md +4 -14
  115. package/docs/examples/health/get-cache.md +4 -14
  116. package/docs/examples/health/get-certificate.md +12 -0
  117. package/docs/examples/health/get-d-b.md +4 -14
  118. package/docs/examples/health/get-failed-jobs.md +13 -0
  119. package/docs/examples/health/get-pub-sub.md +4 -14
  120. package/docs/examples/health/get-queue-builds.md +12 -0
  121. package/docs/examples/health/get-queue-certificates.md +6 -14
  122. package/docs/examples/health/get-queue-databases.md +13 -0
  123. package/docs/examples/health/get-queue-deletes.md +12 -0
  124. package/docs/examples/health/get-queue-functions.md +6 -14
  125. package/docs/examples/health/get-queue-logs.md +6 -14
  126. package/docs/examples/health/get-queue-mails.md +12 -0
  127. package/docs/examples/health/get-queue-messaging.md +12 -0
  128. package/docs/examples/health/get-queue-migrations.md +12 -0
  129. package/docs/examples/health/get-queue-webhooks.md +6 -14
  130. package/docs/examples/health/get-queue.md +4 -14
  131. package/docs/examples/health/get-storage-local.md +4 -14
  132. package/docs/examples/health/get-time.md +4 -14
  133. package/docs/examples/health/get.md +4 -14
  134. package/docs/examples/locale/get.md +4 -14
  135. package/docs/examples/locale/list-codes.md +4 -14
  136. package/docs/examples/locale/list-continents.md +4 -14
  137. package/docs/examples/locale/list-countries-e-u.md +4 -14
  138. package/docs/examples/locale/list-countries-phones.md +4 -14
  139. package/docs/examples/locale/list-countries.md +4 -14
  140. package/docs/examples/locale/list-currencies.md +4 -14
  141. package/docs/examples/locale/list-languages.md +4 -14
  142. package/docs/examples/messaging/create-apns-provider.md +18 -0
  143. package/docs/examples/messaging/create-email.md +23 -0
  144. package/docs/examples/messaging/create-fcm-provider.md +15 -0
  145. package/docs/examples/messaging/create-mailgun-provider.md +21 -0
  146. package/docs/examples/messaging/create-msg91provider.md +17 -0
  147. package/docs/examples/messaging/create-push.md +27 -0
  148. package/docs/examples/messaging/create-sendgrid-provider.md +19 -0
  149. package/docs/examples/messaging/create-sms.md +18 -0
  150. package/docs/examples/messaging/create-smtp-provider.md +25 -0
  151. package/docs/examples/messaging/create-subscriber.md +14 -0
  152. package/docs/examples/messaging/create-telesign-provider.md +17 -0
  153. package/docs/examples/messaging/create-textmagic-provider.md +17 -0
  154. package/docs/examples/messaging/create-topic.md +14 -0
  155. package/docs/examples/messaging/create-twilio-provider.md +17 -0
  156. package/docs/examples/messaging/create-vonage-provider.md +17 -0
  157. package/docs/examples/messaging/delete-provider.md +12 -0
  158. package/docs/examples/messaging/delete-subscriber.md +13 -0
  159. package/docs/examples/messaging/delete-topic.md +12 -0
  160. package/docs/examples/messaging/delete.md +12 -0
  161. package/docs/examples/messaging/get-message.md +12 -0
  162. package/docs/examples/messaging/get-provider.md +12 -0
  163. package/docs/examples/messaging/get-subscriber.md +13 -0
  164. package/docs/examples/messaging/get-topic.md +12 -0
  165. package/docs/examples/messaging/list-message-logs.md +13 -0
  166. package/docs/examples/messaging/list-messages.md +13 -0
  167. package/docs/examples/messaging/list-provider-logs.md +13 -0
  168. package/docs/examples/messaging/list-providers.md +13 -0
  169. package/docs/examples/messaging/list-subscriber-logs.md +13 -0
  170. package/docs/examples/messaging/list-subscribers.md +14 -0
  171. package/docs/examples/messaging/list-targets.md +13 -0
  172. package/docs/examples/messaging/list-topic-logs.md +13 -0
  173. package/docs/examples/messaging/list-topics.md +13 -0
  174. package/docs/examples/messaging/update-a-p-n-s-provider.md +18 -0
  175. package/docs/examples/messaging/update-email.md +22 -0
  176. package/docs/examples/messaging/update-f-c-m-provider.md +15 -0
  177. package/docs/examples/messaging/update-mailgun-provider.md +21 -0
  178. package/docs/examples/messaging/update-msg91provider.md +17 -0
  179. package/docs/examples/messaging/update-push.md +27 -0
  180. package/docs/examples/messaging/update-sendgrid-provider.md +19 -0
  181. package/docs/examples/messaging/update-sms.md +18 -0
  182. package/docs/examples/messaging/update-smtp-provider.md +25 -0
  183. package/docs/examples/messaging/update-telesign-provider.md +17 -0
  184. package/docs/examples/messaging/update-textmagic-provider.md +17 -0
  185. package/docs/examples/messaging/update-topic.md +13 -0
  186. package/docs/examples/messaging/update-twilio-provider.md +17 -0
  187. package/docs/examples/messaging/update-vonage-provider.md +17 -0
  188. package/docs/examples/storage/create-bucket.md +15 -14
  189. package/docs/examples/storage/create-file.md +9 -14
  190. package/docs/examples/storage/delete-bucket.md +6 -14
  191. package/docs/examples/storage/delete-file.md +7 -14
  192. package/docs/examples/storage/get-bucket.md +6 -14
  193. package/docs/examples/storage/get-file-download.md +7 -14
  194. package/docs/examples/storage/get-file-preview.md +18 -14
  195. package/docs/examples/storage/get-file-view.md +7 -14
  196. package/docs/examples/storage/get-file.md +7 -14
  197. package/docs/examples/storage/list-buckets.md +7 -14
  198. package/docs/examples/storage/list-files.md +8 -14
  199. package/docs/examples/storage/update-bucket.md +15 -14
  200. package/docs/examples/storage/update-file.md +9 -14
  201. package/docs/examples/teams/create-membership.md +12 -14
  202. package/docs/examples/teams/create.md +8 -14
  203. package/docs/examples/teams/delete-membership.md +7 -14
  204. package/docs/examples/teams/delete.md +6 -14
  205. package/docs/examples/teams/get-membership.md +7 -14
  206. package/docs/examples/teams/get-prefs.md +6 -14
  207. package/docs/examples/teams/get.md +6 -14
  208. package/docs/examples/teams/list-memberships.md +8 -14
  209. package/docs/examples/teams/list.md +7 -14
  210. package/docs/examples/teams/update-membership-status.md +9 -14
  211. package/docs/examples/teams/update-membership.md +8 -14
  212. package/docs/examples/teams/update-name.md +7 -14
  213. package/docs/examples/teams/update-prefs.md +7 -14
  214. package/docs/examples/users/create-argon2user.md +9 -14
  215. package/docs/examples/users/create-bcrypt-user.md +9 -14
  216. package/docs/examples/users/create-m-d5user.md +9 -14
  217. package/docs/examples/users/create-p-h-pass-user.md +9 -14
  218. package/docs/examples/users/create-s-h-a-user.md +10 -14
  219. package/docs/examples/users/create-scrypt-modified-user.md +12 -14
  220. package/docs/examples/users/create-scrypt-user.md +14 -14
  221. package/docs/examples/users/create-session.md +12 -0
  222. package/docs/examples/users/create-target.md +17 -0
  223. package/docs/examples/users/create-token.md +14 -0
  224. package/docs/examples/users/create.md +10 -14
  225. package/docs/examples/users/delete-authenticator.md +14 -0
  226. package/docs/examples/users/delete-identity.md +6 -14
  227. package/docs/examples/users/delete-session.md +7 -14
  228. package/docs/examples/users/delete-sessions.md +6 -14
  229. package/docs/examples/users/delete-target.md +13 -0
  230. package/docs/examples/users/delete.md +6 -14
  231. package/docs/examples/users/get-prefs.md +6 -14
  232. package/docs/examples/users/get-target.md +13 -0
  233. package/docs/examples/users/get.md +6 -14
  234. package/docs/examples/users/list-factors.md +12 -0
  235. package/docs/examples/users/list-identities.md +7 -14
  236. package/docs/examples/users/list-logs.md +7 -14
  237. package/docs/examples/users/list-memberships.md +6 -14
  238. package/docs/examples/users/list-sessions.md +6 -14
  239. package/docs/examples/users/list-targets.md +13 -0
  240. package/docs/examples/users/list.md +7 -14
  241. package/docs/examples/users/update-email-verification.md +7 -14
  242. package/docs/examples/users/update-email.md +7 -14
  243. package/docs/examples/users/update-labels.md +7 -14
  244. package/docs/examples/users/update-mfa.md +13 -0
  245. package/docs/examples/users/update-name.md +7 -14
  246. package/docs/examples/users/update-password.md +7 -14
  247. package/docs/examples/users/update-phone-verification.md +7 -14
  248. package/docs/examples/users/update-phone.md +7 -14
  249. package/docs/examples/users/update-prefs.md +7 -14
  250. package/docs/examples/users/update-status.md +7 -14
  251. package/docs/examples/users/update-target.md +16 -0
  252. package/index.d.ts +2280 -309
  253. package/index.js +40 -0
  254. package/lib/client.js +122 -65
  255. package/lib/enums/authentication-factor.js +7 -0
  256. package/lib/enums/authenticator-type.js +5 -0
  257. package/lib/enums/browser.js +18 -0
  258. package/lib/enums/compression.js +7 -0
  259. package/lib/enums/credit-card.js +20 -0
  260. package/lib/enums/encryption.js +7 -0
  261. package/lib/enums/execution-method.js +10 -0
  262. package/lib/enums/flag.js +198 -0
  263. package/lib/enums/image-format.js +9 -0
  264. package/lib/enums/image-gravity.js +13 -0
  265. package/lib/enums/index-type.js +8 -0
  266. package/lib/enums/message-status.js +7 -0
  267. package/lib/enums/messaging-provider-type.js +7 -0
  268. package/lib/enums/name.js +16 -0
  269. package/lib/enums/o-auth-provider.js +43 -0
  270. package/lib/enums/password-hash.js +15 -0
  271. package/lib/enums/relation-mutate.js +7 -0
  272. package/lib/enums/relationship-type.js +8 -0
  273. package/lib/enums/runtime.js +40 -0
  274. package/lib/inputFile.js +88 -16
  275. package/lib/query.js +56 -38
  276. package/lib/services/account.js +639 -46
  277. package/lib/services/avatars.js +16 -13
  278. package/lib/services/databases.js +54 -52
  279. package/lib/services/functions.js +77 -109
  280. package/lib/services/graphql.js +4 -2
  281. package/lib/services/health.js +229 -14
  282. package/lib/services/locale.js +9 -7
  283. package/lib/services/messaging.js +2198 -0
  284. package/lib/services/storage.js +64 -100
  285. package/lib/services/teams.js +19 -17
  286. package/lib/services/users.js +367 -45
  287. package/package.json +2 -3
@@ -1,20 +1,14 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = functions.createVariable('[FUNCTION_ID]', '[KEY]', '[VALUE]');
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.createVariable(
11
+ '[FUNCTION_ID]', // functionId
12
+ '[KEY]', // key
13
+ '[VALUE]' // value
14
+ );
@@ -1,20 +1,31 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = functions.create('[FUNCTION_ID]', '[NAME]', 'node-18.0');
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.create(
11
+ '[FUNCTION_ID]', // functionId
12
+ '[NAME]', // name
13
+ sdk..Node145, // runtime
14
+ ["any"], // execute (optional)
15
+ [], // events (optional)
16
+ '', // schedule (optional)
17
+ 1, // timeout (optional)
18
+ false, // enabled (optional)
19
+ false, // logging (optional)
20
+ '[ENTRYPOINT]', // entrypoint (optional)
21
+ '[COMMANDS]', // commands (optional)
22
+ '[INSTALLATION_ID]', // installationId (optional)
23
+ '[PROVIDER_REPOSITORY_ID]', // providerRepositoryId (optional)
24
+ '[PROVIDER_BRANCH]', // providerBranch (optional)
25
+ false, // providerSilentMode (optional)
26
+ '[PROVIDER_ROOT_DIRECTORY]', // providerRootDirectory (optional)
27
+ '[TEMPLATE_REPOSITORY]', // templateRepository (optional)
28
+ '[TEMPLATE_OWNER]', // templateOwner (optional)
29
+ '[TEMPLATE_ROOT_DIRECTORY]', // templateRootDirectory (optional)
30
+ '[TEMPLATE_BRANCH]' // templateBranch (optional)
31
+ );
@@ -1,20 +1,13 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = functions.deleteDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]');
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.deleteDeployment(
11
+ '[FUNCTION_ID]', // functionId
12
+ '[DEPLOYMENT_ID]' // deploymentId
13
+ );
@@ -1,20 +1,13 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = functions.deleteVariable('[FUNCTION_ID]', '[VARIABLE_ID]');
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.deleteVariable(
11
+ '[FUNCTION_ID]', // functionId
12
+ '[VARIABLE_ID]' // variableId
13
+ );
@@ -1,20 +1,12 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = functions.delete('[FUNCTION_ID]');
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.delete(
11
+ '[FUNCTION_ID]' // functionId
12
+ );
@@ -1,20 +1,13 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = functions.downloadDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]');
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.downloadDeployment(
11
+ '[FUNCTION_ID]', // functionId
12
+ '[DEPLOYMENT_ID]' // deploymentId
13
+ );
@@ -1,20 +1,13 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = functions.getDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]');
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.getDeployment(
11
+ '[FUNCTION_ID]', // functionId
12
+ '[DEPLOYMENT_ID]' // deploymentId
13
+ );
@@ -1,20 +1,13 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setSession(''); // The user session to authenticate with
13
7
 
14
- const promise = functions.getExecution('[FUNCTION_ID]', '[EXECUTION_ID]');
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.getExecution(
11
+ '[FUNCTION_ID]', // functionId
12
+ '[EXECUTION_ID]' // executionId
13
+ );
@@ -1,20 +1,13 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = functions.getVariable('[FUNCTION_ID]', '[VARIABLE_ID]');
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.getVariable(
11
+ '[FUNCTION_ID]', // functionId
12
+ '[VARIABLE_ID]' // variableId
13
+ );
@@ -1,20 +1,12 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = functions.get('[FUNCTION_ID]');
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.get(
11
+ '[FUNCTION_ID]' // functionId
12
+ );
@@ -1,20 +1,14 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = functions.listDeployments('[FUNCTION_ID]');
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.listDeployments(
11
+ '[FUNCTION_ID]', // functionId
12
+ [], // queries (optional)
13
+ '[SEARCH]' // search (optional)
14
+ );
@@ -1,20 +1,14 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setSession(''); // The user session to authenticate with
13
7
 
14
- const promise = functions.listExecutions('[FUNCTION_ID]');
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.listExecutions(
11
+ '[FUNCTION_ID]', // functionId
12
+ [], // queries (optional)
13
+ '[SEARCH]' // search (optional)
14
+ );
@@ -1,20 +1,10 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = functions.listRuntimes();
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.listRuntimes();
@@ -1,20 +1,12 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = functions.listVariables('[FUNCTION_ID]');
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.listVariables(
11
+ '[FUNCTION_ID]' // functionId
12
+ );
@@ -1,20 +1,13 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = functions.list();
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.list(
11
+ [], // queries (optional)
12
+ '[SEARCH]' // search (optional)
13
+ );
@@ -1,20 +1,13 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = functions.updateDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]');
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.updateDeployment(
11
+ '[FUNCTION_ID]', // functionId
12
+ '[DEPLOYMENT_ID]' // deploymentId
13
+ );
@@ -1,20 +1,15 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = functions.updateVariable('[FUNCTION_ID]', '[VARIABLE_ID]', '[KEY]');
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.updateVariable(
11
+ '[FUNCTION_ID]', // functionId
12
+ '[VARIABLE_ID]', // variableId
13
+ '[KEY]', // key
14
+ '[VALUE]' // value (optional)
15
+ );
@@ -1,20 +1,27 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const functions = new sdk.Functions(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = functions.update('[FUNCTION_ID]', '[NAME]');
8
+ const functions = new sdk.Functions(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await functions.update(
11
+ '[FUNCTION_ID]', // functionId
12
+ '[NAME]', // name
13
+ sdk..Node145, // runtime (optional)
14
+ ["any"], // execute (optional)
15
+ [], // events (optional)
16
+ '', // schedule (optional)
17
+ 1, // timeout (optional)
18
+ false, // enabled (optional)
19
+ false, // logging (optional)
20
+ '[ENTRYPOINT]', // entrypoint (optional)
21
+ '[COMMANDS]', // commands (optional)
22
+ '[INSTALLATION_ID]', // installationId (optional)
23
+ '[PROVIDER_REPOSITORY_ID]', // providerRepositoryId (optional)
24
+ '[PROVIDER_BRANCH]', // providerBranch (optional)
25
+ false, // providerSilentMode (optional)
26
+ '[PROVIDER_ROOT_DIRECTORY]' // providerRootDirectory (optional)
27
+ );
@@ -1,20 +1,12 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const graphql = new sdk.Graphql(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = graphql.mutation({});
8
+ const graphql = new sdk.Graphql(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await graphql.mutation(
11
+ {} // query
12
+ );
@@ -1,20 +1,12 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const graphql = new sdk.Graphql(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = graphql.query({});
8
+ const graphql = new sdk.Graphql(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await graphql.query(
11
+ {} // query
12
+ );
@@ -1,20 +1,10 @@
1
1
  const sdk = require('node-appwrite');
2
2
 
3
- // Init SDK
4
- const client = new sdk.Client();
5
-
6
- const health = new sdk.Health(client);
7
-
8
- client
3
+ const client = new sdk.Client()
9
4
  .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
10
5
  .setProject('5df5acd0d48c2') // Your project ID
11
- .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
12
- ;
6
+ .setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
13
7
 
14
- const promise = health.getAntivirus();
8
+ const health = new sdk.Health(client);
15
9
 
16
- promise.then(function (response) {
17
- console.log(response);
18
- }, function (error) {
19
- console.log(error);
20
- });
10
+ const response = await health.getAntivirus();