appwrite 26.1.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 (46) 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/embedding_model.rb +10 -0
  6. data/lib/appwrite/enums/invalidation_type.rb +9 -0
  7. data/lib/appwrite/enums/project_key_scopes.rb +2 -0
  8. data/lib/appwrite/enums/project_policy_id.rb +1 -0
  9. data/lib/appwrite/enums/runtime.rb +1 -0
  10. data/lib/appwrite/models/billing_plan.rb +4 -4
  11. data/lib/appwrite/models/billing_plan_addon.rb +6 -6
  12. data/lib/appwrite/models/billing_plan_addon_details.rb +1 -1
  13. data/lib/appwrite/models/database_migration.rb +102 -0
  14. data/lib/appwrite/models/database_migration_list.rb +32 -0
  15. data/lib/appwrite/models/database_status.rb +30 -0
  16. data/lib/appwrite/models/dedicated_database.rb +0 -5
  17. data/lib/appwrite/models/dedicated_database_member.rb +1 -1
  18. data/lib/appwrite/models/dedicated_database_operation.rb +77 -0
  19. data/lib/appwrite/models/dedicated_database_operation_list.rb +32 -0
  20. data/lib/appwrite/models/dedicated_database_replicas.rb +25 -0
  21. data/lib/appwrite/models/dedicated_database_specification_pricing.rb +0 -5
  22. data/lib/appwrite/models/embedding.rb +42 -0
  23. data/lib/appwrite/models/embedding_list.rb +32 -0
  24. data/lib/appwrite/models/file.rb +10 -0
  25. data/lib/appwrite/models/mfa_challenge_secret.rb +47 -0
  26. data/lib/appwrite/models/mfa_factors.rb +8 -3
  27. data/lib/appwrite/models/organization.rb +12 -12
  28. data/lib/appwrite/models/policy_mfa_factors.rb +47 -0
  29. data/lib/appwrite/models/project.rb +5 -0
  30. data/lib/appwrite/models/proxy_invalidation.rb +42 -0
  31. data/lib/appwrite/models/usage_billing_plan.rb +9 -9
  32. data/lib/appwrite/services/account.rb +1 -33
  33. data/lib/appwrite/services/activities.rb +1 -1
  34. data/lib/appwrite/services/apps.rb +52 -10
  35. data/lib/appwrite/services/backups.rb +13 -7
  36. data/lib/appwrite/services/databases.rb +4 -4
  37. data/lib/appwrite/services/embeddings.rb +48 -0
  38. data/lib/appwrite/services/functions.rb +1 -1
  39. data/lib/appwrite/services/project.rb +52 -57
  40. data/lib/appwrite/services/proxy.rb +44 -0
  41. data/lib/appwrite/services/sites.rb +1 -1
  42. data/lib/appwrite/services/storage.rb +4 -2
  43. data/lib/appwrite/services/tables_db.rb +247 -7
  44. data/lib/appwrite/services/users.rb +38 -0
  45. data/lib/appwrite.rb +12 -0
  46. metadata +14 -2
@@ -453,7 +453,7 @@ module Appwrite
453
453
  # @param [Array] permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
454
454
  # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
455
455
  # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
456
- # @param [Array] attributes Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options.
456
+ # @param [Array] attributes Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, varchar, text, mediumtext, longtext, integer, bigint, double, boolean, datetime, point, linestring, polygon, email, url, ip, enum), size (integer, required for string and varchar types), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options.
457
457
  # @param [Array] indexes Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional).
458
458
  #
459
459
  # @return [Collection]
@@ -2275,11 +2275,11 @@ module Appwrite
2275
2275
  # @param [String] database_id Database ID.
2276
2276
  # @param [String] collection_id Collection ID.
2277
2277
  # @param [String] related_collection_id Related Collection ID.
2278
- # @param [RelationshipType] type Relation type
2278
+ # @param [RelationshipType] type Relationship type. Possible values are: oneToOne, oneToMany, manyToOne, manyToMany.
2279
2279
  # @param [] two_way Is Two Way?
