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.
@@ -10,7 +10,7 @@ module Appwrite
10
10
  # Get a list of all the project's functions. You can use the query params to
11
11
  # filter your results.
12
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, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId
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, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId
14
14
  # @param [String] search Search term to filter your list results. Max length: 256 chars.
15
15
  #
16
16
  # @return [FunctionList]
@@ -48,7 +48,7 @@ module Appwrite
48
48
  # @param [String] schedule Schedule CRON syntax.
49
49
  # @param [Integer] timeout Function maximum execution time in seconds.
50
50
  # @param [] enabled Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
51
- # @param [] logging Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.
51
+ # @param [] logging When disabled, executions will exclude logs and errors, and will be slightly faster.
52
52
  # @param [String] entrypoint Entrypoint File. This path is relative to the "providerRootDirectory".
53
53
  # @param [String] commands Build Commands.
54
54
  # @param [Array] scopes List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed.
@@ -57,14 +57,10 @@ module Appwrite
57
57
  # @param [String] provider_branch Production branch for the repo linked to the function.
58
58
  # @param [] provider_silent_mode Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
59
59
  # @param [String] provider_root_directory Path to function code in the linked repo.
60
- # @param [String] template_repository Repository name of the template.
61
- # @param [String] template_owner The name of the owner of the template.
62
- # @param [String] template_root_directory Path to function code in the template repo.
63
- # @param [String] template_version Version (tag) for the repo linked to the function template.
64
60
  # @param [String] specification Runtime specification for the function and builds.
65
61
  #
66
62
  # @return [Function]
67
- def create(function_id:, name:, runtime:, execute: nil, events: nil, schedule: nil, timeout: nil, enabled: nil, logging: nil, entrypoint: nil, commands: nil, scopes: nil, installation_id: nil, provider_repository_id: nil, provider_branch: nil, provider_silent_mode: nil, provider_root_directory: nil, template_repository: nil, template_owner: nil, template_root_directory: nil, template_version: nil, specification: nil)
63
+ def create(function_id:, name:, runtime:, execute: nil, events: nil, schedule: nil, timeout: nil, enabled: nil, logging: nil, entrypoint: nil, commands: nil, scopes: nil, installation_id: nil, provider_repository_id: nil, provider_branch: nil, provider_silent_mode: nil, provider_root_directory: nil, specification: nil)
68
64
  api_path = '/functions'
69
65
 
70
66
  if function_id.nil?
@@ -97,10 +93,6 @@ module Appwrite
97
93
  providerBranch: provider_branch,
98
94
  providerSilentMode: provider_silent_mode,
99
95
  providerRootDirectory: provider_root_directory,
100
- templateRepository: template_repository,
101
- templateOwner: template_owner,
102
- templateRootDirectory: template_root_directory,
103
- templateVersion: template_version,
104
96
  specification: specification,
105
97
  }
106
98
 
@@ -142,7 +134,6 @@ module Appwrite
142
134
 
143
135
 
144
136
  # List allowed function specifications for this instance.
145
- #
146
137
  #
147
138
  #
148
139
  # @return [SpecificationList]
@@ -204,7 +195,7 @@ module Appwrite
204
195
  # @param [String] schedule Schedule CRON syntax.
205
196
  # @param [Integer] timeout Maximum execution time in seconds.
206
197
  # @param [] enabled Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
207
- # @param [] logging Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.
198
+ # @param [] logging When disabled, executions will exclude logs and errors, and will be slightly faster.
208
199
  # @param [String] entrypoint Entrypoint File. This path is relative to the "providerRootDirectory".
209
200
  # @param [String] commands Build Commands.
210
201
  # @param [Array] scopes List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed.
@@ -291,11 +282,48 @@ module Appwrite
291
282
  end
292
283
 
293
284
 
