appwrite 30.0.1 → 30.2.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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +58 -24
  3. data/lib/appwrite/enums/appwrite_migration_resource.rb +47 -0
  4. data/lib/appwrite/enums/build_runtime.rb +4 -0
  5. data/lib/appwrite/enums/environment_resource.rb +40 -0
  6. data/lib/appwrite/enums/firebase_migration_resource.rb +16 -0
  7. data/lib/appwrite/enums/n_host_migration_resource.rb +17 -0
  8. data/lib/appwrite/enums/o_auth_provider.rb +2 -0
  9. data/lib/appwrite/enums/on_duplicate.rb +9 -0
  10. data/lib/appwrite/enums/project_key_scopes.rb +6 -0
  11. data/lib/appwrite/enums/project_o_auth_provider_id.rb +2 -0
  12. data/lib/appwrite/enums/project_policy_id.rb +2 -0
  13. data/lib/appwrite/enums/runtime.rb +4 -0
  14. data/lib/appwrite/enums/supabase_migration_resource.rb +17 -0
  15. data/lib/appwrite/models/activity_event.rb +9 -4
  16. data/lib/appwrite/models/billing_plan.rb +15 -0
  17. data/lib/appwrite/models/device.rb +58 -0
  18. data/lib/appwrite/models/environment.rb +48 -0
  19. data/lib/appwrite/models/environment_list.rb +33 -0
  20. data/lib/appwrite/models/migration.rb +128 -0
  21. data/lib/appwrite/models/migration_list.rb +33 -0
  22. data/lib/appwrite/models/o_auth2_vipps.rb +43 -0
  23. data/lib/appwrite/models/organization.rb +16 -1
  24. data/lib/appwrite/models/policy_account_devices.rb +33 -0
  25. data/lib/appwrite/models/policy_deny_realtime_guests.rb +33 -0
  26. data/lib/appwrite/models/project.rb +10 -0
  27. data/lib/appwrite/models/proxy_rule.rb +11 -1
  28. data/lib/appwrite/models/session.rb +6 -1
  29. data/lib/appwrite/models/waf_rule_bypass.rb +8 -3
  30. data/lib/appwrite/models/waf_rule_challenge.rb +5 -0
  31. data/lib/appwrite/models/waf_rule_deny.rb +8 -3
  32. data/lib/appwrite/models/waf_rule_rate_limit.rb +5 -0
  33. data/lib/appwrite/models/waf_rule_redirect.rb +5 -0
  34. data/lib/appwrite/services/account.rb +175 -20
  35. data/lib/appwrite/services/activities.rb +1 -1
  36. data/lib/appwrite/services/advisor.rb +5 -5
  37. data/lib/appwrite/services/apps.rb +25 -25
  38. data/lib/appwrite/services/avatars.rb +3 -3
  39. data/lib/appwrite/services/backups.rb +6 -6
  40. data/lib/appwrite/services/databases.rb +157 -157
  41. data/lib/appwrite/services/documents_db.rb +63 -63
  42. data/lib/appwrite/services/domains.rb +77 -77
  43. data/lib/appwrite/services/functions.rb +33 -33
  44. data/lib/appwrite/services/messaging.rb +30 -30
  45. data/lib/appwrite/services/migrations.rb +653 -0
  46. data/lib/appwrite/services/mongo.rb +37 -37
  47. data/lib/appwrite/services/mysql.rb +40 -40
  48. data/lib/appwrite/services/oauth2.rb +14 -14
  49. data/lib/appwrite/services/organization.rb +17 -17
  50. data/lib/appwrite/services/postgresql.rb +44 -44
  51. data/lib/appwrite/services/presences.rb +4 -4
  52. data/lib/appwrite/services/project.rb +321 -47
  53. data/lib/appwrite/services/proxy.rb +157 -4
  54. data/lib/appwrite/services/sites.rb +32 -32
  55. data/lib/appwrite/services/storage.rb +19 -19
  56. data/lib/appwrite/services/tables_db.rb +169 -169
  57. data/lib/appwrite/services/teams.rb +23 -23
  58. data/lib/appwrite/services/tokens.rb +7 -7
  59. data/lib/appwrite/services/users.rb +50 -50
  60. data/lib/appwrite/services/vectors_db.rb +55 -55
  61. data/lib/appwrite/services/waf.rb +97 -45
  62. data/lib/appwrite/services/webhooks.rb +4 -4
  63. data/lib/appwrite.rb +17 -0
  64. metadata +17 -2