2280
2280
  # @param [String] key Attribute Key.
2281
2281
  # @param [String] two_way_key Two Way Attribute Key.
2282
- # @param [RelationMutate] on_delete Constraints option
2282
+ # @param [RelationMutate] on_delete Delete constraint. Possible values are: cascade, restrict, setNull.
2283
2283
  #
2284
2284
  # @return [AttributeRelationship]
2285
2285
  def create_relationship_attribute(database_id:, collection_id:, related_collection_id:, type:, two_way: nil, key: nil, two_way_key: nil, on_delete: nil)
@@ -2338,7 +2338,7 @@ module Appwrite
2338
2338
  # @param [String] database_id Database ID.
2339
2339
  # @param [String] collection_id Collection ID.
2340
2340
  # @param [String] key Attribute Key.
2341
- # @param [RelationMutate] on_delete Constraints option
2341
+ # @param [RelationMutate] on_delete Delete constraint. Possible values are: cascade, restrict, setNull.
2342
2342
  # @param [String] new_key New Attribute Key.
2343
2343
  #
2344
2344
  # @return [AttributeRelationship]
@@ -0,0 +1,48 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ class Embeddings < Service
5
+
6
+ def initialize(client)
7
+ @client = client
8
+ end
9
+
10
+ # Generate vector embeddings for an array of text using the selected
11
+ # embedding model. Use the returned vectors to power semantic search and
12
+ # similarity queries against your vector collections.
13
+ #
14
+ #
15
+ # @param [Array] texts Array of text to generate embeddings.
16
+ # @param [EmbeddingModel] model The embedding model to use for generating vector embeddings.
17
+ #
18
+ # @return [EmbeddingList]
19
+ def create_text_embeddings(texts:, model: nil)
20
+ api_path = '/embeddings/text'
21
+
22
+ if texts.nil?
23
+ raise Appwrite::Exception.new('Missing required parameter: "texts"')
24
+ end
25
+
26
+ api_params = {
27
+ texts: texts,
28
+ model: model,
29
+ }
30
+
31
+ api_headers = {
32
+ "X-Appwrite-Project": @client.get_config('project'),
33
+ "content-type": 'application/json',
34
+ "accept": 'application/json',
35
+ }
36
+
37
+ @client.call(
38
+ method: 'POST',
39
+ path: api_path,
40
+ headers: api_headers,
41
+ params: api_params,
42
+ response_type: Models::EmbeddingList
43
+ )
44
+
45
+ end
46
+
47
+ end
48
+ end
@@ -151,7 +151,7 @@ module Appwrite
151
151
 
152
152
  # List allowed function specifications for this instance.
153
153
  #
154
- # @param [String] type Specification type to list. Can be one of: runtimes, builds.
154
+ # @param [String] type Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes.
155
155
  #
156
156
  # @return [SpecificationList]
157
157
  def list_specifications(type: nil)
@@ -123,56 +123,6 @@ module Appwrite
123
123
 
124
124
  end
125
125
 
126
- # Create a new API key. It's recommended to have multiple API keys with
127
- # strict scopes for separate functions within your project.
128
- #
129
- # You can also create an ephemeral API key if you need a short-lived key
130
- # instead.
131
- #
132
- # @param [String] key_id Key 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.
133
- # @param [String] name Key name. Max length: 128 chars.
134
- # @param [Array] scopes Key scopes list. Maximum of 200 scopes are allowed.
135
- # @param [String] expire Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.
136
- #
137
- # @return [Key]
138
- def create_key(key_id:, name:, scopes:, expire: nil)
139
- api_path = '/project/keys'
140
-
141
- if key_id.nil?
142
- raise Appwrite::Exception.new('Missing required parameter: "keyId"')
143
- end
144
-
145
- if name.nil?
146
- raise Appwrite::Exception.new('Missing required parameter: "name"')
147
- end
148
-
149
- if scopes.nil?
150
- raise Appwrite::Exception.new('Missing required parameter: "scopes"')
151
- end
152
-
153
- api_params = {
154
- keyId: key_id,
155
- name: name,
156
- scopes: scopes,
157
- expire: expire,
158
- }
159
-
160
- api_headers = {
161
- "X-Appwrite-Project": @client.get_config('project'),
162
- "content-type": 'application/json',
163
- "accept": 'application/json',
164
- }
165
-
166
- @client.call(
167
- method: 'POST',
168
- path: api_path,
169
- headers: api_headers,
170
- params: api_params,
171
- response_type: Models::Key
172
- )
173
-
174
- end
175
-
176
126
  # Create a new ephemeral API key. It's recommended to have multiple API keys