294
- # Get a list of all the project's code deployments. You can use the query
285
+ # Update the function active deployment. Use this endpoint to switch the code
286
+ # deployment that should be used when visitor opens your function.
287
+ #
288
+ # @param [String] function_id Function ID.
289
+ # @param [String] deployment_id Deployment ID.
290
+ #
291
+ # @return [Function]
292
+ def update_function_deployment(function_id:, deployment_id:)
293
+ api_path = '/functions/{functionId}/deployment'
294
+ .gsub('{functionId}', function_id)
295
+
296
+ if function_id.nil?
297
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
298
+ end
299
+
300
+ if deployment_id.nil?
301
+ raise Appwrite::Exception.new('Missing required parameter: "deploymentId"')
302
+ end
303
+
304
+ api_params = {
305
+ deploymentId: deployment_id,
306
+ }
307
+
308
+ api_headers = {
309
+ "content-type": 'application/json',
310
+ }
311
+
312
+ @client.call(
313
+ method: 'PATCH',
314
+ path: api_path,
315
+ headers: api_headers,
316
+ params: api_params,
317
+ response_type: Models::Function
318
+ )
319
+ end
320
+
321
+
322
+ # Get a list of all the function's code deployments. You can use the query
295
323
  # params to filter your results.
296
324
  #
297
325
  # @param [String] function_id Function ID.
298
- # @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: size, buildId, activate, entrypoint, commands, type, size
326
+ # @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
299
327
  # @param [String] search Search term to filter your list results. Max length: 256 chars.
300
328
  #
301
329
  # @return [DeploymentList]
@@ -385,16 +413,20 @@ module Appwrite
385
413
  end
386
414
 
387
415
 
388
- # Get a code deployment by its unique ID.
416
+ # Create a new build for an existing function deployment. This endpoint
417
+ # allows you to rebuild a deployment with the updated function configuration,
418
+ # including its entrypoint and build commands if they have been modified. The
419
+ # build process will be queued and executed asynchronously. The original
420
+ # deployment's code will be preserved and used for the new build.
389
421
  #
390
422
  # @param [String] function_id Function ID.
391
423
  # @param [String] deployment_id Deployment ID.
424
+ # @param [String] build_id Build unique ID.
392
425
  #
393
426
  # @return [Deployment]
394
- def get_deployment(function_id:, deployment_id:)
395
- api_path = '/functions/{functionId}/deployments/{deploymentId}'
427
+ def create_duplicate_deployment(function_id:, deployment_id:, build_id: nil)
428
+ api_path = '/functions/{functionId}/deployments/duplicate'
396
429
  .gsub('{functionId}', function_id)
397
- .gsub('{deploymentId}', deployment_id)
398
430
 
399
431
  if function_id.nil?
400
432
  raise Appwrite::Exception.new('Missing required parameter: "functionId"')
@@ -405,13 +437,16 @@ module Appwrite
405
437
  end
406
438
 
407
439
  api_params = {
440
+ deploymentId: deployment_id,
441
+ buildId: build_id,
408
442
  }
409
443
 
410
444
  api_headers = {
445
+ "content-type": 'application/json',
411
446
  }
412
447
 
