appwrite 21.1.0 → 22.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.
@@ -195,54 +195,6 @@ module Appwrite
195
195
  )
196
196
  end
197
197
 
198
- # Get billing project aggregation queue.
199
- #
200
- # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
201
- #
202
- # @return [HealthQueue]
203
- def get_queue_billing_project_aggregation(threshold: nil)
204
- api_path = '/health/queue/billing-project-aggregation'
205
-
206
- api_params = {
207
- threshold: threshold,
208
- }
209
-
210
- api_headers = {
211
- }
212
-
213
- @client.call(
214
- method: 'GET',
215
- path: api_path,
216
- headers: api_headers,
217
- params: api_params,
218
- response_type: Models::HealthQueue
219
- )
220
- end
221
-
222
- # Get billing team aggregation queue.
223
- #
224
- # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
225
- #
226
- # @return [HealthQueue]
227
- def get_queue_billing_team_aggregation(threshold: nil)
228
- api_path = '/health/queue/billing-team-aggregation'
229
-
230
- api_params = {
231
- threshold: threshold,
232
- }
233
-
234
- api_headers = {
235
- }
236
-
237
- @client.call(
238
- method: 'GET',
239
- path: api_path,
240
- headers: api_headers,
241
- params: api_params,
242
- response_type: Models::HealthQueue
243
- )
244
- end
245
-
246
198
  # Get the number of builds that are waiting to be processed in the Appwrite
247
199
  # internal queue server.
248
200
  #
@@ -268,30 +220,6 @@ module Appwrite
268
220
  )
269
221
  end
270
222
 
271
- # Get the priority builds queue size.
272
- #
273
- # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 500.
274
- #
275
- # @return [HealthQueue]
276
- def get_queue_priority_builds(threshold: nil)
277
- api_path = '/health/queue/builds-priority'
278
-
279
- api_params = {
280
- threshold: threshold,
281
- }
282
-
283
- api_headers = {
284
- }
285
-
286
- @client.call(
287
- method: 'GET',
288
- path: api_path,
289
- headers: api_headers,
290
- params: api_params,
291
- response_type: Models::HealthQueue
292
- )
293
- end
294
-
295
223
  # Get the number of certificates that are waiting to be issued against
296
224
  # [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue
297
225
  # server.
@@ -526,30 +454,6 @@ module Appwrite
526
454
  )
527
455
  end
528
456
 
529
- # Get region manager queue.
530
- #
531
- # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100.
532
- #
533
- # @return [HealthQueue]
534
- def get_queue_region_manager(threshold: nil)
535
- api_path = '/health/queue/region-manager'
536
-
537
- api_params = {
538
- threshold: threshold,
539
- }
540
-
541
- api_headers = {
542
- }
543
-
544
- @client.call(
545
- method: 'GET',
546
- path: api_path,
547
- headers: api_headers,
548
- params: api_params,
549
- response_type: Models::HealthQueue
550
- )
551
- end
552
-
553
457
  # Get the number of metrics that are waiting to be processed in the Appwrite
554
458
  # stats resources queue.
555
459
  #
@@ -600,30 +504,6 @@ module Appwrite
600
504
  )
601
505
  end
602
506
 
603
- # Get threats queue.
604
- #
605
- # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100.
606
- #
607
- # @return [HealthQueue]
608
- def get_queue_threats(threshold: nil)
609
- api_path = '/health/queue/threats'
610
-
611
- api_params = {
612
- threshold: threshold,
613
- }
614
-
615
- api_headers = {
616
- }
617
-
618
- @client.call(
619
- method: 'GET',
620
- path: api_path,
621
- headers: api_headers,
622
- params: api_params,
623
- response_type: Models::HealthQueue
624
- )
625
- end
626
-
627
507
  # Get the number of webhooks that are waiting to be processed in the Appwrite
628
508
  # internal queue server.
629
509
  #
