@appwrite.io/console 0.2.0 → 0.3.0

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