@appwrite.io/console 0.6.2 → 0.7.0-rc.1

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 (434) hide show
  1. package/.github/workflows/autoclose.yml +11 -0
  2. package/.github/workflows/publish.yml +40 -16
  3. package/README.md +3 -3
  4. package/dist/cjs/sdk.js +2749 -2318
  5. package/dist/cjs/sdk.js.map +1 -1
  6. package/dist/esm/sdk.js +2749 -2318
  7. package/dist/esm/sdk.js.map +1 -1
  8. package/dist/iife/sdk.js +2749 -2318
  9. package/docs/examples/account/create-anonymous-session.md +2 -2
  10. package/docs/examples/account/create-email-password-session.md +2 -2
  11. package/docs/examples/account/create-email-token.md +2 -2
  12. package/docs/examples/account/create-j-w-t.md +2 -2
  13. package/docs/examples/account/create-magic-u-r-l-token.md +2 -2
  14. package/docs/examples/account/create-mfa-authenticator.md +2 -2
  15. package/docs/examples/account/create-mfa-challenge.md +2 -2
  16. package/docs/examples/account/create-mfa-recovery-codes.md +2 -2
  17. package/docs/examples/account/create-o-auth2session.md +1 -1
  18. package/docs/examples/account/create-o-auth2token.md +1 -1
  19. package/docs/examples/account/create-phone-token.md +2 -2
  20. package/docs/examples/account/create-phone-verification.md +2 -2
  21. package/docs/examples/account/create-push-target.md +2 -2
  22. package/docs/examples/account/create-recovery.md +2 -2
  23. package/docs/examples/account/create-session.md +2 -2
  24. package/docs/examples/account/create-verification.md +2 -2
  25. package/docs/examples/account/create.md +2 -2
  26. package/docs/examples/account/delete-identity.md +2 -2
  27. package/docs/examples/account/delete-mfa-authenticator.md +3 -4
  28. package/docs/examples/account/delete-push-target.md +2 -2
  29. package/docs/examples/account/delete-session.md +2 -2
  30. package/docs/examples/account/delete-sessions.md +2 -2
  31. package/docs/examples/account/delete.md +2 -2
  32. package/docs/examples/account/get-mfa-recovery-codes.md +2 -2
  33. package/docs/examples/account/get-prefs.md +2 -2
  34. package/docs/examples/account/get-session.md +2 -2
  35. package/docs/examples/account/get.md +2 -2
  36. package/docs/examples/account/list-identities.md +2 -2
  37. package/docs/examples/account/list-logs.md +2 -2
  38. package/docs/examples/account/list-mfa-factors.md +2 -2
  39. package/docs/examples/account/list-sessions.md +2 -2
  40. package/docs/examples/account/update-email.md +2 -2
  41. package/docs/examples/account/update-m-f-a.md +2 -2
  42. package/docs/examples/account/update-magic-u-r-l-session.md +2 -2
  43. package/docs/examples/account/update-mfa-authenticator.md +2 -2
  44. package/docs/examples/account/update-mfa-challenge.md +2 -2
  45. package/docs/examples/account/update-mfa-recovery-codes.md +2 -2
  46. package/docs/examples/account/update-name.md +2 -2
  47. package/docs/examples/account/update-password.md +2 -2
  48. package/docs/examples/account/update-phone-session.md +2 -2
  49. package/docs/examples/account/update-phone-verification.md +2 -2
  50. package/docs/examples/account/update-phone.md +2 -2
  51. package/docs/examples/account/update-prefs.md +2 -2
  52. package/docs/examples/account/update-push-target.md +2 -2
  53. package/docs/examples/account/update-recovery.md +2 -2
  54. package/docs/examples/account/update-session.md +2 -2
  55. package/docs/examples/account/update-status.md +2 -2
  56. package/docs/examples/account/update-verification.md +2 -2
  57. package/docs/examples/assistant/chat.md +2 -2
  58. package/docs/examples/avatars/get-browser.md +1 -1
  59. package/docs/examples/avatars/get-credit-card.md +1 -1
  60. package/docs/examples/avatars/get-favicon.md +1 -1
  61. package/docs/examples/avatars/get-flag.md +1 -1
  62. package/docs/examples/avatars/get-image.md +1 -1
  63. package/docs/examples/avatars/get-initials.md +1 -1
  64. package/docs/examples/avatars/get-q-r.md +1 -1
  65. package/docs/examples/console/variables.md +2 -2
  66. package/docs/examples/databases/create-boolean-attribute.md +2 -2
  67. package/docs/examples/databases/create-collection.md +2 -2
  68. package/docs/examples/databases/create-datetime-attribute.md +2 -2
  69. package/docs/examples/databases/create-document.md +2 -2
  70. package/docs/examples/databases/create-email-attribute.md +2 -2
  71. package/docs/examples/databases/create-enum-attribute.md +2 -2
  72. package/docs/examples/databases/create-float-attribute.md +2 -2
  73. package/docs/examples/databases/create-index.md +2 -2
  74. package/docs/examples/databases/create-integer-attribute.md +2 -2
  75. package/docs/examples/databases/create-ip-attribute.md +2 -2
  76. package/docs/examples/databases/create-relationship-attribute.md +2 -2
  77. package/docs/examples/databases/create-string-attribute.md +2 -2
  78. package/docs/examples/databases/create-url-attribute.md +2 -2
  79. package/docs/examples/databases/create.md +2 -2
  80. package/docs/examples/databases/delete-attribute.md +2 -2
  81. package/docs/examples/databases/delete-collection.md +2 -2
  82. package/docs/examples/databases/delete-document.md +2 -2
  83. package/docs/examples/databases/delete-index.md +2 -2
  84. package/docs/examples/databases/delete.md +2 -2
  85. package/docs/examples/databases/get-attribute.md +2 -2
  86. package/docs/examples/databases/get-collection-usage.md +2 -2
  87. package/docs/examples/databases/get-collection.md +2 -2
  88. package/docs/examples/databases/get-database-usage.md +2 -2
  89. package/docs/examples/databases/get-document.md +2 -2
  90. package/docs/examples/databases/get-index.md +2 -2
  91. package/docs/examples/databases/get-usage.md +2 -2
  92. package/docs/examples/databases/get.md +2 -2
  93. package/docs/examples/databases/list-attributes.md +2 -2
  94. package/docs/examples/databases/list-collection-logs.md +2 -2
  95. package/docs/examples/databases/list-collections.md +2 -2
  96. package/docs/examples/databases/list-document-logs.md +2 -2
  97. package/docs/examples/databases/list-documents.md +2 -2
  98. package/docs/examples/databases/list-indexes.md +2 -2
  99. package/docs/examples/databases/list-logs.md +2 -2
  100. package/docs/examples/databases/list.md +2 -2
  101. package/docs/examples/databases/update-boolean-attribute.md +2 -2
  102. package/docs/examples/databases/update-collection.md +2 -2
  103. package/docs/examples/databases/update-datetime-attribute.md +2 -2
  104. package/docs/examples/databases/update-document.md +2 -2
  105. package/docs/examples/databases/update-email-attribute.md +2 -2
  106. package/docs/examples/databases/update-enum-attribute.md +2 -2
  107. package/docs/examples/databases/update-float-attribute.md +2 -2
  108. package/docs/examples/databases/update-integer-attribute.md +2 -2
  109. package/docs/examples/databases/update-ip-attribute.md +2 -2
  110. package/docs/examples/databases/update-relationship-attribute.md +2 -2
  111. package/docs/examples/databases/update-string-attribute.md +2 -2
  112. package/docs/examples/databases/update-url-attribute.md +2 -2
  113. package/docs/examples/databases/update.md +2 -2
  114. package/docs/examples/functions/create-build.md +3 -3
  115. package/docs/examples/functions/create-deployment.md +2 -2
  116. package/docs/examples/functions/create-execution.md +4 -3
  117. package/docs/examples/functions/create-variable.md +2 -2
  118. package/docs/examples/functions/create.md +4 -3
  119. package/docs/examples/functions/delete-deployment.md +2 -2
  120. package/docs/examples/functions/delete-execution.md +14 -0
  121. package/docs/examples/functions/delete-variable.md +2 -2
  122. package/docs/examples/functions/delete.md +2 -2
  123. package/docs/examples/functions/{download-deployment.md → get-deployment-download.md} +2 -2
  124. package/docs/examples/functions/get-deployment.md +2 -2
  125. package/docs/examples/functions/get-execution.md +2 -2
  126. package/docs/examples/functions/get-function-usage.md +2 -2
  127. package/docs/examples/functions/get-template.md +13 -0
  128. package/docs/examples/functions/get-usage.md +2 -2
  129. package/docs/examples/functions/get-variable.md +2 -2
  130. package/docs/examples/functions/get.md +2 -2
  131. package/docs/examples/functions/list-deployments.md +2 -2
  132. package/docs/examples/functions/list-executions.md +2 -2
  133. package/docs/examples/functions/list-runtimes.md +2 -2
  134. package/docs/examples/functions/list-templates.md +16 -0
  135. package/docs/examples/functions/list-variables.md +2 -2
  136. package/docs/examples/functions/list.md +2 -2
  137. package/docs/examples/functions/update-deployment-build.md +14 -0
  138. package/docs/examples/functions/update-deployment.md +2 -2
  139. package/docs/examples/functions/update-variable.md +2 -2
  140. package/docs/examples/functions/update.md +3 -2
  141. package/docs/examples/graphql/mutation.md +2 -2
  142. package/docs/examples/graphql/query.md +2 -2
  143. package/docs/examples/health/get-antivirus.md +2 -2
  144. package/docs/examples/health/get-cache.md +2 -2
  145. package/docs/examples/health/get-certificate.md +2 -2
  146. package/docs/examples/health/get-d-b.md +2 -2
  147. package/docs/examples/health/get-failed-jobs.md +2 -2
  148. package/docs/examples/health/get-pub-sub.md +2 -2
  149. package/docs/examples/health/get-queue-builds.md +2 -2
  150. package/docs/examples/health/get-queue-certificates.md +2 -2
  151. package/docs/examples/health/get-queue-databases.md +2 -2
  152. package/docs/examples/health/get-queue-deletes.md +2 -2
  153. package/docs/examples/health/get-queue-functions.md +2 -2
  154. package/docs/examples/health/get-queue-logs.md +2 -2
  155. package/docs/examples/health/get-queue-mails.md +2 -2
  156. package/docs/examples/health/get-queue-messaging.md +2 -2
  157. package/docs/examples/health/get-queue-migrations.md +2 -2
  158. package/docs/examples/health/get-queue-usage-dump.md +2 -2
  159. package/docs/examples/health/get-queue-usage.md +2 -2
  160. package/docs/examples/health/get-queue-webhooks.md +2 -2
  161. package/docs/examples/health/get-queue.md +2 -2
  162. package/docs/examples/health/get-storage-local.md +2 -2
  163. package/docs/examples/health/get-storage.md +2 -2
  164. package/docs/examples/health/get-time.md +2 -2
  165. package/docs/examples/health/get.md +2 -2
  166. package/docs/examples/locale/get.md +2 -2
  167. package/docs/examples/locale/list-codes.md +2 -2
  168. package/docs/examples/locale/list-continents.md +2 -2
  169. package/docs/examples/locale/list-countries-e-u.md +2 -2
  170. package/docs/examples/locale/list-countries-phones.md +2 -2
  171. package/docs/examples/locale/list-countries.md +2 -2
  172. package/docs/examples/locale/list-currencies.md +2 -2
  173. package/docs/examples/locale/list-languages.md +2 -2
  174. package/docs/examples/messaging/create-apns-provider.md +2 -2
  175. package/docs/examples/messaging/create-email.md +2 -2
  176. package/docs/examples/messaging/create-fcm-provider.md +2 -2
  177. package/docs/examples/messaging/create-mailgun-provider.md +2 -2
  178. package/docs/examples/messaging/create-msg91provider.md +2 -2
  179. package/docs/examples/messaging/create-push.md +2 -2
  180. package/docs/examples/messaging/create-sendgrid-provider.md +2 -2
  181. package/docs/examples/messaging/create-sms.md +2 -2
  182. package/docs/examples/messaging/create-smtp-provider.md +2 -2
  183. package/docs/examples/messaging/create-subscriber.md +2 -2
  184. package/docs/examples/messaging/create-telesign-provider.md +2 -2
  185. package/docs/examples/messaging/create-textmagic-provider.md +2 -2
  186. package/docs/examples/messaging/create-topic.md +2 -2
  187. package/docs/examples/messaging/create-twilio-provider.md +2 -2
  188. package/docs/examples/messaging/create-vonage-provider.md +2 -2
  189. package/docs/examples/messaging/delete-provider.md +2 -2
  190. package/docs/examples/messaging/delete-subscriber.md +2 -2
  191. package/docs/examples/messaging/delete-topic.md +2 -2
  192. package/docs/examples/messaging/delete.md +2 -2
  193. package/docs/examples/messaging/get-message.md +2 -2
  194. package/docs/examples/messaging/get-provider.md +2 -2
  195. package/docs/examples/messaging/get-subscriber.md +2 -2
  196. package/docs/examples/messaging/get-topic.md +2 -2
  197. package/docs/examples/messaging/list-message-logs.md +2 -2
  198. package/docs/examples/messaging/list-messages.md +2 -2
  199. package/docs/examples/messaging/list-provider-logs.md +2 -2
  200. package/docs/examples/messaging/list-providers.md +2 -2
  201. package/docs/examples/messaging/list-subscriber-logs.md +2 -2
  202. package/docs/examples/messaging/list-subscribers.md +2 -2
  203. package/docs/examples/messaging/list-targets.md +2 -2
  204. package/docs/examples/messaging/list-topic-logs.md +2 -2
  205. package/docs/examples/messaging/list-topics.md +2 -2
  206. package/docs/examples/messaging/update-apns-provider.md +2 -2
  207. package/docs/examples/messaging/update-email.md +2 -2
  208. package/docs/examples/messaging/update-fcm-provider.md +2 -2
  209. package/docs/examples/messaging/update-mailgun-provider.md +2 -2
  210. package/docs/examples/messaging/update-msg91provider.md +2 -2
  211. package/docs/examples/messaging/update-push.md +2 -2
  212. package/docs/examples/messaging/update-sendgrid-provider.md +2 -2
  213. package/docs/examples/messaging/update-sms.md +2 -2
  214. package/docs/examples/messaging/update-smtp-provider.md +2 -2
  215. package/docs/examples/messaging/update-telesign-provider.md +2 -2
  216. package/docs/examples/messaging/update-textmagic-provider.md +2 -2
  217. package/docs/examples/messaging/update-topic.md +2 -2
  218. package/docs/examples/messaging/update-twilio-provider.md +2 -2
  219. package/docs/examples/messaging/update-vonage-provider.md +2 -2
  220. package/docs/examples/migrations/create-appwrite-migration.md +2 -2
  221. package/docs/examples/migrations/create-firebase-migration.md +2 -2
  222. package/docs/examples/migrations/create-firebase-o-auth-migration.md +2 -2
  223. package/docs/examples/migrations/create-n-host-migration.md +2 -2
  224. package/docs/examples/migrations/create-supabase-migration.md +2 -2
  225. package/docs/examples/migrations/delete-firebase-auth.md +2 -2
  226. package/docs/examples/migrations/delete.md +2 -2
  227. package/docs/examples/migrations/get-appwrite-report.md +2 -2
  228. package/docs/examples/migrations/get-firebase-report-o-auth.md +2 -2
  229. package/docs/examples/migrations/get-firebase-report.md +2 -2
  230. package/docs/examples/migrations/get-n-host-report.md +2 -2
  231. package/docs/examples/migrations/get-supabase-report.md +2 -2
  232. package/docs/examples/migrations/get.md +2 -2
  233. package/docs/examples/migrations/list-firebase-projects.md +2 -2
  234. package/docs/examples/migrations/list.md +2 -2
  235. package/docs/examples/migrations/retry.md +2 -2
  236. package/docs/examples/project/create-variable.md +2 -2
  237. package/docs/examples/project/delete-variable.md +2 -2
  238. package/docs/examples/project/get-usage.md +2 -2
  239. package/docs/examples/project/get-variable.md +2 -2
  240. package/docs/examples/project/list-variables.md +2 -2
  241. package/docs/examples/project/update-variable.md +2 -2
  242. package/docs/examples/projects/create-j-w-t.md +15 -0
  243. package/docs/examples/projects/create-key.md +2 -2
  244. package/docs/examples/projects/create-platform.md +2 -2
  245. package/docs/examples/projects/create-smtp-test.md +2 -2
  246. package/docs/examples/projects/create-webhook.md +2 -2
  247. package/docs/examples/projects/create.md +2 -2
  248. package/docs/examples/projects/delete-email-template.md +2 -2
  249. package/docs/examples/projects/delete-key.md +2 -2
  250. package/docs/examples/projects/delete-platform.md +2 -2
  251. package/docs/examples/projects/delete-sms-template.md +2 -2
  252. package/docs/examples/projects/delete-webhook.md +2 -2
  253. package/docs/examples/projects/delete.md +2 -2
  254. package/docs/examples/projects/get-email-template.md +2 -2
  255. package/docs/examples/projects/get-key.md +2 -2
  256. package/docs/examples/projects/get-platform.md +2 -2
  257. package/docs/examples/projects/get-sms-template.md +2 -2
  258. package/docs/examples/projects/get-webhook.md +2 -2
  259. package/docs/examples/projects/get.md +2 -2
  260. package/docs/examples/projects/list-keys.md +2 -2
  261. package/docs/examples/projects/list-platforms.md +2 -2
  262. package/docs/examples/projects/list-webhooks.md +2 -2
  263. package/docs/examples/projects/list.md +2 -2
  264. package/docs/examples/projects/update-api-status-all.md +2 -2
  265. package/docs/examples/projects/update-api-status.md +2 -2
  266. package/docs/examples/projects/update-auth-duration.md +2 -2
  267. package/docs/examples/projects/update-auth-limit.md +2 -2
  268. package/docs/examples/projects/update-auth-password-dictionary.md +2 -2
  269. package/docs/examples/projects/update-auth-password-history.md +2 -2
  270. package/docs/examples/projects/update-auth-sessions-limit.md +2 -2
  271. package/docs/examples/projects/update-auth-status.md +2 -2
  272. package/docs/examples/projects/update-email-template.md +2 -2
  273. package/docs/examples/projects/update-key.md +2 -2
  274. package/docs/examples/projects/update-mock-numbers.md +14 -0
  275. package/docs/examples/projects/update-o-auth2.md +2 -2
  276. package/docs/examples/projects/update-personal-data-check.md +2 -2
  277. package/docs/examples/projects/update-platform.md +2 -2
  278. package/docs/examples/projects/update-service-status-all.md +2 -2
  279. package/docs/examples/projects/update-service-status.md +2 -2
  280. package/docs/examples/projects/update-session-alerts.md +14 -0
  281. package/docs/examples/projects/update-sms-template.md +2 -2
  282. package/docs/examples/projects/update-smtp.md +2 -2
  283. package/docs/examples/projects/update-team.md +2 -2
  284. package/docs/examples/projects/update-webhook-signature.md +2 -2
  285. package/docs/examples/projects/update-webhook.md +2 -2
  286. package/docs/examples/projects/update.md +2 -2
  287. package/docs/examples/proxy/create-rule.md +2 -2
  288. package/docs/examples/proxy/delete-rule.md +2 -2
  289. package/docs/examples/proxy/get-rule.md +2 -2
  290. package/docs/examples/proxy/list-rules.md +2 -2
  291. package/docs/examples/proxy/update-rule-verification.md +2 -2
  292. package/docs/examples/storage/create-bucket.md +2 -2
  293. package/docs/examples/storage/create-file.md +2 -2
  294. package/docs/examples/storage/delete-bucket.md +2 -2
  295. package/docs/examples/storage/delete-file.md +2 -2
  296. package/docs/examples/storage/get-bucket-usage.md +2 -2
  297. package/docs/examples/storage/get-bucket.md +2 -2
  298. package/docs/examples/storage/get-file-download.md +1 -1
  299. package/docs/examples/storage/get-file-preview.md +1 -1
  300. package/docs/examples/storage/get-file-view.md +1 -1
  301. package/docs/examples/storage/get-file.md +2 -2
  302. package/docs/examples/storage/get-usage.md +2 -2
  303. package/docs/examples/storage/list-buckets.md +2 -2
  304. package/docs/examples/storage/list-files.md +2 -2
  305. package/docs/examples/storage/update-bucket.md +2 -2
  306. package/docs/examples/storage/update-file.md +2 -2
  307. package/docs/examples/teams/create-membership.md +2 -2
  308. package/docs/examples/teams/create.md +2 -2
  309. package/docs/examples/teams/delete-membership.md +2 -2
  310. package/docs/examples/teams/delete.md +2 -2
  311. package/docs/examples/teams/get-membership.md +2 -2
  312. package/docs/examples/teams/get-prefs.md +2 -2
  313. package/docs/examples/teams/get.md +2 -2
  314. package/docs/examples/teams/list-logs.md +2 -2
  315. package/docs/examples/teams/list-memberships.md +2 -2
  316. package/docs/examples/teams/list.md +2 -2
  317. package/docs/examples/teams/update-membership-status.md +2 -2
  318. package/docs/examples/teams/update-membership.md +2 -2
  319. package/docs/examples/teams/update-name.md +2 -2
  320. package/docs/examples/teams/update-prefs.md +2 -2
  321. package/docs/examples/users/create-argon2user.md +2 -2
  322. package/docs/examples/users/create-bcrypt-user.md +2 -2
  323. package/docs/examples/users/create-j-w-t.md +15 -0
  324. package/docs/examples/users/create-m-d5user.md +2 -2
  325. package/docs/examples/users/create-mfa-recovery-codes.md +2 -2
  326. package/docs/examples/users/create-p-h-pass-user.md +2 -2
  327. package/docs/examples/users/create-s-h-a-user.md +2 -2
  328. package/docs/examples/users/create-scrypt-modified-user.md +2 -2
  329. package/docs/examples/users/create-scrypt-user.md +2 -2
  330. package/docs/examples/users/create-session.md +2 -2
  331. package/docs/examples/users/create-target.md +2 -2
  332. package/docs/examples/users/create-token.md +2 -2
  333. package/docs/examples/users/create.md +2 -2
  334. package/docs/examples/users/delete-identity.md +2 -2
  335. package/docs/examples/users/delete-mfa-authenticator.md +2 -2
  336. package/docs/examples/users/delete-session.md +2 -2
  337. package/docs/examples/users/delete-sessions.md +2 -2
  338. package/docs/examples/users/delete-target.md +2 -2
  339. package/docs/examples/users/delete.md +2 -2
  340. package/docs/examples/users/get-mfa-recovery-codes.md +2 -2
  341. package/docs/examples/users/get-prefs.md +2 -2
  342. package/docs/examples/users/get-target.md +2 -2
  343. package/docs/examples/users/get-usage.md +2 -2
  344. package/docs/examples/users/get.md +2 -2
  345. package/docs/examples/users/list-identities.md +2 -2
  346. package/docs/examples/users/list-logs.md +2 -2
  347. package/docs/examples/users/list-memberships.md +2 -2
  348. package/docs/examples/users/list-mfa-factors.md +2 -2
  349. package/docs/examples/users/list-sessions.md +2 -2
  350. package/docs/examples/users/list-targets.md +2 -2
  351. package/docs/examples/users/list.md +2 -2
  352. package/docs/examples/users/update-email-verification.md +2 -2
  353. package/docs/examples/users/update-email.md +2 -2
  354. package/docs/examples/users/update-labels.md +2 -2
  355. package/docs/examples/users/update-mfa-recovery-codes.md +2 -2
  356. package/docs/examples/users/update-mfa.md +2 -2
  357. package/docs/examples/users/update-name.md +2 -2
  358. package/docs/examples/users/update-password.md +2 -2
  359. package/docs/examples/users/update-phone-verification.md +2 -2
  360. package/docs/examples/users/update-phone.md +2 -2
  361. package/docs/examples/users/update-prefs.md +2 -2
  362. package/docs/examples/users/update-status.md +2 -2
  363. package/docs/examples/users/update-target.md +2 -2
  364. package/docs/examples/vcs/create-repository-detection.md +2 -2
  365. package/docs/examples/vcs/create-repository.md +2 -2
  366. package/docs/examples/vcs/delete-installation.md +2 -2
  367. package/docs/examples/vcs/get-installation.md +2 -2
  368. package/docs/examples/vcs/get-repository-contents.md +15 -0
  369. package/docs/examples/vcs/get-repository.md +2 -2
  370. package/docs/examples/vcs/list-installations.md +2 -2
  371. package/docs/examples/vcs/list-repositories.md +2 -2
  372. package/docs/examples/vcs/list-repository-branches.md +2 -2
  373. package/docs/examples/vcs/update-external-deployments.md +2 -2
  374. package/package.json +1 -1
  375. package/src/client.ts +322 -51
  376. package/src/enums/credit-card.ts +1 -1
  377. package/src/enums/email-template-type.ts +2 -0
  378. package/src/enums/name.ts +1 -2
  379. package/src/enums/platform-type.ts +2 -0
  380. package/src/enums/runtime.ts +1 -3
  381. package/src/id.ts +21 -2
  382. package/src/index.ts +7 -0
  383. package/src/models.ts +299 -0
  384. package/src/permission.ts +41 -6
  385. package/src/query.ts +161 -1
  386. package/src/service.ts +3 -0
  387. package/src/services/account.ts +654 -647
  388. package/src/services/assistant.ts +19 -16
  389. package/src/services/avatars.ts +111 -152
  390. package/src/services/console.ts +19 -14
  391. package/src/services/databases.ts +628 -638
  392. package/src/services/functions.ts +446 -321
  393. package/src/services/graphql.ts +31 -24
  394. package/src/services/health.ts +299 -199
  395. package/src/services/locale.ts +113 -77
  396. package/src/services/messaging.ts +568 -583
  397. package/src/services/migrations.ts +199 -197
  398. package/src/services/project.ts +82 -65
  399. package/src/services/projects.ts +615 -459
  400. package/src/services/proxy.ts +68 -50
  401. package/src/services/storage.ts +198 -253
  402. package/src/services/teams.ts +198 -188
  403. package/src/services/users.ts +568 -478
  404. package/src/services/vcs.ts +149 -83
  405. package/types/client.d.ts +82 -4
  406. package/types/enums/credit-card.d.ts +1 -1
  407. package/types/enums/email-template-type.d.ts +3 -1
  408. package/types/enums/name.d.ts +2 -3
  409. package/types/enums/platform-type.d.ts +3 -1
  410. package/types/enums/runtime.d.ts +2 -4
  411. package/types/id.d.ts +15 -0
  412. package/types/index.d.ts +7 -0
  413. package/types/models.d.ts +299 -0
  414. package/types/permission.d.ts +36 -0
  415. package/types/query.d.ts +160 -0
  416. package/types/service.d.ts +3 -0
  417. package/types/services/account.d.ts +165 -320
  418. package/types/services/assistant.d.ts +4 -4
  419. package/types/services/avatars.d.ts +50 -84
  420. package/types/services/console.d.ts +4 -4
  421. package/types/services/databases.d.ts +143 -173
  422. package/types/services/functions.d.ts +119 -92
  423. package/types/services/graphql.d.ts +6 -6
  424. package/types/services/health.d.ts +64 -85
  425. package/types/services/locale.d.ts +28 -39
  426. package/types/services/messaging.d.ts +103 -104
  427. package/types/services/migrations.d.ts +34 -34
  428. package/types/services/project.d.ts +17 -20
  429. package/types/services/projects.d.ts +118 -87
  430. package/types/services/proxy.d.ts +13 -14
  431. package/types/services/storage.d.ts +53 -78
  432. package/types/services/teams.d.ts +53 -83
  433. package/types/services/users.d.ts +120 -157
  434. package/types/services/vcs.d.ts +31 -20