@@ -0,0 +1,172 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ class Project < Service
5
+
6
+ def initialize(client)
7
+ @client = client
8
+ end
9
+
10
+ # Get a list of all project environment variables.
11
+ #
12
+ # @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: key, resourceType, resourceId, secret
13
+ # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
14
+ #
15
+ # @return [VariableList]
16
+ def list_variables(queries: nil, total: nil)
17
+ api_path = '/project/variables'
18
+
19
+ api_params = {
20
+ queries: queries,
21
+ total: total,
22
+ }
23
+
24
+ api_headers = {
25
+ }
26
+
27
+ @client.call(
28
+ method: 'GET',
29
+ path: api_path,
30
+ headers: api_headers,
31
+ params: api_params,
32
+ response_type: Models::VariableList
33
+ )
34
+ end
35
+
36
+ # Create a new project environment variable. These variables can be accessed
37
+ # by all functions and sites in the project.
38
+ #
39
+ # @param [String] variable_id Variable 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.
40
+ # @param [String] key Variable key. Max length: 255 chars.
41
+ # @param [String] value Variable value. Max length: 8192 chars.
42
+ # @param [] secret Secret variables can be updated or deleted, but only projects can read them during build and runtime.
43
+ #
44
+ # @return [Variable]
45
+ def create_variable(variable_id:, key:, value:, secret: nil)
46
+ api_path = '/project/variables'
47
+
48
+ if variable_id.nil?
49
+ raise Appwrite::Exception.new('Missing required parameter: "variableId"')
50
+ end
51
+
52
+ if key.nil?
53
+ raise Appwrite::Exception.new('Missing required parameter: "key"')
54
+ end
55
+
56
+ if value.nil?
57
+ raise Appwrite::Exception.new('Missing required parameter: "value"')
58
+ end
59
+
60
+ api_params = {
61
+ variableId: variable_id,
62
+ key: key,
63
+ value: value,
64
+ secret: secret,
65
+ }
66
+
67
+ api_headers = {
68
+ "content-type": 'application/json',
69
+ }
70
+
71
+ @client.call(
72
+ method: 'POST',
73
+ path: api_path,
74
+ headers: api_headers,
75
+ params: api_params,
76
+ response_type: Models::Variable
77
+ )
78
+ end
79
+
80
+ # Get a variable by its unique ID.
81
+ #
82
+ # @param [String] variable_id Variable ID.
83
+ #
84
+ # @return [Variable]
85
+ def get_variable(variable_id:)
86
+ api_path = '/project/variables/{variableId}'
87
+ .gsub('{variableId}', variable_id)
88
+
89
+ if variable_id.nil?
90
+ raise Appwrite::Exception.new('Missing required parameter: "variableId"')
91
+ end
92
+
93
+ api_params = {
94
+ }
95
+
96
+ api_headers = {
97
+ }
98
+
99
+ @client.call(
100
+ method: 'GET',
101
+ path: api_path,
102
+ headers: api_headers,
103
+ params: api_params,
104
+ response_type: Models::Variable
105
+ )
106
+ end
107
+
108
+ # Update variable by its unique ID.
109
+ #
110
+ # @param [String] variable_id Variable ID.
111
+ # @param [String] key Variable key. Max length: 255 chars.
112
+ # @param [String] value Variable value. Max length: 8192 chars.
113
+ # @param [] secret Secret variables can be updated or deleted, but only projects can read them during build and runtime.
114
+ #
115
+ # @return [Variable]
116
+ def update_variable(variable_id:, key: nil, value: nil, secret: nil)
117
+ api_path = '/project/variables/{variableId}'
118
+ .gsub('{variableId}', variable_id)
119
+
120
+ if variable_id.nil?
121
+ raise Appwrite::Exception.new('Missing required parameter: "variableId"')
122
+ end
123
+
124
+ api_params = {
125
+ key: key,
126
+ value: value,
127
+ secret: secret,
128
+ }
129
+
130
+ api_headers = {
131
+ "content-type": 'application/json',
132
+ }
133
+
134
+ @client.call(
135
+ method: 'PUT',
136
+ path: api_path,
137
+ headers: api_headers,
138
+ params: api_params,
139
+ response_type: Models::Variable
140
+ )
141
+ end
142
+
143
+ # Delete a variable by its unique ID.
144
+ #
145
+ # @param [String] variable_id Variable ID.
146
+ #
147
+ # @return []
148
+ def delete_variable(variable_id:)
149
+ api_path = '/project/variables/{variableId}'
150
+ .gsub('{variableId}', variable_id)
151
+
152
+ if variable_id.nil?
153
+ raise Appwrite::Exception.new('Missing required parameter: "variableId"')
154
+ end
155
+
156
+ api_params = {
157
+ }
158
+
159
+ api_headers = {
160
+ "content-type": 'application/json',
161
+ }
162
+
163
+ @client.call(
164
+ method: 'DELETE',
165
+ path: api_path,
166
+ headers: api_headers,
167
+ params: api_params,
168
+ )
169
+ end
170
+
171
+ end
172
+ end
@@ -47,6 +47,7 @@ module Appwrite
47
47
  # @param [Integer] timeout Maximum request time in seconds.