@@ -72,7 +72,7 @@ module Appwrite
72
72
  end
73
73
 
74
74
  api_path = '/project/auth-methods/{methodId}'
75
- .gsub('{methodId}', method_id)
75
+ .gsub('{methodId}', @client.encode_path(method_id))
76
76
 
77
77
  api_params = {
78
78
  enabled: enabled,
@@ -94,12 +94,13 @@ module Appwrite
94
94
  end
95
95
 
96
96
  # Get a list of all environments of the project. You can use the query params
97
- # to filter your results.
97
+ # to filter your results. An environment is listed by its ID, the one passed
98
+ # in the `X-Appwrite-Environment` header to act in it.
98
99
  #
99
- # @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, teamId, labels, search, accessedAt, status, parentId
100
+ # @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: $id, name, search
100
101
  # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
101
102
  #
102
- # @return [ProjectList]
103
+ # @return [EnvironmentList]
103
104
  def list_environments(
104
105
  queries: nil,
105
106
  total: nil
@@ -121,21 +122,35 @@ module Appwrite
121
122
  path: api_path,
122
123
  headers: api_headers,
123
124
  params: api_params,
124
- response_type: Models::ProjectList
125
+ response_type: Models::EnvironmentList
125
126
  )
126
127
  end
127
128
 
128
129
  # Create a new environment of the project. An environment is a separate
129
130
  # project in the same organization and region, with its own resources and
130
- # users. Its usage is billed under the project it belongs to.
131
- #
132
- # @param [String] environment_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, and hyphen. Can't start with a special char. Max length is 36 chars.
131
+ # users. Its usage is billed under the project it belongs to. Requests act in
132
+ # the environment when they carry the project's ID in the
133
+ # `X-Appwrite-Project` header and the environment's ID in the
134
+ # `X-Appwrite-Environment` header; the environment has no project ID of its
135
+ # own to pass.
136
+ #
137
+ # Pass `resources` to copy the project into the environment. The environment
138
+ # is returned at once and the copy runs as a migration of the environment,
139
+ # listed by its migrations routes and announced on its `migrations.*`
140
+ # realtime events; a resource whose ID can be chosen keeps it. Users are
141
+ # copied newest first and at most 90 of them, so the environment keeps room
142
+ # under its limit of 100 users for test accounts, and the memberships of
143
+ # users left behind are not copied.
144
+ #
145
+ # @param [String] environment_id Environment ID, unique within the project and passed in the `X-Appwrite-Environment` header to act in the environment. Choose a custom ID such as `staging`, or generate a random ID with `ID.unique()`. Valid chars are a-z, 0-9, and hyphen. Can't start with a special char. Max length is 36 chars.
133
146
  # @param [String] name Environment name. Max length: 128 chars.
147
+ # @param [Array] resources Resources to copy from the project into the environment, by type. A structural type such as `database`, `table`, `column`, `index`, `bucket`, `team`, `function` or `site` copies the structure and its settings; `row`, `file`, `user`, `membership`, `deployment` and `site-deployment` copy what it holds. A function or site is copied with its active deployment; add `deployment` or `site-deployment` to copy every deployment. Users are copied newest first and at most 90 of them, leaving room under the limit of 100 users of an environment for test accounts; the memberships of users left behind are not copied. Leave empty for an empty environment. Maximum of 100 types.
134
148
  #
135
- # @return [Project]
149
+ # @return [Environment]
136
150
  def create_environment(
137
151
  environment_id:,
138
- name:
152
+ name:,
153
+ resources: nil
139
154
  )
140
155
  if environment_id.nil?
141
156
  raise Appwrite::Exception.new('Missing required parameter: "environmentId"')
@@ -150,6 +165,7 @@ module Appwrite
150
165
  api_params = {
151
166
  environmentId: environment_id,
152
167
  name: name,
168
+ resources: resources,
153
169
  }
154
170
 
155
171
  api_headers = {
@@ -163,15 +179,16 @@ module Appwrite
163
179
  path: api_path,
164
180
  headers: api_headers,
165
181
  params: api_params,
166
- response_type: Models::Project
182
+ response_type: Models::Environment
167
183
  )
168
184
  end
169
185
 
170
- # Get an environment of the project by its unique ID.
186
+ # Get an environment of the project by its ID, the one passed in the
187
+ # `X-Appwrite-Environment` header to act in it.
171
188
  #
172
- # @param [String] environment_id Environment unique ID.
189
+ # @param [String] environment_id Environment ID.
173
190
  #
174
- # @return [Project]
191
+ # @return [Environment]
175
192
  def get_environment(
176
193
  environment_id:
177
194
  )
@@ -180,7 +197,7 @@ module Appwrite
180
197
  end
181
198
 
182
199
  api_path = '/project/environments/{environmentId}'
183
- .gsub('{environmentId}', environment_id)
200
+ .gsub('{environmentId}', @client.encode_path(environment_id))
184
201
 
185
202
  api_params = {}
186
203
 
@@ -194,16 +211,17 @@ module Appwrite
194
211
  path: api_path,
195
212
  headers: api_headers,
196
213
  params: api_params,
197
- response_type: Models::Project
214
+ response_type: Models::Environment
198
215
  )