@@ -1,54 +1,52 @@
1
- import { Service } from '../service';
2
- import { AppwriteException, Client } from '../client';
1
+ import { AppwriteException, Client, type Payload, UploadProgress } from '../client';
3
2
  import type { Models } from '../models';
4
- import type { UploadProgress, Payload } from '../client';
5
3
  import { Runtime } from '../enums/runtime';
6
4
  import { FunctionUsageRange } from '../enums/function-usage-range';
7
5
  import { ExecutionMethod } from '../enums/execution-method';
8
6
 
9
- export class Functions extends Service {
7
+ export class Functions {
8
+ client: Client;
10
9
 
11
- constructor(client: Client)
12
- {
13
- super(client);
14
- }
10
+ constructor(client: Client) {
11
+ this.client = client;
12
+ }
15
13
 
16
14
  /**
17
15
  * List functions
18
16
  *
19
- * Get a list of all the project's functions. You can use the query params to
20
- * filter your results.
17
+ * Get a list of all the project's functions. You can use the query params to filter your results.
21
18
  *
22
19
  * @param {string[]} queries
23
20
  * @param {string} search
24
21
  * @throws {AppwriteException}
25
- * @returns {Promise}
26
- */
22
+ * @returns {Promise<Models.FunctionList>}
23
+ */
27
24
  async list(queries?: string[], search?: string): Promise<Models.FunctionList> {
28
25
  const apiPath = '/functions';
29
26
  const payload: Payload = {};
30
-
31
27
  if (typeof queries !== 'undefined') {
32
28
  payload['queries'] = queries;
33
29
  }
34
-
35
30
  if (typeof search !== 'undefined') {
36
31
  payload['search'] = search;
37
32
  }
38
-
39
33
  const uri = new URL(this.client.config.endpoint + apiPath);
40
- return await this.client.call('get', uri, {
34
+
35
+ const apiHeaders: { [header: string]: string } = {
41
36
  'content-type': 'application/json',
42
- }, payload);
43
- }
37
+ }
44
38
 
39
+ return await this.client.call(
40
+ 'get',
41
+ uri,
42
+ apiHeaders,
43
+ payload
44
+ );
45
+ }
45
46
  /**
46
47
  * Create function
47
48
  *
48
- * Create a new function. You can pass a list of
49
- * [permissions](https://appwrite.io/docs/permissions) to allow different
50
- * project users or team with access to execute the function using the client
51
- * API.
49
+ * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API.
52
50
  *
53
51
  * @param {string} functionId
54
52
  * @param {string} name
@@ -61,6 +59,7 @@ export class Functions extends Service {
61
59
  * @param {boolean} logging
62
60
  * @param {string} entrypoint
63
61
  * @param {string} commands
62
+ * @param {string[]} scopes
64
63
  * @param {string} installationId
65
64
  * @param {string} providerRepositoryId
66
65
  * @param {string} providerBranch
@@ -69,152 +68,217 @@ export class Functions extends Service {
69
68
  * @param {string} templateRepository
70
69
  * @param {string} templateOwner
71
70
  * @param {string} templateRootDirectory
72
- * @param {string} templateBranch
71
+ * @param {string} templateVersion
73
72
  * @throws {AppwriteException}
74
- * @returns {Promise}
75
- */
76
- async create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, templateRepository?: string, templateOwner?: string, templateRootDirectory?: string, templateBranch?: string): Promise<Models.Function> {
73
+ * @returns {Promise<Models.Function>}
74
+ */
75
+ async create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, templateRepository?: string, templateOwner?: string, templateRootDirectory?: string, templateVersion?: string): Promise<Models.Function> {
77
76
  if (typeof functionId === 'undefined') {
78
77
  throw new AppwriteException('Missing required parameter: "functionId"');
79
78
  }
80
-
81
79
  if (typeof name === 'undefined') {
82
80
  throw new AppwriteException('Missing required parameter: "name"');
83
81
  }
84
-
85
82
  if (typeof runtime === 'undefined') {
86
83
  throw new AppwriteException('Missing required parameter: "runtime"');
87
84
  }
88
-
89
85
  const apiPath = '/functions';
90
86
  const payload: Payload = {};
91
-
92
87
  if (typeof functionId !== 'undefined') {
93
88
  payload['functionId'] = functionId;
94
89
  }
95
-
96
90
  if (typeof name !== 'undefined') {
97
91
  payload['name'] = name;
98
92
  }
99
-
100
93
  if (typeof runtime !== 'undefined') {
101
94
  payload['runtime'] = runtime;
102
95
  }
103
-
104
96
  if (typeof execute !== 'undefined') {
105
97
  payload['execute'] = execute;
106
98
  }
107
-
108
99
  if (typeof events !== 'undefined') {
109
100
  payload['events'] = events;
110
101
  }
111
-
112
102
  if (typeof schedule !== 'undefined') {
113
103
  payload['schedule'] = schedule;
114
104
  }
115
-
116
105
  if (typeof timeout !== 'undefined') {
117
106
  payload['timeout'] = timeout;
118
107
  }
119
-
120
108
  if (typeof enabled !== 'undefined') {
121
109
  payload['enabled'] = enabled;
122
110
  }
123
-
124
111
  if (typeof logging !== 'undefined') {
125
112
  payload['logging'] = logging;
126
113
  }
127
-
128
114
  if (typeof entrypoint !== 'undefined') {
129
115
  payload['entrypoint'] = entrypoint;
130
116
  }
131
-
132
117
  if (typeof commands !== 'undefined') {
133
118
  payload['commands'] = commands;
134
119
  }
135
-
120
+ if (typeof scopes !== 'undefined') {
121
+ payload['scopes'] = scopes;
122
+ }
136
123
  if (typeof installationId !== 'undefined') {
137
124
  payload['installationId'] = installationId;
138
125
  }
139
-
140
126
  if (typeof providerRepositoryId !== 'undefined') {
141
127
  payload['providerRepositoryId'] = providerRepositoryId;
142
128
  }
143
-
144
129
  if (typeof providerBranch !== 'undefined') {
145
130
  payload['providerBranch'] = providerBranch;
146
131
  }
147
-
148
132
  if (typeof providerSilentMode !== 'undefined') {
149
133
  payload['providerSilentMode'] = providerSilentMode;
150
134
  }
151
-
152
135
  if (typeof providerRootDirectory !== 'undefined') {
153
136
  payload['providerRootDirectory'] = providerRootDirectory;
154
137
  }
155
-
156
138
  if (typeof templateRepository !== 'undefined') {
157
139
  payload['templateRepository'] = templateRepository;
158
140
  }
159
-
160
141
  if (typeof templateOwner !== 'undefined') {
161
142
  payload['templateOwner'] = templateOwner;
162
143
  }
163
-
164
144
  if (typeof templateRootDirectory !== 'undefined') {
165
145
  payload['templateRootDirectory'] = templateRootDirectory;
166
146
  }
167
-
168
- if (typeof templateBranch !== 'undefined') {
169
- payload['templateBranch'] = templateBranch;
147
+ if (typeof templateVersion !== 'undefined') {
148
+ payload['templateVersion'] = templateVersion;
170
149
  }
171
-
172
150
  const uri = new URL(this.client.config.endpoint + apiPath);
173
- return await this.client.call('post', uri, {
151
+
152
+ const apiHeaders: { [header: string]: string } = {
174
153
  'content-type': 'application/json',
175
- }, payload);
176
- }
154
+ }
177
155
 
156
+ return await this.client.call(
157
+ 'post',
158
+ uri,
159
+ apiHeaders,
160
+ payload
161
+ );
162
+ }
178
163
  /**
179
164
  * List runtimes
180
165
  *
181
166
  * Get a list of all runtimes that are currently active on your instance.
182
167
  *
183
168
  * @throws {AppwriteException}
184
- * @returns {Promise}
185
- */
169
+ * @returns {Promise<Models.RuntimeList>}
170
+ */
186
171
  async listRuntimes(): Promise<Models.RuntimeList> {
187
172
  const apiPath = '/functions/runtimes';
188
173
  const payload: Payload = {};
174
+ const uri = new URL(this.client.config.endpoint + apiPath);
175
+
176
+ const apiHeaders: { [header: string]: string } = {
177
+ 'content-type': 'application/json',
178
+ }
189
179
 
180
+ return await this.client.call(
181
+ 'get',
182
+ uri,
183
+ apiHeaders,
184
+ payload
185
+ );
186
+ }
187
+ /**
188
+ * List function templates
189
+ *
190
+ * List available function templates. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method.
191
+ *
192
+ * @param {string[]} runtimes
193
+ * @param {string[]} useCases
194
+ * @param {number} limit
195
+ * @param {number} offset
196
+ * @throws {AppwriteException}
197
+ * @returns {Promise<Models.TemplateFunctionList>}
198
+ */
199
+ async listTemplates(runtimes?: string[], useCases?: string[], limit?: number, offset?: number): Promise<Models.TemplateFunctionList> {
200
+ const apiPath = '/functions/templates';
201
+ const payload: Payload = {};
202
+ if (typeof runtimes !== 'undefined') {
203
+ payload['runtimes'] = runtimes;
204
+ }
205
+ if (typeof useCases !== 'undefined') {
206
+ payload['useCases'] = useCases;
207
+ }
208
+ if (typeof limit !== 'undefined') {
209
+ payload['limit'] = limit;
210
+ }
211
+ if (typeof offset !== 'undefined') {
212
+ payload['offset'] = offset;
213
+ }
190
214
  const uri = new URL(this.client.config.endpoint + apiPath);
191
- return await this.client.call('get', uri, {
215
+
216
+ const apiHeaders: { [header: string]: string } = {
192
217
  'content-type': 'application/json',
193
- }, payload);
218
+ }
219
+
220
+ return await this.client.call(
221
+ 'get',
222
+ uri,
223
+ apiHeaders,
224
+ payload
225
+ );
194
226
  }