177
127
  # with strict scopes for separate functions within your project.
178
128
  #
@@ -576,9 +526,10 @@ module Appwrite
576
526
  # @param [String] user_code_format Character set for device flow user codes: `numeric` (digits only — best for numeric keypads and TV remotes), `alphabetic` (letters only), or `alphanumeric` (letters and digits — highest entropy per character). Defaults to `alphanumeric`.
577
527
  # @param [Integer] device_code_duration Lifetime in seconds of device flow device codes and user codes. Device codes are intentionally short-lived. Leave empty to use default 600.
578
528
  # @param [Array] default_scopes List of OAuth2 scopes used when an authorization request omits the scope parameter. Every default scope must also be allowed by the OAuth2 server. Maximum of 100 scopes are allowed, each up to 128 characters long.
529
+ # @param [Array] installation_scopes List of scopes an application may request when installed on a team. Omitting the parameter clears the list, so no installation scopes can be granted. Maximum of 100 scopes are allowed, each up to 128 characters long.
579
530
  #
580
531
  # @return [Project]
581
- def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, authorization_details_types: nil, access_token_duration: nil, refresh_token_duration: nil, public_access_token_duration: nil, public_refresh_token_duration: nil, installation_access_token_duration: nil, confidential_pkce: nil, verification_url: nil, user_code_length: nil, user_code_format: nil, device_code_duration: nil, default_scopes: nil)
532
+ def update_o_auth2_server(enabled:, authorization_url:, scopes: nil, authorization_details_types: nil, access_token_duration: nil, refresh_token_duration: nil, public_access_token_duration: nil, public_refresh_token_duration: nil, installation_access_token_duration: nil, confidential_pkce: nil, verification_url: nil, user_code_length: nil, user_code_format: nil, device_code_duration: nil, default_scopes: nil, installation_scopes: nil)
582
533
  api_path = '/project/oauth2-server'
583
534
 
584
535
  if enabled.nil?
@@ -605,6 +556,7 @@ module Appwrite
605
556
  userCodeFormat: user_code_format,
606
557
  deviceCodeDuration: device_code_duration,
607
558
  defaultScopes: default_scopes,
559
+ installationScopes: installation_scopes,
608
560
  }
609
561
 