48
48
  # @param [String] install_command Install Command.
49
49
  # @param [String] build_command Build Command.
50
+ # @param [String] start_command Custom start command. Leave empty to use default.
50
51
  # @param [String] output_directory Output Directory for site.
51
52
  # @param [Adapter] adapter Framework adapter defining rendering strategy. Allowed values are: static, ssr
52
53
  # @param [String] installation_id Appwrite Installation ID for VCS (Version Control System) deployment.
@@ -55,10 +56,12 @@ module Appwrite
55
56
  # @param [String] provider_branch Production branch for the repo linked to the site.
56
57
  # @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.
57
58
  # @param [String] provider_root_directory Path to site code in the linked repo.
58
- # @param [String] specification Framework specification for the site and builds.
59
+ # @param [String] build_specification Build specification for the site deployments.
60
+ # @param [String] runtime_specification Runtime specification for the SSR executions.
61
+ # @param [Integer] deployment_retention Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.
59
62
  #
60
63
  # @return [Site]
61
- 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)
64
+ def create(site_id:, name:, framework:, build_runtime:, enabled: nil, logging: nil, timeout: nil, install_command: nil, build_command: nil, start_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, build_specification: nil, runtime_specification: nil, deployment_retention: nil)
62
65
  api_path = '/sites'
63
66
 
64
67
  if site_id.nil?
@@ -86,6 +89,7 @@ module Appwrite
86
89
  timeout: timeout,
87
90
  installCommand: install_command,
88
91
  buildCommand: build_command,
92
+ startCommand: start_command,
89
93
  outputDirectory: output_directory,
90
94
  buildRuntime: build_runtime,
91
95
  adapter: adapter,
@@ -95,7 +99,9 @@ module Appwrite
95
99
  providerBranch: provider_branch,
96
100
  providerSilentMode: provider_silent_mode,
97
101
  providerRootDirectory: provider_root_directory,
98
- specification: specification,
102
+ buildSpecification: build_specification,
103
+ runtimeSpecification: runtime_specification,
104
+ deploymentRetention: deployment_retention,
99
105
  }
100
106
 
