node-appwrite 12.0.1 → 12.1.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/.travis.yml +18 -8
  2. package/README.md +1 -1
  3. package/dist/client.d.mts +131 -0
  4. package/dist/client.d.ts +131 -0
  5. package/dist/client.js +302 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/client.mjs +295 -0
  8. package/dist/client.mjs.map +1 -0
  9. package/dist/enums/authentication-factor.d.mts +8 -0
  10. package/dist/enums/authentication-factor.d.ts +8 -0
  11. package/dist/enums/authentication-factor.js +13 -0
  12. package/dist/enums/authentication-factor.js.map +1 -0
  13. package/dist/enums/authentication-factor.mjs +11 -0
  14. package/dist/enums/authentication-factor.mjs.map +1 -0
  15. package/dist/enums/authenticator-type.d.mts +5 -0
  16. package/dist/enums/authenticator-type.d.ts +5 -0
  17. package/dist/enums/authenticator-type.js +10 -0
  18. package/dist/enums/authenticator-type.js.map +1 -0
  19. package/dist/enums/authenticator-type.mjs +8 -0
  20. package/dist/enums/authenticator-type.mjs.map +1 -0
  21. package/dist/enums/browser.d.mts +18 -0
  22. package/dist/enums/browser.d.ts +18 -0
  23. package/dist/enums/browser.js +23 -0
  24. package/dist/enums/browser.js.map +1 -0
  25. package/dist/enums/browser.mjs +21 -0
  26. package/dist/enums/browser.mjs.map +1 -0
  27. package/dist/enums/compression.d.mts +7 -0
  28. package/dist/enums/compression.d.ts +7 -0
  29. package/dist/enums/compression.js +12 -0
  30. package/dist/enums/compression.js.map +1 -0
  31. package/dist/enums/compression.mjs +10 -0
  32. package/dist/enums/compression.mjs.map +1 -0
  33. package/dist/enums/credit-card.d.mts +20 -0
  34. package/dist/enums/credit-card.d.ts +20 -0
  35. package/dist/enums/credit-card.js +25 -0
  36. package/dist/enums/credit-card.js.map +1 -0
  37. package/dist/enums/credit-card.mjs +23 -0
  38. package/dist/enums/credit-card.mjs.map +1 -0
  39. package/dist/enums/execution-method.d.mts +10 -0
  40. package/dist/enums/execution-method.d.ts +10 -0
  41. package/dist/enums/execution-method.js +15 -0
  42. package/dist/enums/execution-method.js.map +1 -0
  43. package/dist/enums/execution-method.mjs +13 -0
  44. package/dist/enums/execution-method.mjs.map +1 -0
  45. package/dist/enums/flag.d.mts +198 -0
  46. package/dist/enums/flag.d.ts +198 -0
  47. package/dist/enums/flag.js +203 -0
  48. package/dist/enums/flag.js.map +1 -0
  49. package/dist/enums/flag.mjs +201 -0
  50. package/dist/enums/flag.mjs.map +1 -0
  51. package/dist/enums/image-format.d.mts +9 -0
  52. package/dist/enums/image-format.d.ts +9 -0
  53. package/dist/enums/image-format.js +14 -0
  54. package/dist/enums/image-format.js.map +1 -0
  55. package/dist/enums/image-format.mjs +12 -0
  56. package/dist/enums/image-format.mjs.map +1 -0
  57. package/dist/enums/image-gravity.d.mts +13 -0
  58. package/dist/enums/image-gravity.d.ts +13 -0
  59. package/dist/enums/image-gravity.js +18 -0
  60. package/dist/enums/image-gravity.js.map +1 -0
  61. package/dist/enums/image-gravity.mjs +16 -0
  62. package/dist/enums/image-gravity.mjs.map +1 -0
  63. package/dist/enums/index-type.d.mts +7 -0
  64. package/dist/enums/index-type.d.ts +7 -0
  65. package/dist/enums/index-type.js +12 -0
  66. package/dist/enums/index-type.js.map +1 -0
  67. package/dist/enums/index-type.mjs +10 -0
  68. package/dist/enums/index-type.mjs.map +1 -0
  69. package/dist/enums/messaging-provider-type.d.mts +7 -0
  70. package/dist/enums/messaging-provider-type.d.ts +7 -0
  71. package/dist/enums/messaging-provider-type.js +12 -0
  72. package/dist/enums/messaging-provider-type.js.map +1 -0
  73. package/dist/enums/messaging-provider-type.mjs +10 -0
  74. package/dist/enums/messaging-provider-type.mjs.map +1 -0
  75. package/dist/enums/name.d.mts +17 -0
  76. package/dist/enums/name.d.ts +17 -0
  77. package/dist/enums/name.js +22 -0
  78. package/dist/enums/name.js.map +1 -0
  79. package/dist/enums/name.mjs +20 -0
  80. package/dist/enums/name.mjs.map +1 -0
  81. package/dist/enums/o-auth-provider.d.mts +43 -0
  82. package/dist/enums/o-auth-provider.d.ts +43 -0
  83. package/dist/enums/o-auth-provider.js +48 -0
  84. package/dist/enums/o-auth-provider.js.map +1 -0
  85. package/dist/enums/o-auth-provider.mjs +46 -0
  86. package/dist/enums/o-auth-provider.mjs.map +1 -0
  87. package/dist/enums/password-hash.d.mts +15 -0
  88. package/dist/enums/password-hash.d.ts +15 -0
  89. package/dist/enums/password-hash.js +20 -0
  90. package/dist/enums/password-hash.js.map +1 -0
  91. package/dist/enums/password-hash.mjs +18 -0
  92. package/dist/enums/password-hash.mjs.map +1 -0
  93. package/dist/enums/relation-mutate.d.mts +7 -0
  94. package/dist/enums/relation-mutate.d.ts +7 -0
  95. package/dist/enums/relation-mutate.js +12 -0
  96. package/dist/enums/relation-mutate.js.map +1 -0
  97. package/dist/enums/relation-mutate.mjs +10 -0
  98. package/dist/enums/relation-mutate.mjs.map +1 -0
  99. package/dist/enums/relationship-type.d.mts +8 -0
  100. package/dist/enums/relationship-type.d.ts +8 -0
  101. package/dist/enums/relationship-type.js +13 -0
  102. package/dist/enums/relationship-type.js.map +1 -0
  103. package/dist/enums/relationship-type.mjs +11 -0
  104. package/dist/enums/relationship-type.mjs.map +1 -0
  105. package/dist/enums/runtime.d.mts +48 -0
  106. package/dist/enums/runtime.d.ts +48 -0
  107. package/dist/enums/runtime.js +53 -0
  108. package/dist/enums/runtime.js.map +1 -0
  109. package/dist/enums/runtime.mjs +51 -0
  110. package/dist/enums/runtime.mjs.map +1 -0
  111. package/dist/enums/smtp-encryption.d.mts +7 -0
  112. package/dist/enums/smtp-encryption.d.ts +7 -0
  113. package/dist/enums/smtp-encryption.js +12 -0
  114. package/dist/enums/smtp-encryption.js.map +1 -0
  115. package/dist/enums/smtp-encryption.mjs +10 -0
  116. package/dist/enums/smtp-encryption.mjs.map +1 -0
  117. package/dist/id.d.mts +7 -0
  118. package/dist/id.d.ts +7 -0
  119. package/dist/id.js +29 -0
  120. package/dist/id.js.map +1 -0
  121. package/dist/id.mjs +27 -0
  122. package/dist/id.mjs.map +1 -0
  123. package/dist/index.d.mts +35 -0
  124. package/dist/index.d.ts +35 -0
  125. package/dist/index.js +180 -0
  126. package/dist/index.js.map +1 -0
  127. package/dist/index.mjs +35 -0
  128. package/dist/index.mjs.map +1 -0
  129. package/dist/inputFile.d.mts +9 -0
  130. package/dist/inputFile.d.ts +9 -0
  131. package/dist/inputFile.js +23 -0
  132. package/dist/inputFile.js.map +1 -0
  133. package/dist/inputFile.mjs +21 -0
  134. package/dist/inputFile.mjs.map +1 -0
  135. package/dist/models.d.mts +2406 -0
  136. package/dist/models.d.ts +2406 -0
  137. package/dist/models.js +4 -0
  138. package/dist/models.js.map +1 -0
  139. package/dist/models.mjs +3 -0
  140. package/dist/models.mjs.map +1 -0
  141. package/dist/permission.d.mts +9 -0
  142. package/dist/permission.d.ts +9 -0
  143. package/dist/permission.js +23 -0
  144. package/dist/permission.js.map +1 -0
  145. package/dist/permission.mjs +21 -0
  146. package/dist/permission.mjs.map +1 -0
  147. package/dist/query.d.mts +35 -0
  148. package/dist/query.d.ts +35 -0
  149. package/dist/query.js +49 -0
  150. package/dist/query.js.map +1 -0
  151. package/dist/query.mjs +47 -0
  152. package/dist/query.mjs.map +1 -0
  153. package/dist/role.d.mts +72 -0
  154. package/dist/role.d.ts +72 -0
  155. package/dist/role.js +96 -0
  156. package/dist/role.js.map +1 -0
  157. package/dist/role.mjs +94 -0
  158. package/dist/role.mjs.map +1 -0
  159. package/dist/services/account.d.mts +478 -0
  160. package/dist/services/account.d.ts +478 -0
  161. package/dist/services/account.js +1331 -0
  162. package/dist/services/account.js.map +1 -0
  163. package/dist/services/account.mjs +1329 -0
  164. package/dist/services/account.mjs.map +1 -0
  165. package/dist/services/avatars.d.mts +118 -0
  166. package/dist/services/avatars.d.ts +118 -0
  167. package/dist/services/avatars.js +297 -0
  168. package/dist/services/avatars.js.map +1 -0
  169. package/dist/services/avatars.mjs +295 -0
  170. package/dist/services/avatars.mjs.map +1 -0
  171. package/dist/services/databases.d.mts +606 -0
  172. package/dist/services/databases.d.ts +606 -0
  173. package/dist/services/databases.js +1908 -0
  174. package/dist/services/databases.js.map +1 -0
  175. package/dist/services/databases.mjs +1906 -0
  176. package/dist/services/databases.mjs.map +1 -0
  177. package/dist/services/functions.d.mts +287 -0
  178. package/dist/services/functions.d.ts +287 -0
  179. package/dist/services/functions.js +837 -0
  180. package/dist/services/functions.js.map +1 -0
  181. package/dist/services/functions.mjs +835 -0
  182. package/dist/services/functions.mjs.map +1 -0
  183. package/dist/services/graphql.d.mts +30 -0
  184. package/dist/services/graphql.d.ts +30 -0
  185. package/dist/services/graphql.js +73 -0
  186. package/dist/services/graphql.js.map +1 -0
  187. package/dist/services/graphql.mjs +71 -0
  188. package/dist/services/graphql.mjs.map +1 -0
  189. package/dist/services/health.d.mts +235 -0
  190. package/dist/services/health.d.ts +235 -0
  191. package/dist/services/health.js +584 -0
  192. package/dist/services/health.js.map +1 -0
  193. package/dist/services/health.mjs +582 -0
  194. package/dist/services/health.mjs.map +1 -0
  195. package/dist/services/locale.d.mts +84 -0
  196. package/dist/services/locale.d.ts +84 -0
  197. package/dist/services/locale.js +189 -0
  198. package/dist/services/locale.js.map +1 -0
  199. package/dist/services/locale.mjs +187 -0
  200. package/dist/services/locale.mjs.map +1 -0
  201. package/dist/services/messaging.d.mts +688 -0
  202. package/dist/services/messaging.d.ts +688 -0
  203. package/dist/services/messaging.js +2152 -0
  204. package/dist/services/messaging.js.map +1 -0
  205. package/dist/services/messaging.mjs +2150 -0
  206. package/dist/services/messaging.mjs.map +1 -0
  207. package/dist/services/storage.d.mts +193 -0
  208. package/dist/services/storage.d.ts +193 -0
  209. package/dist/services/storage.js +550 -0
  210. package/dist/services/storage.js.map +1 -0
  211. package/dist/services/storage.mjs +548 -0
  212. package/dist/services/storage.mjs.map +1 -0
  213. package/dist/services/teams.d.mts +171 -0
  214. package/dist/services/teams.d.ts +171 -0
  215. package/dist/services/teams.js +466 -0
  216. package/dist/services/teams.js.map +1 -0
  217. package/dist/services/teams.mjs +464 -0
  218. package/dist/services/teams.mjs.map +1 -0
  219. package/dist/services/users.d.mts +490 -0
  220. package/dist/services/users.d.ts +490 -0
  221. package/dist/services/users.js +1464 -0
  222. package/dist/services/users.js.map +1 -0
  223. package/dist/services/users.mjs +1462 -0
  224. package/dist/services/users.mjs.map +1 -0
  225. package/docs/examples/functions/create-deployment.md +1 -1
  226. package/docs/examples/messaging/create-msg91provider.md +1 -1
  227. package/docs/examples/messaging/update-msg91provider.md +2 -2
  228. package/docs/examples/storage/create-file.md +1 -1
  229. package/package.json +35 -5
  230. package/src/client.ts +366 -0
  231. package/src/enums/authentication-factor.ts +6 -0
  232. package/src/enums/authenticator-type.ts +3 -0
  233. package/src/enums/browser.ts +16 -0
  234. package/src/enums/compression.ts +5 -0
  235. package/src/enums/credit-card.ts +18 -0
  236. package/src/enums/execution-method.ts +8 -0
  237. package/src/enums/flag.ts +196 -0
  238. package/src/enums/image-format.ts +7 -0
  239. package/src/enums/image-gravity.ts +11 -0
  240. package/src/enums/index-type.ts +5 -0
  241. package/src/enums/messaging-provider-type.ts +5 -0
  242. package/src/enums/name.ts +15 -0
  243. package/src/enums/o-auth-provider.ts +41 -0
  244. package/src/enums/password-hash.ts +13 -0
  245. package/src/enums/relation-mutate.ts +5 -0
  246. package/src/enums/relationship-type.ts +6 -0
  247. package/src/enums/runtime.ts +46 -0
  248. package/src/enums/smtp-encryption.ts +5 -0
  249. package/{lib/id.js → src/id.ts} +8 -12
  250. package/src/index.ts +35 -0
  251. package/src/inputFile.ts +23 -0
  252. package/src/models.ts +2404 -0
  253. package/src/permission.ts +22 -0
  254. package/src/query.ts +101 -0
  255. package/{lib/role.js → src/role.ts} +23 -25
  256. package/src/services/account.ts +1418 -0
  257. package/src/services/avatars.ts +312 -0
  258. package/{lib/services/databases.js → src/services/databases.ts} +644 -638
  259. package/{lib/services/functions.js → src/services/functions.ts} +317 -369
  260. package/{lib/services/graphql.js → src/services/graphql.ts} +35 -34
  261. package/src/services/health.ts +629 -0
  262. package/src/services/locale.ts +205 -0
  263. package/{lib/services/messaging.js → src/services/messaging.ts} +666 -641
  264. package/{lib/services/storage.js → src/services/storage.ts} +211 -298
  265. package/{lib/services/teams.js → src/services/teams.ts} +211 -200
  266. package/{lib/services/users.js → src/services/users.ts} +603 -519
  267. package/tsconfig.json +18 -0
  268. package/tsup.config.js +19 -0
  269. package/index.d.ts +0 -6656
  270. package/index.js +0 -75
  271. package/lib/client.js +0 -245
  272. package/lib/enums/authentication-factor.js +0 -8
  273. package/lib/enums/authenticator-type.js +0 -5
  274. package/lib/enums/browser.js +0 -18
  275. package/lib/enums/compression.js +0 -7
  276. package/lib/enums/credit-card.js +0 -20
  277. package/lib/enums/execution-method.js +0 -10
  278. package/lib/enums/flag.js +0 -198
  279. package/lib/enums/image-format.js +0 -9
  280. package/lib/enums/image-gravity.js +0 -13
  281. package/lib/enums/index-type.js +0 -7
  282. package/lib/enums/messaging-provider-type.js +0 -7
  283. package/lib/enums/name.js +0 -17
  284. package/lib/enums/o-auth-provider.js +0 -43
  285. package/lib/enums/password-hash.js +0 -15
  286. package/lib/enums/relation-mutate.js +0 -7
  287. package/lib/enums/relationship-type.js +0 -8
  288. package/lib/enums/runtime.js +0 -48
  289. package/lib/enums/smtp-encryption.js +0 -7
  290. package/lib/exception.js +0 -10
  291. package/lib/inputFile.js +0 -117
  292. package/lib/permission.js +0 -24
  293. package/lib/query.js +0 -90
  294. package/lib/service.js +0 -10
  295. package/lib/services/account.js +0 -1365
  296. package/lib/services/avatars.js +0 -325
  297. package/lib/services/health.js +0 -513
  298. package/lib/services/locale.js +0 -169
