appwrite 26.0.0 → 27.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 (86) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +16 -2
  3. data/lib/appwrite/enums/authentication_factor.rb +1 -0
  4. data/lib/appwrite/enums/build_runtime.rb +1 -0
  5. data/lib/appwrite/enums/database_status.rb +11 -0
  6. data/lib/appwrite/enums/database_type.rb +3 -0
  7. data/lib/appwrite/enums/embedding_model.rb +10 -0
  8. data/lib/appwrite/enums/invalidation_type.rb +9 -0
  9. data/lib/appwrite/enums/organization_key_scopes.rb +2 -0
  10. data/lib/appwrite/enums/project_key_scopes.rb +5 -0
  11. data/lib/appwrite/enums/project_policy_id.rb +1 -0
  12. data/lib/appwrite/enums/runtime.rb +1 -0
  13. data/lib/appwrite/models/activity_event.rb +58 -3
  14. data/lib/appwrite/models/app.rb +152 -0
  15. data/lib/appwrite/models/app_installation.rb +72 -0
  16. data/lib/appwrite/models/app_installation_list.rb +32 -0
  17. data/lib/appwrite/models/app_key.rb +67 -0
  18. data/lib/appwrite/models/app_key_list.rb +32 -0
  19. data/lib/appwrite/models/app_scope.rb +47 -0
  20. data/lib/appwrite/models/app_scope_list.rb +32 -0
  21. data/lib/appwrite/models/app_secret.rb +67 -0
  22. data/lib/appwrite/models/app_secret_list.rb +32 -0
  23. data/lib/appwrite/models/app_secret_plaintext.rb +67 -0
  24. data/lib/appwrite/models/apps_list.rb +32 -0
  25. data/lib/appwrite/models/billing_plan.rb +9 -4
  26. data/lib/appwrite/models/billing_plan_addon.rb +6 -6
  27. data/lib/appwrite/models/billing_plan_addon_details.rb +1 -1
  28. data/lib/appwrite/models/database.rb +35 -6
  29. data/lib/appwrite/models/database_migration.rb +102 -0
  30. data/lib/appwrite/models/database_migration_list.rb +32 -0
  31. data/lib/appwrite/models/database_status.rb +92 -0
  32. data/lib/appwrite/models/database_status_connections.rb +32 -0
  33. data/lib/appwrite/models/database_status_replica.rb +42 -0
  34. data/lib/appwrite/models/database_status_volume.rb +42 -0
  35. data/lib/appwrite/models/dedicated_database.rb +262 -0
  36. data/lib/appwrite/models/dedicated_database_member.rb +42 -0
  37. data/lib/appwrite/models/dedicated_database_operation.rb +77 -0
  38. data/lib/appwrite/models/dedicated_database_operation_list.rb +32 -0
  39. data/lib/appwrite/models/dedicated_database_replicas.rb +62 -0
  40. data/lib/appwrite/models/dedicated_database_specification.rb +67 -0
  41. data/lib/appwrite/models/dedicated_database_specification_list.rb +37 -0
  42. data/lib/appwrite/models/dedicated_database_specification_pricing.rb +42 -0
  43. data/lib/appwrite/models/embedding.rb +42 -0
  44. data/lib/appwrite/models/embedding_list.rb +32 -0
  45. data/lib/appwrite/models/file.rb +10 -0
  46. data/lib/appwrite/models/mfa_challenge_secret.rb +47 -0
  47. data/lib/appwrite/models/mfa_factors.rb +8 -3
  48. data/lib/appwrite/models/oauth2_approve.rb +27 -0
  49. data/lib/appwrite/models/oauth2_authorize.rb +32 -0
  50. data/lib/appwrite/models/oauth2_consent.rb +72 -0
  51. data/lib/appwrite/models/oauth2_consent_list.rb +32 -0
  52. data/lib/appwrite/models/oauth2_consent_token.rb +77 -0
  53. data/lib/appwrite/models/oauth2_consent_token_list.rb +32 -0
  54. data/lib/appwrite/models/oauth2_device_authorization.rb +52 -0
  55. data/lib/appwrite/models/oauth2_grant.rb +82 -0
  56. data/lib/appwrite/models/oauth2_organization.rb +27 -0
  57. data/lib/appwrite/models/oauth2_organization_list.rb +32 -0
  58. data/lib/appwrite/models/oauth2_par.rb +32 -0
  59. data/lib/appwrite/models/oauth2_project.rb +37 -0
  60. data/lib/appwrite/models/oauth2_project_list.rb +32 -0
  61. data/lib/appwrite/models/oauth2_reject.rb +27 -0
  62. data/lib/appwrite/models/oauth2_token.rb +57 -0
  63. data/lib/appwrite/models/organization.rb +12 -12
  64. data/lib/appwrite/models/policy_mfa_factors.rb +47 -0
  65. data/lib/appwrite/models/project.rb +15 -0
  66. data/lib/appwrite/models/project_auth_method.rb +3 -3
  67. data/lib/appwrite/models/proxy_invalidation.rb +42 -0
  68. data/lib/appwrite/models/usage_billing_plan.rb +9 -9
  69. data/lib/appwrite/services/account.rb +210 -33
  70. data/lib/appwrite/services/activities.rb +1 -1
  71. data/lib/appwrite/services/apps.rb +855 -0
  72. data/lib/appwrite/services/backups.rb +31 -12
  73. data/lib/appwrite/services/databases.rb +4 -4
  74. data/lib/appwrite/services/embeddings.rb +48 -0
  75. data/lib/appwrite/services/functions.rb +1 -1
  76. data/lib/appwrite/services/oauth2.rb +525 -0
  77. data/lib/appwrite/services/organization.rb +168 -0
  78. data/lib/appwrite/services/project.rb +54 -57
  79. data/lib/appwrite/services/proxy.rb +44 -0
  80. data/lib/appwrite/services/sites.rb +4 -2
  81. data/lib/appwrite/services/storage.rb +4 -2
  82. data/lib/appwrite/services/tables_db.rb +378 -6
  83. data/lib/appwrite/services/teams.rb +198 -0
  84. data/lib/appwrite/services/users.rb +38 -0
  85. data/lib/appwrite.rb +50 -0
  86. metadata +52 -2
