appwrite 15.1.0.pre.rc.1 → 16.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.
@@ -0,0 +1,1004 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ class Sites < Service
5
+
6
+ def initialize(client)
7
+ @client = client
8
+ end
9
+
10
+ # Get a list of all the project's sites. You can use the query params to
11
+ # filter your results.
12
+ #
13
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId
14
+ # @param [String] search Search term to filter your list results. Max length: 256 chars.
15
+ #
16
+ # @return [SiteList]
17
+ def list(queries: nil, search: nil)
18
+ api_path = '/sites'
19
+
20
+ api_params = {
21
+ queries: queries,
22
+ search: search,
23
+ }
24
+
25
+ api_headers = {
26
+ }
27
+
28
+ @client.call(
29
+ method: 'GET',
30
+ path: api_path,
31
+ headers: api_headers,
32
+ params: api_params,
33
+ response_type: Models::SiteList
34
+ )
35
+ end
36
+
37
+
38
+ # Create a new site.
39
+ #
40
+ # @param [String] site_id Site ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
41
+ # @param [String] name Site name. Max length: 128 chars.
42
+ # @param [Framework] framework Sites framework.
43
+ # @param [BuildRuntime] build_runtime Runtime to use during build step.
44
+ # @param [] enabled Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.
45
+ # @param [] logging When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.
46
+ # @param [Integer] timeout Maximum request time in seconds.
47
+ # @param [String] install_command Install Command.
48
+ # @param [String] build_command Build Command.
49
+ # @param [String] output_directory Output Directory for site.
50
+ # @param [Adapter] adapter Framework adapter defining rendering strategy. Allowed values are: static, ssr
51
+ # @param [String] installation_id Appwrite Installation ID for VCS (Version Control System) deployment.
52
+ # @param [String] fallback_file Fallback file for single page application sites.
53
+ # @param [String] provider_repository_id Repository ID of the repo linked to the site.
54
+ # @param [String] provider_branch Production branch for the repo linked to the site.
55
+ # @param [] provider_silent_mode Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.
56
+ # @param [String] provider_root_directory Path to site code in the linked repo.
57
+ # @param [String] specification Framework specification for the site and builds.
58
+ #
59
+ # @return [Site]
60
+ def create(site_id:, name:, framework:, build_runtime:, enabled: nil, logging: nil, timeout: nil, install_command: nil, build_command: nil, output_directory: nil, adapter: nil, installation_id: nil, fallback_file: nil, provider_repository_id: nil, provider_branch: nil, provider_silent_mode: nil, provider_root_directory: nil, specification: nil)
61
+ api_path = '/sites'
62
+
63
+ if site_id.nil?
64
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
65
+ end
66
+
67
+ if name.nil?
68
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
69
+ end
70
+
71
+ if framework.nil?
72
+ raise Appwrite::Exception.new('Missing required parameter: "framework"')
73
+ end
74
+
75
+ if build_runtime.nil?
76
+ raise Appwrite::Exception.new('Missing required parameter: "buildRuntime"')
77
+ end
78
+
79
+ api_params = {
80
+ siteId: site_id,
81
+ name: name,
82
+ framework: framework,
83
+ enabled: enabled,
84
+ logging: logging,
85
+ timeout: timeout,
86
+ installCommand: install_command,
87
+ buildCommand: build_command,
88
+ outputDirectory: output_directory,
89
+ buildRuntime: build_runtime,
90
+ adapter: adapter,
91
+ installationId: installation_id,
92
+ fallbackFile: fallback_file,
93
+ providerRepositoryId: provider_repository_id,
94
+ providerBranch: provider_branch,
95
+ providerSilentMode: provider_silent_mode,
96
+ providerRootDirectory: provider_root_directory,
97
+ specification: specification,
98
+ }
99
+
100
+ api_headers = {
101
+ "content-type": 'application/json',
102
+ }
103
+
104
+ @client.call(
105
+ method: 'POST',
106
+ path: api_path,
107
+ headers: api_headers,
108
+ params: api_params,
109
+ response_type: Models::Site
110
+ )
111
+ end
112
+
113
+
114
+ # Get a list of all frameworks that are currently available on the server
115
+ # instance.
116
+ #
117
+ #
118
+ # @return [FrameworkList]
119
+ def list_frameworks()
120
+ api_path = '/sites/frameworks'
121
+
122
+ api_params = {
123
+ }
124
+
125
+ api_headers = {
126
+ }
127
+
128
+ @client.call(
129
+ method: 'GET',
130
+ path: api_path,
131
+ headers: api_headers,
132
+ params: api_params,
133
+ response_type: Models::FrameworkList
134
+ )
135
+ end
136
+
137
+
138
+ # List allowed site specifications for this instance.
139
+ #
140
+ #
141
+ # @return [SpecificationList]
142
+ def list_specifications()
143
+ api_path = '/sites/specifications'
144
+
145
+ api_params = {
146
+ }
147
+
148
+ api_headers = {
149
+ }
150
+
151
+ @client.call(
152
+ method: 'GET',
153
+ path: api_path,
154
+ headers: api_headers,
155
+ params: api_params,
156
+ response_type: Models::SpecificationList
157
+ )
158
+ end
159
+
160
+
161
+ # Get a site by its unique ID.
162
+ #
163
+ # @param [String] site_id Site ID.
164
+ #
165
+ # @return [Site]
166
+ def get(site_id:)
167
+ api_path = '/sites/{siteId}'
168
+ .gsub('{siteId}', site_id)
169
+
170
+ if site_id.nil?
171
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
172
+ end
173
+
174
+ api_params = {
175
+ }
176
+
177
+ api_headers = {
178
+ }
179
+
180
+ @client.call(
181
+ method: 'GET',
182
+ path: api_path,
183
+ headers: api_headers,
184
+ params: api_params,
185
+ response_type: Models::Site
186
+ )
187
+ end
188
+
189
+
190
+ # Update site by its unique ID.
191
+ #
192
+ # @param [String] site_id Site ID.
193
+ # @param [String] name Site name. Max length: 128 chars.
194
+ # @param [Framework] framework Sites framework.
195
+ # @param [] enabled Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.
196
+ # @param [] logging When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.
197
+ # @param [Integer] timeout Maximum request time in seconds.
198
+ # @param [String] install_command Install Command.
199
+ # @param [String] build_command Build Command.
200
+ # @param [String] output_directory Output Directory for site.
201
+ # @param [BuildRuntime] build_runtime Runtime to use during build step.
202
+ # @param [Adapter] adapter Framework adapter defining rendering strategy. Allowed values are: static, ssr
203
+ # @param [String] fallback_file Fallback file for single page application sites.
204
+ # @param [String] installation_id Appwrite Installation ID for VCS (Version Control System) deployment.
205
+ # @param [String] provider_repository_id Repository ID of the repo linked to the site.
206
+ # @param [String] provider_branch Production branch for the repo linked to the site.
207
+ # @param [] provider_silent_mode Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.
208
+ # @param [String] provider_root_directory Path to site code in the linked repo.
209
+ # @param [String] specification Framework specification for the site and builds.
210
+ #
211
+ # @return [Site]
212
+ def update(site_id:, name:, framework:, enabled: nil, logging: nil, timeout: nil, install_command: nil, build_command: nil, output_directory: nil, build_runtime: nil, adapter: nil, fallback_file: nil, installation_id: nil, provider_repository_id: nil, provider_branch: nil, provider_silent_mode: nil, provider_root_directory: nil, specification: nil)
213
+ api_path = '/sites/{siteId}'
214
+ .gsub('{siteId}', site_id)
215
+
216
+ if site_id.nil?
217
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
218
+ end
219
+
220
+ if name.nil?
221
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
222
+ end
223
+
224
+ if framework.nil?
225
+ raise Appwrite::Exception.new('Missing required parameter: "framework"')
226
+ end
227
+
228
+ api_params = {
229
+ name: name,
230
+ framework: framework,
231
+ enabled: enabled,
232
+ logging: logging,
233
+ timeout: timeout,
234
+ installCommand: install_command,
235
+ buildCommand: build_command,
236
+ outputDirectory: output_directory,
237
+ buildRuntime: build_runtime,
238
+ adapter: adapter,
239
+ fallbackFile: fallback_file,
240
+ installationId: installation_id,
241
+ providerRepositoryId: provider_repository_id,
242
+ providerBranch: provider_branch,
243
+ providerSilentMode: provider_silent_mode,
244
+ providerRootDirectory: provider_root_directory,
245
+ specification: specification,
246
+ }
247
+
248
+ api_headers = {
249
+ "content-type": 'application/json',
250
+ }
251
+
252
+ @client.call(
253
+ method: 'PUT',
254
+ path: api_path,
255
+ headers: api_headers,
256
+ params: api_params,
257
+ response_type: Models::Site
258
+ )
259
+ end
260
+
261
+
262
+ # Delete a site by its unique ID.
263
+ #
264
+ # @param [String] site_id Site ID.
265
+ #
266
+ # @return []
267
+ def delete(site_id:)
268
+ api_path = '/sites/{siteId}'
269
+ .gsub('{siteId}', site_id)
270
+
271
+ if site_id.nil?
272
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
273
+ end
274
+
275
+ api_params = {
276
+ }
277
+
278
+ api_headers = {
279
+ "content-type": 'application/json',
280
+ }
281
+
282
+ @client.call(
283
+ method: 'DELETE',
284
+ path: api_path,
285
+ headers: api_headers,
286
+ params: api_params,
287
+ )
288
+ end
289
+
290
+
291
+ # Update the site active deployment. Use this endpoint to switch the code
292
+ # deployment that should be used when visitor opens your site.
293
+ #
294
+ # @param [String] site_id Site ID.
295
+ # @param [String] deployment_id Deployment ID.
296
+ #
297
+ # @return [Site]
298
+ def update_site_deployment(site_id:, deployment_id:)
299
+ api_path = '/sites/{siteId}/deployment'
300
+ .gsub('{siteId}', site_id)
301
+
302
+ if site_id.nil?
303
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
304
+ end
305
+
306
+ if deployment_id.nil?
307
+ raise Appwrite::Exception.new('Missing required parameter: "deploymentId"')
308
+ end
309
+
310
+ api_params = {
311
+ deploymentId: deployment_id,
312
+ }
313
+
314
+ api_headers = {
315
+ "content-type": 'application/json',
316
+ }
317
+
318
+ @client.call(
319
+ method: 'PATCH',
320
+ path: api_path,
321
+ headers: api_headers,
322
+ params: api_params,
323
+ response_type: Models::Site
324
+ )
325
+ end
326
+
327
+
328
+ # Get a list of all the site's code deployments. You can use the query params
329
+ # to filter your results.
330
+ #
331
+ # @param [String] site_id Site ID.
332
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type
333
+ # @param [String] search Search term to filter your list results. Max length: 256 chars.
334
+ #
335
+ # @return [DeploymentList]
336
+ def list_deployments(site_id:, queries: nil, search: nil)
337
+ api_path = '/sites/{siteId}/deployments'
338
+ .gsub('{siteId}', site_id)
339
+
340
+ if site_id.nil?
341
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
342
+ end
343
+
344
+ api_params = {
345
+ queries: queries,
346
+ search: search,
347
+ }
348
+
349
+ api_headers = {
350
+ }
351
+
352
+ @client.call(
353
+ method: 'GET',
354
+ path: api_path,
355
+ headers: api_headers,
356
+ params: api_params,
357
+ response_type: Models::DeploymentList
358
+ )
359
+ end
360
+
361
+
362
+ # Create a new site code deployment. Use this endpoint to upload a new
363
+ # version of your site code. To activate your newly uploaded code, you'll
364
+ # need to update the function's deployment to use your new deployment ID.
365
+ #
366
+ # @param [String] site_id Site ID.
367
+ # @param [file] code Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.
368
+ # @param [] activate Automatically activate the deployment when it is finished building.
369
+ # @param [String] install_command Install Commands.
370
+ # @param [String] build_command Build Commands.
371
+ # @param [String] output_directory Output Directory.
372
+ #
373
+ # @return [Deployment]
374
+ def create_deployment(site_id:, code:, activate:, install_command: nil, build_command: nil, output_directory: nil, on_progress: nil)
375
+ api_path = '/sites/{siteId}/deployments'
376
+ .gsub('{siteId}', site_id)
377
+
378
+ if site_id.nil?
379
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
380
+ end
381
+
382
+ if code.nil?
383
+ raise Appwrite::Exception.new('Missing required parameter: "code"')
384
+ end
385
+
386
+ if activate.nil?
387
+ raise Appwrite::Exception.new('Missing required parameter: "activate"')
388
+ end
389
+
390
+ api_params = {
391
+ installCommand: install_command,
392
+ buildCommand: build_command,
393
+ outputDirectory: output_directory,
394
+ code: code,
395
+ activate: activate,
396
+ }
397
+
398
+ api_headers = {
399
+ "content-type": 'multipart/form-data',
400
+ }
401
+
402
+ id_param_name = nil
403
+ param_name = 'code'
404
+
405
+ @client.chunked_upload(
406
+ path: api_path,
407
+ headers: api_headers,
408
+ params: api_params,
409
+ param_name: param_name,
410
+ id_param_name: id_param_name,
411
+ on_progress: on_progress,
412
+ response_type: Models::Deployment
413
+ )
414
+ end
415
+
416
+
417
+ # Create a new build for an existing site deployment. This endpoint allows
418
+ # you to rebuild a deployment with the updated site configuration, including
419
+ # its commands and output directory if they have been modified. The build
420
+ # process will be queued and executed asynchronously. The original
421
+ # deployment's code will be preserved and used for the new build.
422
+ #
423
+ # @param [String] site_id Site ID.
424
+ # @param [String] deployment_id Deployment ID.
425
+ #
426
+ # @return [Deployment]
427
+ def create_duplicate_deployment(site_id:, deployment_id:)
428
+ api_path = '/sites/{siteId}/deployments/duplicate'
429
+ .gsub('{siteId}', site_id)
430
+
431
+ if site_id.nil?
432
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
433
+ end
434
+
435
+ if deployment_id.nil?
436
+ raise Appwrite::Exception.new('Missing required parameter: "deploymentId"')
437
+ end
438
+
439
+ api_params = {
440
+ deploymentId: deployment_id,
441
+ }
442
+
443
+ api_headers = {
444
+ "content-type": 'application/json',
445
+ }
446
+
447
+ @client.call(
448
+ method: 'POST',
449
+ path: api_path,
450
+ headers: api_headers,
451
+ params: api_params,
452
+ response_type: Models::Deployment
453
+ )
454
+ end
455
+
456
+
457
+ # Create a deployment based on a template.
458
+ #
459
+ # Use this endpoint with combination of
460
+ # [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to
461
+ # find the template details.
462
+ #
463
+ # @param [String] site_id Site ID.
464
+ # @param [String] repository Repository name of the template.
465
+ # @param [String] owner The name of the owner of the template.
466
+ # @param [String] root_directory Path to site code in the template repo.
467
+ # @param [String] version Version (tag) for the repo linked to the site template.
468
+ # @param [] activate Automatically activate the deployment when it is finished building.
469
+ #
470
+ # @return [Deployment]
471
+ def create_template_deployment(site_id:, repository:, owner:, root_directory:, version:, activate: nil)
472
+ api_path = '/sites/{siteId}/deployments/template'
473
+ .gsub('{siteId}', site_id)
474
+
475
+ if site_id.nil?
476
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
477
+ end
478
+
479
+ if repository.nil?
480
+ raise Appwrite::Exception.new('Missing required parameter: "repository"')
481
+ end
482
+
483
+ if owner.nil?
484
+ raise Appwrite::Exception.new('Missing required parameter: "owner"')
485
+ end
486
+
487
+ if root_directory.nil?
488
+ raise Appwrite::Exception.new('Missing required parameter: "rootDirectory"')
489
+ end
490
+
491
+ if version.nil?
492
+ raise Appwrite::Exception.new('Missing required parameter: "version"')
493
+ end
494
+
495
+ api_params = {
496
+ repository: repository,
497
+ owner: owner,
498
+ rootDirectory: root_directory,
499
+ version: version,
500
+ activate: activate,
501
+ }
502
+
503
+ api_headers = {
504
+ "content-type": 'application/json',
505
+ }
506
+
507
+ @client.call(
508
+ method: 'POST',
509
+ path: api_path,
510
+ headers: api_headers,
511
+ params: api_params,
512
+ response_type: Models::Deployment
513
+ )
514
+ end
515
+
516
+
517
+ # Create a deployment when a site is connected to VCS.
518
+ #
519
+ # This endpoint lets you create deployment from a branch, commit, or a tag.
520
+ #
521
+ # @param [String] site_id Site ID.
522
+ # @param [VCSDeploymentType] type Type of reference passed. Allowed values are: branch, commit
523
+ # @param [String] reference VCS reference to create deployment from. Depending on type this can be: branch name, commit hash
524
+ # @param [] activate Automatically activate the deployment when it is finished building.
525
+ #
526
+ # @return [Deployment]
527
+ def create_vcs_deployment(site_id:, type:, reference:, activate: nil)
528
+ api_path = '/sites/{siteId}/deployments/vcs'
529
+ .gsub('{siteId}', site_id)
530
+
531
+ if site_id.nil?
532
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
533
+ end
534
+
535
+ if type.nil?
536
+ raise Appwrite::Exception.new('Missing required parameter: "type"')
537
+ end
538
+
539
+ if reference.nil?
540
+ raise Appwrite::Exception.new('Missing required parameter: "reference"')
541
+ end
542
+
543
+ api_params = {
544
+ type: type,
545
+ reference: reference,
546
+ activate: activate,
547
+ }
548
+
549
+ api_headers = {
550
+ "content-type": 'application/json',
551
+ }
552
+
553
+ @client.call(
554
+ method: 'POST',
555
+ path: api_path,
556
+ headers: api_headers,
557
+ params: api_params,
558
+ response_type: Models::Deployment
559
+ )
560
+ end
561
+
562
+
563
+ # Get a site deployment by its unique ID.
564
+ #
565
+ # @param [String] site_id Site ID.
566
+ # @param [String] deployment_id Deployment ID.
567
+ #
568
+ # @return [Deployment]
569
+ def get_deployment(site_id:, deployment_id:)
570
+ api_path = '/sites/{siteId}/deployments/{deploymentId}'
571
+ .gsub('{siteId}', site_id)
572
+ .gsub('{deploymentId}', deployment_id)
573
+
574
+ if site_id.nil?
575
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
576
+ end
577
+
578
+ if deployment_id.nil?
579
+ raise Appwrite::Exception.new('Missing required parameter: "deploymentId"')
580
+ end
581
+
582
+ api_params = {
583
+ }
584
+
585
+ api_headers = {
586
+ }
587
+
588
+ @client.call(
589
+ method: 'GET',
590
+ path: api_path,
591
+ headers: api_headers,
592
+ params: api_params,
593
+ response_type: Models::Deployment
594
+ )
595
+ end
596
+
597
+
598
+ # Delete a site deployment by its unique ID.
599
+ #
600
+ # @param [String] site_id Site ID.
601
+ # @param [String] deployment_id Deployment ID.
602
+ #
603
+ # @return []
604
+ def delete_deployment(site_id:, deployment_id:)
605
+ api_path = '/sites/{siteId}/deployments/{deploymentId}'
606
+ .gsub('{siteId}', site_id)
607
+ .gsub('{deploymentId}', deployment_id)
608
+
609
+ if site_id.nil?
610
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
611
+ end
612
+
613
+ if deployment_id.nil?
614
+ raise Appwrite::Exception.new('Missing required parameter: "deploymentId"')
615
+ end
616
+
617
+ api_params = {
618
+ }
619
+
620
+ api_headers = {
621
+ "content-type": 'application/json',
622
+ }
623
+
624
+ @client.call(
625
+ method: 'DELETE',
626
+ path: api_path,
627
+ headers: api_headers,
628
+ params: api_params,
629
+ )
630
+ end
631
+
632
+
633
+ # Get a site deployment content by its unique ID. The endpoint response
634
+ # return with a 'Content-Disposition: attachment' header that tells the
635
+ # browser to start downloading the file to user downloads directory.
636
+ #
637
+ # @param [String] site_id Site ID.
638
+ # @param [String] deployment_id Deployment ID.
639
+ # @param [DeploymentDownloadType] type Deployment file to download. Can be: "source", "output".
640
+ #
641
+ # @return []
642
+ def get_deployment_download(site_id:, deployment_id:, type: nil)
643
+ api_path = '/sites/{siteId}/deployments/{deploymentId}/download'
644
+ .gsub('{siteId}', site_id)
645
+ .gsub('{deploymentId}', deployment_id)
646
+
647
+ if site_id.nil?
648
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
649
+ end
650
+
651
+ if deployment_id.nil?
652
+ raise Appwrite::Exception.new('Missing required parameter: "deploymentId"')
653
+ end
654
+
655
+ api_params = {
656
+ type: type,
657
+ }
658
+
659
+ api_headers = {
660
+ }
661
+
662
+ @client.call(
663
+ method: 'GET',
664
+ path: api_path,
665
+ headers: api_headers,
666
+ params: api_params,
667
+ )
668
+ end
669
+
670
+
671
+ # Cancel an ongoing site deployment build. If the build is already in
672
+ # progress, it will be stopped and marked as canceled. If the build hasn't
673
+ # started yet, it will be marked as canceled without executing. You cannot
674
+ # cancel builds that have already completed (status 'ready') or failed. The
675
+ # response includes the final build status and details.
676
+ #
677
+ # @param [String] site_id Site ID.
678
+ # @param [String] deployment_id Deployment ID.
679
+ #
680
+ # @return [Deployment]
681
+ def update_deployment_status(site_id:, deployment_id:)
682
+ api_path = '/sites/{siteId}/deployments/{deploymentId}/status'
683
+ .gsub('{siteId}', site_id)
684
+ .gsub('{deploymentId}', deployment_id)
685
+
686
+ if site_id.nil?
687
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
688
+ end
689
+
690
+ if deployment_id.nil?
691
+ raise Appwrite::Exception.new('Missing required parameter: "deploymentId"')
692
+ end
693
+
694
+ api_params = {
695
+ }
696
+
697
+ api_headers = {
698
+ "content-type": 'application/json',
699
+ }
700
+
701
+ @client.call(
702
+ method: 'PATCH',
703
+ path: api_path,
704
+ headers: api_headers,
705
+ params: api_params,
706
+ response_type: Models::Deployment
707
+ )
708
+ end
709
+
710
+
711
+ # Get a list of all site logs. You can use the query params to filter your
712
+ # results.
713
+ #
714
+ # @param [String] site_id Site ID.
715
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
716
+ #
717
+ # @return [ExecutionList]
718
+ def list_logs(site_id:, queries: nil)
719
+ api_path = '/sites/{siteId}/logs'
720
+ .gsub('{siteId}', site_id)
721
+
722
+ if site_id.nil?
723
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
724
+ end
725
+
726
+ api_params = {
727
+ queries: queries,
728
+ }
729
+
730
+ api_headers = {
731
+ }
732
+
733
+ @client.call(
734
+ method: 'GET',
735
+ path: api_path,
736
+ headers: api_headers,
737
+ params: api_params,
738
+ response_type: Models::ExecutionList
739
+ )
740
+ end
741
+
742
+
743
+ # Get a site request log by its unique ID.
744
+ #
745
+ # @param [String] site_id Site ID.
746
+ # @param [String] log_id Log ID.
747
+ #
748
+ # @return [Execution]
749
+ def get_log(site_id:, log_id:)
750
+ api_path = '/sites/{siteId}/logs/{logId}'
751
+ .gsub('{siteId}', site_id)
752
+ .gsub('{logId}', log_id)
753
+
754
+ if site_id.nil?
755
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
756
+ end
757
+
758
+ if log_id.nil?
759
+ raise Appwrite::Exception.new('Missing required parameter: "logId"')
760
+ end
761
+
762
+ api_params = {
763
+ }
764
+
765
+ api_headers = {
766
+ }
767
+
768
+ @client.call(
769
+ method: 'GET',
770
+ path: api_path,
771
+ headers: api_headers,
772
+ params: api_params,
773
+ response_type: Models::Execution
774
+ )
775
+ end
776
+
777
+
778
+ # Delete a site log by its unique ID.
779
+ #
780
+ # @param [String] site_id Site ID.
781
+ # @param [String] log_id Log ID.
782
+ #
783
+ # @return []
784
+ def delete_log(site_id:, log_id:)
785
+ api_path = '/sites/{siteId}/logs/{logId}'
786
+ .gsub('{siteId}', site_id)
787
+ .gsub('{logId}', log_id)
788
+
789
+ if site_id.nil?
790
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
791
+ end
792
+
793
+ if log_id.nil?
794
+ raise Appwrite::Exception.new('Missing required parameter: "logId"')
795
+ end
796
+
797
+ api_params = {
798
+ }
799
+
800
+ api_headers = {
801
+ "content-type": 'application/json',
802
+ }
803
+
804
+ @client.call(
805
+ method: 'DELETE',
806
+ path: api_path,
807
+ headers: api_headers,
808
+ params: api_params,
809
+ )
810
+ end
811
+
812
+
813
+ # Get a list of all variables of a specific site.
814
+ #
815
+ # @param [String] site_id Site unique ID.
816
+ #
817
+ # @return [VariableList]
818
+ def list_variables(site_id:)
819
+ api_path = '/sites/{siteId}/variables'
820
+ .gsub('{siteId}', site_id)
821
+
822
+ if site_id.nil?
823
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
824
+ end
825
+
826
+ api_params = {
827
+ }
828
+
829
+ api_headers = {
830
+ }
831
+
832
+ @client.call(
833
+ method: 'GET',
834
+ path: api_path,
835
+ headers: api_headers,
836
+ params: api_params,
837
+ response_type: Models::VariableList
838
+ )
839
+ end
840
+
841
+
842
+ # Create a new site variable. These variables can be accessed during build
843
+ # and runtime (server-side rendering) as environment variables.
844
+ #
845
+ # @param [String] site_id Site unique ID.
846
+ # @param [String] key Variable key. Max length: 255 chars.
847
+ # @param [String] value Variable value. Max length: 8192 chars.
848
+ # @param [] secret Secret variables can be updated or deleted, but only sites can read them during build and runtime.
849
+ #
850
+ # @return [Variable]
851
+ def create_variable(site_id:, key:, value:, secret: nil)
852
+ api_path = '/sites/{siteId}/variables'
853
+ .gsub('{siteId}', site_id)
854
+
855
+ if site_id.nil?
856
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
857
+ end
858
+
859
+ if key.nil?
860
+ raise Appwrite::Exception.new('Missing required parameter: "key"')
861
+ end
862
+
863
+ if value.nil?
864
+ raise Appwrite::Exception.new('Missing required parameter: "value"')
865
+ end
866
+
867
+ api_params = {
868
+ key: key,
869
+ value: value,
870
+ secret: secret,
871
+ }
872
+
873
+ api_headers = {
874
+ "content-type": 'application/json',
875
+ }
876
+
877
+ @client.call(
878
+ method: 'POST',
879
+ path: api_path,
880
+ headers: api_headers,
881
+ params: api_params,
882
+ response_type: Models::Variable
883
+ )
884
+ end
885
+
886
+
887
+ # Get a variable by its unique ID.
888
+ #
889
+ # @param [String] site_id Site unique ID.
890
+ # @param [String] variable_id Variable unique ID.
891
+ #
892
+ # @return [Variable]
893
+ def get_variable(site_id:, variable_id:)
894
+ api_path = '/sites/{siteId}/variables/{variableId}'
895
+ .gsub('{siteId}', site_id)
896
+ .gsub('{variableId}', variable_id)
897
+
898
+ if site_id.nil?
899
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
900
+ end
901
+
902
+ if variable_id.nil?
903
+ raise Appwrite::Exception.new('Missing required parameter: "variableId"')
904
+ end
905
+
906
+ api_params = {
907
+ }
908
+
909
+ api_headers = {
910
+ }
911
+
912
+ @client.call(
913
+ method: 'GET',
914
+ path: api_path,
915
+ headers: api_headers,
916
+ params: api_params,
917
+ response_type: Models::Variable
918
+ )
919
+ end
920
+
921
+
922
+ # Update variable by its unique ID.
923
+ #
924
+ # @param [String] site_id Site unique ID.
925
+ # @param [String] variable_id Variable unique ID.
926
+ # @param [String] key Variable key. Max length: 255 chars.
927
+ # @param [String] value Variable value. Max length: 8192 chars.
928
+ # @param [] secret Secret variables can be updated or deleted, but only sites can read them during build and runtime.
929
+ #
930
+ # @return [Variable]
931
+ def update_variable(site_id:, variable_id:, key:, value: nil, secret: nil)
932
+ api_path = '/sites/{siteId}/variables/{variableId}'
933
+ .gsub('{siteId}', site_id)
934
+ .gsub('{variableId}', variable_id)
935
+
936
+ if site_id.nil?
937
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
938
+ end
939
+
940
+ if variable_id.nil?
941
+ raise Appwrite::Exception.new('Missing required parameter: "variableId"')
942
+ end
943
+
944
+ if key.nil?
945
+ raise Appwrite::Exception.new('Missing required parameter: "key"')
946
+ end
947
+
948
+ api_params = {
949
+ key: key,
950
+ value: value,
951
+ secret: secret,
952
+ }
953
+
954
+ api_headers = {
955
+ "content-type": 'application/json',
956
+ }
957
+
958
+ @client.call(
959
+ method: 'PUT',
960
+ path: api_path,
961
+ headers: api_headers,
962
+ params: api_params,
963
+ response_type: Models::Variable
964
+ )
965
+ end
966
+
967
+
968
+ # Delete a variable by its unique ID.
969
+ #
970
+ # @param [String] site_id Site unique ID.
971
+ # @param [String] variable_id Variable unique ID.
972
+ #
973
+ # @return []
974
+ def delete_variable(site_id:, variable_id:)
975
+ api_path = '/sites/{siteId}/variables/{variableId}'
976
+ .gsub('{siteId}', site_id)
977
+ .gsub('{variableId}', variable_id)
978
+
979
+ if site_id.nil?
980
+ raise Appwrite::Exception.new('Missing required parameter: "siteId"')
981
+ end
982
+
983
+ if variable_id.nil?
984
+ raise Appwrite::Exception.new('Missing required parameter: "variableId"')
985
+ end
986
+
987
+ api_params = {
988
+ }
989
+
990
+ api_headers = {
991
+ "content-type": 'application/json',
992
+ }
993
+
994
+ @client.call(
995
+ method: 'DELETE',
996
+ path: api_path,
997
+ headers: api_headers,
998
+ params: api_params,
999
+ )
1000
+ end
1001
+
1002
+
1003
+ end
1004
+ end