227
+ /**
228
+ * Get function template
229
+ *
230
+ * Get a function template using ID. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method.
231
+ *
232
+ * @param {string} templateId
233
+ * @throws {AppwriteException}
234
+ * @returns {Promise<Models.TemplateFunction>}
235
+ */
236
+ async getTemplate(templateId: string): Promise<Models.TemplateFunction> {
237
+ if (typeof templateId === 'undefined') {
238
+ throw new AppwriteException('Missing required parameter: "templateId"');
239
+ }
240
+ const apiPath = '/functions/templates/{templateId}'.replace('{templateId}', templateId);
241
+ const payload: Payload = {};
242
+ const uri = new URL(this.client.config.endpoint + apiPath);
243
+
244
+ const apiHeaders: { [header: string]: string } = {
245
+ 'content-type': 'application/json',
246
+ }
195
247
 
248
+ return await this.client.call(
249
+ 'get',
250
+ uri,
251
+ apiHeaders,
252
+ payload
253
+ );
254
+ }
196
255
  /**
197
256
  * Get functions usage
198
257
  *
199
258
  *
200
259
  * @param {FunctionUsageRange} range
201
260
  * @throws {AppwriteException}
202
- * @returns {Promise}
203
- */
261
+ * @returns {Promise<Models.UsageFunctions>}
262
+ */
204
263
  async getUsage(range?: FunctionUsageRange): Promise<Models.UsageFunctions> {
205
264
  const apiPath = '/functions/usage';
206
265
  const payload: Payload = {};
207
-
208
266
  if (typeof range !== 'undefined') {
209
267
  payload['range'] = range;
210
268
  }
211
-
212
269
  const uri = new URL(this.client.config.endpoint + apiPath);
213
- return await this.client.call('get', uri, {
270
+
271
+ const apiHeaders: { [header: string]: string } = {
214
272
  'content-type': 'application/json',
215
- }, payload);
216
- }
273
+ }
217
274
 
