@appwrite.io/console 0.6.4 → 0.7.0-rc.2

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