node-appwrite 16.0.0 → 17.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.
Files changed (92) hide show
  1. package/README.md +2 -2
  2. package/dist/client.js +3 -3
  3. package/dist/client.js.map +1 -1
  4. package/dist/client.mjs +3 -3
  5. package/dist/client.mjs.map +1 -1
  6. package/dist/enums/adapter.d.mts +6 -0
  7. package/dist/enums/adapter.d.ts +6 -0
  8. package/dist/enums/adapter.js +11 -0
  9. package/dist/enums/adapter.js.map +1 -0
  10. package/dist/enums/adapter.mjs +10 -0
  11. package/dist/enums/adapter.mjs.map +1 -0
  12. package/dist/enums/build-runtime.d.mts +67 -0
  13. package/dist/enums/build-runtime.d.ts +67 -0
  14. package/dist/enums/build-runtime.js +72 -0
  15. package/dist/enums/build-runtime.js.map +1 -0
  16. package/dist/enums/build-runtime.mjs +71 -0
  17. package/dist/enums/build-runtime.mjs.map +1 -0
  18. package/dist/enums/deployment-download-type.d.mts +6 -0
  19. package/dist/enums/deployment-download-type.d.ts +6 -0
  20. package/dist/enums/deployment-download-type.js +11 -0
  21. package/dist/enums/deployment-download-type.js.map +1 -0
  22. package/dist/enums/deployment-download-type.mjs +10 -0
  23. package/dist/enums/deployment-download-type.mjs.map +1 -0
  24. package/dist/enums/framework.d.mts +18 -0
  25. package/dist/enums/framework.d.ts +18 -0
  26. package/dist/enums/framework.js +23 -0
  27. package/dist/enums/framework.js.map +1 -0
  28. package/dist/enums/framework.mjs +22 -0
  29. package/dist/enums/framework.mjs.map +1 -0
  30. package/dist/enums/image-format.d.mts +0 -1
  31. package/dist/enums/image-format.d.ts +0 -1
  32. package/dist/enums/image-format.js +0 -1
  33. package/dist/enums/image-format.js.map +1 -1
  34. package/dist/enums/image-format.mjs +0 -1
  35. package/dist/enums/image-format.mjs.map +1 -1
  36. package/dist/enums/runtime.d.mts +5 -1
  37. package/dist/enums/runtime.d.ts +5 -1
  38. package/dist/enums/runtime.js +4 -0
  39. package/dist/enums/runtime.js.map +1 -1
  40. package/dist/enums/runtime.mjs +4 -0
  41. package/dist/enums/runtime.mjs.map +1 -1
  42. package/dist/enums/v-c-s-deployment-type.d.mts +7 -0
  43. package/dist/enums/v-c-s-deployment-type.d.ts +7 -0
  44. package/dist/enums/v-c-s-deployment-type.js +12 -0
  45. package/dist/enums/v-c-s-deployment-type.js.map +1 -0
  46. package/dist/enums/v-c-s-deployment-type.mjs +11 -0
  47. package/dist/enums/v-c-s-deployment-type.mjs.map +1 -0
  48. package/dist/index.d.mts +7 -0
  49. package/dist/index.d.ts +7 -0
  50. package/dist/index.js +35 -0
  51. package/dist/index.js.map +1 -1
  52. package/dist/index.mjs +7 -0
  53. package/dist/index.mjs.map +1 -1
  54. package/dist/models.d.mts +286 -48
  55. package/dist/models.d.ts +286 -48
  56. package/dist/services/databases.d.mts +44 -2
  57. package/dist/services/databases.d.ts +44 -2
  58. package/dist/services/databases.js +151 -12
  59. package/dist/services/databases.js.map +1 -1
  60. package/dist/services/databases.mjs +151 -12
  61. package/dist/services/databases.mjs.map +1 -1
  62. package/dist/services/functions.d.mts +56 -30
  63. package/dist/services/functions.d.ts +56 -30
  64. package/dist/services/functions.js +185 -87
  65. package/dist/services/functions.js.map +1 -1
  66. package/dist/services/functions.mjs +185 -87
  67. package/dist/services/functions.mjs.map +1 -1
  68. package/dist/services/sites.d.mts +286 -0
  69. package/dist/services/sites.d.ts +286 -0
  70. package/dist/services/sites.js +923 -0
  71. package/dist/services/sites.js.map +1 -0
  72. package/dist/services/sites.mjs +922 -0
  73. package/dist/services/sites.mjs.map +1 -0
  74. package/dist/services/storage.d.mts +6 -3
  75. package/dist/services/storage.d.ts +6 -3
  76. package/dist/services/storage.js +15 -3
  77. package/dist/services/storage.js.map +1 -1
  78. package/dist/services/storage.mjs +15 -3
  79. package/dist/services/storage.mjs.map +1 -1
  80. package/dist/services/tokens.d.mts +55 -0
  81. package/dist/services/tokens.d.ts +55 -0
  82. package/dist/services/tokens.js +149 -0
  83. package/dist/services/tokens.js.map +1 -0
  84. package/dist/services/tokens.mjs +148 -0
  85. package/dist/services/tokens.mjs.map +1 -0
  86. package/dist/services/users.d.mts +3 -1
  87. package/dist/services/users.d.ts +3 -1
  88. package/dist/services/users.js +9 -1
  89. package/dist/services/users.js.map +1 -1
  90. package/dist/services/users.mjs +9 -1
  91. package/dist/services/users.mjs.map +1 -1
  92. package/package.json +1 -1