275
+ return await this.client.call(
276
+ 'get',
277
+ uri,
278
+ apiHeaders,
279
+ payload
280
+ );
281
+ }
218
282
  /**
219
283
  * Get function
220
284
  *
@@ -222,22 +286,27 @@ export class Functions extends Service {
222
286
  *
223
287
  * @param {string} functionId
224
288
  * @throws {AppwriteException}
225
- * @returns {Promise}
226
- */
289
+ * @returns {Promise<Models.Function>}
290
+ */
227
291
  async get(functionId: string): Promise<Models.Function> {
228
292
  if (typeof functionId === 'undefined') {
229
293
  throw new AppwriteException('Missing required parameter: "functionId"');
230
294
  }
231
-
232
295
  const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
233
296
  const payload: Payload = {};
234
-
235
297
  const uri = new URL(this.client.config.endpoint + apiPath);
236
- return await this.client.call('get', uri, {
298
+
299
+ const apiHeaders: { [header: string]: string } = {
237
300
  'content-type': 'application/json',
238
- }, payload);
239
- }
301
+ }
240
302
 
303
+ return await this.client.call(
304
+ 'get',
305
+ uri,
306
+ apiHeaders,
307
+ payload
308
+ );
309
+ }
241
310
  /**
242
311
  * Update function
243
312
  *
@@ -254,92 +323,85 @@ export class Functions extends Service {
254
323
  * @param {boolean} logging
255
324
  * @param {string} entrypoint
256
325
  * @param {string} commands
326
+ * @param {string[]} scopes
257
327
  * @param {string} installationId
258
328
  * @param {string} providerRepositoryId
259
329
  * @param {string} providerBranch
260
330
  * @param {boolean} providerSilentMode
261
331
  * @param {string} providerRootDirectory
262
332
  * @throws {AppwriteException}
263
- * @returns {Promise}
264
- */
265
- async update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string): Promise<Models.Function> {
333
+ * @returns {Promise<Models.Function>}
334
+ */
335
+ async update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string): Promise<Models.Function> {
266
336
  if (typeof functionId === 'undefined') {
267
337
  throw new AppwriteException('Missing required parameter: "functionId"');
268
338
  }
269
-
270
339
  if (typeof name === 'undefined') {
271
340
  throw new AppwriteException('Missing required parameter: "name"');
272
341
  }
273
-
274
342
  const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
275
343
  const payload: Payload = {};
276
-
277
344
  if (typeof name !== 'undefined') {
278
345
  payload['name'] = name;
279
346
  }
280
-
281
347
  if (typeof runtime !== 'undefined') {
282
348
  payload['runtime'] = runtime;
283
349
  }
284
-
285
350
  if (typeof execute !== 'undefined') {
286
351
  payload['execute'] = execute;
287
352
  }
288
-
289
353
  if (typeof events !== 'undefined') {
290
354
  payload['events'] = events;
291
355
  }
292
-
293
356
  if (typeof schedule !== 'undefined') {
294
357
  payload['schedule'] = schedule;
295
358
  }
296
-
297
359
  if (typeof timeout !== 'undefined') {
298
360
  payload['timeout'] = timeout;
299
361
  }
300
-
301
362
  if (typeof enabled !== 'undefined') {
302
363
  payload['enabled'] = enabled;
303
364
  }
304
-
305
365
  if (typeof logging !== 'undefined') {
306
366
  payload['logging'] = logging;
307
367
  }
308
-
309
368
  if (typeof entrypoint !== 'undefined') {
310
369
  payload['entrypoint'] = entrypoint;
311
370
  }
312
-
313
371
  if (typeof commands !== 'undefined') {
314
372
  payload['commands'] = commands;
315
373
  }
316
-
374
+ if (typeof scopes !== 'undefined') {
375
+ payload['scopes'] = scopes;
376
+ }
317
377
  if (typeof installationId !== 'undefined') {
318
378
  payload['installationId'] = installationId;
319
379
  }
320
-
321
380
  if (typeof providerRepositoryId !== 'undefined') {
322
381
  payload['providerRepositoryId'] = providerRepositoryId;
323
382
  }
324
-
325
383
  if (typeof providerBranch !== 'undefined') {
326
384
  payload['providerBranch'] = providerBranch;
327
385
  }
328
-
329
386
  if (typeof providerSilentMode !== 'undefined') {
330
387
  payload['providerSilentMode'] = providerSilentMode;
331
388
  }
332
-
333
389
  if (typeof providerRootDirectory !== 'undefined') {
334
390
  payload['providerRootDirectory'] = providerRootDirectory;
335
391
  }
336
-
337
392
  const uri = new URL(this.client.config.endpoint + apiPath);
338
- return await this.client.call('put', uri, {
393
+
394
+ const apiHeaders: { [header: string]: string } = {
339
395
  'content-type': 'application/json',
340
- }, payload);
341
- }
396
+ }
342
397
 