610
562
  api_headers = {
@@ -3051,6 +3003,44 @@ module Appwrite
3051
3003
 
3052
3004
  end
3053
3005
 
3006
+ # Updating this policy allows you to control which factors users can use to
3007
+ # complete an MFA challenge. Disabled factors cannot be used to create a
3008
+ # challenge and are reported as unavailable when listing factors. The custom
3009
+ # factor is disabled by default; enable it to deliver challenge codes through
3010
+ # your own channel. Recovery codes always remain available as a fallback.
3011
+ #
3012
+ # @param [] totp Set to true to allow TOTP to complete an MFA challenge, or false to disable it.
3013
+ # @param [] email Set to true to allow email to complete an MFA challenge, or false to disable it.
3014
+ # @param [] phone Set to true to allow phone (SMS) to complete an MFA challenge, or false to disable it.
3015
+ # @param [] custom Set to true to allow the custom factor to complete an MFA challenge, or false to disable it.
3016
+ #
3017
+ # @return [Project]
3018
+ def update_mfa_factors_policy(totp: nil, email: nil, phone: nil, custom: nil)
3019
+ api_path = '/project/policies/mfa-factors'
3020
+
3021
+ api_params = {
3022
+ totp: totp,
3023
+ email: email,
3024
+ phone: phone,
3025
+ custom: custom,
3026
+ }
3027
+
3028
+ api_headers = {
3029
+ "X-Appwrite-Project": @client.get_config('project'),
3030
+ "content-type": 'application/json',
3031
+ "accept": 'application/json',
3032
+ }
3033
+
3034
+ @client.call(
3035
+ method: 'PATCH',
3036
+ path: api_path,
3037
+ headers: api_headers,
3038
+ params: api_params,
3039
+ response_type: Models::Project
3040
+ )
3041
+
3042
+ end
3043
+
3054
3044
  # Updating this policy allows you to control if new passwords are checked
3055
3045
  # against most common passwords dictionary. When enabled, and user changes
3056
3046
  # their password, password must not be contained in the dictionary.
@@ -3095,7 +3085,7 @@ module Appwrite
3095
3085
  # users, and it will only start to collect and enforce the policy on password
3096
3086
  # changes since the policy is enabled.
3097
3087
  #
3098
- # @param [Integer] total Set the password history length per user. Value can be between 1 and 5000, or null to disable the limit.
3088
+ # @param [Integer] total Set the password history length per user. Value can be between 1 and 20, or null to disable the limit.
3099
3089
  #
3100
3090
  # @return [Project]
3101
3091
  def update_password_history_policy(total:)
@@ -3235,7 +3225,7 @@ module Appwrite
3235
3225
  # Update maximum duration how long sessions created within a project should
3236
3226
  # stay active for.
3237
3227
  #
3238
- # @param [Integer] duration Maximum session length in seconds. Minium allowed value is 5 second, and maximum is 1 year, which is 31536000 seconds.
3228
+ # @param [Integer] duration Maximum session length in seconds. Minium allowed value is 60 seconds, and maximum is 1 year, which is 31536000 seconds.
3239
3229
  #
3240
3230
  # @return [Project]
3241
3231
  def update_session_duration_policy(duration:)
@@ -3302,7 +3292,7 @@ module Appwrite
3302
3292
  # Update the maximum number of sessions allowed per user. When the limit is
3303
3293
  # hit, the oldest session will be deleted to make room for new one.
3304
3294
  #
3305
- # @param [Integer] total Set the maximum number of sessions allowed per user. Value can be between 1 and 5000, or null to disable the limit.
3295
+ # @param [Integer] total Set the maximum number of sessions allowed per user. Value can be between 1 and 100.
3306
3296
  #
3307
3297
  # @return [Project]
3308
3298
  def update_session_limit_policy(total:)
@@ -3336,7 +3326,7 @@ module Appwrite
3336
3326
  # amount of existing users already exceeded the limit, all users remain
3337
3327
  # active, but new user sign up will be prohibited.
3338
3328
  #
3339
- # @param [Integer] total Set the maximum number of users allowed in the project. Value can be between 1 and 5000, or null to disable the limit.
3329
+ # @param [Integer] total Set the maximum number of users allowed in the project. Value can be between 0 and 10000. Use 0 or null to disable the limit.
3340
3330
  #
3341
3331
  # @return [Project]
3342
3332
  def update_user_limit_policy(total:)
@@ -3369,9 +3359,9 @@ module Appwrite
3369
3359
  # Get a policy by its unique ID. This endpoint returns the current
3370
3360
  # configuration for the requested project policy.
3371
3361
  #
3372
- # @param [ProjectPolicyId] policy_id Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email, deny-corporate-email.
3362
+ # @param [ProjectPolicyId] policy_id Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, 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.
3373
3363
  #
3374
- # @return [PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail, PolicyDenyCorporateEmail]
3364
+ # @return [PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyMfaFactors, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail, PolicyDenyCorporateEmail]
3375
3365
  def get_policy(policy_id:)
3376
3366
  api_path = '/project/policies/{policyId}'
3377
3367
  .gsub('{policyId}', policy_id)
@@ -3449,6 +3439,11 @@ module Appwrite
3449
3439
  return Models::PolicyMembershipPrivacy.from(map: response)
3450
3440
  end
3451
3441
 
3442
+ if response['$id'] == 'mfa-factors'
3443
+
3444
+ return Models::PolicyMfaFactors.from(map: response)
3445
+ end
3446
+
3452
3447
  if response['$id'] == 'deny-aliased-email'
3453
3448
 
3454
3449
  return Models::PolicyDenyAliasedEmail.from(map: response)
@@ -7,6 +7,50 @@ module Appwrite
7
7
  @client = client
8
8
  end
9
9
 
10
+ # Create a new CDN cache invalidation for a domain. Executes a hard purge of
11
+ # cached content.
12
+ #
13
+ # Depending on type, the invalidation purges a single cache tag, a single URL
14
+ # path, or all cached content for the domain.
15
+ #
16
+ # @param [String] domain Domain name.
17
+ # @param [InvalidationType] type Type of reference passed. Allowed values are: tag, path, all
18
+ # @param [String] reference Reference to invalidate. Depending on type this can be: cache tag name (up to 128 characters), URL path (up to 2048 characters). Not required when type is all.
19
+ #
20
+ # @return [ProxyInvalidation]
21
+ def create_invalidation(domain:, type:, reference: nil)
22
+ api_path = '/proxy/invalidations'
23
+
24
+ if domain.nil?
25
+ raise Appwrite::Exception.new('Missing required parameter: "domain"')
26
+ end
27
+
28
+ if type.nil?
29
+ raise Appwrite::Exception.new('Missing required parameter: "type"')
30
+ end
31
+
32
+ api_params = {
33
+ domain: domain,
34
+ type: type,
35
+ reference: reference,
36
+ }
37
+
38
+ api_headers = {
39
+ "X-Appwrite-Project": @client.get_config('project'),
40
+ "content-type": 'application/json',
41
+ "accept": 'application/json',
42
+ }
43
+
44
+ @client.call(
45
+ method: 'POST',
46
+ path: api_path,
47
+ headers: api_headers,
48
+ params: api_params,
49
+ response_type: Models::ProxyInvalidation
50
+ )
51
+
52
+ end
53
+
10
54
  # Get a list of all the proxy rules. You can use the query params to filter
11
55
  # your results.
12
56
  #
@@ -155,7 +155,7 @@ module Appwrite
155
155
 
156
156
  # List allowed site specifications for this instance.
157
157
  #
158
- # @param [String] type Specification type to list. Can be one of: runtimes, builds.
158
+ # @param [String] type Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes.
159
159
  #
160
160
  # @return [SpecificationList]
161
161
  def list_specifications(type: nil)
@@ -217,7 +217,7 @@ module Appwrite
217
217
  # your results.
218
218
  #
219
219
  # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
220
- # @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, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded
220
+ # @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, folder, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded
221
221
  # @param [String] search Search term to filter your list results. Max length: 256 chars.
222
222
  # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
223
223
  #
@@ -274,9 +274,10 @@ module Appwrite
274
274
  # @param [String] file_id File 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.
275
275
  # @param [file] file Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file).
276
276
  # @param [Array] permissions An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
277
+ # @param [String] folder Virtual folder to place the file in, for example "photos/2026". Nest folders with `/`. Defaults to the bucket root.
277
278
  #
278
279
  # @return [File]
279
- def create_file(bucket_id:, file_id:, file:, permissions: nil, on_progress: nil)
280
+ def create_file(bucket_id:, file_id:, file:, permissions: nil, folder: nil, on_progress: nil)
280
281
  api_path = '/storage/buckets/{bucketId}/files'
281
282
  .gsub('{bucketId}', bucket_id)
282
283
 
@@ -296,6 +297,7 @@ module Appwrite
296
297
  fileId: file_id,
297
298
  file: file,
298
299
  permissions: permissions,
300
+ folder: folder,
299
301
  }
300
302
 
301
303
  api_headers = {