413
448
  @client.call(
414
- method: 'GET',
449
+ method: 'POST',
415
450
  path: api_path,
416
451
  headers: api_headers,
417
452
  params: api_params,
@@ -420,28 +455,50 @@ module Appwrite
420
455
  end
421
456
 
422
457
 
423
- # Update the function code deployment ID using the unique function ID. Use
424
- # this endpoint to switch the code deployment that should be executed by the
425
- # execution endpoint.
458
+ # Create a deployment based on a template.
459
+ #
460
+ # Use this endpoint with combination of
461
+ # [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to
462
+ # find the template details.
426
463
  #
427
464
  # @param [String] function_id Function ID.
428
- # @param [String] deployment_id Deployment ID.
465
+ # @param [String] repository Repository name of the template.
466
+ # @param [String] owner The name of the owner of the template.
467
+ # @param [String] root_directory Path to function code in the template repo.
468
+ # @param [String] version Version (tag) for the repo linked to the function template.
469
+ # @param [] activate Automatically activate the deployment when it is finished building.
429
470
  #
430
- # @return [Function]
431
- def update_deployment(function_id:, deployment_id:)
432
- api_path = '/functions/{functionId}/deployments/{deploymentId}'
471
+ # @return [Deployment]
472
+ def create_template_deployment(function_id:, repository:, owner:, root_directory:, version:, activate: nil)
473
+ api_path = '/functions/{functionId}/deployments/template'
433
474
  .gsub('{functionId}', function_id)
434
- .gsub('{deploymentId}', deployment_id)
435
475
 
436
476
  if function_id.nil?
437
477
  raise Appwrite::Exception.new('Missing required parameter: "functionId"')
438
478
  end
439
479
 
440
- if deployment_id.nil?
441
- raise Appwrite::Exception.new('Missing required parameter: "deploymentId"')
480
+ if repository.nil?
481
+ raise Appwrite::Exception.new('Missing required parameter: "repository"')
482
+ end
483
+
484
+ if owner.nil?
485
+ raise Appwrite::Exception.new('Missing required parameter: "owner"')
486
+ end
487
+
488
+ if root_directory.nil?
489
+ raise Appwrite::Exception.new('Missing required parameter: "rootDirectory"')
490
+ end
491
+
492
+ if version.nil?
493
+ raise Appwrite::Exception.new('Missing required parameter: "version"')
442
494
  end
443
495
 
444
496
  api_params = {
497
+ repository: repository,
498
+ owner: owner,
499
+ rootDirectory: root_directory,
500
+ version: version,
501
+ activate: activate,
445
502
  }
446
503
 
447
504
  api_headers = {
@@ -449,22 +506,68 @@ module Appwrite
449
506
  }
450
507
 
451
508
  @client.call(
452
- method: 'PATCH',
509
+ method: 'POST',
453
510
  path: api_path,
454
511
  headers: api_headers,
455
512
  params: api_params,
456
- response_type: Models::Function
513
+ response_type: Models::Deployment
457
514
  )
458
515
  end
459
516
 
460
517
 
461
- # Delete a code deployment by its unique ID.
518
+ # Create a deployment when a function is connected to VCS.
519
+ #
520
+ # This endpoint lets you create deployment from a branch, commit, or a tag.
521
+ #
522
+ # @param [String] function_id Function ID.
523
+ # @param [VCSDeploymentType] type Type of reference passed. Allowed values are: branch, commit
524
+ # @param [String] reference VCS reference to create deployment from. Depending on type this can be: branch name, commit hash
525
+ # @param [] activate Automatically activate the deployment when it is finished building.
526
+ #
527
+ # @return [Deployment]
528
+ def create_vcs_deployment(function_id:, type:, reference:, activate: nil)
529
+ api_path = '/functions/{functionId}/deployments/vcs'
530
+ .gsub('{functionId}', function_id)
531
+
532
+ if function_id.nil?
533
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
534
+ end
535
+
536
+ if type.nil?
537
+ raise Appwrite::Exception.new('Missing required parameter: "type"')
538
+ end
539
+
540
+ if reference.nil?
541
+ raise Appwrite::Exception.new('Missing required parameter: "reference"')
542
+ end
543
+
544
+ api_params = {
545
+ type: type,
546
+ reference: reference,
547
+ activate: activate,
548
+ }
549
+
550
+ api_headers = {
551
+ "content-type": 'application/json',
552
+ }
553
+
554
+ @client.call(
555
+ method: 'POST',
556
+ path: api_path,
557
+ headers: api_headers,
558
+ params: api_params,
559
+ response_type: Models::Deployment
560
+ )
561
+ end
562
+
563
+
564
+ # Get a function deployment by its unique ID.
462
565
  #
463
566
  # @param [String] function_id Function ID.
464
567
  # @param [String] deployment_id Deployment ID.
465
568
  #
466
- # @return []
467
- def delete_deployment(function_id:, deployment_id:)
569
+ # @return [Deployment]
570
+ def get_deployment(function_id:, deployment_id:)
468
571
  api_path = '/functions/{functionId}/deployments/{deploymentId}'
469
572
  .gsub('{functionId}', function_id)
470
573
  .gsub('{deploymentId}', deployment_id)
@@ -481,31 +584,26 @@ module Appwrite
481
584
  }
482
585
 
483
586
  api_headers = {
484
- "content-type": 'application/json',
485
587
  }