398
+ return await this.client.call(
399
+ 'put',
400
+ uri,
401
+ apiHeaders,
402
+ payload
403
+ );
404
+ }
343
405
  /**
344
406
  * Delete function
345
407
  *
@@ -347,69 +409,71 @@ export class Functions extends Service {
347
409
  *
348
410
  * @param {string} functionId
349
411
  * @throws {AppwriteException}
350
- * @returns {Promise}
351
- */
412
+ * @returns {Promise<{}>}
413
+ */
352
414
  async delete(functionId: string): Promise<{}> {
353
415
  if (typeof functionId === 'undefined') {
354
416
  throw new AppwriteException('Missing required parameter: "functionId"');
355
417
  }
356
-
357
418
  const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
358
419
  const payload: Payload = {};
359
-
360
420
  const uri = new URL(this.client.config.endpoint + apiPath);
361
- return await this.client.call('delete', uri, {
421
+
422
+ const apiHeaders: { [header: string]: string } = {
362
423
  'content-type': 'application/json',
363
- }, payload);
364
- }
424
+ }
365
425
 
426
+ return await this.client.call(
427
+ 'delete',
428
+ uri,
429
+ apiHeaders,
430
+ payload
431
+ );
432
+ }
366
433
  /**
367
434
  * List deployments
368
435
  *
369
- * Get a list of all the project's code deployments. You can use the query
370
- * params to filter your results.
436
+ * Get a list of all the project&#039;s code deployments. You can use the query params to filter your results.
371
437
  *
372
438
  * @param {string} functionId
373
439
  * @param {string[]} queries
374
440
  * @param {string} search
375
441
  * @throws {AppwriteException}
376
- * @returns {Promise}
377
- */
442
+ * @returns {Promise<Models.DeploymentList>}
443
+ */
378
444
  async listDeployments(functionId: string, queries?: string[], search?: string): Promise<Models.DeploymentList> {
379
445
  if (typeof functionId === 'undefined') {
380
446
  throw new AppwriteException('Missing required parameter: "functionId"');
381
447
  }
382
-
383
448
  const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
384
449
  const payload: Payload = {};
385
-
386
450
  if (typeof queries !== 'undefined') {
387
451
  payload['queries'] = queries;
388
452
  }
389
-
390
453
  if (typeof search !== 'undefined') {
391
454
  payload['search'] = search;
392
455
  }
393
-
394
456
  const uri = new URL(this.client.config.endpoint + apiPath);
395
- return await this.client.call('get', uri, {
457
+
458
+ const apiHeaders: { [header: string]: string } = {
396
459
  'content-type': 'application/json',
397
- }, payload);
398
- }
460
+ }
399
461
 
