node-appwrite 9.0.0 → 10.0.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.
- package/README.md +2 -2
- package/docs/examples/account/create-phone-verification.md +1 -1
- package/docs/examples/account/create-recovery.md +1 -1
- package/docs/examples/account/create-verification.md +1 -1
- package/docs/examples/account/delete-identity.md +20 -0
- package/docs/examples/account/delete-session.md +1 -1
- package/docs/examples/account/delete-sessions.md +1 -1
- package/docs/examples/account/get-prefs.md +1 -1
- package/docs/examples/account/get-session.md +1 -1
- package/docs/examples/account/get.md +1 -1
- package/docs/examples/account/list-identities.md +20 -0
- package/docs/examples/account/list-logs.md +1 -1
- package/docs/examples/account/list-sessions.md +1 -1
- package/docs/examples/account/update-email.md +1 -1
- package/docs/examples/account/update-name.md +1 -1
- package/docs/examples/account/update-password.md +1 -1
- package/docs/examples/account/update-phone-verification.md +1 -1
- package/docs/examples/account/update-phone.md +1 -1
- package/docs/examples/account/update-prefs.md +1 -1
- package/docs/examples/account/update-recovery.md +1 -1
- package/docs/examples/account/update-session.md +1 -1
- package/docs/examples/account/update-status.md +1 -1
- package/docs/examples/account/update-verification.md +1 -1
- package/docs/examples/avatars/get-browser.md +1 -1
- package/docs/examples/avatars/get-credit-card.md +1 -1
- package/docs/examples/avatars/get-favicon.md +1 -1
- package/docs/examples/avatars/get-flag.md +1 -1
- package/docs/examples/avatars/get-image.md +1 -1
- package/docs/examples/avatars/get-initials.md +1 -1
- package/docs/examples/avatars/get-q-r.md +1 -1
- package/docs/examples/databases/create-boolean-attribute.md +1 -1
- package/docs/examples/databases/create-collection.md +1 -1
- package/docs/examples/databases/create-datetime-attribute.md +1 -1
- package/docs/examples/databases/create-document.md +1 -1
- package/docs/examples/databases/create-email-attribute.md +1 -1
- package/docs/examples/databases/create-enum-attribute.md +1 -1
- package/docs/examples/databases/create-float-attribute.md +1 -1
- package/docs/examples/databases/create-index.md +1 -1
- package/docs/examples/databases/create-integer-attribute.md +1 -1
- package/docs/examples/databases/create-ip-attribute.md +1 -1
- package/docs/examples/databases/create-relationship-attribute.md +1 -1
- package/docs/examples/databases/create-string-attribute.md +1 -1
- package/docs/examples/databases/create-url-attribute.md +1 -1
- package/docs/examples/databases/create.md +1 -1
- package/docs/examples/databases/delete-attribute.md +1 -1
- package/docs/examples/databases/delete-collection.md +1 -1
- package/docs/examples/databases/delete-document.md +1 -1
- package/docs/examples/databases/delete-index.md +1 -1
- package/docs/examples/databases/delete.md +1 -1
- package/docs/examples/databases/get-attribute.md +1 -1
- package/docs/examples/databases/get-collection.md +1 -1
- package/docs/examples/databases/get-document.md +1 -1
- package/docs/examples/databases/get-index.md +1 -1
- package/docs/examples/databases/get.md +1 -1
- package/docs/examples/databases/list-attributes.md +1 -1
- package/docs/examples/databases/list-collections.md +1 -1
- package/docs/examples/databases/list-documents.md +1 -1
- package/docs/examples/databases/list-indexes.md +1 -1
- package/docs/examples/databases/list.md +1 -1
- package/docs/examples/databases/update-boolean-attribute.md +1 -1
- package/docs/examples/databases/update-collection.md +1 -1
- package/docs/examples/databases/update-datetime-attribute.md +1 -1
- package/docs/examples/databases/update-document.md +1 -1
- package/docs/examples/databases/update-email-attribute.md +1 -1
- package/docs/examples/databases/update-enum-attribute.md +1 -1
- package/docs/examples/databases/update-float-attribute.md +1 -1
- package/docs/examples/databases/update-integer-attribute.md +1 -1
- package/docs/examples/databases/update-ip-attribute.md +1 -1
- package/docs/examples/databases/update-relationship-attribute.md +1 -1
- package/docs/examples/databases/update-string-attribute.md +1 -1
- package/docs/examples/databases/update-url-attribute.md +1 -1
- package/docs/examples/databases/update.md +1 -1
- package/docs/examples/functions/create-build.md +1 -1
- package/docs/examples/functions/create-deployment.md +2 -2
- package/docs/examples/functions/create-execution.md +1 -1
- package/docs/examples/functions/create-variable.md +1 -1
- package/docs/examples/functions/create.md +1 -1
- package/docs/examples/functions/delete-deployment.md +1 -1
- package/docs/examples/functions/delete-variable.md +1 -1
- package/docs/examples/functions/delete.md +1 -1
- package/docs/examples/functions/download-deployment.md +20 -0
- package/docs/examples/functions/get-deployment.md +1 -1
- package/docs/examples/functions/get-execution.md +1 -1
- package/docs/examples/functions/get-variable.md +1 -1
- package/docs/examples/functions/get.md +1 -1
- package/docs/examples/functions/list-deployments.md +1 -1
- package/docs/examples/functions/list-executions.md +1 -1
- package/docs/examples/functions/list-runtimes.md +1 -1
- package/docs/examples/functions/list-variables.md +1 -1
- package/docs/examples/functions/list.md +1 -1
- package/docs/examples/functions/update-deployment.md +1 -1
- package/docs/examples/functions/update-variable.md +1 -1
- package/docs/examples/functions/update.md +2 -2
- package/docs/examples/graphql/mutation.md +1 -1
- package/docs/examples/graphql/query.md +1 -1
- package/docs/examples/health/get-antivirus.md +1 -1
- package/docs/examples/health/get-cache.md +1 -1
- package/docs/examples/health/get-d-b.md +1 -1
- package/docs/examples/health/get-pub-sub.md +20 -0
- package/docs/examples/health/get-queue-certificates.md +1 -1
- package/docs/examples/health/get-queue-functions.md +1 -1
- package/docs/examples/health/get-queue-logs.md +1 -1
- package/docs/examples/health/get-queue-webhooks.md +1 -1
- package/docs/examples/health/get-queue.md +20 -0
- package/docs/examples/health/get-storage-local.md +1 -1
- package/docs/examples/health/get-time.md +1 -1
- package/docs/examples/health/get.md +1 -1
- package/docs/examples/locale/get.md +1 -1
- package/docs/examples/locale/list-codes.md +20 -0
- package/docs/examples/locale/list-continents.md +1 -1
- package/docs/examples/locale/list-countries-e-u.md +1 -1
- package/docs/examples/locale/list-countries-phones.md +1 -1
- package/docs/examples/locale/list-countries.md +1 -1
- package/docs/examples/locale/list-currencies.md +1 -1
- package/docs/examples/locale/list-languages.md +1 -1
- package/docs/examples/storage/create-bucket.md +1 -1
- package/docs/examples/storage/create-file.md +1 -1
- package/docs/examples/storage/delete-bucket.md +1 -1
- package/docs/examples/storage/delete-file.md +1 -1
- package/docs/examples/storage/get-bucket.md +1 -1
- package/docs/examples/storage/get-file-download.md +1 -1
- package/docs/examples/storage/get-file-preview.md +1 -1
- package/docs/examples/storage/get-file-view.md +1 -1
- package/docs/examples/storage/get-file.md +1 -1
- package/docs/examples/storage/list-buckets.md +1 -1
- package/docs/examples/storage/list-files.md +1 -1
- package/docs/examples/storage/update-bucket.md +1 -1
- package/docs/examples/storage/update-file.md +1 -1
- package/docs/examples/teams/create-membership.md +1 -1
- package/docs/examples/teams/create.md +1 -1
- package/docs/examples/teams/delete-membership.md +1 -1
- package/docs/examples/teams/delete.md +1 -1
- package/docs/examples/teams/get-membership.md +1 -1
- package/docs/examples/teams/get-prefs.md +1 -1
- package/docs/examples/teams/get.md +1 -1
- package/docs/examples/teams/list-memberships.md +1 -1
- package/docs/examples/teams/list.md +1 -1
- package/docs/examples/teams/update-membership-status.md +1 -1
- package/docs/examples/teams/{update-membership-roles.md → update-membership.md} +2 -2
- package/docs/examples/teams/update-name.md +1 -1
- package/docs/examples/teams/update-prefs.md +1 -1
- package/docs/examples/users/create-argon2user.md +1 -1
- package/docs/examples/users/create-bcrypt-user.md +1 -1
- package/docs/examples/users/create-m-d5user.md +1 -1
- package/docs/examples/users/create-p-h-pass-user.md +1 -1
- package/docs/examples/users/create-s-h-a-user.md +1 -1
- package/docs/examples/users/create-scrypt-modified-user.md +1 -1
- package/docs/examples/users/create-scrypt-user.md +1 -1
- package/docs/examples/users/create.md +1 -1
- package/docs/examples/users/delete-identity.md +20 -0
- package/docs/examples/users/delete-session.md +1 -1
- package/docs/examples/users/delete-sessions.md +1 -1
- package/docs/examples/users/delete.md +1 -1
- package/docs/examples/users/get-prefs.md +1 -1
- package/docs/examples/users/get.md +1 -1
- package/docs/examples/users/list-identities.md +20 -0
- package/docs/examples/users/list-logs.md +1 -1
- package/docs/examples/users/list-memberships.md +1 -1
- package/docs/examples/users/list-sessions.md +1 -1
- package/docs/examples/users/list.md +1 -1
- package/docs/examples/users/update-email-verification.md +1 -1
- package/docs/examples/users/update-email.md +1 -1
- package/docs/examples/users/update-labels.md +20 -0
- package/docs/examples/users/update-name.md +1 -1
- package/docs/examples/users/update-password.md +1 -1
- package/docs/examples/users/update-phone-verification.md +1 -1
- package/docs/examples/users/update-phone.md +1 -1
- package/docs/examples/users/update-prefs.md +1 -1
- package/docs/examples/users/update-status.md +1 -1
- package/index.d.ts +435 -55
- package/lib/client.js +4 -2
- package/lib/services/account.js +94 -50
- package/lib/services/avatars.js +14 -14
- package/lib/services/databases.js +120 -90
- package/lib/services/functions.js +212 -59
- package/lib/services/graphql.js +4 -4
- package/lib/services/health.js +57 -22
- package/lib/services/locale.js +32 -14
- package/lib/services/storage.js +33 -28
- package/lib/services/teams.js +29 -28
- package/lib/services/users.js +135 -50
- package/package.json +2 -2
|
@@ -26,7 +26,7 @@ class Functions extends Service {
|
|
|
26
26
|
* @returns {Promise}
|
|
27
27
|
*/
|
|
28
28
|
async list(queries, search) {
|
|
29
|
-
|
|
29
|
+
const apiPath = '/functions';
|
|
30
30
|
let payload = {};
|
|
31
31
|
|
|
32
32
|
if (typeof queries !== 'undefined') {
|
|
@@ -37,7 +37,7 @@ class Functions extends Service {
|
|
|
37
37
|
payload['search'] = search;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
return await this.client.call('get',
|
|
40
|
+
return await this.client.call('get', apiPath, {
|
|
41
41
|
'content-type': 'application/json',
|
|
42
42
|
}, payload);
|
|
43
43
|
}
|
|
@@ -57,11 +57,23 @@ class Functions extends Service {
|
|
|
57
57
|
* @param {string} schedule
|
|
58
58
|
* @param {number} timeout
|
|
59
59
|
* @param {boolean} enabled
|
|
60
|
+
* @param {boolean} logging
|
|
61
|
+
* @param {string} entrypoint
|
|
62
|
+
* @param {string} commands
|
|
63
|
+
* @param {string} installationId
|
|
64
|
+
* @param {string} providerRepositoryId
|
|
65
|
+
* @param {string} providerBranch
|
|
66
|
+
* @param {boolean} providerSilentMode
|
|
67
|
+
* @param {string} providerRootDirectory
|
|
68
|
+
* @param {string} templateRepository
|
|
69
|
+
* @param {string} templateOwner
|
|
70
|
+
* @param {string} templateRootDirectory
|
|
71
|
+
* @param {string} templateBranch
|
|
60
72
|
* @throws {AppwriteException}
|
|
61
73
|
* @returns {Promise}
|
|
62
74
|
*/
|
|
63
|
-
async create(functionId, name, runtime, execute, events, schedule, timeout, enabled) {
|
|
64
|
-
|
|
75
|
+
async create(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, templateRepository, templateOwner, templateRootDirectory, templateBranch) {
|
|
76
|
+
const apiPath = '/functions';
|
|
65
77
|
let payload = {};
|
|
66
78
|
if (typeof functionId === 'undefined') {
|
|
67
79
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
@@ -84,14 +96,14 @@ class Functions extends Service {
|
|
|
84
96
|
payload['name'] = name;
|
|
85
97
|
}
|
|
86
98
|
|
|
87
|
-
if (typeof execute !== 'undefined') {
|
|
88
|
-
payload['execute'] = execute;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
99
|
if (typeof runtime !== 'undefined') {
|
|
92
100
|
payload['runtime'] = runtime;
|
|
93
101
|
}
|
|
94
102
|
|
|
103
|
+
if (typeof execute !== 'undefined') {
|
|
104
|
+
payload['execute'] = execute;
|
|
105
|
+
}
|
|
106
|
+
|
|
95
107
|
if (typeof events !== 'undefined') {
|
|
96
108
|
payload['events'] = events;
|
|
97
109
|
}
|
|
@@ -108,7 +120,55 @@ class Functions extends Service {
|
|
|
108
120
|
payload['enabled'] = enabled;
|
|
109
121
|
}
|
|
110
122
|
|
|
111
|
-
|
|
123
|
+
if (typeof logging !== 'undefined') {
|
|
124
|
+
payload['logging'] = logging;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (typeof entrypoint !== 'undefined') {
|
|
128
|
+
payload['entrypoint'] = entrypoint;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (typeof commands !== 'undefined') {
|
|
132
|
+
payload['commands'] = commands;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (typeof installationId !== 'undefined') {
|
|
136
|
+
payload['installationId'] = installationId;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (typeof providerRepositoryId !== 'undefined') {
|
|
140
|
+
payload['providerRepositoryId'] = providerRepositoryId;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (typeof providerBranch !== 'undefined') {
|
|
144
|
+
payload['providerBranch'] = providerBranch;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (typeof providerSilentMode !== 'undefined') {
|
|
148
|
+
payload['providerSilentMode'] = providerSilentMode;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (typeof providerRootDirectory !== 'undefined') {
|
|
152
|
+
payload['providerRootDirectory'] = providerRootDirectory;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (typeof templateRepository !== 'undefined') {
|
|
156
|
+
payload['templateRepository'] = templateRepository;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (typeof templateOwner !== 'undefined') {
|
|
160
|
+
payload['templateOwner'] = templateOwner;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (typeof templateRootDirectory !== 'undefined') {
|
|
164
|
+
payload['templateRootDirectory'] = templateRootDirectory;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (typeof templateBranch !== 'undefined') {
|
|
168
|
+
payload['templateBranch'] = templateBranch;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return await this.client.call('post', apiPath, {
|
|
112
172
|
'content-type': 'application/json',
|
|
113
173
|
}, payload);
|
|
114
174
|
}
|
|
@@ -122,10 +182,10 @@ class Functions extends Service {
|
|
|
122
182
|
* @returns {Promise}
|
|
123
183
|
*/
|
|
124
184
|
async listRuntimes() {
|
|
125
|
-
|
|
185
|
+
const apiPath = '/functions/runtimes';
|
|
126
186
|
let payload = {};
|
|
127
187
|
|
|
128
|
-
return await this.client.call('get',
|
|
188
|
+
return await this.client.call('get', apiPath, {
|
|
129
189
|
'content-type': 'application/json',
|
|
130
190
|
}, payload);
|
|
131
191
|
}
|
|
@@ -140,14 +200,14 @@ class Functions extends Service {
|
|
|
140
200
|
* @returns {Promise}
|
|
141
201
|
*/
|
|
142
202
|
async get(functionId) {
|
|
143
|
-
|
|
203
|
+
const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
144
204
|
let payload = {};
|
|
145
205
|
if (typeof functionId === 'undefined') {
|
|
146
206
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
147
207
|
}
|
|
148
208
|
|
|
149
209
|
|
|
150
|
-
return await this.client.call('get',
|
|
210
|
+
return await this.client.call('get', apiPath, {
|
|
151
211
|
'content-type': 'application/json',
|
|
152
212
|
}, payload);
|
|
153
213
|
}
|
|
@@ -159,16 +219,25 @@ class Functions extends Service {
|
|
|
159
219
|
*
|
|
160
220
|
* @param {string} functionId
|
|
161
221
|
* @param {string} name
|
|
222
|
+
* @param {string} runtime
|
|
162
223
|
* @param {string[]} execute
|
|
163
224
|
* @param {string[]} events
|
|
164
225
|
* @param {string} schedule
|
|
165
226
|
* @param {number} timeout
|
|
166
227
|
* @param {boolean} enabled
|
|
228
|
+
* @param {boolean} logging
|
|
229
|
+
* @param {string} entrypoint
|
|
230
|
+
* @param {string} commands
|
|
231
|
+
* @param {string} installationId
|
|
232
|
+
* @param {string} providerRepositoryId
|
|
233
|
+
* @param {string} providerBranch
|
|
234
|
+
* @param {boolean} providerSilentMode
|
|
235
|
+
* @param {string} providerRootDirectory
|
|
167
236
|
* @throws {AppwriteException}
|
|
168
237
|
* @returns {Promise}
|
|
169
238
|
*/
|
|
170
|
-
async update(functionId, name, execute, events, schedule, timeout, enabled) {
|
|
171
|
-
|
|
239
|
+
async update(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory) {
|
|
240
|
+
const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
172
241
|
let payload = {};
|
|
173
242
|
if (typeof functionId === 'undefined') {
|
|
174
243
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
@@ -178,11 +247,19 @@ class Functions extends Service {
|
|
|
178
247
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
179
248
|
}
|
|
180
249
|
|
|
250
|
+
if (typeof runtime === 'undefined') {
|
|
251
|
+
throw new AppwriteException('Missing required parameter: "runtime"');
|
|
252
|
+
}
|
|
253
|
+
|
|
181
254
|
|
|
182
255
|
if (typeof name !== 'undefined') {
|
|
183
256
|
payload['name'] = name;
|
|
184
257
|
}
|
|
185
258
|
|
|
259
|
+
if (typeof runtime !== 'undefined') {
|
|
260
|
+
payload['runtime'] = runtime;
|
|
261
|
+
}
|
|
262
|
+
|
|
186
263
|
if (typeof execute !== 'undefined') {
|
|
187
264
|
payload['execute'] = execute;
|
|
188
265
|
}
|
|
@@ -203,7 +280,39 @@ class Functions extends Service {
|
|
|
203
280
|
payload['enabled'] = enabled;
|
|
204
281
|
}
|
|
205
282
|
|
|
206
|
-
|
|
283
|
+
if (typeof logging !== 'undefined') {
|
|
284
|
+
payload['logging'] = logging;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (typeof entrypoint !== 'undefined') {
|
|
288
|
+
payload['entrypoint'] = entrypoint;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (typeof commands !== 'undefined') {
|
|
292
|
+
payload['commands'] = commands;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (typeof installationId !== 'undefined') {
|
|
296
|
+
payload['installationId'] = installationId;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if (typeof providerRepositoryId !== 'undefined') {
|
|
300
|
+
payload['providerRepositoryId'] = providerRepositoryId;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (typeof providerBranch !== 'undefined') {
|
|
304
|
+
payload['providerBranch'] = providerBranch;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if (typeof providerSilentMode !== 'undefined') {
|
|
308
|
+
payload['providerSilentMode'] = providerSilentMode;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (typeof providerRootDirectory !== 'undefined') {
|
|
312
|
+
payload['providerRootDirectory'] = providerRootDirectory;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return await this.client.call('put', apiPath, {
|
|
207
316
|
'content-type': 'application/json',
|
|
208
317
|
}, payload);
|
|
209
318
|
}
|
|
@@ -218,14 +327,14 @@ class Functions extends Service {
|
|
|
218
327
|
* @returns {Promise}
|
|
219
328
|
*/
|
|
220
329
|
async delete(functionId) {
|
|
221
|
-
|
|
330
|
+
const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
222
331
|
let payload = {};
|
|
223
332
|
if (typeof functionId === 'undefined') {
|
|
224
333
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
225
334
|
}
|
|
226
335
|
|
|
227
336
|
|
|
228
|
-
return await this.client.call('delete',
|
|
337
|
+
return await this.client.call('delete', apiPath, {
|
|
229
338
|
'content-type': 'application/json',
|
|
230
339
|
}, payload);
|
|
231
340
|
}
|
|
@@ -243,7 +352,7 @@ class Functions extends Service {
|
|
|
243
352
|
* @returns {Promise}
|
|
244
353
|
*/
|
|
245
354
|
async listDeployments(functionId, queries, search) {
|
|
246
|
-
|
|
355
|
+
const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
247
356
|
let payload = {};
|
|
248
357
|
if (typeof functionId === 'undefined') {
|
|
249
358
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
@@ -258,7 +367,7 @@ class Functions extends Service {
|
|
|
258
367
|
payload['search'] = search;
|
|
259
368
|
}
|
|
260
369
|
|
|
261
|
-
return await this.client.call('get',
|
|
370
|
+
return await this.client.call('get', apiPath, {
|
|
262
371
|
'content-type': 'application/json',
|
|
263
372
|
}, payload);
|
|
264
373
|
}
|
|
@@ -275,26 +384,23 @@ class Functions extends Service {
|
|
|
275
384
|
* learn more about code packaging in the [Appwrite Cloud Functions
|
|
276
385
|
* tutorial](/docs/functions).
|
|
277
386
|
*
|
|
278
|
-
* Use the "command" param to set the
|
|
387
|
+
* Use the "command" param to set the entrypoint used to execute your code.
|
|
279
388
|
*
|
|
280
389
|
* @param {string} functionId
|
|
281
|
-
* @param {string} entrypoint
|
|
282
390
|
* @param {InputFile} code
|
|
283
391
|
* @param {boolean} activate
|
|
392
|
+
* @param {string} entrypoint
|
|
393
|
+
* @param {string} commands
|
|
284
394
|
* @throws {AppwriteException}
|
|
285
395
|
* @returns {Promise}
|
|
286
396
|
*/
|
|
287
|
-
async createDeployment(functionId,
|
|
288
|
-
|
|
397
|
+
async createDeployment(functionId, code, activate, entrypoint, commands, onProgress = () => {}) {
|
|
398
|
+
const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
289
399
|
let payload = {};
|
|
290
400
|
if (typeof functionId === 'undefined') {
|
|
291
401
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
292
402
|
}
|
|
293
403
|
|
|
294
|
-
if (typeof entrypoint === 'undefined') {
|
|
295
|
-
throw new AppwriteException('Missing required parameter: "entrypoint"');
|
|
296
|
-
}
|
|
297
|
-
|
|
298
404
|
if (typeof code === 'undefined') {
|
|
299
405
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
300
406
|
}
|
|
@@ -308,6 +414,10 @@ class Functions extends Service {
|
|
|
308
414
|
payload['entrypoint'] = entrypoint;
|
|
309
415
|
}
|
|
310
416
|
|
|
417
|
+
if (typeof commands !== 'undefined') {
|
|
418
|
+
payload['commands'] = commands;
|
|
419
|
+
}
|
|
420
|
+
|
|
311
421
|
if (typeof code !== 'undefined') {
|
|
312
422
|
payload['code'] = code;
|
|
313
423
|
}
|
|
@@ -353,7 +463,7 @@ class Functions extends Service {
|
|
|
353
463
|
const stream = Stream.Readable.from(currentChunk);
|
|
354
464
|
payload['code'] = { type: 'file', file: stream, filename: code.filename };
|
|
355
465
|
|
|
356
|
-
response = await selfClient.call('post',
|
|
466
|
+
response = await selfClient.call('post', apiPath, headers, payload);
|
|
357
467
|
|
|
358
468
|
if (!id) {
|
|
359
469
|
id = response['$id'];
|
|
@@ -449,7 +559,7 @@ class Functions extends Service {
|
|
|
449
559
|
* @returns {Promise}
|
|
450
560
|
*/
|
|
451
561
|
async getDeployment(functionId, deploymentId) {
|
|
452
|
-
|
|
562
|
+
const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
453
563
|
let payload = {};
|
|
454
564
|
if (typeof functionId === 'undefined') {
|
|
455
565
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
@@ -460,7 +570,7 @@ class Functions extends Service {
|
|
|
460
570
|
}
|
|
461
571
|
|
|
462
572
|
|
|
463
|
-
return await this.client.call('get',
|
|
573
|
+
return await this.client.call('get', apiPath, {
|
|
464
574
|
'content-type': 'application/json',
|
|
465
575
|
}, payload);
|
|
466
576
|
}
|
|
@@ -478,7 +588,7 @@ class Functions extends Service {
|
|
|
478
588
|
* @returns {Promise}
|
|
479
589
|
*/
|
|
480
590
|
async updateDeployment(functionId, deploymentId) {
|
|
481
|
-
|
|
591
|
+
const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
482
592
|
let payload = {};
|
|
483
593
|
if (typeof functionId === 'undefined') {
|
|
484
594
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
@@ -489,7 +599,7 @@ class Functions extends Service {
|
|
|
489
599
|
}
|
|
490
600
|
|
|
491
601
|
|
|
492
|
-
return await this.client.call('patch',
|
|
602
|
+
return await this.client.call('patch', apiPath, {
|
|
493
603
|
'content-type': 'application/json',
|
|
494
604
|
}, payload);
|
|
495
605
|
}
|
|
@@ -505,7 +615,7 @@ class Functions extends Service {
|
|
|
505
615
|
* @returns {Promise}
|
|
506
616
|
*/
|
|
507
617
|
async deleteDeployment(functionId, deploymentId) {
|
|
508
|
-
|
|
618
|
+
const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
509
619
|
let payload = {};
|
|
510
620
|
if (typeof functionId === 'undefined') {
|
|
511
621
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
@@ -516,7 +626,7 @@ class Functions extends Service {
|
|
|
516
626
|
}
|
|
517
627
|
|
|
518
628
|
|
|
519
|
-
return await this.client.call('delete',
|
|
629
|
+
return await this.client.call('delete', apiPath, {
|
|
520
630
|
'content-type': 'application/json',
|
|
521
631
|
}, payload);
|
|
522
632
|
}
|
|
@@ -524,6 +634,9 @@ class Functions extends Service {
|
|
|
524
634
|
/**
|
|
525
635
|
* Create Build
|
|
526
636
|
*
|
|
637
|
+
* Create a new build for an Appwrite Function deployment. This endpoint can
|
|
638
|
+
* be used to retry a failed build.
|
|
639
|
+
*
|
|
527
640
|
* @param {string} functionId
|
|
528
641
|
* @param {string} deploymentId
|
|
529
642
|
* @param {string} buildId
|
|
@@ -531,7 +644,7 @@ class Functions extends Service {
|
|
|
531
644
|
* @returns {Promise}
|
|
532
645
|
*/
|
|
533
646
|
async createBuild(functionId, deploymentId, buildId) {
|
|
534
|
-
|
|
647
|
+
const apiPath = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
|
|
535
648
|
let payload = {};
|
|
536
649
|
if (typeof functionId === 'undefined') {
|
|
537
650
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
@@ -546,11 +659,36 @@ class Functions extends Service {
|
|
|
546
659
|
}
|
|
547
660
|
|
|
548
661
|
|
|
549
|
-
return await this.client.call('post',
|
|
662
|
+
return await this.client.call('post', apiPath, {
|
|
550
663
|
'content-type': 'application/json',
|
|
551
664
|
}, payload);
|
|
552
665
|
}
|
|
553
666
|
|
|
667
|
+
/**
|
|
668
|
+
* Download Deployment
|
|
669
|
+
*
|
|
670
|
+
* @param {string} functionId
|
|
671
|
+
* @param {string} deploymentId
|
|
672
|
+
* @throws {AppwriteException}
|
|
673
|
+
* @returns {Promise}
|
|
674
|
+
*/
|
|
675
|
+
async downloadDeployment(functionId, deploymentId) {
|
|
676
|
+
const apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
677
|
+
let payload = {};
|
|
678
|
+
if (typeof functionId === 'undefined') {
|
|
679
|
+
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
if (typeof deploymentId === 'undefined') {
|
|
683
|
+
throw new AppwriteException('Missing required parameter: "deploymentId"');
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
return await this.client.call('get', apiPath, {
|
|
688
|
+
'content-type': 'application/json',
|
|
689
|
+
}, payload, 'arraybuffer');
|
|
690
|
+
}
|
|
691
|
+
|
|
554
692
|
/**
|
|
555
693
|
* List Executions
|
|
556
694
|
*
|
|
@@ -564,7 +702,7 @@ class Functions extends Service {
|
|
|
564
702
|
* @returns {Promise}
|
|
565
703
|
*/
|
|
566
704
|
async listExecutions(functionId, queries, search) {
|
|
567
|
-
|
|
705
|
+
const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
568
706
|
let payload = {};
|
|
569
707
|
if (typeof functionId === 'undefined') {
|
|
570
708
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
@@ -579,7 +717,7 @@ class Functions extends Service {
|
|
|
579
717
|
payload['search'] = search;
|
|
580
718
|
}
|
|
581
719
|
|
|
582
|
-
return await this.client.call('get',
|
|
720
|
+
return await this.client.call('get', apiPath, {
|
|
583
721
|
'content-type': 'application/json',
|
|
584
722
|
}, payload);
|
|
585
723
|
}
|
|
@@ -593,28 +731,43 @@ class Functions extends Service {
|
|
|
593
731
|
* function execution process will start asynchronously.
|
|
594
732
|
*
|
|
595
733
|
* @param {string} functionId
|
|
596
|
-
* @param {string}
|
|
734
|
+
* @param {string} body
|
|
597
735
|
* @param {boolean} async
|
|
736
|
+
* @param {string} xpath
|
|
737
|
+
* @param {string} method
|
|
738
|
+
* @param {object} headers
|
|
598
739
|
* @throws {AppwriteException}
|
|
599
740
|
* @returns {Promise}
|
|
600
741
|
*/
|
|
601
|
-
async createExecution(functionId,
|
|
602
|
-
|
|
742
|
+
async createExecution(functionId, body, async, xpath, method, headers) {
|
|
743
|
+
const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
603
744
|
let payload = {};
|
|
604
745
|
if (typeof functionId === 'undefined') {
|
|
605
746
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
606
747
|
}
|
|
607
748
|
|
|
608
749
|
|
|
609
|
-
if (typeof
|
|
610
|
-
payload['
|
|
750
|
+
if (typeof body !== 'undefined') {
|
|
751
|
+
payload['body'] = body;
|
|
611
752
|
}
|
|
612
753
|
|
|
613
754
|
if (typeof async !== 'undefined') {
|
|
614
755
|
payload['async'] = async;
|
|
615
756
|
}
|
|
616
757
|
|
|
617
|
-
|
|
758
|
+
if (typeof xpath !== 'undefined') {
|
|
759
|
+
payload['path'] = xpath;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
if (typeof method !== 'undefined') {
|
|
763
|
+
payload['method'] = method;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
if (typeof headers !== 'undefined') {
|
|
767
|
+
payload['headers'] = headers;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
return await this.client.call('post', apiPath, {
|
|
618
771
|
'content-type': 'application/json',
|
|
619
772
|
}, payload);
|
|
620
773
|
}
|
|
@@ -630,7 +783,7 @@ class Functions extends Service {
|
|
|
630
783
|
* @returns {Promise}
|
|
631
784
|
*/
|
|
632
785
|
async getExecution(functionId, executionId) {
|
|
633
|
-
|
|
786
|
+
const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
|
|
634
787
|
let payload = {};
|
|
635
788
|
if (typeof functionId === 'undefined') {
|
|
636
789
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
@@ -641,7 +794,7 @@ class Functions extends Service {
|
|
|
641
794
|
}
|
|
642
795
|
|
|
643
796
|
|
|
644
|
-
return await this.client.call('get',
|
|
797
|
+
return await this.client.call('get', apiPath, {
|
|
645
798
|
'content-type': 'application/json',
|
|
646
799
|
}, payload);
|
|
647
800
|
}
|
|
@@ -656,14 +809,14 @@ class Functions extends Service {
|
|
|
656
809
|
* @returns {Promise}
|
|
657
810
|
*/
|
|
658
811
|
async listVariables(functionId) {
|
|
659
|
-
|
|
812
|
+
const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
|
|
660
813
|
let payload = {};
|
|
661
814
|
if (typeof functionId === 'undefined') {
|
|
662
815
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
663
816
|
}
|
|
664
817
|
|
|
665
818
|
|
|
666
|
-
return await this.client.call('get',
|
|
819
|
+
return await this.client.call('get', apiPath, {
|
|
667
820
|
'content-type': 'application/json',
|
|
668
821
|
}, payload);
|
|
669
822
|
}
|
|
@@ -671,8 +824,8 @@ class Functions extends Service {
|
|
|
671
824
|
/**
|
|
672
825
|
* Create Variable
|
|
673
826
|
*
|
|
674
|
-
* Create a new function variable. These variables can be accessed
|
|
675
|
-
*
|
|
827
|
+
* Create a new function environment variable. These variables can be accessed
|
|
828
|
+
* in the function at runtime as environment variables.
|
|
676
829
|
*
|
|
677
830
|
* @param {string} functionId
|
|
678
831
|
* @param {string} key
|
|
@@ -681,7 +834,7 @@ class Functions extends Service {
|
|
|
681
834
|
* @returns {Promise}
|
|
682
835
|
*/
|
|
683
836
|
async createVariable(functionId, key, value) {
|
|
684
|
-
|
|
837
|
+
const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
|
|
685
838
|
let payload = {};
|
|
686
839
|
if (typeof functionId === 'undefined') {
|
|
687
840
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
@@ -704,7 +857,7 @@ class Functions extends Service {
|
|
|
704
857
|
payload['value'] = value;
|
|
705
858
|
}
|
|
706
859
|
|
|
707
|
-
return await this.client.call('post',
|
|
860
|
+
return await this.client.call('post', apiPath, {
|
|
708
861
|
'content-type': 'application/json',
|
|
709
862
|
}, payload);
|
|
710
863
|
}
|
|
@@ -720,7 +873,7 @@ class Functions extends Service {
|
|
|
720
873
|
* @returns {Promise}
|
|
721
874
|
*/
|
|
722
875
|
async getVariable(functionId, variableId) {
|
|
723
|
-
|
|
876
|
+
const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
724
877
|
let payload = {};
|
|
725
878
|
if (typeof functionId === 'undefined') {
|
|
726
879
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
@@ -731,7 +884,7 @@ class Functions extends Service {
|
|
|
731
884
|
}
|
|
732
885
|
|
|
733
886
|
|
|
734
|
-
return await this.client.call('get',
|
|
887
|
+
return await this.client.call('get', apiPath, {
|
|
735
888
|
'content-type': 'application/json',
|
|
736
889
|
}, payload);
|
|
737
890
|
}
|
|
@@ -749,7 +902,7 @@ class Functions extends Service {
|
|
|
749
902
|
* @returns {Promise}
|
|
750
903
|
*/
|
|
751
904
|
async updateVariable(functionId, variableId, key, value) {
|
|
752
|
-
|
|
905
|
+
const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
753
906
|
let payload = {};
|
|
754
907
|
if (typeof functionId === 'undefined') {
|
|
755
908
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
@@ -772,7 +925,7 @@ class Functions extends Service {
|
|
|
772
925
|
payload['value'] = value;
|
|
773
926
|
}
|
|
774
927
|
|
|
775
|
-
return await this.client.call('put',
|
|
928
|
+
return await this.client.call('put', apiPath, {
|
|
776
929
|
'content-type': 'application/json',
|
|
777
930
|
}, payload);
|
|
778
931
|
}
|
|
@@ -788,7 +941,7 @@ class Functions extends Service {
|
|
|
788
941
|
* @returns {Promise}
|
|
789
942
|
*/
|
|
790
943
|
async deleteVariable(functionId, variableId) {
|
|
791
|
-
|
|
944
|
+
const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
792
945
|
let payload = {};
|
|
793
946
|
if (typeof functionId === 'undefined') {
|
|
794
947
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
@@ -799,7 +952,7 @@ class Functions extends Service {
|
|
|
799
952
|
}
|
|
800
953
|
|
|
801
954
|
|
|
802
|
-
return await this.client.call('delete',
|
|
955
|
+
return await this.client.call('delete', apiPath, {
|
|
803
956
|
'content-type': 'application/json',
|
|
804
957
|
}, payload);
|
|
805
958
|
}
|
package/lib/services/graphql.js
CHANGED
|
@@ -24,7 +24,7 @@ class Graphql extends Service {
|
|
|
24
24
|
* @returns {Promise}
|
|
25
25
|
*/
|
|
26
26
|
async query(query) {
|
|
27
|
-
|
|
27
|
+
const apiPath = '/graphql';
|
|
28
28
|
let payload = {};
|
|
29
29
|
if (typeof query === 'undefined') {
|
|
30
30
|
throw new AppwriteException('Missing required parameter: "query"');
|
|
@@ -35,7 +35,7 @@ class Graphql extends Service {
|
|
|
35
35
|
payload['query'] = query;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
return await this.client.call('post',
|
|
38
|
+
return await this.client.call('post', apiPath, {
|
|
39
39
|
'x-sdk-graphql': 'true',
|
|
40
40
|
'content-type': 'application/json',
|
|
41
41
|
}, payload);
|
|
@@ -51,7 +51,7 @@ class Graphql extends Service {
|
|
|
51
51
|
* @returns {Promise}
|
|
52
52
|
*/
|
|
53
53
|
async mutation(query) {
|
|
54
|
-
|
|
54
|
+
const apiPath = '/graphql/mutation';
|
|
55
55
|
let payload = {};
|
|
56
56
|
if (typeof query === 'undefined') {
|
|
57
57
|
throw new AppwriteException('Missing required parameter: "query"');
|
|
@@ -62,7 +62,7 @@ class Graphql extends Service {
|
|
|
62
62
|
payload['query'] = query;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
return await this.client.call('post',
|
|
65
|
+
return await this.client.call('post', apiPath, {
|
|
66
66
|
'x-sdk-graphql': 'true',
|
|
67
67
|
'content-type': 'application/json',
|
|
68
68
|
}, payload);
|