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