462
+ return await this.client.call(
463
+ 'get',
464
+ uri,
465
+ apiHeaders,
466
+ payload
467
+ );
468
+ }
400
469
  /**
401
470
  * Create deployment
402
471
  *
403
- * Create a new function code deployment. Use this endpoint to upload a new
404
- * version of your code function. To execute your newly uploaded code, you'll
405
- * need to update the function's deployment to use your new deployment UID.
406
- *
407
- * This endpoint accepts a tar.gz file compressed with your code. Make sure to
408
- * include any dependencies your code has within the compressed file. You can
409
- * learn more about code packaging in the [Appwrite Cloud Functions
410
- * tutorial](https://appwrite.io/docs/functions).
411
- *
412
- * Use the "command" param to set the entrypoint used to execute your code.
472
+ * Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you&#039;ll need to update the function&#039;s deployment to use your new deployment UID.
473
+
474
+ This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions).
475
+
476
+ Use the &quot;command&quot; param to set the entrypoint used to execute your code.
413
477
  *
414
478
  * @param {string} functionId
415
479
  * @param {File} code
@@ -417,87 +481,46 @@ export class Functions extends Service {
417
481
  * @param {string} entrypoint
418
482
  * @param {string} commands
419
483
  * @throws {AppwriteException}
420
- * @returns {Promise}
421
- */
484
+ * @returns {Promise<Models.Deployment>}
485
+ */
422
486
  async createDeployment(functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress = (progress: UploadProgress) => {}): Promise<Models.Deployment> {
423
487
  if (typeof functionId === 'undefined') {
424
488
  throw new AppwriteException('Missing required parameter: "functionId"');
425
489
  }
426
-
427
490
  if (typeof code === 'undefined') {
428
491
  throw new AppwriteException('Missing required parameter: "code"');
429
492
  }
430
-
431
493
  if (typeof activate === 'undefined') {
432
494
  throw new AppwriteException('Missing required parameter: "activate"');
433
495
  }
434
-
435
496
  const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
436
497
  const payload: Payload = {};
437
-
438
498
  if (typeof entrypoint !== 'undefined') {
439
499
  payload['entrypoint'] = entrypoint;
440
500
  }
441
-
442
501
  if (typeof commands !== 'undefined') {
443
502
  payload['commands'] = commands;
444
503
  }
445
-
446
504
  if (typeof code !== 'undefined') {
447
505
  payload['code'] = code;
448
506
  }
449
-
450
507
  if (typeof activate !== 'undefined') {
451
508
  payload['activate'] = activate;
452
509
  }
453
-
454
510
  const uri = new URL(this.client.config.endpoint + apiPath);
455
511
 
456
- if(!(code instanceof File)) {
457
- throw new AppwriteException('Parameter "code" has to be a File.');
458
- }
459
-
460
- const size = code.size;
461
-
462
- if (size <= Service.CHUNK_SIZE) {
463
- return await this.client.call('post', uri, {
464
- 'content-type': 'multipart/form-data',
465
- }, payload);
466
- }
467
-
468
512
  const apiHeaders: { [header: string]: string } = {
469
513
  'content-type': 'multipart/form-data',
470
514
  }
471
515
 
472
- let offset = 0;
473
- let response = undefined;
474
-
475
- while (offset < size) {
476
- let end = Math.min(offset + Service.CHUNK_SIZE - 1, size - 1);
477
-
478
- apiHeaders['content-range'] = 'bytes ' + offset + '-' + end + '/' + size;
479
- if (response && response.$id) {
480
- apiHeaders['x-appwrite-id'] = response.$id;
481
- }
482
-
483
- const chunk = code.slice(offset, end + 1);
484
- payload['code'] = new File([chunk], code.name);
485
- response = await this.client.call('post', uri, apiHeaders, payload);
486
-
487
- if (onProgress) {
488
- onProgress({
489
- $id: response.$id,
490
- progress: (offset / size) * 100,
491
- sizeUploaded: offset,
492
- chunksTotal: response.chunksTotal,
493
- chunksUploaded: response.chunksUploaded
494
- });
495
- }
496
- offset += Service.CHUNK_SIZE;
497
- }
498
- return response;
516
+ return await this.client.chunkedUpload(
517
+ 'post',
518
+ uri,
519
+ apiHeaders,
520
+ payload,
521
+ onProgress
522
+ );
499
523
  }
500
-
501
524
  /**
502
525
  * Get deployment
503
526
  *
@@ -506,56 +529,62 @@ export class Functions extends Service {
506
529
  * @param {string} functionId
507
530
  * @param {string} deploymentId
508
531
  * @throws {AppwriteException}
509
- * @returns {Promise}
510
- */
532
+ * @returns {Promise<Models.Deployment>}
533
+ */
511
534
  async getDeployment(functionId: string, deploymentId: string): Promise<Models.Deployment> {
512
535
  if (typeof functionId === 'undefined') {
513
536
  throw new AppwriteException('Missing required parameter: "functionId"');
514
537
  }
515
-
516
538
  if (typeof deploymentId === 'undefined') {
517
539
  throw new AppwriteException('Missing required parameter: "deploymentId"');
518
540
  }
519
-
520
541
  const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
521
542
  const payload: Payload = {};
522
-
523
543
  const uri = new URL(this.client.config.endpoint + apiPath);
524
- return await this.client.call('get', uri, {
544
+
545
+ const apiHeaders: { [header: string]: string } = {
525
546
  'content-type': 'application/json',
526
- }, payload);
527
- }
547
+ }
528
548
 
549
+ return await this.client.call(
550
+ 'get',
551
+ uri,
552
+ apiHeaders,
553
+ payload
554
+ );
555
+ }
529
556
  /**
530
- * Update function deployment
557
+ * Update deployment
531
558
  *
532
- * Update the function code deployment ID using the unique function ID. Use
533
- * this endpoint to switch the code deployment that should be executed by the
534
- * execution endpoint.
559
+ * Update the function code deployment ID using the unique function ID. Use this endpoint to switch the code deployment that should be executed by the execution endpoint.
535
560
  *
536
561
  * @param {string} functionId
537
562
  * @param {string} deploymentId
538
563
  * @throws {AppwriteException}
539
- * @returns {Promise}
540
- */
564
+ * @returns {Promise<Models.Function>}
565
+ */
541
566
  async updateDeployment(functionId: string, deploymentId: string): Promise<Models.Function> {
542
567
  if (typeof functionId === 'undefined') {
543
568
  throw new AppwriteException('Missing required parameter: "functionId"');
544
569
  }
545
-
546
570
  if (typeof deploymentId === 'undefined') {
547
571
  throw new AppwriteException('Missing required parameter: "deploymentId"');
548
572
  }
549
-
550
573
  const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
551
574
  const payload: Payload = {};
552
-
553
575
  const uri = new URL(this.client.config.endpoint + apiPath);
554
- return await this.client.call('patch', uri, {
576
+
577
+ const apiHeaders: { [header: string]: string } = {
555
578
  'content-type': 'application/json',
556
- }, payload);
557
- }
579
+ }
558
580
 
581
+ return await this.client.call(
582
+ 'patch',
583
+ uri,
584
+ apiHeaders,
585
+ payload
586
+ );
587
+ }
559
588
  /**
560
589
  * Delete deployment
561
590
  *
@@ -564,134 +593,169 @@ export class Functions extends Service {
564
593
  * @param {string} functionId
565
594
  * @param {string} deploymentId
566
595
  * @throws {AppwriteException}
567
- * @returns {Promise}
568
- */
596
+ * @returns {Promise<{}>}
597
+ */
569
598
  async deleteDeployment(functionId: string, deploymentId: string): Promise<{}> {
570
599
  if (typeof functionId === 'undefined') {
571
600
  throw new AppwriteException('Missing required parameter: "functionId"');
572
601
  }
573
-
574
602
  if (typeof deploymentId === 'undefined') {
575
603
  throw new AppwriteException('Missing required parameter: "deploymentId"');
576
604
  }
577
-
578
605
  const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
579
606
  const payload: Payload = {};
580
-
581
607
  const uri = new URL(this.client.config.endpoint + apiPath);
582
- return await this.client.call('delete', uri, {
608
+
609
+ const apiHeaders: { [header: string]: string } = {
583
610
  'content-type': 'application/json',
584
- }, payload);
585
- }
611
+ }
586
612
 