@@ -0,0 +1,835 @@
1
+ import { AppwriteException } from '../client';
2
+
3
+ class Functions {
4
+ constructor(client) {
5
+ this.client = client;
6
+ }
7
+ /**
8
+ * List functions
9
+ *
10
+ * Get a list of all the project's functions. You can use the query params to filter your results.
11
+ *
12
+ * @param {string[]} queries
13
+ * @param {string} search
14
+ * @throws {AppwriteException}
15
+ * @returns {Promise<Models.FunctionList>}
16
+ */
17
+ async list(queries, search) {
18
+ const apiPath = "/functions";
19
+ const payload = {};
20
+ if (typeof queries !== "undefined") {
21
+ payload["queries"] = queries;
22
+ }
23
+ if (typeof search !== "undefined") {
24
+ payload["search"] = search;
25
+ }
26
+ const uri = new URL(this.client.config.endpoint + apiPath);
27
+ const apiHeaders = {
28
+ "content-type": "application/json"
29
+ };
30
+ return await this.client.call(
31
+ "get",
32
+ uri,
33
+ apiHeaders,
34
+ payload
35
+ );
36
+ }
37
+ /**
38
+ * Create function
39
+ *
40
+ * 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.
41
+ *
42
+ * @param {string} functionId
43
+ * @param {string} name
44
+ * @param {Runtime} runtime
45
+ * @param {string[]} execute
46
+ * @param {string[]} events
47
+ * @param {string} schedule
48
+ * @param {number} timeout
49
+ * @param {boolean} enabled
50
+ * @param {boolean} logging
51
+ * @param {string} entrypoint
52
+ * @param {string} commands
53
+ * @param {string} installationId
54
+ * @param {string} providerRepositoryId
55
+ * @param {string} providerBranch
56
+ * @param {boolean} providerSilentMode
57
+ * @param {string} providerRootDirectory
58
+ * @param {string} templateRepository
59
+ * @param {string} templateOwner
60
+ * @param {string} templateRootDirectory
61
+ * @param {string} templateBranch
62
+ * @throws {AppwriteException}
63
+ * @returns {Promise<Models.Function>}
64
+ */
65
+ async create(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, templateRepository, templateOwner, templateRootDirectory, templateBranch) {
66
+ if (typeof functionId === "undefined") {
67
+ throw new AppwriteException('Missing required parameter: "functionId"');
68
+ }
69
+ if (typeof name === "undefined") {
70
+ throw new AppwriteException('Missing required parameter: "name"');
71
+ }
72
+ if (typeof runtime === "undefined") {
73
+ throw new AppwriteException('Missing required parameter: "runtime"');
74
+ }
75
+ const apiPath = "/functions";
76
+ const payload = {};
77
+ if (typeof functionId !== "undefined") {
78
+ payload["functionId"] = functionId;
79
+ }
80
+ if (typeof name !== "undefined") {
81
+ payload["name"] = name;
82
+ }
83
+ if (typeof runtime !== "undefined") {
84
+ payload["runtime"] = runtime;
85
+ }
86
+ if (typeof execute !== "undefined") {
87
+ payload["execute"] = execute;
88
+ }
89
+ if (typeof events !== "undefined") {
90
+ payload["events"] = events;
91
+ }
92
+ if (typeof schedule !== "undefined") {
93
+ payload["schedule"] = schedule;
94
+ }
95
+ if (typeof timeout !== "undefined") {
96
+ payload["timeout"] = timeout;
97
+ }
98
+ if (typeof enabled !== "undefined") {
99
+ payload["enabled"] = enabled;
100
+ }
101
+ if (typeof logging !== "undefined") {
102
+ payload["logging"] = logging;
103
+ }
104
+ if (typeof entrypoint !== "undefined") {
105
+ payload["entrypoint"] = entrypoint;
106
+ }
107
+ if (typeof commands !== "undefined") {
108
+ payload["commands"] = commands;
109
+ }
110
+ if (typeof installationId !== "undefined") {
111
+ payload["installationId"] = installationId;
112
+ }
113
+ if (typeof providerRepositoryId !== "undefined") {
114
+ payload["providerRepositoryId"] = providerRepositoryId;
115
+ }
116
+ if (typeof providerBranch !== "undefined") {
117
+ payload["providerBranch"] = providerBranch;
118
+ }
119
+ if (typeof providerSilentMode !== "undefined") {
120
+ payload["providerSilentMode"] = providerSilentMode;
121
+ }
122
+ if (typeof providerRootDirectory !== "undefined") {
123
+ payload["providerRootDirectory"] = providerRootDirectory;
124
+ }
125
+ if (typeof templateRepository !== "undefined") {
126
+ payload["templateRepository"] = templateRepository;
127
+ }
128
+ if (typeof templateOwner !== "undefined") {
129
+ payload["templateOwner"] = templateOwner;
130
+ }
131
+ if (typeof templateRootDirectory !== "undefined") {
132
+ payload["templateRootDirectory"] = templateRootDirectory;
133
+ }
134
+ if (typeof templateBranch !== "undefined") {
135
+ payload["templateBranch"] = templateBranch;
136
+ }
137
+ const uri = new URL(this.client.config.endpoint + apiPath);
138
+ const apiHeaders = {
139
+ "content-type": "application/json"
140
+ };
141
+ return await this.client.call(
142
+ "post",
143
+ uri,
144
+ apiHeaders,
145
+ payload
146
+ );
147
+ }
148
+ /**
149
+ * List runtimes
150
+ *
151
+ * Get a list of all runtimes that are currently active on your instance.
152
+ *
153
+ * @throws {AppwriteException}
154
+ * @returns {Promise<Models.RuntimeList>}
155
+ */
156
+ async listRuntimes() {
157
+ const apiPath = "/functions/runtimes";
158
+ const payload = {};
159
+ const uri = new URL(this.client.config.endpoint + apiPath);
160
+ const apiHeaders = {
161
+ "content-type": "application/json"
162
+ };
163
+ return await this.client.call(
164
+ "get",
165
+ uri,
166
+ apiHeaders,
167
+ payload
168
+ );
169
+ }
170
+ /**
171
+ * Get function
172
+ *
173
+ * Get a function by its unique ID.
174
+ *
175
+ * @param {string} functionId
176
+ * @throws {AppwriteException}
177
+ * @returns {Promise<Models.Function>}
178
+ */
179
+ async get(functionId) {
180
+ if (typeof functionId === "undefined") {
181
+ throw new AppwriteException('Missing required parameter: "functionId"');
182
+ }
183
+ const apiPath = "/functions/{functionId}".replace("{functionId}", functionId);
184
+ const payload = {};
185
+ const uri = new URL(this.client.config.endpoint + apiPath);
186
+ const apiHeaders = {
187
+ "content-type": "application/json"
188
+ };
189
+ return await this.client.call(
190
+ "get",
191
+ uri,
192
+ apiHeaders,
193
+ payload
194
+ );
195
+ }
196
+ /**
197
+ * Update function
198
+ *
199
+ * Update function by its unique ID.
200
+ *
201
+ * @param {string} functionId
202
+ * @param {string} name
203
+ * @param {Runtime} runtime
204
+ * @param {string[]} execute
205
+ * @param {string[]} events
206
+ * @param {string} schedule
207
+ * @param {number} timeout
208
+ * @param {boolean} enabled
209
+ * @param {boolean} logging
210
+ * @param {string} entrypoint
211
+ * @param {string} commands
212
+ * @param {string} installationId
213
+ * @param {string} providerRepositoryId
214
+ * @param {string} providerBranch
215
+ * @param {boolean} providerSilentMode
216
+ * @param {string} providerRootDirectory
217
+ * @throws {AppwriteException}
218
+ * @returns {Promise<Models.Function>}
219
+ */
220
+ async update(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory) {
221
+ if (typeof functionId === "undefined") {
222
+ throw new AppwriteException('Missing required parameter: "functionId"');
223
+ }
224
+ if (typeof name === "undefined") {
225
+ throw new AppwriteException('Missing required parameter: "name"');
226
+ }
227
+ const apiPath = "/functions/{functionId}".replace("{functionId}", functionId);
228
+ const payload = {};
229
+ if (typeof name !== "undefined") {
230
+ payload["name"] = name;
231
+ }
232
+ if (typeof runtime !== "undefined") {
233
+ payload["runtime"] = runtime;
234
+ }
235
+ if (typeof execute !== "undefined") {
236
+ payload["execute"] = execute;
237
+ }
238
+ if (typeof events !== "undefined") {
239
+ payload["events"] = events;
240
+ }
241
+ if (typeof schedule !== "undefined") {
242
+ payload["schedule"] = schedule;
243
+ }
244
+ if (typeof timeout !== "undefined") {
245
+ payload["timeout"] = timeout;
246
+ }
247
+ if (typeof enabled !== "undefined") {
248
+ payload["enabled"] = enabled;
249
+ }
250
+ if (typeof logging !== "undefined") {
251
+ payload["logging"] = logging;
252
+ }
253
+ if (typeof entrypoint !== "undefined") {
254
+ payload["entrypoint"] = entrypoint;
255
+ }
256
+ if (typeof commands !== "undefined") {
257
+ payload["commands"] = commands;
258
+ }
259
+ if (typeof installationId !== "undefined") {
260
+ payload["installationId"] = installationId;
261
+ }
262
+ if (typeof providerRepositoryId !== "undefined") {
263
+ payload["providerRepositoryId"] = providerRepositoryId;
264
+ }
265
+ if (typeof providerBranch !== "undefined") {
266
+ payload["providerBranch"] = providerBranch;
267
+ }
268
+ if (typeof providerSilentMode !== "undefined") {
269
+ payload["providerSilentMode"] = providerSilentMode;
270
+ }
271
+ if (typeof providerRootDirectory !== "undefined") {
272
+ payload["providerRootDirectory"] = providerRootDirectory;
273
+ }
274
+ const uri = new URL(this.client.config.endpoint + apiPath);
275
+ const apiHeaders = {
276
+ "content-type": "application/json"
277
+ };
278
+ return await this.client.call(
279
+ "put",
280
+ uri,
281
+ apiHeaders,
282
+ payload
283
+ );
284
+ }
285
+ /**
286
+ * Delete function
287
+ *
288
+ * Delete a function by its unique ID.
289
+ *
290
+ * @param {string} functionId
291
+ * @throws {AppwriteException}
292
+ * @returns {Promise<{}>}
293
+ */
294
+ async delete(functionId) {
295
+ if (typeof functionId === "undefined") {
296
+ throw new AppwriteException('Missing required parameter: "functionId"');
297
+ }
298
+ const apiPath = "/functions/{functionId}".replace("{functionId}", functionId);
299
+ const payload = {};
300
+ const uri = new URL(this.client.config.endpoint + apiPath);
301
+ const apiHeaders = {
302
+ "content-type": "application/json"
303
+ };
304
+ return await this.client.call(
305
+ "delete",
306
+ uri,
307
+ apiHeaders,
308
+ payload
309
+ );
310
+ }
311
+ /**
312
+ * List deployments
313
+ *
314
+ * Get a list of all the project&#039;s code deployments. You can use the query params to filter your results.
315
+ *
316
+ * @param {string} functionId
317
+ * @param {string[]} queries
318
+ * @param {string} search
319
+ * @throws {AppwriteException}
320
+ * @returns {Promise<Models.DeploymentList>}
321
+ */
322
+ async listDeployments(functionId, queries, search) {
323
+ if (typeof functionId === "undefined") {
324
+ throw new AppwriteException('Missing required parameter: "functionId"');
325
+ }
326
+ const apiPath = "/functions/{functionId}/deployments".replace("{functionId}", functionId);
327
+ const payload = {};
328
+ if (typeof queries !== "undefined") {
329
+ payload["queries"] = queries;
330
+ }
331
+ if (typeof search !== "undefined") {
332
+ payload["search"] = search;
333
+ }
334
+ const uri = new URL(this.client.config.endpoint + apiPath);
335
+ const apiHeaders = {
336
+ "content-type": "application/json"
337
+ };
338
+ return await this.client.call(
339
+ "get",
340
+ uri,
341
+ apiHeaders,
342
+ payload
343
+ );
344
+ }
345
+ /**
346
+ * Create deployment
347
+ *
348
+ * 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.
349
+
350
+ 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).
351
+
352
+ Use the &quot;command&quot; param to set the entrypoint used to execute your code.
353
+ *
354
+ * @param {string} functionId
355
+ * @param {File} code
356
+ * @param {boolean} activate
357
+ * @param {string} entrypoint
358
+ * @param {string} commands
359
+ * @throws {AppwriteException}
360
+ * @returns {Promise<Models.Deployment>}
361
+ */
362
+ async createDeployment(functionId, code, activate, entrypoint, commands, onProgress = (progress) => {
363
+ }) {
364
+ if (typeof functionId === "undefined") {
365
+ throw new AppwriteException('Missing required parameter: "functionId"');
366
+ }
367
+ if (typeof code === "undefined") {
368
+ throw new AppwriteException('Missing required parameter: "code"');
369
+ }
370
+ if (typeof activate === "undefined") {
371
+ throw new AppwriteException('Missing required parameter: "activate"');
372
+ }
373
+ const apiPath = "/functions/{functionId}/deployments".replace("{functionId}", functionId);
374
+ const payload = {};
375
+ if (typeof entrypoint !== "undefined") {
376
+ payload["entrypoint"] = entrypoint;
377
+ }
378
+ if (typeof commands !== "undefined") {
379
+ payload["commands"] = commands;
380
+ }
381
+ if (typeof code !== "undefined") {
382
+ payload["code"] = code;
383
+ }
384
+ if (typeof activate !== "undefined") {
385
+ payload["activate"] = activate;
386
+ }
387
+ const uri = new URL(this.client.config.endpoint + apiPath);
388
+ const apiHeaders = {
389
+ "content-type": "multipart/form-data"
390
+ };
391
+ return await this.client.chunkedUpload(
392
+ "post",
393
+ uri,
394
+ apiHeaders,
395
+ payload,
396
+ onProgress
397
+ );
398
+ }
399
+ /**
400
+ * Get deployment
401
+ *
402
+ * Get a code deployment by its unique ID.
403
+ *
404
+ * @param {string} functionId
405
+ * @param {string} deploymentId
406
+ * @throws {AppwriteException}
407
+ * @returns {Promise<Models.Deployment>}
408
+ */
409
+ async getDeployment(functionId, deploymentId) {
410
+ if (typeof functionId === "undefined") {
411
+ throw new AppwriteException('Missing required parameter: "functionId"');
412
+ }
413
+ if (typeof deploymentId === "undefined") {
414
+ throw new AppwriteException('Missing required parameter: "deploymentId"');
415
+ }
416
+ const apiPath = "/functions/{functionId}/deployments/{deploymentId}".replace("{functionId}", functionId).replace("{deploymentId}", deploymentId);
417
+ const payload = {};
418
+ const uri = new URL(this.client.config.endpoint + apiPath);
419
+ const apiHeaders = {
420
+ "content-type": "application/json"
421
+ };
422
+ return await this.client.call(
423
+ "get",
424
+ uri,
425
+ apiHeaders,
426
+ payload
427
+ );
428
+ }
429
+ /**
430
+ * Update function deployment
431
+ *
432
+ * 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.
433
+ *
434
+ * @param {string} functionId
435
+ * @param {string} deploymentId
436
+ * @throws {AppwriteException}
437
+ * @returns {Promise<Models.Function>}
438
+ */
439
+ async updateDeployment(functionId, deploymentId) {
440
+ if (typeof functionId === "undefined") {
441
+ throw new AppwriteException('Missing required parameter: "functionId"');
442
+ }
443
+ if (typeof deploymentId === "undefined") {
444
+ throw new AppwriteException('Missing required parameter: "deploymentId"');
445
+ }
446
+ const apiPath = "/functions/{functionId}/deployments/{deploymentId}".replace("{functionId}", functionId).replace("{deploymentId}", deploymentId);
447
+ const payload = {};
448
+ const uri = new URL(this.client.config.endpoint + apiPath);
449
+ const apiHeaders = {
450
+ "content-type": "application/json"
451
+ };
452
+ return await this.client.call(
453
+ "patch",
454
+ uri,
455
+ apiHeaders,
456
+ payload
457
+ );
458
+ }
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, deploymentId) {
470
+ if (typeof functionId === "undefined") {
471
+ throw new AppwriteException('Missing required parameter: "functionId"');
472
+ }
473
+ if (typeof deploymentId === "undefined") {
474
+ throw new AppwriteException('Missing required parameter: "deploymentId"');
475
+ }
476
+ const apiPath = "/functions/{functionId}/deployments/{deploymentId}".replace("{functionId}", functionId).replace("{deploymentId}", deploymentId);
477
+ const payload = {};
478
+ const uri = new URL(this.client.config.endpoint + apiPath);
479
+ const apiHeaders = {
480
+ "content-type": "application/json"
481
+ };
482
+ return await this.client.call(
483
+ "delete",
484
+ uri,
485
+ apiHeaders,
486
+ payload
487
+ );
488
+ }
489
+ /**
490
+ * Create build
491
+ *
492
+ * Create a new build for an Appwrite Function deployment. This endpoint can be used to retry a failed build.
493
+ *
494
+ * @param {string} functionId
495
+ * @param {string} deploymentId
496
+ * @param {string} buildId
497
+ * @throws {AppwriteException}
498
+ * @returns {Promise<{}>}
499
+ */
500
+ async createBuild(functionId, deploymentId, buildId) {
501
+ if (typeof functionId === "undefined") {
502
+ throw new AppwriteException('Missing required parameter: "functionId"');
503
+ }
504
+ if (typeof deploymentId === "undefined") {
505
+ throw new AppwriteException('Missing required parameter: "deploymentId"');
506
+ }
507
+ if (typeof buildId === "undefined") {
508
+ throw new AppwriteException('Missing required parameter: "buildId"');
509
+ }
510
+ const apiPath = "/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}".replace("{functionId}", functionId).replace("{deploymentId}", deploymentId).replace("{buildId}", buildId);
511
+ const payload = {};
512
+ const uri = new URL(this.client.config.endpoint + apiPath);
513
+ const apiHeaders = {
514
+ "content-type": "application/json"
515
+ };
516
+ return await this.client.call(
517
+ "post",
518
+ uri,
519
+ apiHeaders,
520
+ payload
521
+ );
522
+ }
523
+ /**
524
+ * Download Deployment
525
+ *
526
+ * Get a Deployment&#039;s contents by its unique ID. This endpoint supports range requests for partial or streaming file download.
527
+ *
528
+ * @param {string} functionId
529
+ * @param {string} deploymentId
530
+ * @throws {AppwriteException}
531
+ * @returns {Promise<ArrayBuffer>}
532
+ */
533
+ async downloadDeployment(functionId, deploymentId) {
534
+ if (typeof functionId === "undefined") {
535
+ throw new AppwriteException('Missing required parameter: "functionId"');
536
+ }
537
+ if (typeof deploymentId === "undefined") {
538
+ throw new AppwriteException('Missing required parameter: "deploymentId"');
539
+ }
540
+ const apiPath = "/functions/{functionId}/deployments/{deploymentId}/download".replace("{functionId}", functionId).replace("{deploymentId}", deploymentId);
541
+ const payload = {};
542
+ const uri = new URL(this.client.config.endpoint + apiPath);
543
+ const apiHeaders = {
544
+ "content-type": "application/json"
545
+ };
546
+ return await this.client.call(
547
+ "get",
548
+ uri,
549
+ apiHeaders,
550
+ payload,
551
+ "arrayBuffer"
552
+ );
553
+ }
554
+ /**
555
+ * List executions
556
+ *
557
+ * Get a list of all the current user function execution logs. You can use the query params to filter your results.
558
+ *
559
+ * @param {string} functionId
560
+ * @param {string[]} queries
561
+ * @param {string} search
562
+ * @throws {AppwriteException}
563
+ * @returns {Promise<Models.ExecutionList>}
564
+ */
565
+ async listExecutions(functionId, queries, search) {
566
+ if (typeof functionId === "undefined") {
567
+ throw new AppwriteException('Missing required parameter: "functionId"');
568
+ }
569
+ const apiPath = "/functions/{functionId}/executions".replace("{functionId}", functionId);
570
+ const payload = {};
571
+ if (typeof queries !== "undefined") {
572
+ payload["queries"] = queries;
573
+ }
574
+ if (typeof search !== "undefined") {
575
+ payload["search"] = search;
576
+ }
577
+ const uri = new URL(this.client.config.endpoint + apiPath);
578
+ const apiHeaders = {
579
+ "content-type": "application/json"
580
+ };
581
+ return await this.client.call(
582
+ "get",
583
+ uri,
584
+ apiHeaders,
585
+ payload
586
+ );
587
+ }
588
+ /**
589
+ * Create execution
590
+ *
591
+ * 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.
592
+ *
593
+ * @param {string} functionId
594
+ * @param {string} body
595
+ * @param {boolean} async
596
+ * @param {string} xpath
597
+ * @param {ExecutionMethod} method
598
+ * @param {object} headers
599
+ * @throws {AppwriteException}
600
+ * @returns {Promise<Models.Execution>}
601
+ */
602
+ async createExecution(functionId, body, async, xpath, method, headers) {
603
+ if (typeof functionId === "undefined") {
604
+ throw new AppwriteException('Missing required parameter: "functionId"');
605
+ }
606
+ const apiPath = "/functions/{functionId}/executions".replace("{functionId}", functionId);
607
+ const payload = {};
608
+ if (typeof body !== "undefined") {
609
+ payload["body"] = body;
610
+ }
611
+ if (typeof async !== "undefined") {
612
+ payload["async"] = async;
613
+ }
614
+ if (typeof xpath !== "undefined") {
615
+ payload["path"] = xpath;
616
+ }
617
+ if (typeof method !== "undefined") {
618
+ payload["method"] = method;
619
+ }
620
+ if (typeof headers !== "undefined") {
621
+ payload["headers"] = headers;
622
+ }
623
+ const uri = new URL(this.client.config.endpoint + apiPath);
624
+ const apiHeaders = {
625
+ "content-type": "application/json"
626
+ };
627
+ return await this.client.call(
628
+ "post",
629
+ uri,
630
+ apiHeaders,
631
+ payload
632
+ );
633
+ }
634
+ /**
635
+ * Get execution
636
+ *
637
+ * Get a function execution log by its unique ID.
638
+ *
639
+ * @param {string} functionId
640
+ * @param {string} executionId
641
+ * @throws {AppwriteException}
642
+ * @returns {Promise<Models.Execution>}
643
+ */
644
+ async getExecution(functionId, executionId) {
645
+ if (typeof functionId === "undefined") {
646
+ throw new AppwriteException('Missing required parameter: "functionId"');
647
+ }
648
+ if (typeof executionId === "undefined") {
649
+ throw new AppwriteException('Missing required parameter: "executionId"');
650
+ }
651
+ const apiPath = "/functions/{functionId}/executions/{executionId}".replace("{functionId}", functionId).replace("{executionId}", executionId);
652
+ const payload = {};
653
+ const uri = new URL(this.client.config.endpoint + apiPath);
654
+ const apiHeaders = {
655
+ "content-type": "application/json"
656
+ };
657
+ return await this.client.call(
658
+ "get",
659
+ uri,
660
+ apiHeaders,
661
+ payload
662
+ );
663
+ }
664
+ /**
665
+ * List variables
666
+ *
667
+ * Get a list of all variables of a specific function.
668
+ *
669
+ * @param {string} functionId
670
+ * @throws {AppwriteException}
671
+ * @returns {Promise<Models.VariableList>}
672
+ */
673
+ async listVariables(functionId) {
674
+ if (typeof functionId === "undefined") {
675
+ throw new AppwriteException('Missing required parameter: "functionId"');
676
+ }
677
+ const apiPath = "/functions/{functionId}/variables".replace("{functionId}", functionId);
678
+ const payload = {};
679
+ const uri = new URL(this.client.config.endpoint + apiPath);
680
+ const apiHeaders = {
681
+ "content-type": "application/json"
682
+ };
683
+ return await this.client.call(
684
+ "get",
685
+ uri,
686
+ apiHeaders,
687
+ payload
688
+ );
689
+ }
690
+ /**
691
+ * Create variable
692
+ *
693
+ * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables.
694
+ *
695
+ * @param {string} functionId
696
+ * @param {string} key
697
+ * @param {string} value
698
+ * @throws {AppwriteException}
699
+ * @returns {Promise<Models.Variable>}
700
+ */
701
+ async createVariable(functionId, key, value) {
702
+ if (typeof functionId === "undefined") {
703
+ throw new AppwriteException('Missing required parameter: "functionId"');
704
+ }
705
+ if (typeof key === "undefined") {
706
+ throw new AppwriteException('Missing required parameter: "key"');
707
+ }
708
+ if (typeof value === "undefined") {
709
+ throw new AppwriteException('Missing required parameter: "value"');
710
+ }
711
+ const apiPath = "/functions/{functionId}/variables".replace("{functionId}", functionId);
712
+ const payload = {};
713
+ if (typeof key !== "undefined") {
714
+ payload["key"] = key;
715
+ }
716
+ if (typeof value !== "undefined") {
717
+ payload["value"] = value;
718
+ }
719
+ const uri = new URL(this.client.config.endpoint + apiPath);
720
+ const apiHeaders = {
721
+ "content-type": "application/json"
722
+ };
723
+ return await this.client.call(
724
+ "post",
725
+ uri,
726
+ apiHeaders,
727
+ payload
728
+ );
729
+ }
730
+ /**
731
+ * Get variable
732
+ *
733
+ * Get a variable by its unique ID.
734
+ *
735
+ * @param {string} functionId
736
+ * @param {string} variableId
737
+ * @throws {AppwriteException}
738
+ * @returns {Promise<Models.Variable>}
739
+ */
740
+ async getVariable(functionId, variableId) {
741
+ if (typeof functionId === "undefined") {
742
+ throw new AppwriteException('Missing required parameter: "functionId"');
743
+ }
744
+ if (typeof variableId === "undefined") {
745
+ throw new AppwriteException('Missing required parameter: "variableId"');
746
+ }
747
+ const apiPath = "/functions/{functionId}/variables/{variableId}".replace("{functionId}", functionId).replace("{variableId}", variableId);
748
+ const payload = {};
749
+ const uri = new URL(this.client.config.endpoint + apiPath);
750
+ const apiHeaders = {
751
+ "content-type": "application/json"
752
+ };
753
+ return await this.client.call(
754
+ "get",
755
+ uri,
756
+ apiHeaders,
757
+ payload
758
+ );
759
+ }
760
+ /**
761
+ * Update variable
762
+ *
763
+ * Update variable by its unique ID.
764
+ *
765
+ * @param {string} functionId
766
+ * @param {string} variableId
767
+ * @param {string} key
768
+ * @param {string} value
769
+ * @throws {AppwriteException}
770
+ * @returns {Promise<Models.Variable>}
771
+ */
772
+ async updateVariable(functionId, variableId, key, value) {
773
+ if (typeof functionId === "undefined") {
774
+ throw new AppwriteException('Missing required parameter: "functionId"');
775
+ }
776
+ if (typeof variableId === "undefined") {
777
+ throw new AppwriteException('Missing required parameter: "variableId"');
778
+ }
779
+ if (typeof key === "undefined") {
780
+ throw new AppwriteException('Missing required parameter: "key"');
781
+ }
782
+ const apiPath = "/functions/{functionId}/variables/{variableId}".replace("{functionId}", functionId).replace("{variableId}", variableId);
783
+ const payload = {};
784
+ if (typeof key !== "undefined") {
785
+ payload["key"] = key;
786
+ }
787
+ if (typeof value !== "undefined") {
788
+ payload["value"] = value;
789
+ }
790
+ const uri = new URL(this.client.config.endpoint + apiPath);
791
+ const apiHeaders = {
792
+ "content-type": "application/json"
793
+ };
794
+ return await this.client.call(
795
+ "put",
796
+ uri,
797
+ apiHeaders,
798
+ payload
799
+ );
800
+ }
801
+ /**
802
+ * Delete variable
803
+ *
804
+ * Delete a variable by its unique ID.
805
+ *
806
+ * @param {string} functionId
807
+ * @param {string} variableId
808
+ * @throws {AppwriteException}
809
+ * @returns {Promise<{}>}
810
+ */
811
+ async deleteVariable(functionId, variableId) {
812
+ if (typeof functionId === "undefined") {
813
+ throw new AppwriteException('Missing required parameter: "functionId"');
814
+ }
815
+ if (typeof variableId === "undefined") {
816
+ throw new AppwriteException('Missing required parameter: "variableId"');
817
+ }
818
+ const apiPath = "/functions/{functionId}/variables/{variableId}".replace("{functionId}", functionId).replace("{variableId}", variableId);
819
+ const payload = {};
820
+ const uri = new URL(this.client.config.endpoint + apiPath);
821
+ const apiHeaders = {
822
+ "content-type": "application/json"
823
+ };
824
+ return await this.client.call(
825
+ "delete",
826
+ uri,
827
+ apiHeaders,
828
+ payload
829
+ );
830
+ }
831
+ }
832
+
833
+ export { Functions };
834
+ //# sourceMappingURL=out.js.map
835
+ //# sourceMappingURL=functions.mjs.map