@@ -0,0 +1,855 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ class Apps < Service
5
+
6
+ def initialize(client)
7
+ @client = client
8
+ end
9
+
10
+ # List applications.
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.
13
+ # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
14
+ #
15
+ # @return [AppsList]
16
+ def list(queries: nil, total: nil)
17
+ api_path = '/apps'
18
+
19
+ api_params = {
20
+ queries: queries,
21
+ total: total,
22
+ }
23
+
24
+ api_headers = {
25
+ "X-Appwrite-Project": @client.get_config('project'),
26
+ "accept": 'application/json',
27
+ }
28
+
29
+ @client.call(
30
+ method: 'GET',
31
+ path: api_path,
32
+ headers: api_headers,
33
+ params: api_params,
34
+ response_type: Models::AppsList
35
+ )
36
+
37
+ end
38
+
39
+ # Create a new application.
40
+ #
41
+ # @param [String] app_id Application 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.
42
+ # @param [String] name Application name.
43
+ # @param [Array] redirect_uris Redirect URIs. Each must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI (e.g. com.example.app:/oauth), and must not contain a fragment.
44
+ # @param [String] description Application description shown to users during OAuth2 consent.
45
+ # @param [String] client_uri Application homepage URL shown to users during OAuth2 consent.
46
+ # @param [String] logo_uri Application logo URL shown to users during OAuth2 consent.
47
+ # @param [String] privacy_policy_url Application privacy policy URL shown to users during OAuth2 consent.
48
+ # @param [String] terms_url Application terms of service URL shown to users during OAuth2 consent.
49
+ # @param [Array] contacts Application support or security contact emails. Maximum of 100 contacts are allowed.
50
+ # @param [String] tagline Application tagline shown to users during OAuth2 consent.
51
+ # @param [Array] tags Application tags shown to users during OAuth2 consent. Maximum of 100 tags are allowed, each up to 64 characters long.
52
+ # @param [Array] images Application image URLs shown to users during OAuth2 consent. Maximum of 100 images are allowed.
53
+ # @param [String] support_url Application support URL shown to users during OAuth2 consent.
54
+ # @param [String] data_deletion_url Application data deletion URL shown to users during OAuth2 consent.
55
+ # @param [Array] post_logout_redirect_uris Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list.
56
+ # @param [] enabled Is application enabled?
57
+ # @param [String] type OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`.
58
+ # @param [] device_flow Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false.
59
+ # @param [String] team_id Team unique ID.
60
+ #
61
+ # @return [App]
62
+ def create(app_id:, name:, redirect_uris:, description: nil, client_uri: nil, logo_uri: nil, privacy_policy_url: nil, terms_url: nil, contacts: nil, tagline: nil, tags: nil, images: nil, support_url: nil, data_deletion_url: nil, post_logout_redirect_uris: nil, enabled: nil, type: nil, device_flow: nil, team_id: nil)
63
+ api_path = '/apps'
64
+
65
+ if app_id.nil?
66
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
67
+ end
68
+
69
+ if name.nil?
70
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
71
+ end
72
+
73
+ if redirect_uris.nil?
74
+ raise Appwrite::Exception.new('Missing required parameter: "redirectUris"')
75
+ end
76
+
77
+ api_params = {
78
+ appId: app_id,
79
+ name: name,
80
+ description: description,
81
+ clientUri: client_uri,
82
+ logoUri: logo_uri,
83
+ privacyPolicyUrl: privacy_policy_url,
84
+ termsUrl: terms_url,
85
+ contacts: contacts,
86
+ tagline: tagline,
87
+ tags: tags,
88
+ images: images,
89
+ supportUrl: support_url,
90
+ dataDeletionUrl: data_deletion_url,
91
+ redirectUris: redirect_uris,
92
+ postLogoutRedirectUris: post_logout_redirect_uris,
93
+ enabled: enabled,
94
+ type: type,
95
+ deviceFlow: device_flow,
96
+ teamId: team_id,
97
+ }
98
+
99
+ api_headers = {
100
+ "X-Appwrite-Project": @client.get_config('project'),
101
+ "content-type": 'application/json',
102
+ "accept": 'application/json',
103
+ }
104
+
105
+ @client.call(
106
+ method: 'POST',
107
+ path: api_path,
108
+ headers: api_headers,
109
+ params: api_params,
110
+ response_type: Models::App
111
+ )
112
+
113
+ end
114
+
115
+ # List scopes an application can request when installed on a team.
116
+ #
117
+ #
118
+ # @return [AppScopeList]
119
+ def list_installation_scopes()
120
+ api_path = '/apps/scopes/installations'
121
+
122
+ api_params = {
123
+ }
124
+
125
+ api_headers = {
126
+ "X-Appwrite-Project": @client.get_config('project'),
127
+ "accept": 'application/json',
128
+ }
129
+
130
+ @client.call(
131
+ method: 'GET',
132
+ path: api_path,
133
+ headers: api_headers,
134
+ params: api_params,
135
+ response_type: Models::AppScopeList
136
+ )
137
+
138
+ end
139
+
140
+ # List scopes an application can request during the OAuth2 flow.
141
+ #
142
+ #
143
+ # @return [AppScopeList]
144
+ def list_o_auth2_scopes()
145
+ api_path = '/apps/scopes/oauth2'
146
+
147
+ api_params = {
148
+ }
149
+
150
+ api_headers = {
151
+ "X-Appwrite-Project": @client.get_config('project'),
152
+ "accept": 'application/json',
153
+ }
154
+
155
+ @client.call(
156
+ method: 'GET',
157
+ path: api_path,
158
+ headers: api_headers,
159
+ params: api_params,
160
+ response_type: Models::AppScopeList
161
+ )
162
+
163
+ end
164
+
165
+ # Get an application by its unique ID.
166
+ #
167
+ # @param [String] app_id Application unique ID.
168
+ #
169
+ # @return [App]
170
+ def get(app_id:)
171
+ api_path = '/apps/{appId}'
172
+ .gsub('{appId}', app_id)
173
+
174
+ if app_id.nil?
175
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
176
+ end
177
+
178
+ api_params = {
179
+ }
180
+
181
+ api_headers = {
182
+ "X-Appwrite-Project": @client.get_config('project'),
183
+ "accept": 'application/json',
184
+ }
185
+
186
+ @client.call(
187
+ method: 'GET',
188
+ path: api_path,
189
+ headers: api_headers,
190
+ params: api_params,
191
+ response_type: Models::App
192
+ )
193
+
194
+ end
195
+
196
+ # Update an application by its unique ID.
197
+ #
198
+ # @param [String] app_id Application unique ID.
199
+ # @param [String] name Application name.
200
+ # @param [String] description Application description shown to users during OAuth2 consent.
201
+ # @param [String] client_uri Application homepage URL shown to users during OAuth2 consent.
202
+ # @param [String] logo_uri Application logo URL shown to users during OAuth2 consent.
203
+ # @param [String] privacy_policy_url Application privacy policy URL shown to users during OAuth2 consent.
204
+ # @param [String] terms_url Application terms of service URL shown to users during OAuth2 consent.
205
+ # @param [Array] contacts Application support or security contact emails. Maximum of 100 contacts are allowed.
206
+ # @param [String] tagline Application tagline shown to users during OAuth2 consent.
207
+ # @param [Array] tags Application tags shown to users during OAuth2 consent. Maximum of 100 tags are allowed, each up to 64 characters long.
208
+ # @param [Array] images Application image URLs shown to users during OAuth2 consent. Maximum of 100 images are allowed.
209
+ # @param [String] support_url Application support URL shown to users during OAuth2 consent.
210
+ # @param [String] data_deletion_url Application data deletion URL shown to users during OAuth2 consent.
211
+ # @param [] enabled Is application enabled?
212
+ # @param [Array] redirect_uris Redirect URIs. Each must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI (e.g. com.example.app:/oauth), and must not contain a fragment.
213
+ # @param [Array] post_logout_redirect_uris Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list.
214
+ # @param [String] type OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`.
215
+ # @param [] device_flow Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false.
216
+ # @param [Array] installation_scopes Scopes the application requests when installed on a team. Only scopes allowed by the project's OAuth2 server installation scopes configuration are accepted; use the list installation scopes endpoint to discover available values. Maximum of 100 scopes are allowed.
217
+ # @param [String] installation_redirect_url URL users are redirected to after creating or updating an installation of this application. Must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI, and must not contain a fragment. Leave empty for no redirect.
218
+ #
219
+ # @return [App]
220
+ def update(app_id:, name:, description: nil, client_uri: nil, logo_uri: nil, privacy_policy_url: nil, terms_url: nil, contacts: nil, tagline: nil, tags: nil, images: nil, support_url: nil, data_deletion_url: nil, enabled: nil, redirect_uris: nil, post_logout_redirect_uris: nil, type: nil, device_flow: nil, installation_scopes: nil, installation_redirect_url: nil)
221
+ api_path = '/apps/{appId}'
222
+ .gsub('{appId}', app_id)
223
+
224
+ if app_id.nil?
225
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
226
+ end
227
+
228
+ if name.nil?
229
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
230
+ end
231
+
232
+ api_params = {
233
+ name: name,
234
+ description: description,
235
+ clientUri: client_uri,
236
+ logoUri: logo_uri,
237
+ privacyPolicyUrl: privacy_policy_url,
238
+ termsUrl: terms_url,
239
+ contacts: contacts,
240
+ tagline: tagline,
241
+ tags: tags,
242
+ images: images,
243
+ supportUrl: support_url,
244
+ dataDeletionUrl: data_deletion_url,
245
+ enabled: enabled,
246
+ redirectUris: redirect_uris,
247
+ postLogoutRedirectUris: post_logout_redirect_uris,
248
+ type: type,
249
+ deviceFlow: device_flow,
250
+ installationScopes: installation_scopes,
251
+ installationRedirectUrl: installation_redirect_url,
252
+ }
253
+
254
+ api_headers = {
255
+ "X-Appwrite-Project": @client.get_config('project'),
256
+ "content-type": 'application/json',
257
+ "accept": 'application/json',
258
+ }
259
+
260
+ @client.call(
261
+ method: 'PUT',
262
+ path: api_path,
263
+ headers: api_headers,
264
+ params: api_params,
265
+ response_type: Models::App
266
+ )
267
+
268
+ end
269
+
270
+ # Delete an application by its unique ID.
271
+ #
272
+ # @param [String] app_id Application unique ID.
273
+ #
274
+ # @return []
275
+ def delete(app_id:)
276
+ api_path = '/apps/{appId}'
277
+ .gsub('{appId}', app_id)
278
+
279
+ if app_id.nil?
280
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
281
+ end
282
+
283
+ api_params = {
284
+ }
285
+
286
+ api_headers = {
287
+ "X-Appwrite-Project": @client.get_config('project'),
288
+ "content-type": 'application/json',
289
+ "accept": 'application/json',
290
+ }
291
+
292
+ @client.call(
293
+ method: 'DELETE',
294
+ path: api_path,
295
+ headers: api_headers,
296
+ params: api_params,
297
+ )
298
+
299
+ end
300
+
301
+ # List installations of an application. Requires an app key sent in the
302
+ # `X-Appwrite-Key` header alongside the `X-Appwrite-App` header, or a caller
303
+ # with update access to the app.
304
+ #
305
+ # @param [String] app_id Application unique ID.
306
+ # @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.
307
+ # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
308
+ #
309
+ # @return [AppInstallationList]
310
+ def list_installations(app_id:, queries: nil, total: nil)
311
+ api_path = '/apps/{appId}/installations'
312
+ .gsub('{appId}', app_id)
313
+
314
+ if app_id.nil?
315
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
316
+ end
317
+
318
+ api_params = {
319
+ queries: queries,
320
+ total: total,
321
+ }
322
+
323
+ api_headers = {
324
+ "X-Appwrite-Project": @client.get_config('project'),
325
+ "accept": 'application/json',
326
+ }
327
+
328
+ @client.call(
329
+ method: 'GET',
330
+ path: api_path,
331
+ headers: api_headers,
332
+ params: api_params,
333
+ response_type: Models::AppInstallationList
334
+ )
335
+
336
+ end
337
+
338
+ # Get an installation of an application by its unique ID. Requires an app key
339
+ # sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header,
340
+ # or a caller with update access to the app.
341
+ #
342
+ # @param [String] app_id Application unique ID.
343
+ # @param [String] installation_id Installation unique ID.
344
+ #
345
+ # @return [AppInstallation]
346
+ def get_installation(app_id:, installation_id:)
347
+ api_path = '/apps/{appId}/installations/{installationId}'
348
+ .gsub('{appId}', app_id)
349
+ .gsub('{installationId}', installation_id)
350
+
351
+ if app_id.nil?
352
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
353
+ end
354
+
355
+ if installation_id.nil?
356
+ raise Appwrite::Exception.new('Missing required parameter: "installationId"')
357
+ end
358
+
359
+ api_params = {
360
+ }
361
+
362
+ api_headers = {
363
+ "X-Appwrite-Project": @client.get_config('project'),
364
+ "accept": 'application/json',
365
+ }
366
+
367
+ @client.call(
368
+ method: 'GET',
369
+ path: api_path,
370
+ headers: api_headers,
371
+ params: api_params,
372
+ response_type: Models::AppInstallation
373
+ )
374
+
375
+ end
376
+
377
+ # Delete an installation of an application by its unique ID. Requires a
378
+ # caller with update access to the app. Previously issued installation access
379
+ # tokens are revoked.
380
+ #
381
+ # @param [String] app_id Application unique ID.
382
+ # @param [String] installation_id Installation unique ID.
383
+ #
384
+ # @return []
385
+ def delete_installation(app_id:, installation_id:)
386
+ api_path = '/apps/{appId}/installations/{installationId}'
387
+ .gsub('{appId}', app_id)
388
+ .gsub('{installationId}', installation_id)
389
+
390
+ if app_id.nil?
391
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
392
+ end
393
+
394
+ if installation_id.nil?
395
+ raise Appwrite::Exception.new('Missing required parameter: "installationId"')
396
+ end
397
+
398
+ api_params = {
399
+ }
400
+
401
+ api_headers = {
402
+ "X-Appwrite-Project": @client.get_config('project'),
403
+ "content-type": 'application/json',
404
+ "accept": 'application/json',
405
+ }
406
+
407
+ @client.call(
408
+ method: 'DELETE',
409
+ path: api_path,
410
+ headers: api_headers,
411
+ params: api_params,
412
+ )
413
+
414
+ end
415
+
416
+ # Create a token for an installation of an application. Requires an app key
417
+ # sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header,
418
+ # or a caller with update access to the app. The returned token carries the
419
+ # scopes and authorization details granted to the installation, and can be
420
+ # used as an `Authorization: Bearer` header everywhere OAuth2 access tokens
421
+ # are accepted. Multiple tokens can be active for the same installation at
422
+ # once; each token stays valid until it expires or the installation is
423
+ # updated or deleted.
424
+ #
425
+ # @param [String] app_id Application unique ID.
426
+ # @param [String] installation_id Installation unique ID.
427
+ #
428
+ # @return [Oauth2Token]
429
+ def create_installation_token(app_id:, installation_id:)
430
+ api_path = '/apps/{appId}/installations/{installationId}/tokens'
431
+ .gsub('{appId}', app_id)
432
+ .gsub('{installationId}', installation_id)
433
+
434
+ if app_id.nil?
435
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
436
+ end
437
+
438
+ if installation_id.nil?
439
+ raise Appwrite::Exception.new('Missing required parameter: "installationId"')
440
+ end
441
+
442
+ api_params = {
443
+ }
444
+
445
+ api_headers = {
446
+ "X-Appwrite-Project": @client.get_config('project'),
447
+ "content-type": 'application/json',
448
+ "accept": 'application/json',
449
+ }
450
+
451
+ @client.call(
452
+ method: 'POST',
453
+ path: api_path,
454
+ headers: api_headers,
455
+ params: api_params,
456
+ response_type: Models::Oauth2Token
457
+ )
458
+
459
+ end
460
+
461
+ # List app keys for an application.
462
+ #
463
+ # @param [String] app_id Application unique ID.
464
+ # @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.
465
+ # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
466
+ #
467
+ # @return [AppKeyList]
468
+ def list_keys(app_id:, queries: nil, total: nil)
469
+ api_path = '/apps/{appId}/keys'
470
+ .gsub('{appId}', app_id)
471
+
472
+ if app_id.nil?
473
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
474
+ end
475
+
476
+ api_params = {
477
+ queries: queries,
478
+ total: total,
479
+ }
480
+
481
+ api_headers = {
482
+ "X-Appwrite-Project": @client.get_config('project'),
483
+ "accept": 'application/json',
484
+ }
485
+
486
+ @client.call(
487
+ method: 'GET',
488
+ path: api_path,
489
+ headers: api_headers,
490
+ params: api_params,
491
+ response_type: Models::AppKeyList
492
+ )
493
+
494
+ end
495
+
496
+ # Create a new app key for an application. App keys carry no scopes; send one
497
+ # in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header to
498
+ # list the application's installations and create installation access tokens.
499
+ #
500
+ # @param [String] app_id Application unique ID.
501
+ #
502
+ # @return [AppKey]
503
+ def create_key(app_id:)
504
+ api_path = '/apps/{appId}/keys'
505
+ .gsub('{appId}', app_id)
506
+
507
+ if app_id.nil?
508
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
509
+ end
510
+
511
+ api_params = {
512
+ }
513
+
514
+ api_headers = {
515
+ "X-Appwrite-Project": @client.get_config('project'),
516
+ "content-type": 'application/json',
517
+ "accept": 'application/json',
518
+ }
519
+
520
+ @client.call(
521
+ method: 'POST',
522
+ path: api_path,
523
+ headers: api_headers,
524
+ params: api_params,
525
+ response_type: Models::AppKey
526
+ )
527
+
528
+ end
529
+
530
+ # Get an app key by its unique ID.
531
+ #
532
+ # @param [String] app_id Application unique ID.
533
+ # @param [String] key_id App key unique ID.
534
+ #
535
+ # @return [AppKey]
536
+ def get_key(app_id:, key_id:)
537
+ api_path = '/apps/{appId}/keys/{keyId}'
538
+ .gsub('{appId}', app_id)
539
+ .gsub('{keyId}', key_id)
540
+
541
+ if app_id.nil?
542
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
543
+ end
544
+
545
+ if key_id.nil?
546
+ raise Appwrite::Exception.new('Missing required parameter: "keyId"')
547
+ end
548
+
549
+ api_params = {
550
+ }
551
+
552
+ api_headers = {
553
+ "X-Appwrite-Project": @client.get_config('project'),
554
+ "accept": 'application/json',
555
+ }
556
+
557
+ @client.call(
558
+ method: 'GET',
559
+ path: api_path,
560
+ headers: api_headers,
561
+ params: api_params,
562
+ response_type: Models::AppKey
563
+ )
564
+
565
+ end
566
+
567
+ # Delete an app key by its unique ID.
568
+ #
569
+ # @param [String] app_id Application unique ID.
570
+ # @param [String] key_id App key unique ID.
571
+ #
572
+ # @return []
573
+ def delete_key(app_id:, key_id:)
574
+ api_path = '/apps/{appId}/keys/{keyId}'
575
+ .gsub('{appId}', app_id)
576
+ .gsub('{keyId}', key_id)
577
+
578
+ if app_id.nil?
579
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
580
+ end
581
+
582
+ if key_id.nil?
583
+ raise Appwrite::Exception.new('Missing required parameter: "keyId"')
584
+ end
585
+
586
+ api_params = {
587
+ }
588
+
589
+ api_headers = {
590
+ "X-Appwrite-Project": @client.get_config('project'),
591
+ "content-type": 'application/json',
592
+ "accept": 'application/json',
593
+ }
594
+
595
+ @client.call(
596
+ method: 'DELETE',
597
+ path: api_path,
598
+ headers: api_headers,
599
+ params: api_params,
600
+ )
601
+
602
+ end
603
+
604
+ # Update the labels of an application. Labels are read-only for clients; only
605
+ # a server SDK using a project API key can set them. Replaces the previous
606
+ # labels.
607
+ #
608
+ # @param [String] app_id Application unique ID.
609
+ # @param [Array] labels Array of application labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long.
610
+ #
611
+ # @return [App]
612
+ def update_labels(app_id:, labels:)
613
+ api_path = '/apps/{appId}/labels'
614
+ .gsub('{appId}', app_id)
615
+
616
+ if app_id.nil?
617
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
618
+ end
619
+
620
+ if labels.nil?
621
+ raise Appwrite::Exception.new('Missing required parameter: "labels"')
622
+ end
623
+
624
+ api_params = {
625
+ labels: labels,
626
+ }
627
+
628
+ api_headers = {
629
+ "X-Appwrite-Project": @client.get_config('project'),
630
+ "content-type": 'application/json',
631
+ "accept": 'application/json',
632
+ }
633
+
634
+ @client.call(
635
+ method: 'PUT',
636
+ path: api_path,
637
+ headers: api_headers,
638
+ params: api_params,
639
+ response_type: Models::App
640
+ )
641
+
642
+ end
643
+
644
+ # List client secrets for an application.
645
+ #
646
+ # @param [String] app_id Application unique ID.
647
+ # @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.
648
+ # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
649
+ #
650
+ # @return [AppSecretList]
651
+ def list_secrets(app_id:, queries: nil, total: nil)
652
+ api_path = '/apps/{appId}/secrets'
653
+ .gsub('{appId}', app_id)
654
+
655
+ if app_id.nil?
656
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
657
+ end
658
+
659
+ api_params = {
660
+ queries: queries,
661
+ total: total,
662
+ }
663
+
664
+ api_headers = {
665
+ "X-Appwrite-Project": @client.get_config('project'),
666
+ "accept": 'application/json',
667
+ }
668
+
669
+ @client.call(
670
+ method: 'GET',
671
+ path: api_path,
672
+ headers: api_headers,
673
+ params: api_params,
674
+ response_type: Models::AppSecretList
675
+ )
676
+
677
+ end
678
+
679
+ # Create a new client secret for an application.
680
+ #
681
+ # @param [String] app_id Application unique ID.
682
+ #
683
+ # @return [AppSecretPlaintext]
684
+ def create_secret(app_id:)
685
+ api_path = '/apps/{appId}/secrets'
686
+ .gsub('{appId}', app_id)
687
+
688
+ if app_id.nil?
689
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
690
+ end
691
+
692
+ api_params = {
693
+ }
694
+
695
+ api_headers = {
696
+ "X-Appwrite-Project": @client.get_config('project'),
697
+ "content-type": 'application/json',
698
+ "accept": 'application/json',
699
+ }
700
+
701
+ @client.call(
702
+ method: 'POST',
703
+ path: api_path,
704
+ headers: api_headers,
705
+ params: api_params,
706
+ response_type: Models::AppSecretPlaintext
707
+ )
708
+
709
+ end
710
+
711
+ # Get an application client secret by its unique ID.
712
+ #
713
+ # @param [String] app_id Application unique ID.
714
+ # @param [String] secret_id Secret unique ID.
715
+ #
716
+ # @return [AppSecret]
717
+ def get_secret(app_id:, secret_id:)
718
+ api_path = '/apps/{appId}/secrets/{secretId}'
719
+ .gsub('{appId}', app_id)
720
+ .gsub('{secretId}', secret_id)
721
+
722
+ if app_id.nil?
723
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
724
+ end
725
+
726
+ if secret_id.nil?
727
+ raise Appwrite::Exception.new('Missing required parameter: "secretId"')
728
+ end
729
+
730
+ api_params = {
731
+ }
732
+
733
+ api_headers = {
734
+ "X-Appwrite-Project": @client.get_config('project'),
735
+ "accept": 'application/json',
736
+ }
737
+
738
+ @client.call(
739
+ method: 'GET',
740
+ path: api_path,
741
+ headers: api_headers,
742
+ params: api_params,
743
+ response_type: Models::AppSecret
744
+ )
745
+
746
+ end
747
+
748
+ # Delete an application client secret by its unique ID.
749
+ #
750
+ # @param [String] app_id Application unique ID.
751
+ # @param [String] secret_id Secret unique ID.
752
+ #
753
+ # @return []
754
+ def delete_secret(app_id:, secret_id:)
755
+ api_path = '/apps/{appId}/secrets/{secretId}'
756
+ .gsub('{appId}', app_id)
757
+ .gsub('{secretId}', secret_id)
758
+
759
+ if app_id.nil?
760
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
761
+ end
762
+
763
+ if secret_id.nil?
764
+ raise Appwrite::Exception.new('Missing required parameter: "secretId"')
765
+ end
766
+
767
+ api_params = {
768
+ }
769
+
770
+ api_headers = {
771
+ "X-Appwrite-Project": @client.get_config('project'),
772
+ "content-type": 'application/json',
773
+ "accept": 'application/json',
774
+ }
775
+
776
+ @client.call(
777
+ method: 'DELETE',
778
+ path: api_path,
779
+ headers: api_headers,
780
+ params: api_params,
781
+ )
782
+
783
+ end
784
+
785
+ # Transfer an application to another team by its unique ID.
786
+ #
787
+ # @param [String] app_id Application unique ID.
788
+ # @param [String] team_id Team ID of the team to transfer application to.
789
+ #
790
+ # @return [App]
791
+ def update_team(app_id:, team_id:)
792
+ api_path = '/apps/{appId}/team'
793
+ .gsub('{appId}', app_id)
794
+
795
+ if app_id.nil?
796
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
797
+ end
798
+
799
+ if team_id.nil?
800
+ raise Appwrite::Exception.new('Missing required parameter: "teamId"')
801
+ end
802
+
803
+ api_params = {
804
+ teamId: team_id,
805
+ }
806
+
807
+ api_headers = {
808
+ "X-Appwrite-Project": @client.get_config('project'),
809
+ "content-type": 'application/json',
810
+ "accept": 'application/json',
811
+ }
812
+
813
+ @client.call(
814
+ method: 'PATCH',
815
+ path: api_path,
816
+ headers: api_headers,
817
+ params: api_params,
818
+ response_type: Models::App
819
+ )
820
+
821
+ end
822
+
823
+ # Revoke all tokens for an application by its unique ID.
824
+ #
825
+ # @param [String] app_id Application unique ID.
826
+ #
827
+ # @return []
828
+ def delete_tokens(app_id:)
829
+ api_path = '/apps/{appId}/tokens'
830
+ .gsub('{appId}', app_id)
831
+
832
+ if app_id.nil?
833
+ raise Appwrite::Exception.new('Missing required parameter: "appId"')
834
+ end
835
+
836
+ api_params = {
837
+ }
838
+
839
+ api_headers = {
840
+ "X-Appwrite-Project": @client.get_config('project'),
841
+ "content-type": 'application/json',
842
+ "accept": 'application/json',
843
+ }
844
+
845
+ @client.call(
846
+ method: 'DELETE',
847
+ path: api_path,
848
+ headers: api_headers,
849
+ params: api_params,
850
+ )
851
+
852
+ end
853
+
854
+ end
855
+ end