613
+ return await this.client.call(
614
+ 'delete',
615
+ uri,
616
+ apiHeaders,
617
+ payload
618
+ );
619
+ }
587
620
  /**
588
- * Create build
621
+ * Rebuild deployment
589
622
  *
590
- * Create a new build for an Appwrite Function deployment. This endpoint can
591
- * be used to retry a failed build.
592
623
  *
593
624
  * @param {string} functionId
594
625
  * @param {string} deploymentId
595
626
  * @param {string} buildId
596
627
  * @throws {AppwriteException}
597
- * @returns {Promise}
598
- */
599
- async createBuild(functionId: string, deploymentId: string, buildId: string): Promise<{}> {
628
+ * @returns {Promise<{}>}
629
+ */
630
+ async createBuild(functionId: string, deploymentId: string, buildId?: string): Promise<{}> {
600
631
  if (typeof functionId === 'undefined') {
601
632
  throw new AppwriteException('Missing required parameter: "functionId"');
602
633
  }
603
-
604
634
  if (typeof deploymentId === 'undefined') {
605
635
  throw new AppwriteException('Missing required parameter: "deploymentId"');
606
636
  }
637
+ const apiPath = '/functions/{functionId}/deployments/{deploymentId}/build'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
638
+ const payload: Payload = {};
639
+ if (typeof buildId !== 'undefined') {
640
+ payload['buildId'] = buildId;
641
+ }
642
+ const uri = new URL(this.client.config.endpoint + apiPath);
607
643
 
608
- if (typeof buildId === 'undefined') {
609
- throw new AppwriteException('Missing required parameter: "buildId"');
644
+ const apiHeaders: { [header: string]: string } = {
645
+ 'content-type': 'application/json',
610
646
  }
611
647
 
612
- const apiPath = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
648
+ return await this.client.call(
649
+ 'post',
650
+ uri,
651
+ apiHeaders,
652
+ payload
653
+ );
654
+ }
655
+ /**
656
+ * Cancel deployment
657
+ *
658
+ *
659
+ * @param {string} functionId
660
+ * @param {string} deploymentId
661
+ * @throws {AppwriteException}
662
+ * @returns {Promise<Models.Build>}
663
+ */
664
+ async updateDeploymentBuild(functionId: string, deploymentId: string): Promise<Models.Build> {
665
+ if (typeof functionId === 'undefined') {
666
+ throw new AppwriteException('Missing required parameter: "functionId"');
667
+ }
668
+ if (typeof deploymentId === 'undefined') {
669
+ throw new AppwriteException('Missing required parameter: "deploymentId"');
670
+ }
671
+ const apiPath = '/functions/{functionId}/deployments/{deploymentId}/build'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
613
672
  const payload: Payload = {};
614
-
615
673
  const uri = new URL(this.client.config.endpoint + apiPath);
616
- return await this.client.call('post', uri, {
674
+
675
+ const apiHeaders: { [header: string]: string } = {
617
676
  'content-type': 'application/json',
618
- }, payload);
619
- }
677
+ }
620
678
 
679
+ return await this.client.call(
680
+ 'patch',
681
+ uri,
682
+ apiHeaders,
683
+ payload
684
+ );
685
+ }
621
686
  /**
622
- * Download Deployment
687
+ * Download deployment
623
688
  *
624
- * Get a Deployment's contents by its unique ID. This endpoint supports range
625
- * requests for partial or streaming file download.
689
+ * Get a Deployment&#039;s contents by its unique ID. This endpoint supports range requests for partial or streaming file download.
626
690
  *
627
691
  * @param {string} functionId
628
692
  * @param {string} deploymentId
629
693
  * @throws {AppwriteException}
630
- * @returns {URL}
631
- */
632
- downloadDeployment(functionId: string, deploymentId: string): URL {
694
+ * @returns {string}
695
+ */
696
+ getDeploymentDownload(functionId: string, deploymentId: string): string {
633
697
  if (typeof functionId === 'undefined') {
634
698
  throw new AppwriteException('Missing required parameter: "functionId"');
635
699
  }
636
-
637
700
  if (typeof deploymentId === 'undefined') {
638
701
  throw new AppwriteException('Missing required parameter: "deploymentId"');
639
702
  }
640
-
641
703
  const apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
642
704
  const payload: Payload = {};
643
-
644
705
  const uri = new URL(this.client.config.endpoint + apiPath);
645
- payload['project'] = this.client.config.project;
646
706
 
707
+ const apiHeaders: { [header: string]: string } = {
708
+ 'content-type': 'application/json',
709
+ }
710
+
711
+ payload['project'] = this.client.config.project;
647
712
 
648
- for (const [key, value] of Object.entries(Service.flatten(payload))) {
713
+ for (const [key, value] of Object.entries(Client.flatten(payload))) {
649
714
  uri.searchParams.append(key, value);
650
715
  }
651
- return uri;
652
- }
653
716
 
717
+ return uri.toString();
718
+ }
654
719
  /**
655
720
  * List executions
656
721
  *
657
- * Get a list of all the current user function execution logs. You can use the
658
- * query params to filter your results.
722
+ * Get a list of all the current user function execution logs. You can use the query params to filter your results.
659
723
  *
660
724
  * @param {string} functionId
661
725
  * @param {string[]} queries
662
726
  * @param {string} search
663
727
  * @throws {AppwriteException}
664
- * @returns {Promise}
665
- */
728
+ * @returns {Promise<Models.ExecutionList>}
729
+ */
666
730
  async listExecutions(functionId: string, queries?: string[], search?: string): Promise<Models.ExecutionList> {
667
731
  if (typeof functionId === 'undefined') {
668
732
  throw new AppwriteException('Missing required parameter: "functionId"');
669
733
  }
670
-
671
734
  const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
672
735
  const payload: Payload = {};
673
-
674
736
  if (typeof queries !== 'undefined') {
675
737
  payload['queries'] = queries;
676
738
  }
677
-
678
739
  if (typeof search !== 'undefined') {
679
740
  payload['search'] = search;
680
741
  }
681
-
682
742
  const uri = new URL(this.client.config.endpoint + apiPath);
683
- return await this.client.call('get', uri, {
743
+
744
+ const apiHeaders: { [header: string]: string } = {
684
745
  'content-type': 'application/json',
685
- }, payload);
686
- }
746
+ }
687
747
 
748
+ return await this.client.call(
749
+ 'get',
750
+ uri,
751
+ apiHeaders,
752
+ payload
753
+ );
754
+ }
688
755
  /**
689
756
  * Create execution
690
757
  *
691
- * Trigger a function execution. The returned object will return you the
692
- * current execution status. You can ping the `Get Execution` endpoint to get
693
- * updates on the current execution status. Once this endpoint is called, your
694
- * function execution process will start asynchronously.
758
+ * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.
695
759
  *
696
760
  * @param {string} functionId
697
761
  * @param {string} body
@@ -699,43 +763,48 @@ export class Functions extends Service {
699
763
  * @param {string} xpath
700
764
  * @param {ExecutionMethod} method
701
765
  * @param {object} headers
766
+ * @param {string} scheduledAt
702
767
  * @throws {AppwriteException}
703
- * @returns {Promise}
704
- */
705
- async createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object): Promise<Models.Execution> {
768
+ * @returns {Promise<Models.Execution>}
769
+ */
770
+ async createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string, onProgress = (progress: UploadProgress) => {}): Promise<Models.Execution> {
706
771
  if (typeof functionId === 'undefined') {
707
772
  throw new AppwriteException('Missing required parameter: "functionId"');
708
773
  }
709
-
710
774
  const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
711
775
  const payload: Payload = {};
712
-
713
776
  if (typeof body !== 'undefined') {
714
777
  payload['body'] = body;
715
778
  }
716
-
717
779
  if (typeof async !== 'undefined') {
718
780
  payload['async'] = async;
719
781
  }
720
-
721
782
  if (typeof xpath !== 'undefined') {
722
783
  payload['path'] = xpath;
723
784
  }
724
-
725
785
  if (typeof method !== 'undefined') {
726
786
  payload['method'] = method;
727
787
  }
728
-
729
788
  if (typeof headers !== 'undefined') {
730
789
  payload['headers'] = headers;
731
790
  }
732
-
791
+ if (typeof scheduledAt !== 'undefined') {
792
+ payload['scheduledAt'] = scheduledAt;
793
+ }
733
794
  const uri = new URL(this.client.config.endpoint + apiPath);
734
- return await this.client.call('post', uri, {
735
- 'content-type': 'application/json',
736
- }, payload);
737
- }
738
795
 
796
+ const apiHeaders: { [header: string]: string } = {
797
+ 'content-type': 'multipart/form-data',
798
+ }
799
+
800
+ return await this.client.chunkedUpload(
801
+ 'post',
802
+ uri,
803
+ apiHeaders,
804
+ payload,
805
+ onProgress
806
+ );
807
+ }
739
808
  /**
740
809
  * Get execution
741
810
  *
@@ -744,26 +813,63 @@ export class Functions extends Service {
744
813
  * @param {string} functionId
745
814
  * @param {string} executionId
746
815
  * @throws {AppwriteException}
747
- * @returns {Promise}
748
- */
816
+ * @returns {Promise<Models.Execution>}
817
+ */
749
818
  async getExecution(functionId: string, executionId: string): Promise<Models.Execution> {
750
819
  if (typeof functionId === 'undefined') {
751
820
  throw new AppwriteException('Missing required parameter: "functionId"');
752
821
  }
753
-
754
822
  if (typeof executionId === 'undefined') {
755
823
  throw new AppwriteException('Missing required parameter: "executionId"');
756
824
  }
757
-
758
825
  const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
759
826
  const payload: Payload = {};
760
-
761
827
  const uri = new URL(this.client.config.endpoint + apiPath);
762
- return await this.client.call('get', uri, {
828
+
829
+ const apiHeaders: { [header: string]: string } = {
763
830
  'content-type': 'application/json',
764
- }, payload);
831
+ }
832
+
833
+ return await this.client.call(
834
+ 'get',
835
+ uri,
836
+ apiHeaders,
837
+ payload
838
+ );
765
839
  }