101
107
  api_headers = {
@@ -194,6 +200,7 @@ module Appwrite
194
200
  # @param [Integer] timeout Maximum request time in seconds.
195
201
  # @param [String] install_command Install Command.
196
202
  # @param [String] build_command Build Command.
203
+ # @param [String] start_command Custom start command. Leave empty to use default.
197
204
  # @param [String] output_directory Output Directory for site.
198
205
  # @param [BuildRuntime] build_runtime Runtime to use during build step.
199
206
  # @param [Adapter] adapter Framework adapter defining rendering strategy. Allowed values are: static, ssr
@@ -203,10 +210,12 @@ module Appwrite
203
210
  # @param [String] provider_branch Production branch for the repo linked to the site.
204
211
  # @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.
205
212
  # @param [String] provider_root_directory Path to site code in the linked repo.
206
- # @param [String] specification Framework specification for the site and builds.
213
+ # @param [String] build_specification Build specification for the site deployments.
214
+ # @param [String] runtime_specification Runtime specification for the SSR executions.
215
+ # @param [Integer] deployment_retention Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.
207
216
  #
208
217
  # @return [Site]
209
- 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)
218
+ def update(site_id:, name:, framework:, enabled: nil, logging: nil, timeout: nil, install_command: nil, build_command: nil, start_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, build_specification: nil, runtime_specification: nil, deployment_retention: nil)
210
219
  api_path = '/sites/{siteId}'
211
220
  .gsub('{siteId}', site_id)
212
221
 
@@ -230,6 +239,7 @@ module Appwrite
230
239
  timeout: timeout,
231
240
  installCommand: install_command,
232
241
  buildCommand: build_command,
242
+ startCommand: start_command,
233
243
  outputDirectory: output_directory,
234
244
  buildRuntime: build_runtime,
235
245
  adapter: adapter,
@@ -239,7 +249,9 @@ module Appwrite
239
249
  providerBranch: provider_branch,
240
250
  providerSilentMode: provider_silent_mode,
241
251
  providerRootDirectory: provider_root_directory,
242
- specification: specification,
252
+ buildSpecification: build_specification,
253
+ runtimeSpecification: runtime_specification,
254
+ deploymentRetention: deployment_retention,
243
255
  }
244
256
 
245
257
  api_headers = {
@@ -2582,7 +2582,7 @@ module Appwrite
2582
2582
  # @param [String] database_id Database ID.
2583
2583
  # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
2584
2584
  # @param [String] key Index Key.
2585
- # @param [IndexType] type Index type.
2585
+ # @param [TablesDBIndexType] type Index type.
2586
2586
  # @param [Array] columns Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long.
2587
2587
  # @param [Array] orders Array of index orders. Maximum of 100 orders are allowed.
2588
2588
  # @param [Array] lengths Length of index. Maximum of 100
@@ -10,7 +10,7 @@ module Appwrite
10
10
  # Get a list of all the project's users. 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, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels
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, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator
14
14
  # @param [String] search Search term to filter your list results. Max length: 256 chars.
15
15
  # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
16
16
  #
@@ -598,6 +598,46 @@ module Appwrite
598
598
  )
599
599
  end
600
600
 
601
+ # Enable or disable whether a user can impersonate other users. When
602
+ # impersonation headers are used, the request runs as the target user for API
603
+ # behavior, while internal audit logs still attribute the action to the
604
+ # original impersonator and store the impersonated target details only in
605
+ # internal audit payload data.
606
+ #
607
+ #
608
+ # @param [String] user_id User ID.
609
+ # @param [] impersonator Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data.
610
+ #
611
+ # @return [User]
612
+ def update_impersonator(user_id:, impersonator:)
613
+ api_path = '/users/{userId}/impersonator'
614
+ .gsub('{userId}', user_id)
615
+
616
+ if user_id.nil?
617
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
618
+ end
619
+
620
+ if impersonator.nil?
621
+ raise Appwrite::Exception.new('Missing required parameter: "impersonator"')
622
+ end
623
+
624
+ api_params = {
625
+ impersonator: impersonator,
626
+ }
627
+
628
+ api_headers = {
629
+ "content-type": 'application/json',
630
+ }
631
+
632
+ @client.call(
633
+ method: 'PATCH',
634
+ path: api_path,
635
+ headers: api_headers,
636
+ params: api_params,
637
+ response_type: Models::User
638
+ )
639
+ end
640
+
601
641
  # Use this endpoint to create a JSON Web Token for user by its unique ID. You
602
642
  # can use the resulting JWT to authenticate on behalf of the user. The JWT
603
643
  # secret will become invalid if the session it uses gets deleted.