486
588
 
487
589
  @client.call(
488
- method: 'DELETE',
590
+ method: 'GET',
489
591
  path: api_path,
490
592
  headers: api_headers,
491
593
  params: api_params,
594
+ response_type: Models::Deployment
492
595
  )
493
596
  end
494
597
 
495
598
 
496
- # Create a new build for an existing function deployment. This endpoint
497
- # allows you to rebuild a deployment with the updated function configuration,
498
- # including its entrypoint and build commands if they have been modified The
499
- # build process will be queued and executed asynchronously. The original
500
- # deployment's code will be preserved and used for the new build.
599
+ # Delete a code deployment by its unique ID.
501
600
  #
502
601
  # @param [String] function_id Function ID.
503
602
  # @param [String] deployment_id Deployment ID.
504
- # @param [String] build_id Build unique ID.
505
603
  #
506
604
  # @return []
507
- def create_build(function_id:, deployment_id:, build_id: nil)
508
- api_path = '/functions/{functionId}/deployments/{deploymentId}/build'
605
+ def delete_deployment(function_id:, deployment_id:)
606
+ api_path = '/functions/{functionId}/deployments/{deploymentId}'
509
607
  .gsub('{functionId}', function_id)
510
608
  .gsub('{deploymentId}', deployment_id)
511
609
 
@@ -518,7 +616,6 @@ module Appwrite
518
616
  end
519
617
 
520
618
  api_params = {
521
- buildId: build_id,
522
619
  }
523
620
 
524
621
  api_headers = {
@@ -526,7 +623,7 @@ module Appwrite
526
623
  }
527
624
 
528
625
  @client.call(
529
- method: 'POST',
626
+ method: 'DELETE',
530
627
  path: api_path,
531
628
  headers: api_headers,
532
629
  params: api_params,
@@ -534,18 +631,17 @@ module Appwrite
534
631
  end
535
632
 
536
633
 
537
- # Cancel an ongoing function deployment build. If the build is already in
538
- # progress, it will be stopped and marked as canceled. If the build hasn't
539
- # started yet, it will be marked as canceled without executing. You cannot
540
- # cancel builds that have already completed (status 'ready') or failed. The
541
- # response includes the final build status and details.
634
+ # Get a function deployment content by its unique ID. The endpoint response
635
+ # return with a 'Content-Disposition: attachment' header that tells the
636
+ # browser to start downloading the file to user downloads directory.
542
637
  #
543
638
  # @param [String] function_id Function ID.
544
639
  # @param [String] deployment_id Deployment ID.
640
+ # @param [DeploymentDownloadType] type Deployment file to download. Can be: "source", "output".
545
641
  #
546
- # @return [Build]
547
- def update_deployment_build(function_id:, deployment_id:)
548
- api_path = '/functions/{functionId}/deployments/{deploymentId}/build'
642
+ # @return []
643
+ def get_deployment_download(function_id:, deployment_id:, type: nil)
644
+ api_path = '/functions/{functionId}/deployments/{deploymentId}/download'
549
645
  .gsub('{functionId}', function_id)
550
646
  .gsub('{deploymentId}', deployment_id)
551
647
 
@@ -558,31 +654,33 @@ module Appwrite
558
654
  end
559
655
 
560
656
  api_params = {
657
+ type: type,
561
658
  }
562
659
 
563
660
  api_headers = {
564
- "content-type": 'application/json',
565
661
  }
566
662
 
567
663
  @client.call(
568
- method: 'PATCH',
664
+ method: 'GET',
569
665
  path: api_path,
570
666
  headers: api_headers,
571
667
  params: api_params,
572
- response_type: Models::Build
573
668
  )
574
669
  end
575
670
 
576
671
 
577
- # Get a Deployment's contents by its unique ID. This endpoint supports range
578
- # requests for partial or streaming file download.
672
+ # Cancel an ongoing function deployment build. If the build is already in
673
+ # progress, it will be stopped and marked as canceled. If the build hasn't
674
+ # started yet, it will be marked as canceled without executing. You cannot
675
+ # cancel builds that have already completed (status 'ready') or failed. The
676
+ # response includes the final build status and details.
579
677
  #
580
678
  # @param [String] function_id Function ID.
581
679
  # @param [String] deployment_id Deployment ID.
582
680
  #
583
- # @return []
584
- def get_deployment_download(function_id:, deployment_id:)
585
- api_path = '/functions/{functionId}/deployments/{deploymentId}/download'
681
+ # @return [Deployment]
682
+ def update_deployment_status(function_id:, deployment_id:)
683
+ api_path = '/functions/{functionId}/deployments/{deploymentId}/status'
586
684
  .gsub('{functionId}', function_id)
587
685
  .gsub('{deploymentId}', deployment_id)
588
686
 
@@ -598,13 +696,15 @@ module Appwrite
598
696
  }