840
+ /**
841
+ * Delete execution
842
+ *
843
+ * Delete a function execution by its unique ID.
844
+
845
+ *
846
+ * @param {string} functionId
847
+ * @param {string} executionId
848
+ * @throws {AppwriteException}
849
+ * @returns {Promise<{}>}
850
+ */
851
+ async deleteExecution(functionId: string, executionId: string): Promise<{}> {
852
+ if (typeof functionId === 'undefined') {
853
+ throw new AppwriteException('Missing required parameter: "functionId"');
854
+ }
855
+ if (typeof executionId === 'undefined') {
856
+ throw new AppwriteException('Missing required parameter: "executionId"');
857
+ }
858
+ const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
859
+ const payload: Payload = {};
860
+ const uri = new URL(this.client.config.endpoint + apiPath);
766
861
 
862
+ const apiHeaders: { [header: string]: string } = {
863
+ 'content-type': 'application/json',
864
+ }
865
+
866
+ return await this.client.call(
867
+ 'delete',
868
+ uri,
869
+ apiHeaders,
870
+ payload
871
+ );
872
+ }
767
873
  /**
768
874
  * Get function usage
769
875
  *
@@ -771,26 +877,30 @@ export class Functions extends Service {
771
877
  * @param {string} functionId
772
878
  * @param {FunctionUsageRange} range
773
879
  * @throws {AppwriteException}
774
- * @returns {Promise}
775
- */
880
+ * @returns {Promise<Models.UsageFunction>}
881
+ */
776
882
  async getFunctionUsage(functionId: string, range?: FunctionUsageRange): Promise<Models.UsageFunction> {
777
883
  if (typeof functionId === 'undefined') {
778
884
  throw new AppwriteException('Missing required parameter: "functionId"');
779
885
  }
780
-
781
886
  const apiPath = '/functions/{functionId}/usage'.replace('{functionId}', functionId);
782
887
  const payload: Payload = {};
783
-
784
888
  if (typeof range !== 'undefined') {
785
889
  payload['range'] = range;
786
890
  }
787
-
788
891
  const uri = new URL(this.client.config.endpoint + apiPath);
789
- return await this.client.call('get', uri, {
892
+
893
+ const apiHeaders: { [header: string]: string } = {
790
894
  'content-type': 'application/json',
791
- }, payload);
792
- }
895
+ }
793
896
 
897
+ return await this.client.call(
898
+ 'get',
899
+ uri,
900
+ apiHeaders,
901
+ payload
902
+ );
903
+ }
794
904
  /**
795
905
  * List variables
796
906
  *
@@ -798,64 +908,69 @@ export class Functions extends Service {
798
908
  *
799
909
  * @param {string} functionId
800
910
  * @throws {AppwriteException}
801
- * @returns {Promise}
802
- */
911
+ * @returns {Promise<Models.VariableList>}
912
+ */
803
913
  async listVariables(functionId: string): Promise<Models.VariableList> {
804
914
  if (typeof functionId === 'undefined') {
805
915
  throw new AppwriteException('Missing required parameter: "functionId"');
806
916
  }
807
-
808
917
  const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
809
918
  const payload: Payload = {};
810
-
811
919
  const uri = new URL(this.client.config.endpoint + apiPath);
812
- return await this.client.call('get', uri, {
920
+
921
+ const apiHeaders: { [header: string]: string } = {
813
922
  'content-type': 'application/json',
814
- }, payload);
815
- }
923
+ }
816
924
 
925
+ return await this.client.call(
926
+ 'get',
927
+ uri,
928
+ apiHeaders,
929
+ payload
930
+ );
931
+ }
817
932
  /**
818
933
  * Create variable
819
934
  *
820
- * Create a new function environment variable. These variables can be accessed
821
- * in the function at runtime as environment variables.
935
+ * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables.
822
936
  *
823
937
  * @param {string} functionId
824
938
  * @param {string} key
825
939
  * @param {string} value
826
940
  * @throws {AppwriteException}
827
- * @returns {Promise}
828
- */
941
+ * @returns {Promise<Models.Variable>}
942
+ */
829
943
  async createVariable(functionId: string, key: string, value: string): Promise<Models.Variable> {
830
944
  if (typeof functionId === 'undefined') {
831
945
  throw new AppwriteException('Missing required parameter: "functionId"');
832
946
  }
833
-
834
947
  if (typeof key === 'undefined') {
835
948
  throw new AppwriteException('Missing required parameter: "key"');
836
949
  }
837
-
838
950
  if (typeof value === 'undefined') {
839
951
  throw new AppwriteException('Missing required parameter: "value"');
840
952
  }
841
-
842
953
  const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
843
954
  const payload: Payload = {};
844
-
845
955
  if (typeof key !== 'undefined') {
846
956
  payload['key'] = key;
847
957
  }
848
-
849
958
  if (typeof value !== 'undefined') {
850
959
  payload['value'] = value;
851
960
  }
852
-
853
961
  const uri = new URL(this.client.config.endpoint + apiPath);
854
- return await this.client.call('post', uri, {
962
+
963
+ const apiHeaders: { [header: string]: string } = {
855
964
  'content-type': 'application/json',
856
- }, payload);
857
- }
965
+ }
858
966
 
967
+ return await this.client.call(
968
+ 'post',
969
+ uri,
970
+ apiHeaders,
971
+ payload
972
+ );
973
+ }
859
974
  /**
860
975
  * Get variable
861
976
  *
@@ -864,26 +979,30 @@ export class Functions extends Service {
864
979
  * @param {string} functionId
865
980
  * @param {string} variableId
866
981
  * @throws {AppwriteException}
867
- * @returns {Promise}
868
- */
982
+ * @returns {Promise<Models.Variable>}
983
+ */
869
984
  async getVariable(functionId: string, variableId: string): Promise<Models.Variable> {
870
985
  if (typeof functionId === 'undefined') {
871
986
  throw new AppwriteException('Missing required parameter: "functionId"');
872
987
  }
873
-
874
988
  if (typeof variableId === 'undefined') {
875
989
  throw new AppwriteException('Missing required parameter: "variableId"');
876
990
  }
877
-
878
991
  const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
879
992
  const payload: Payload = {};
880
-
881
993
  const uri = new URL(this.client.config.endpoint + apiPath);
882
- return await this.client.call('get', uri, {
994
+
995
+ const apiHeaders: { [header: string]: string } = {
883
996
  'content-type': 'application/json',
884
- }, payload);
885
- }
997
+ }
886
998
 
999
+ return await this.client.call(
1000
+ 'get',
1001
+ uri,
1002
+ apiHeaders,
1003
+ payload
1004
+ );
1005
+ }
887
1006
  /**
888
1007
  * Update variable
889
1008
  *
@@ -894,38 +1013,39 @@ export class Functions extends Service {
894
1013
  * @param {string} key
895
1014
  * @param {string} value
896
1015
  * @throws {AppwriteException}
897
- * @returns {Promise}
898
- */
1016
+ * @returns {Promise<Models.Variable>}
1017
+ */
899
1018
  async updateVariable(functionId: string, variableId: string, key: string, value?: string): Promise<Models.Variable> {
900
1019
  if (typeof functionId === 'undefined') {
901
1020
  throw new AppwriteException('Missing required parameter: "functionId"');
902
1021
  }
903
-
904
1022
  if (typeof variableId === 'undefined') {
905
1023
  throw new AppwriteException('Missing required parameter: "variableId"');
906
1024
  }
907
-
908
1025
  if (typeof key === 'undefined') {
909
1026
  throw new AppwriteException('Missing required parameter: "key"');
910
1027
  }
911
-
912
1028
  const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
913
1029
  const payload: Payload = {};
914
-
915
1030
  if (typeof key !== 'undefined') {
916
1031
  payload['key'] = key;
917
1032
  }
918
-
919
1033
  if (typeof value !== 'undefined') {
920
1034
  payload['value'] = value;
921
1035
  }
922
-
923
1036
  const uri = new URL(this.client.config.endpoint + apiPath);
924
- return await this.client.call('put', uri, {
1037
+
1038
+ const apiHeaders: { [header: string]: string } = {
925
1039
  'content-type': 'application/json',
926
- }, payload);
927
- }
1040
+ }
928
1041
 
1042
+ return await this.client.call(
1043
+ 'put',
1044
+ uri,
1045
+ apiHeaders,
1046
+ payload
1047
+ );
1048
+ }
929
1049
  /**
930
1050
  * Delete variable
931
1051
  *
@@ -934,23 +1054,28 @@ export class Functions extends Service {
934
1054
  * @param {string} functionId
935
1055
  * @param {string} variableId
936
1056
  * @throws {AppwriteException}
937
- * @returns {Promise}
938
- */
1057
+ * @returns {Promise<{}>}
1058
+ */
939
1059
  async deleteVariable(functionId: string, variableId: string): Promise<{}> {
940
1060
  if (typeof functionId === 'undefined') {
941
1061
  throw new AppwriteException('Missing required parameter: "functionId"');
942
1062
  }
943
-
944
1063
  if (typeof variableId === 'undefined') {
945
1064
  throw new AppwriteException('Missing required parameter: "variableId"');
946
1065
  }
947
-
948
1066
  const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
949
1067
  const payload: Payload = {};
950
-
951
1068
  const uri = new URL(this.client.config.endpoint + apiPath);
952
- return await this.client.call('delete', uri, {
1069
+
1070
+ const apiHeaders: { [header: string]: string } = {
953
1071
  'content-type': 'application/json',
954
- }, payload);
1072
+ }
1073
+
1074
+ return await this.client.call(
1075
+ 'delete',
1076
+ uri,
1077
+ apiHeaders,
1078
+ payload
1079
+ );
955
1080
  }
956
- };
1081
+ }