@@ -0,0 +1,923 @@
1
+ 'use strict';
2
+
3
+ var client = require('../client');
4
+
5
+ class Sites {
6
+ constructor(client) {
7
+ this.client = client;
8
+ }
9
+ /**
10
+ * Get a list of all the project's sites. 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.SiteList>}
16
+ */
17
+ list(queries, search) {
18
+ const apiPath = "/sites";
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
+ return this.client.call(
29
+ "get",
30
+ uri,
31
+ apiHeaders,
32
+ payload
33
+ );
34
+ }
35
+ /**
36
+ * Create a new site.
37
+ *
38
+ * @param {string} siteId
39
+ * @param {string} name
40
+ * @param {Framework} framework
41
+ * @param {BuildRuntime} buildRuntime
42
+ * @param {boolean} enabled
43
+ * @param {boolean} logging
44
+ * @param {number} timeout
45
+ * @param {string} installCommand
46
+ * @param {string} buildCommand
47
+ * @param {string} outputDirectory
48
+ * @param {Adapter} adapter
49
+ * @param {string} installationId
50
+ * @param {string} fallbackFile
51
+ * @param {string} providerRepositoryId
52
+ * @param {string} providerBranch
53
+ * @param {boolean} providerSilentMode
54
+ * @param {string} providerRootDirectory
55
+ * @param {string} specification
56
+ * @throws {AppwriteException}
57
+ * @returns {Promise<Models.Site>}
58
+ */
59
+ create(siteId, name, framework, buildRuntime, enabled, logging, timeout, installCommand, buildCommand, outputDirectory, adapter, installationId, fallbackFile, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification) {
60
+ if (typeof siteId === "undefined") {
61
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
62
+ }
63
+ if (typeof name === "undefined") {
64
+ throw new client.AppwriteException('Missing required parameter: "name"');
65
+ }
66
+ if (typeof framework === "undefined") {
67
+ throw new client.AppwriteException('Missing required parameter: "framework"');
68
+ }
69
+ if (typeof buildRuntime === "undefined") {
70
+ throw new client.AppwriteException('Missing required parameter: "buildRuntime"');
71
+ }
72
+ const apiPath = "/sites";
73
+ const payload = {};
74
+ if (typeof siteId !== "undefined") {
75
+ payload["siteId"] = siteId;
76
+ }
77
+ if (typeof name !== "undefined") {
78
+ payload["name"] = name;
79
+ }
80
+ if (typeof framework !== "undefined") {
81
+ payload["framework"] = framework;
82
+ }
83
+ if (typeof enabled !== "undefined") {
84
+ payload["enabled"] = enabled;
85
+ }
86
+ if (typeof logging !== "undefined") {
87
+ payload["logging"] = logging;
88
+ }
89
+ if (typeof timeout !== "undefined") {
90
+ payload["timeout"] = timeout;
91
+ }
92
+ if (typeof installCommand !== "undefined") {
93
+ payload["installCommand"] = installCommand;
94
+ }
95
+ if (typeof buildCommand !== "undefined") {
96
+ payload["buildCommand"] = buildCommand;
97
+ }
98
+ if (typeof outputDirectory !== "undefined") {
99
+ payload["outputDirectory"] = outputDirectory;
100
+ }
101
+ if (typeof buildRuntime !== "undefined") {
102
+ payload["buildRuntime"] = buildRuntime;
103
+ }
104
+ if (typeof adapter !== "undefined") {
105
+ payload["adapter"] = adapter;
106
+ }
107
+ if (typeof installationId !== "undefined") {
108
+ payload["installationId"] = installationId;
109
+ }
110
+ if (typeof fallbackFile !== "undefined") {
111
+ payload["fallbackFile"] = fallbackFile;
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 specification !== "undefined") {
126
+ payload["specification"] = specification;
127
+ }
128
+ const uri = new URL(this.client.config.endpoint + apiPath);
129
+ const apiHeaders = {
130
+ "content-type": "application/json"
131
+ };
132
+ return this.client.call(
133
+ "post",
134
+ uri,
135
+ apiHeaders,
136
+ payload
137
+ );
138
+ }
139
+ /**
140
+ * Get a list of all frameworks that are currently available on the server instance.
141
+ *
142
+ * @throws {AppwriteException}
143
+ * @returns {Promise<Models.FrameworkList>}
144
+ */
145
+ listFrameworks() {
146
+ const apiPath = "/sites/frameworks";
147
+ const payload = {};
148
+ const uri = new URL(this.client.config.endpoint + apiPath);
149
+ const apiHeaders = {};
150
+ return this.client.call(
151
+ "get",
152
+ uri,
153
+ apiHeaders,
154
+ payload
155
+ );
156
+ }
157
+ /**
158
+ * List allowed site specifications for this instance.
159
+ *
160
+ * @throws {AppwriteException}
161
+ * @returns {Promise<Models.SpecificationList>}
162
+ */
163
+ listSpecifications() {
164
+ const apiPath = "/sites/specifications";
165
+ const payload = {};
166
+ const uri = new URL(this.client.config.endpoint + apiPath);
167
+ const apiHeaders = {};
168
+ return this.client.call(
169
+ "get",
170
+ uri,
171
+ apiHeaders,
172
+ payload
173
+ );
174
+ }
175
+ /**
176
+ * Get a site by its unique ID.
177
+ *
178
+ * @param {string} siteId
179
+ * @throws {AppwriteException}
180
+ * @returns {Promise<Models.Site>}
181
+ */
182
+ get(siteId) {
183
+ if (typeof siteId === "undefined") {
184
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
185
+ }
186
+ const apiPath = "/sites/{siteId}".replace("{siteId}", siteId);
187
+ const payload = {};
188
+ const uri = new URL(this.client.config.endpoint + apiPath);
189
+ const apiHeaders = {};
190
+ return this.client.call(
191
+ "get",
192
+ uri,
193
+ apiHeaders,
194
+ payload
195
+ );
196
+ }
197
+ /**
198
+ * Update site by its unique ID.
199
+ *
200
+ * @param {string} siteId
201
+ * @param {string} name
202
+ * @param {Framework} framework
203
+ * @param {boolean} enabled
204
+ * @param {boolean} logging
205
+ * @param {number} timeout
206
+ * @param {string} installCommand
207
+ * @param {string} buildCommand
208
+ * @param {string} outputDirectory
209
+ * @param {BuildRuntime} buildRuntime
210
+ * @param {Adapter} adapter
211
+ * @param {string} fallbackFile
212
+ * @param {string} installationId
213
+ * @param {string} providerRepositoryId
214
+ * @param {string} providerBranch
215
+ * @param {boolean} providerSilentMode
216
+ * @param {string} providerRootDirectory
217
+ * @param {string} specification
218
+ * @throws {AppwriteException}
219
+ * @returns {Promise<Models.Site>}
220
+ */
221
+ update(siteId, name, framework, enabled, logging, timeout, installCommand, buildCommand, outputDirectory, buildRuntime, adapter, fallbackFile, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification) {
222
+ if (typeof siteId === "undefined") {
223
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
224
+ }
225
+ if (typeof name === "undefined") {
226
+ throw new client.AppwriteException('Missing required parameter: "name"');
227
+ }
228
+ if (typeof framework === "undefined") {
229
+ throw new client.AppwriteException('Missing required parameter: "framework"');
230
+ }
231
+ const apiPath = "/sites/{siteId}".replace("{siteId}", siteId);
232
+ const payload = {};
233
+ if (typeof name !== "undefined") {
234
+ payload["name"] = name;
235
+ }
236
+ if (typeof framework !== "undefined") {
237
+ payload["framework"] = framework;
238
+ }
239
+ if (typeof enabled !== "undefined") {
240
+ payload["enabled"] = enabled;
241
+ }
242
+ if (typeof logging !== "undefined") {
243
+ payload["logging"] = logging;
244
+ }
245
+ if (typeof timeout !== "undefined") {
246
+ payload["timeout"] = timeout;
247
+ }
248
+ if (typeof installCommand !== "undefined") {
249
+ payload["installCommand"] = installCommand;
250
+ }
251
+ if (typeof buildCommand !== "undefined") {
252
+ payload["buildCommand"] = buildCommand;
253
+ }
254
+ if (typeof outputDirectory !== "undefined") {
255
+ payload["outputDirectory"] = outputDirectory;
256
+ }
257
+ if (typeof buildRuntime !== "undefined") {
258
+ payload["buildRuntime"] = buildRuntime;
259
+ }
260
+ if (typeof adapter !== "undefined") {
261
+ payload["adapter"] = adapter;
262
+ }
263
+ if (typeof fallbackFile !== "undefined") {
264
+ payload["fallbackFile"] = fallbackFile;
265
+ }
266
+ if (typeof installationId !== "undefined") {
267
+ payload["installationId"] = installationId;
268
+ }
269
+ if (typeof providerRepositoryId !== "undefined") {
270
+ payload["providerRepositoryId"] = providerRepositoryId;
271
+ }
272
+ if (typeof providerBranch !== "undefined") {
273
+ payload["providerBranch"] = providerBranch;
274
+ }
275
+ if (typeof providerSilentMode !== "undefined") {
276
+ payload["providerSilentMode"] = providerSilentMode;
277
+ }
278
+ if (typeof providerRootDirectory !== "undefined") {
279
+ payload["providerRootDirectory"] = providerRootDirectory;
280
+ }
281
+ if (typeof specification !== "undefined") {
282
+ payload["specification"] = specification;
283
+ }
284
+ const uri = new URL(this.client.config.endpoint + apiPath);
285
+ const apiHeaders = {
286
+ "content-type": "application/json"
287
+ };
288
+ return this.client.call(
289
+ "put",
290
+ uri,
291
+ apiHeaders,
292
+ payload
293
+ );
294
+ }
295
+ /**
296
+ * Delete a site by its unique ID.
297
+ *
298
+ * @param {string} siteId
299
+ * @throws {AppwriteException}
300
+ * @returns {Promise<{}>}
301
+ */
302
+ delete(siteId) {
303
+ if (typeof siteId === "undefined") {
304
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
305
+ }
306
+ const apiPath = "/sites/{siteId}".replace("{siteId}", siteId);
307
+ const payload = {};
308
+ const uri = new URL(this.client.config.endpoint + apiPath);
309
+ const apiHeaders = {
310
+ "content-type": "application/json"
311
+ };
312
+ return this.client.call(
313
+ "delete",
314
+ uri,
315
+ apiHeaders,
316
+ payload
317
+ );
318
+ }
319
+ /**
320
+ * Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site.
321
+ *
322
+ * @param {string} siteId
323
+ * @param {string} deploymentId
324
+ * @throws {AppwriteException}
325
+ * @returns {Promise<Models.Site>}
326
+ */
327
+ updateSiteDeployment(siteId, deploymentId) {
328
+ if (typeof siteId === "undefined") {
329
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
330
+ }
331
+ if (typeof deploymentId === "undefined") {
332
+ throw new client.AppwriteException('Missing required parameter: "deploymentId"');
333
+ }
334
+ const apiPath = "/sites/{siteId}/deployment".replace("{siteId}", siteId);
335
+ const payload = {};
336
+ if (typeof deploymentId !== "undefined") {
337
+ payload["deploymentId"] = deploymentId;
338
+ }
339
+ const uri = new URL(this.client.config.endpoint + apiPath);
340
+ const apiHeaders = {
341
+ "content-type": "application/json"
342
+ };
343
+ return this.client.call(
344
+ "patch",
345
+ uri,
346
+ apiHeaders,
347
+ payload
348
+ );
349
+ }
350
+ /**
351
+ * Get a list of all the site&#039;s code deployments. You can use the query params to filter your results.
352
+ *
353
+ * @param {string} siteId
354
+ * @param {string[]} queries
355
+ * @param {string} search
356
+ * @throws {AppwriteException}
357
+ * @returns {Promise<Models.DeploymentList>}
358
+ */
359
+ listDeployments(siteId, queries, search) {
360
+ if (typeof siteId === "undefined") {
361
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
362
+ }
363
+ const apiPath = "/sites/{siteId}/deployments".replace("{siteId}", siteId);
364
+ const payload = {};
365
+ if (typeof queries !== "undefined") {
366
+ payload["queries"] = queries;
367
+ }
368
+ if (typeof search !== "undefined") {
369
+ payload["search"] = search;
370
+ }
371
+ const uri = new URL(this.client.config.endpoint + apiPath);
372
+ const apiHeaders = {};
373
+ return this.client.call(
374
+ "get",
375
+ uri,
376
+ apiHeaders,
377
+ payload
378
+ );
379
+ }
380
+ /**
381
+ * Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you&#039;ll need to update the function&#039;s deployment to use your new deployment ID.
382
+ *
383
+ * @param {string} siteId
384
+ * @param {File} code
385
+ * @param {boolean} activate
386
+ * @param {string} installCommand
387
+ * @param {string} buildCommand
388
+ * @param {string} outputDirectory
389
+ * @throws {AppwriteException}
390
+ * @returns {Promise<Models.Deployment>}
391
+ */
392
+ createDeployment(siteId, code, activate, installCommand, buildCommand, outputDirectory, onProgress = (progress) => {
393
+ }) {
394
+ if (typeof siteId === "undefined") {
395
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
396
+ }
397
+ if (typeof code === "undefined") {
398
+ throw new client.AppwriteException('Missing required parameter: "code"');
399
+ }
400
+ if (typeof activate === "undefined") {
401
+ throw new client.AppwriteException('Missing required parameter: "activate"');
402
+ }
403
+ const apiPath = "/sites/{siteId}/deployments".replace("{siteId}", siteId);
404
+ const payload = {};
405
+ if (typeof installCommand !== "undefined") {
406
+ payload["installCommand"] = installCommand;
407
+ }
408
+ if (typeof buildCommand !== "undefined") {
409
+ payload["buildCommand"] = buildCommand;
410
+ }
411
+ if (typeof outputDirectory !== "undefined") {
412
+ payload["outputDirectory"] = outputDirectory;
413
+ }
414
+ if (typeof code !== "undefined") {
415
+ payload["code"] = code;
416
+ }
417
+ if (typeof activate !== "undefined") {
418
+ payload["activate"] = activate;
419
+ }
420
+ const uri = new URL(this.client.config.endpoint + apiPath);
421
+ const apiHeaders = {
422
+ "content-type": "multipart/form-data"
423
+ };
424
+ return this.client.chunkedUpload(
425
+ "post",
426
+ uri,
427
+ apiHeaders,
428
+ payload,
429
+ onProgress
430
+ );
431
+ }
432
+ /**
433
+ * Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment&#039;s code will be preserved and used for the new build.
434
+ *
435
+ * @param {string} siteId
436
+ * @param {string} deploymentId
437
+ * @throws {AppwriteException}
438
+ * @returns {Promise<Models.Deployment>}
439
+ */
440
+ createDuplicateDeployment(siteId, deploymentId) {
441
+ if (typeof siteId === "undefined") {
442
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
443
+ }
444
+ if (typeof deploymentId === "undefined") {
445
+ throw new client.AppwriteException('Missing required parameter: "deploymentId"');
446
+ }
447
+ const apiPath = "/sites/{siteId}/deployments/duplicate".replace("{siteId}", siteId);
448
+ const payload = {};
449
+ if (typeof deploymentId !== "undefined") {
450
+ payload["deploymentId"] = deploymentId;
451
+ }
452
+ const uri = new URL(this.client.config.endpoint + apiPath);
453
+ const apiHeaders = {
454
+ "content-type": "application/json"
455
+ };
456
+ return this.client.call(
457
+ "post",
458
+ uri,
459
+ apiHeaders,
460
+ payload
461
+ );
462
+ }
463
+ /**
464
+ * Create a deployment based on a template.
465
+
466
+ Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details.
467
+ *
468
+ * @param {string} siteId
469
+ * @param {string} repository
470
+ * @param {string} owner
471
+ * @param {string} rootDirectory
472
+ * @param {string} version
473
+ * @param {boolean} activate
474
+ * @throws {AppwriteException}
475
+ * @returns {Promise<Models.Deployment>}
476
+ */
477
+ createTemplateDeployment(siteId, repository, owner, rootDirectory, version, activate) {
478
+ if (typeof siteId === "undefined") {
479
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
480
+ }
481
+ if (typeof repository === "undefined") {
482
+ throw new client.AppwriteException('Missing required parameter: "repository"');
483
+ }
484
+ if (typeof owner === "undefined") {
485
+ throw new client.AppwriteException('Missing required parameter: "owner"');
486
+ }
487
+ if (typeof rootDirectory === "undefined") {
488
+ throw new client.AppwriteException('Missing required parameter: "rootDirectory"');
489
+ }
490
+ if (typeof version === "undefined") {
491
+ throw new client.AppwriteException('Missing required parameter: "version"');
492
+ }
493
+ const apiPath = "/sites/{siteId}/deployments/template".replace("{siteId}", siteId);
494
+ const payload = {};
495
+ if (typeof repository !== "undefined") {
496
+ payload["repository"] = repository;
497
+ }
498
+ if (typeof owner !== "undefined") {
499
+ payload["owner"] = owner;
500
+ }
501
+ if (typeof rootDirectory !== "undefined") {
502
+ payload["rootDirectory"] = rootDirectory;
503
+ }
504
+ if (typeof version !== "undefined") {
505
+ payload["version"] = version;
506
+ }
507
+ if (typeof activate !== "undefined") {
508
+ payload["activate"] = activate;
509
+ }
510
+ const uri = new URL(this.client.config.endpoint + apiPath);
511
+ const apiHeaders = {
512
+ "content-type": "application/json"
513
+ };
514
+ return this.client.call(
515
+ "post",
516
+ uri,
517
+ apiHeaders,
518
+ payload
519
+ );
520
+ }
521
+ /**
522
+ * Create a deployment when a site is connected to VCS.
523
+
524
+ This endpoint lets you create deployment from a branch, commit, or a tag.
525
+ *
526
+ * @param {string} siteId
527
+ * @param {VCSDeploymentType} type
528
+ * @param {string} reference
529
+ * @param {boolean} activate
530
+ * @throws {AppwriteException}
531
+ * @returns {Promise<Models.Deployment>}
532
+ */
533
+ createVcsDeployment(siteId, type, reference, activate) {
534
+ if (typeof siteId === "undefined") {
535
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
536
+ }
537
+ if (typeof type === "undefined") {
538
+ throw new client.AppwriteException('Missing required parameter: "type"');
539
+ }
540
+ if (typeof reference === "undefined") {
541
+ throw new client.AppwriteException('Missing required parameter: "reference"');
542
+ }
543
+ const apiPath = "/sites/{siteId}/deployments/vcs".replace("{siteId}", siteId);
544
+ const payload = {};
545
+ if (typeof type !== "undefined") {
546
+ payload["type"] = type;
547
+ }
548
+ if (typeof reference !== "undefined") {
549
+ payload["reference"] = reference;
550
+ }
551
+ if (typeof activate !== "undefined") {
552
+ payload["activate"] = activate;
553
+ }
554
+ const uri = new URL(this.client.config.endpoint + apiPath);
555
+ const apiHeaders = {
556
+ "content-type": "application/json"
557
+ };
558
+ return this.client.call(
559
+ "post",
560
+ uri,
561
+ apiHeaders,
562
+ payload
563
+ );
564
+ }
565
+ /**
566
+ * Get a site deployment by its unique ID.
567
+ *
568
+ * @param {string} siteId
569
+ * @param {string} deploymentId
570
+ * @throws {AppwriteException}
571
+ * @returns {Promise<Models.Deployment>}
572
+ */
573
+ getDeployment(siteId, deploymentId) {
574
+ if (typeof siteId === "undefined") {
575
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
576
+ }
577
+ if (typeof deploymentId === "undefined") {
578
+ throw new client.AppwriteException('Missing required parameter: "deploymentId"');
579
+ }
580
+ const apiPath = "/sites/{siteId}/deployments/{deploymentId}".replace("{siteId}", siteId).replace("{deploymentId}", deploymentId);
581
+ const payload = {};
582
+ const uri = new URL(this.client.config.endpoint + apiPath);
583
+ const apiHeaders = {};
584
+ return this.client.call(
585
+ "get",
586
+ uri,
587
+ apiHeaders,
588
+ payload
589
+ );
590
+ }
591
+ /**
592
+ * Delete a site deployment by its unique ID.
593
+ *
594
+ * @param {string} siteId
595
+ * @param {string} deploymentId
596
+ * @throws {AppwriteException}
597
+ * @returns {Promise<{}>}
598
+ */
599
+ deleteDeployment(siteId, deploymentId) {
600
+ if (typeof siteId === "undefined") {
601
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
602
+ }
603
+ if (typeof deploymentId === "undefined") {
604
+ throw new client.AppwriteException('Missing required parameter: "deploymentId"');
605
+ }
606
+ const apiPath = "/sites/{siteId}/deployments/{deploymentId}".replace("{siteId}", siteId).replace("{deploymentId}", deploymentId);
607
+ const payload = {};
608
+ const uri = new URL(this.client.config.endpoint + apiPath);
609
+ const apiHeaders = {
610
+ "content-type": "application/json"
611
+ };
612
+ return this.client.call(
613
+ "delete",
614
+ uri,
615
+ apiHeaders,
616
+ payload
617
+ );
618
+ }
619
+ /**
620
+ * Get a site deployment content by its unique ID. The endpoint response return with a &#039;Content-Disposition: attachment&#039; header that tells the browser to start downloading the file to user downloads directory.
621
+ *
622
+ * @param {string} siteId
623
+ * @param {string} deploymentId
624
+ * @param {DeploymentDownloadType} type
625
+ * @throws {AppwriteException}
626
+ * @returns {Promise<ArrayBuffer>}
627
+ */
628
+ getDeploymentDownload(siteId, deploymentId, type) {
629
+ if (typeof siteId === "undefined") {
630
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
631
+ }
632
+ if (typeof deploymentId === "undefined") {
633
+ throw new client.AppwriteException('Missing required parameter: "deploymentId"');
634
+ }
635
+ const apiPath = "/sites/{siteId}/deployments/{deploymentId}/download".replace("{siteId}", siteId).replace("{deploymentId}", deploymentId);
636
+ const payload = {};
637
+ if (typeof type !== "undefined") {
638
+ payload["type"] = type;
639
+ }
640
+ const uri = new URL(this.client.config.endpoint + apiPath);
641
+ const apiHeaders = {};
642
+ return this.client.call(
643
+ "get",
644
+ uri,
645
+ apiHeaders,
646
+ payload,
647
+ "arrayBuffer"
648
+ );
649
+ }
650
+ /**
651
+ * Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn&#039;t started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status &#039;ready&#039;) or failed. The response includes the final build status and details.
652
+ *
653
+ * @param {string} siteId
654
+ * @param {string} deploymentId
655
+ * @throws {AppwriteException}
656
+ * @returns {Promise<Models.Deployment>}
657
+ */
658
+ updateDeploymentStatus(siteId, deploymentId) {
659
+ if (typeof siteId === "undefined") {
660
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
661
+ }
662
+ if (typeof deploymentId === "undefined") {
663
+ throw new client.AppwriteException('Missing required parameter: "deploymentId"');
664
+ }
665
+ const apiPath = "/sites/{siteId}/deployments/{deploymentId}/status".replace("{siteId}", siteId).replace("{deploymentId}", deploymentId);
666
+ const payload = {};
667
+ const uri = new URL(this.client.config.endpoint + apiPath);
668
+ const apiHeaders = {
669
+ "content-type": "application/json"
670
+ };
671
+ return this.client.call(
672
+ "patch",
673
+ uri,
674
+ apiHeaders,
675
+ payload
676
+ );
677
+ }
678
+ /**
679
+ * Get a list of all site logs. You can use the query params to filter your results.
680
+ *
681
+ * @param {string} siteId
682
+ * @param {string[]} queries
683
+ * @throws {AppwriteException}
684
+ * @returns {Promise<Models.ExecutionList>}
685
+ */
686
+ listLogs(siteId, queries) {
687
+ if (typeof siteId === "undefined") {
688
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
689
+ }
690
+ const apiPath = "/sites/{siteId}/logs".replace("{siteId}", siteId);
691
+ const payload = {};
692
+ if (typeof queries !== "undefined") {
693
+ payload["queries"] = queries;
694
+ }
695
+ const uri = new URL(this.client.config.endpoint + apiPath);
696
+ const apiHeaders = {};
697
+ return this.client.call(
698
+ "get",
699
+ uri,
700
+ apiHeaders,
701
+ payload
702
+ );
703
+ }
704
+ /**
705
+ * Get a site request log by its unique ID.
706
+ *
707
+ * @param {string} siteId
708
+ * @param {string} logId
709
+ * @throws {AppwriteException}
710
+ * @returns {Promise<Models.Execution>}
711
+ */
712
+ getLog(siteId, logId) {
713
+ if (typeof siteId === "undefined") {
714
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
715
+ }
716
+ if (typeof logId === "undefined") {
717
+ throw new client.AppwriteException('Missing required parameter: "logId"');
718
+ }
719
+ const apiPath = "/sites/{siteId}/logs/{logId}".replace("{siteId}", siteId).replace("{logId}", logId);
720
+ const payload = {};
721
+ const uri = new URL(this.client.config.endpoint + apiPath);
722
+ const apiHeaders = {};
723
+ return this.client.call(
724
+ "get",
725
+ uri,
726
+ apiHeaders,
727
+ payload
728
+ );
729
+ }
730
+ /**
731
+ * Delete a site log by its unique ID.
732
+ *
733
+ * @param {string} siteId
734
+ * @param {string} logId
735
+ * @throws {AppwriteException}
736
+ * @returns {Promise<{}>}
737
+ */
738
+ deleteLog(siteId, logId) {
739
+ if (typeof siteId === "undefined") {
740
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
741
+ }
742
+ if (typeof logId === "undefined") {
743
+ throw new client.AppwriteException('Missing required parameter: "logId"');
744
+ }
745
+ const apiPath = "/sites/{siteId}/logs/{logId}".replace("{siteId}", siteId).replace("{logId}", logId);
746
+ const payload = {};
747
+ const uri = new URL(this.client.config.endpoint + apiPath);
748
+ const apiHeaders = {
749
+ "content-type": "application/json"
750
+ };
751
+ return this.client.call(
752
+ "delete",
753
+ uri,
754
+ apiHeaders,
755
+ payload
756
+ );
757
+ }
758
+ /**
759
+ * Get a list of all variables of a specific site.
760
+ *
761
+ * @param {string} siteId
762
+ * @throws {AppwriteException}
763
+ * @returns {Promise<Models.VariableList>}
764
+ */
765
+ listVariables(siteId) {
766
+ if (typeof siteId === "undefined") {
767
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
768
+ }
769
+ const apiPath = "/sites/{siteId}/variables".replace("{siteId}", siteId);
770
+ const payload = {};
771
+ const uri = new URL(this.client.config.endpoint + apiPath);
772
+ const apiHeaders = {};
773
+ return this.client.call(
774
+ "get",
775
+ uri,
776
+ apiHeaders,
777
+ payload
778
+ );
779
+ }
780
+ /**
781
+ * Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables.
782
+ *
783
+ * @param {string} siteId
784
+ * @param {string} key
785
+ * @param {string} value
786
+ * @param {boolean} secret
787
+ * @throws {AppwriteException}
788
+ * @returns {Promise<Models.Variable>}
789
+ */
790
+ createVariable(siteId, key, value, secret) {
791
+ if (typeof siteId === "undefined") {
792
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
793
+ }
794
+ if (typeof key === "undefined") {
795
+ throw new client.AppwriteException('Missing required parameter: "key"');
796
+ }
797
+ if (typeof value === "undefined") {
798
+ throw new client.AppwriteException('Missing required parameter: "value"');
799
+ }
800
+ const apiPath = "/sites/{siteId}/variables".replace("{siteId}", siteId);
801
+ const payload = {};
802
+ if (typeof key !== "undefined") {
803
+ payload["key"] = key;
804
+ }
805
+ if (typeof value !== "undefined") {
806
+ payload["value"] = value;
807
+ }
808
+ if (typeof secret !== "undefined") {
809
+ payload["secret"] = secret;
810
+ }
811
+ const uri = new URL(this.client.config.endpoint + apiPath);
812
+ const apiHeaders = {
813
+ "content-type": "application/json"
814
+ };
815
+ return this.client.call(
816
+ "post",
817
+ uri,
818
+ apiHeaders,
819
+ payload
820
+ );
821
+ }
822
+ /**
823
+ * Get a variable by its unique ID.
824
+ *
825
+ * @param {string} siteId
826
+ * @param {string} variableId
827
+ * @throws {AppwriteException}
828
+ * @returns {Promise<Models.Variable>}
829
+ */
830
+ getVariable(siteId, variableId) {
831
+ if (typeof siteId === "undefined") {
832
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
833
+ }
834
+ if (typeof variableId === "undefined") {
835
+ throw new client.AppwriteException('Missing required parameter: "variableId"');
836
+ }
837
+ const apiPath = "/sites/{siteId}/variables/{variableId}".replace("{siteId}", siteId).replace("{variableId}", variableId);
838
+ const payload = {};
839
+ const uri = new URL(this.client.config.endpoint + apiPath);
840
+ const apiHeaders = {};
841
+ return this.client.call(
842
+ "get",
843
+ uri,
844
+ apiHeaders,
845
+ payload
846
+ );
847
+ }
848
+ /**
849
+ * Update variable by its unique ID.
850
+ *
851
+ * @param {string} siteId
852
+ * @param {string} variableId
853
+ * @param {string} key
854
+ * @param {string} value
855
+ * @param {boolean} secret
856
+ * @throws {AppwriteException}
857
+ * @returns {Promise<Models.Variable>}
858
+ */
859
+ updateVariable(siteId, variableId, key, value, secret) {
860
+ if (typeof siteId === "undefined") {
861
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
862
+ }
863
+ if (typeof variableId === "undefined") {
864
+ throw new client.AppwriteException('Missing required parameter: "variableId"');
865
+ }
866
+ if (typeof key === "undefined") {
867
+ throw new client.AppwriteException('Missing required parameter: "key"');
868
+ }
869
+ const apiPath = "/sites/{siteId}/variables/{variableId}".replace("{siteId}", siteId).replace("{variableId}", variableId);
870
+ const payload = {};
871
+ if (typeof key !== "undefined") {
872
+ payload["key"] = key;
873
+ }
874
+ if (typeof value !== "undefined") {
875
+ payload["value"] = value;
876
+ }
877
+ if (typeof secret !== "undefined") {
878
+ payload["secret"] = secret;
879
+ }
880
+ const uri = new URL(this.client.config.endpoint + apiPath);
881
+ const apiHeaders = {
882
+ "content-type": "application/json"
883
+ };
884
+ return this.client.call(
885
+ "put",
886
+ uri,
887
+ apiHeaders,
888
+ payload
889
+ );
890
+ }
891
+ /**
892
+ * Delete a variable by its unique ID.
893
+ *
894
+ * @param {string} siteId
895
+ * @param {string} variableId
896
+ * @throws {AppwriteException}
897
+ * @returns {Promise<{}>}
898
+ */
899
+ deleteVariable(siteId, variableId) {
900
+ if (typeof siteId === "undefined") {
901
+ throw new client.AppwriteException('Missing required parameter: "siteId"');
902
+ }
903
+ if (typeof variableId === "undefined") {
904
+ throw new client.AppwriteException('Missing required parameter: "variableId"');
905
+ }
906
+ const apiPath = "/sites/{siteId}/variables/{variableId}".replace("{siteId}", siteId).replace("{variableId}", variableId);
907
+ const payload = {};
908
+ const uri = new URL(this.client.config.endpoint + apiPath);
909
+ const apiHeaders = {
910
+ "content-type": "application/json"
911
+ };
912
+ return this.client.call(
913
+ "delete",
914
+ uri,
915
+ apiHeaders,
916
+ payload
917
+ );
918
+ }
919
+ }
920
+
921
+ exports.Sites = Sites;
922
+ //# sourceMappingURL=out.js.map
923
+ //# sourceMappingURL=sites.js.map