199
216
  end
200
217
 
201
- # Update the name of an environment of the project.
218
+ # Update the name of an environment of the project. The environment ID cannot
219
+ # be changed.
202
220
  #
203
- # @param [String] environment_id Environment unique ID.
221
+ # @param [String] environment_id Environment ID.
204
222
  # @param [String] name Environment name. Max length: 128 chars.
205
223
  #
206
- # @return [Project]
224
+ # @return [Environment]
207
225
  def update_environment(
208
226
  environment_id:,
209
227
  name:
@@ -217,7 +235,7 @@ module Appwrite
217
235
  end
218
236
 
219
237
  api_path = '/project/environments/{environmentId}'
220
- .gsub('{environmentId}', environment_id)
238
+ .gsub('{environmentId}', @client.encode_path(environment_id))
221
239
 
222
240
  api_params = {
223
241
  name: name,
@@ -234,13 +252,13 @@ module Appwrite
234
252
  path: api_path,
235
253
  headers: api_headers,
236
254
  params: api_params,
237
- response_type: Models::Project
255
+ response_type: Models::Environment
238
256
  )
239
257
  end
240
258
 
241
259
  # Delete an environment of the project, with all of its resources and users.
242
260
  #
243
- # @param [String] environment_id Environment unique ID.
261
+ # @param [String] environment_id Environment ID.
244
262
  #
245
263
  # @return []
246
264
  def delete_environment(
@@ -251,7 +269,7 @@ module Appwrite
251
269
  end
252
270
 
253
271
  api_path = '/project/environments/{environmentId}'
254
- .gsub('{environmentId}', environment_id)
272
+ .gsub('{environmentId}', @client.encode_path(environment_id))
255
273
 
256
274
  api_params = {}
257
275
 
@@ -357,7 +375,7 @@ module Appwrite
357
375
  end
358
376
 
359
377
  api_path = '/project/keys/{keyId}'
360
- .gsub('{keyId}', key_id)
378
+ .gsub('{keyId}', @client.encode_path(key_id))
361
379
 
362
380
  api_params = {}
363
381
 
@@ -405,7 +423,7 @@ module Appwrite
405
423
  end
406
424
 
407
425
  api_path = '/project/keys/{keyId}'
408
- .gsub('{keyId}', key_id)
426
+ .gsub('{keyId}', @client.encode_path(key_id))
409
427
 
410
428
  api_params = {
411
429
  name: name,
@@ -443,7 +461,7 @@ module Appwrite
443
461
  end
444
462
 
445
463
  api_path = '/project/keys/{keyId}'
446
- .gsub('{keyId}', key_id)
464
+ .gsub('{keyId}', @client.encode_path(key_id))
447
465
 
448
466
  api_params = {}
449
467
 
@@ -582,7 +600,7 @@ module Appwrite
582
600
  end
583
601
 
584
602
  api_path = '/project/mock-phones/{number}'
585
- .gsub('{number}', number)
603
+ .gsub('{number}', @client.encode_path(number))
586
604
 
587
605
  api_params = {}
588
606
 
@@ -620,7 +638,7 @@ module Appwrite
620
638
  end
621
639
 
622
640
  api_path = '/project/mock-phones/{number}'
623
- .gsub('{number}', number)
641
+ .gsub('{number}', @client.encode_path(number))
624
642
 
625
643
  api_params = {
626
644
  otp: otp,
@@ -655,7 +673,7 @@ module Appwrite
655
673
  end
656
674
 
657
675
  api_path = '/project/mock-phones/{number}'
658
- .gsub('{number}', number)
676
+ .gsub('{number}', @client.encode_path(number))
659
677
 
660
678
  api_params = {}
661
679
 
@@ -2345,6 +2363,76 @@ module Appwrite
2345
2363
  )
2346
2364
  end
2347
2365
 
2366
+ # Update the project OAuth2 Vipps MobilePay configuration.
2367
+ #
2368
+ # @param [String] client_id 'Client ID' of Vipps MobilePay OAuth2 app. For example: 9a3a4b3e-0000-0000-0000-0f1a6d1c3b2e
2369
+ # @param [String] client_secret 'Client Secret' of Vipps MobilePay OAuth2 app. For example: Ay1jb000000000000000000000000000000Vx3k
2370
+ # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid.
2371
+ #
2372
+ # @return [OAuth2Vipps]
2373
+ def update_o_auth2_vipps(
2374
+ client_id: nil,
2375
+ client_secret: nil,
2376
+ enabled: nil
2377
+ )
2378
+ api_path = '/project/oauth2/vipps'
2379
+
2380
+ api_params = {
2381
+ clientId: client_id,
2382
+ clientSecret: client_secret,
2383
+ enabled: enabled,
2384
+ }
2385
+
2386
+ api_headers = {
2387
+ "X-Appwrite-Project": @client.get_config('project'),
2388
+ "content-type": 'application/json',
2389
+ "accept": 'application/json',
2390
+ }
2391
+
2392
+ @client.call(
2393
+ method: 'PATCH',
2394
+ path: api_path,
2395
+ headers: api_headers,
2396
+ params: api_params,
2397
+ response_type: Models::OAuth2Vipps
2398
+ )
2399
+ end
2400
+
2401
+ # Update the project OAuth2 Vipps MobilePay Sandbox configuration.
2402
+ #
2403
+ # @param [String] client_id 'Client ID' of Vipps MobilePay Sandbox OAuth2 app. For example: 9a3a4b3e-0000-0000-0000-0f1a6d1c3b2e
2404
+ # @param [String] client_secret 'Client Secret' of Vipps MobilePay Sandbox OAuth2 app. For example: Ay1jb000000000000000000000000000000Vx3k
2405
+ # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid.
2406
+ #
2407
+ # @return [OAuth2Vipps]
2408
+ def update_o_auth2_vipps_sandbox(
2409
+ client_id: nil,
2410
+ client_secret: nil,
2411
+ enabled: nil
2412
+ )
2413
+ api_path = '/project/oauth2/vippsSandbox'
2414
+
2415
+ api_params = {
2416
+ clientId: client_id,
2417
+ clientSecret: client_secret,
2418
+ enabled: enabled,
2419
+ }
2420
+
2421
+ api_headers = {
2422
+ "X-Appwrite-Project": @client.get_config('project'),
2423
+ "content-type": 'application/json',
2424
+ "accept": 'application/json',
2425
+ }
2426
+
2427
+ @client.call(
2428
+ method: 'PATCH',
2429
+ path: api_path,
2430
+ headers: api_headers,
2431
+ params: api_params,
2432
+ response_type: Models::OAuth2Vipps
2433
+ )
2434
+ end
2435
+
2348
2436
  # Update the project OAuth2 Webflow configuration.
2349
2437
  #
2350
2438
  # @param [String] client_id 'Client ID' of Webflow OAuth2 app. For example: 8bb20000000000000000000000000000000000000000000000000000000040dd
@@ -2598,7 +2686,7 @@ module Appwrite
2598
2686
  #
2599
2687
  # @param [ProjectOAuthProviderId] provider_id OAuth2 provider key. For example: github, google, apple.
2600
2688
  #
2601
- # @return [OAuth2Github, OAuth2Discord, OAuth2Figma, OAuth2Dropbox, OAuth2Dailymotion, OAuth2Bitbucket, OAuth2Bitly, OAuth2Box, OAuth2Autodesk, OAuth2Google, OAuth2Zoom, OAuth2Zoho, OAuth2Yandex, OAuth2X, OAuth2WordPress, OAuth2Webflow, OAuth2Twitch, OAuth2Stripe, OAuth2Spotify, OAuth2Slack, OAuth2Podio, OAuth2Notion, OAuth2Salesforce, OAuth2Yahoo, OAuth2HuggingFace, OAuth2Resend, OAuth2Cloudflare, OAuth2Linkedin, OAuth2Disqus, OAuth2Amazon, OAuth2Etsy, OAuth2Facebook, OAuth2Tradeshift, OAuth2Paypal, OAuth2Gitlab, OAuth2Authentik, OAuth2Auth0, OAuth2FusionAuth, OAuth2Keycloak, OAuth2Oidc, OAuth2Apple, OAuth2Okta, OAuth2Kick, OAuth2Microsoft, OAuth2TikTok, OAuth2Kakao]
2689
+ # @return [OAuth2Github, OAuth2Discord, OAuth2Figma, OAuth2Dropbox, OAuth2Dailymotion, OAuth2Bitbucket, OAuth2Bitly, OAuth2Box, OAuth2Autodesk, OAuth2Google, OAuth2Zoom, OAuth2Zoho, OAuth2Yandex, OAuth2X, OAuth2WordPress, OAuth2Webflow, OAuth2Twitch, OAuth2Stripe, OAuth2Spotify, OAuth2Slack, OAuth2Podio, OAuth2Notion, OAuth2Salesforce, OAuth2Yahoo, OAuth2HuggingFace, OAuth2Resend, OAuth2Cloudflare, OAuth2Linkedin, OAuth2Disqus, OAuth2Amazon, OAuth2Etsy, OAuth2Facebook, OAuth2Tradeshift, OAuth2Paypal, OAuth2Gitlab, OAuth2Authentik, OAuth2Auth0, OAuth2FusionAuth, OAuth2Keycloak, OAuth2Oidc, OAuth2Apple, OAuth2Okta, OAuth2Kick, OAuth2Microsoft, OAuth2TikTok, OAuth2Kakao, OAuth2Vipps]
2602
2690
  def get_o_auth2_provider(
2603
2691
  provider_id:
2604
2692
  )
@@ -2607,7 +2695,7 @@ module Appwrite
2607
2695
  end
2608
2696
 
2609
2697
  api_path = '/project/oauth2/{providerId}'
2610
- .gsub('{providerId}', provider_id)
2698
+ .gsub('{providerId}', @client.encode_path(provider_id))
2611
2699
 
2612
2700
  api_params = {}
2613
2701
 
@@ -2787,11 +2875,21 @@ module Appwrite
2787
2875
  return Models::OAuth2Facebook.from(map: response)
2788
2876
  end
2789
2877
 
2878
+ if response['$id'] == 'tradeshift'
2879
+
2880
+ return Models::OAuth2Tradeshift.from(map: response)
2881
+ end
2882
+
2790
2883
  if response['$id'] == 'tradeshiftBox'
2791
2884
 
2792
2885
  return Models::OAuth2Tradeshift.from(map: response)
2793
2886
  end
2794
2887
 
2888
+ if response['$id'] == 'paypal'
2889
+
2890
+ return Models::OAuth2Paypal.from(map: response)
2891
+ end
2892
+
2795
2893
  if response['$id'] == 'paypalSandbox'
2796
2894
 
2797
2895
  return Models::OAuth2Paypal.from(map: response)
@@ -2857,6 +2955,16 @@ module Appwrite
2857
2955
  return Models::OAuth2Kakao.from(map: response)
2858
2956
  end
2859
2957
 
2958
+ if response['$id'] == 'vipps'
2959
+
2960
+ return Models::OAuth2Vipps.from(map: response)
2961
+ end
2962
+
2963
+ if response['$id'] == 'vippsSandbox'
2964
+
2965
+ return Models::OAuth2Vipps.from(map: response)
2966
+ end
2967
+
2860
2968
  raise Exception, "Unable to match response to any expected response model"
2861
2969
  end
2862
2970
 
@@ -2972,7 +3080,7 @@ module Appwrite
2972
3080
  end
2973
3081
 
2974
3082
  api_path = '/project/platforms/android/{platformId}'
2975
- .gsub('{platformId}', platform_id)
3083
+ .gsub('{platformId}', @client.encode_path(platform_id))
2976
3084
 
2977
3085
  api_params = {
2978
3086
  name: name,
@@ -3070,7 +3178,7 @@ module Appwrite
3070
3178
  end
3071
3179
 
3072
3180
  api_path = '/project/platforms/apple/{platformId}'
3073
- .gsub('{platformId}', platform_id)
3181
+ .gsub('{platformId}', @client.encode_path(platform_id))
3074
3182
 
3075
3183
  api_params = {
3076
3184
  name: name,
@@ -3167,7 +3275,7 @@ module Appwrite
3167
3275
  end
3168
3276
 
3169
3277
  api_path = '/project/platforms/linux/{platformId}'
3170
- .gsub('{platformId}', platform_id)
3278
+ .gsub('{platformId}', @client.encode_path(platform_id))
3171
3279
 
3172
3280
  api_params = {
3173
3281
  name: name,
@@ -3264,7 +3372,7 @@ module Appwrite
3264
3372
  end
3265
3373
 
3266
3374
  api_path = '/project/platforms/web/{platformId}'
3267
- .gsub('{platformId}', platform_id)
3375
+ .gsub('{platformId}', @client.encode_path(platform_id))
3268
3376
 
3269
3377
  api_params = {
3270
3378
  name: name,
@@ -3361,7 +3469,7 @@ module Appwrite
3361
3469
  end
3362
3470
 
3363
3471
  api_path = '/project/platforms/windows/{platformId}'
3364
- .gsub('{platformId}', platform_id)
3472
+ .gsub('{platformId}', @client.encode_path(platform_id))
3365
3473
 
3366
3474
  api_params = {
3367
3475
  name: name,
@@ -3397,7 +3505,7 @@ module Appwrite
3397
3505
  end
3398
3506
 
3399
3507
  api_path = '/project/platforms/{platformId}'
3400
- .gsub('{platformId}', platform_id)
3508
+ .gsub('{platformId}', @client.encode_path(platform_id))
3401
3509
 
3402
3510
  api_params = {}
3403
3511
 
@@ -3459,7 +3567,7 @@ module Appwrite
3459
3567
  end
3460
3568
 
3461
3569
  api_path = '/project/platforms/{platformId}'
3462
- .gsub('{platformId}', platform_id)
3570
+ .gsub('{platformId}', @client.encode_path(platform_id))
3463
3571
 
3464
3572
  api_params = {}
3465
3573
 
@@ -3508,6 +3616,42 @@ module Appwrite
3508
3616
  )
3509
3617
  end
3510
3618
 
3619
+ # Update whether account devices are enabled for the project. When enabled, a
3620
+ # browser can create an account device that holds multiple sessions and
3621
+ # switch between them. When disabled, account devices can no longer be
3622
+ # created, so each browser is limited to a single active session.
3623
+ #
3624
+ # @param [] enabled Set to true to allow account devices, or false to disable them for this project.
3625
+ #
3626
+ # @return [Project]
3627
+ def update_account_devices_policy(
3628
+ enabled:
3629
+ )
3630
+ if enabled.nil?
3631
+ raise Appwrite::Exception.new('Missing required parameter: "enabled"')
3632
+ end
3633
+
3634
+ api_path = '/project/policies/account-devices'
3635
+
3636
+ api_params = {
3637
+ enabled: enabled,
3638
+ }
3639
+
3640
+ api_headers = {
3641
+ "X-Appwrite-Project": @client.get_config('project'),
3642
+ "content-type": 'application/json',
3643
+ "accept": 'application/json',
3644
+ }
3645
+
3646
+ @client.call(
3647
+ method: 'PATCH',
3648
+ path: api_path,
3649
+ headers: api_headers,
3650
+ params: api_params,
3651
+ response_type: Models::Project
3652
+ )
3653
+ end
3654
+
3511
3655
  # Configures if aliased emails such as subaddresses and emails with suffixes
3512
3656
  # are denied during new users sign-ups and email updates.
3513
3657
  #
@@ -3644,6 +3788,41 @@ module Appwrite
3644
3788
  )
3645
3789
  end
3646
3790
 
3791
+ # Configures if guests, connections without a signed-in user, may subscribe
3792
+ # to realtime channels. When enabled, a guest can still connect and sign in
3793
+ # over the connection, but cannot subscribe until it does.
3794
+ #
3795
+ # @param [] enabled Set whether or not to stop guests from subscribing to realtime channels.
3796
+ #
3797
+ # @return [Project]
3798
+ def update_deny_realtime_guests_policy(
3799
+ enabled:
3800
+ )
3801
+ if enabled.nil?
3802
+ raise Appwrite::Exception.new('Missing required parameter: "enabled"')
3803
+ end
3804
+
3805
+ api_path = '/project/policies/deny-realtime-guests'
3806
+
3807
+ api_params = {
3808
+ enabled: enabled,
3809
+ }
3810
+
3811
+ api_headers = {
3812
+ "X-Appwrite-Project": @client.get_config('project'),
3813
+ "content-type": 'application/json',
3814
+ "accept": 'application/json',
3815
+ }
3816
+
3817
+ @client.call(
3818
+ method: 'PATCH',
3819
+ path: api_path,
3820
+ headers: api_headers,
3821
+ params: api_params,
3822
+ response_type: Models::Project
3823
+ )
3824
+ end
3825
+
3647
3826
  # Updating this policy allows you to control if team members can see other
3648
3827
  # members information. When enabled, all team members can see ID, name,
3649
3828
  # email, phone number, and MFA status of other members..
@@ -4201,9 +4380,9 @@ module Appwrite
4201
4380
  # Get a policy by its unique ID. This endpoint returns the current
4202
4381
  # configuration for the requested project policy.
4203
4382
  #
4204
- # @param [ProjectPolicyId] policy_id Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, password-pwned, password-rotation, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, mfa-factors, deny-aliased-email, deny-disposable-email, deny-free-email, deny-corporate-email, passkey.
4383
+ # @param [ProjectPolicyId] policy_id Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, password-pwned, password-rotation, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, mfa-factors, deny-aliased-email, deny-disposable-email, deny-free-email, deny-corporate-email, deny-realtime-guests, passkey, account-devices.
4205
4384
  #
4206
- # @return [PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicyPasswordPwned, PolicyPasswordRotation, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyMfaFactors, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail, PolicyDenyCorporateEmail, PolicyPasskey]
4385
+ # @return [PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicyPasswordPwned, PolicyPasswordRotation, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyMfaFactors, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail, PolicyDenyCorporateEmail, PolicyDenyRealtimeGuests, PolicyPasskey, PolicyAccountDevices]
4207
4386
  def get_policy(
4208
4387
  policy_id:
4209
4388
  )
@@ -4212,7 +4391,7 @@ module Appwrite
4212
4391
  end
4213
4392
 
4214
4393
  api_path = '/project/policies/{policyId}'
4215
- .gsub('{policyId}', policy_id)
4394
+ .gsub('{policyId}', @client.encode_path(policy_id))
4216
4395
 
4217
4396
  api_params = {}
4218
4397
 
@@ -4317,14 +4496,83 @@ module Appwrite
4317
4496
  return Models::PolicyDenyCorporateEmail.from(map: response)
4318
4497
  end
4319
4498
 
4499
+ if response['$id'] == 'deny-realtime-guests'
4500
+
4501
+ return Models::PolicyDenyRealtimeGuests.from(map: response)
4502
+ end
4503
+
4320
4504
  if response['$id'] == 'passkey'
4321
4505
 
4322
4506
  return Models::PolicyPasskey.from(map: response)
4323
4507
  end
4324
4508
 
4509
+ if response['$id'] == 'account-devices'
4510
+
4511
+ return Models::PolicyAccountDevices.from(map: response)
4512
+ end
4513
+
4325
4514
  raise Exception, "Unable to match response to any expected response model"
4326
4515
  end
4327
4516
 
4517
+ # Get the project preferences. Preferences are a key-value object stored on
4518
+ # the project for anyone working on it.
4519
+ #
4520
+ #
4521
+ # @return [Preferences]
4522
+ def get_prefs()
4523
+ api_path = '/project/prefs'
4524
+
4525
+ api_params = {}
4526
+
4527
+ api_headers = {
4528
+ "X-Appwrite-Project": @client.get_config('project'),
4529
+ "accept": 'application/json',
4530
+ }
4531
+
4532
+ @client.call(
4533
+ method: 'GET',
4534
+ path: api_path,
4535
+ headers: api_headers,
4536
+ params: api_params,
4537
+ response_type: Models::Preferences
4538
+ )
4539
+ end
4540
+
4541
+ # Update the project preferences. The object you pass is stored as is and
4542
+ # replaces any previous value. The maximum allowed prefs size is 64kB and
4543
+ # throws an error if exceeded.
4544
+ #
4545
+ # @param [Hash] prefs Prefs key-value JSON object.
4546
+ #
4547
+ # @return [Preferences]
4548
+ def update_prefs(
4549
+ prefs:
4550
+ )
4551
+ if prefs.nil?
4552
+ raise Appwrite::Exception.new('Missing required parameter: "prefs"')
4553
+ end
4554
+
4555
+ api_path = '/project/prefs'
4556
+
4557
+ api_params = {
4558
+ prefs: prefs,
4559
+ }
4560
+
4561
+ api_headers = {
4562
+ "X-Appwrite-Project": @client.get_config('project'),
4563
+ "content-type": 'application/json',
4564
+ "accept": 'application/json',
4565
+ }
4566
+
4567
+ @client.call(
4568
+ method: 'PUT',
4569
+ path: api_path,
4570
+ headers: api_headers,
4571
+ params: api_params,
4572
+ response_type: Models::Preferences
4573
+ )
4574
+ end
4575
+
4328
4576
  # Update properties of a specific protocol. Use this endpoint to enable or
4329
4577
  # disable a protocol in your project.
4330
4578
  #
@@ -4345,7 +4593,7 @@ module Appwrite
4345
4593
  end
4346
4594
 
4347
4595
  api_path = '/project/protocols/{protocolId}'
4348
- .gsub('{protocolId}', protocol_id)
4596
+ .gsub('{protocolId}', @client.encode_path(protocol_id))
4349
4597
 
4350
4598
  api_params = {
4351
4599
  enabled: enabled,
@@ -4386,7 +4634,7 @@ module Appwrite
4386
4634
  end
4387
4635
 
4388
4636
  api_path = '/project/services/{serviceId}'
4389
- .gsub('{serviceId}', service_id)
4637
+ .gsub('{serviceId}', @client.encode_path(service_id))
4390
4638
 
4391
4639
  api_params = {
4392
4640
  enabled: enabled,
@@ -4407,6 +4655,32 @@ module Appwrite
4407
4655
  )
4408
4656
  end
4409
4657
 
4658
+ # Delete all sessions in the project. Any session created before this request
4659
+ # will be invalidated immediately: users will be signed out of every active
4660
+ # client (web, mobile, server SDKs, JWTs), and will be able to sign in again
4661
+ # afterwards. API keys are not affected by this action.
4662
+ #
4663
+ #
4664
+ # @return []
4665
+ def delete_sessions()
4666
+ api_path = '/project/sessions'
4667
+
4668
+ api_params = {}
4669
+
4670
+ api_headers = {
4671
+ "X-Appwrite-Project": @client.get_config('project'),
4672
+ "content-type": 'application/json',
4673
+ "accept": 'application/json',
4674
+ }
4675
+
4676
+ @client.call(
4677
+ method: 'DELETE',
4678
+ path: api_path,
4679
+ headers: api_headers,
4680
+ params: api_params,
4681
+ )
4682
+ end
4683
+
4410
4684
  # Update the SMTP configuration for your project. Use this endpoint to
4411
4685
  # configure your project's SMTP provider with your custom settings for
4412
4686
  # sending transactional emails.
@@ -4602,7 +4876,7 @@ module Appwrite
4602
4876
  end
4603
4877
 
4604
4878
  api_path = '/project/templates/email/{templateId}'
4605
- .gsub('{templateId}', template_id)
4879
+ .gsub('{templateId}', @client.encode_path(template_id))
4606
4880
 
4607
4881
  api_params = {
4608
4882
  locale: locale,
@@ -4720,7 +4994,7 @@ module Appwrite
4720
4994
  end
4721
4995
 
4722
4996
  api_path = '/project/variables/{variableId}'
4723
- .gsub('{variableId}', variable_id)
4997
+ .gsub('{variableId}', @client.encode_path(variable_id))
4724
4998
 
4725
4999
  api_params = {}
4726
5000
 
@@ -4759,7 +5033,7 @@ module Appwrite
4759
5033
  end
4760
5034
 
4761
5035
  api_path = '/project/variables/{variableId}'
4762
- .gsub('{variableId}', variable_id)
5036
+ .gsub('{variableId}', @client.encode_path(variable_id))
4763
5037
 
4764
5038
  api_params = {
4765
5039
  key: key,
@@ -4796,7 +5070,7 @@ module Appwrite
4796
5070
  end
4797
5071
 
4798
5072
  api_path = '/project/variables/{variableId}'
4799
- .gsub('{variableId}', variable_id)
5073
+ .gsub('{variableId}', @client.encode_path(variable_id))
4800
5074
 
4801
5075
  api_params = {}
4802
5076