599
697
 
600
698
  api_headers = {
699
+ "content-type": 'application/json',
601
700
  }
602
701
 
603
702
  @client.call(
604
- method: 'GET',
703
+ method: 'PATCH',
605
704
  path: api_path,
606
705
  headers: api_headers,
607
706
  params: api_params,
707
+ response_type: Models::Deployment
608
708
  )
609
709
  end
610
710
 
@@ -614,10 +714,9 @@ module Appwrite
614
714
  #
615
715
  # @param [String] function_id Function ID.
616
716
  # @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
617
- # @param [String] search Search term to filter your list results. Max length: 256 chars.
618
717
  #
619
718
  # @return [ExecutionList]
620
- def list_executions(function_id:, queries: nil, search: nil)
719
+ def list_executions(function_id:, queries: nil)
621
720
  api_path = '/functions/{functionId}/executions'
622
721
  .gsub('{functionId}', function_id)
623
722
 
@@ -627,7 +726,6 @@ module Appwrite
627
726
 
628
727
  api_params = {
629
728
  queries: queries,
630
- search: search,
631
729
  }
632
730
 
633
731
  api_headers = {
@@ -724,7 +822,6 @@ module Appwrite
724
822
 
725
823
 
726
824
  # Delete a function execution by its unique ID.
727
- #
728
825
  #
729
826
  # @param [String] function_id Function ID.
730
827
  # @param [String] execution_id Execution ID.
@@ -794,9 +891,10 @@ module Appwrite
794
891
  # @param [String] function_id Function unique ID.
795
892
  # @param [String] key Variable key. Max length: 255 chars.
796
893
  # @param [String] value Variable value. Max length: 8192 chars.
894
+ # @param [] secret Secret variables can be updated or deleted, but only functions can read them during build and runtime.
797
895
  #
798
896
  # @return [Variable]
799
- def create_variable(function_id:, key:, value:)
897
+ def create_variable(function_id:, key:, value:, secret: nil)
800
898
  api_path = '/functions/{functionId}/variables'
801
899
  .gsub('{functionId}', function_id)
802
900
 
@@ -815,6 +913,7 @@ module Appwrite
815
913
  api_params = {
816
914
  key: key,
817
915
  value: value,
916
+ secret: secret,
818
917
  }
819
918
 
820
919
  api_headers = {
@@ -872,9 +971,10 @@ module Appwrite
872
971
  # @param [String] variable_id Variable unique ID.
873
972
  # @param [String] key Variable key. Max length: 255 chars.
874
973
  # @param [String] value Variable value. Max length: 8192 chars.
974
+ # @param [] secret Secret variables can be updated or deleted, but only functions can read them during build and runtime.
875
975
  #
876
976
  # @return [Variable]
877
- def update_variable(function_id:, variable_id:, key:, value: nil)
977
+ def update_variable(function_id:, variable_id:, key:, value: nil, secret: nil)
878
978
  api_path = '/functions/{functionId}/variables/{variableId}'
879
979
  .gsub('{functionId}', function_id)
880
980
  .gsub('{variableId}', variable_id)
@@ -894,6 +994,7 @@ module Appwrite
894
994
  api_params = {
895
995
  key: key,
896
996
  value: value,
997
+ secret: secret,
897
998
  }
898
999
 
899
1000
  api_headers = {