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
@@ -317,24 +317,44 @@ module Appwrite
317
317
 
318
318
  # Create and trigger a new restoration for a backup on a project.
319
319
  #
320
- # When restoring a DocumentsDB or VectorsDB database to a new resource, pass
321
- # `newSpecification` to provision the restored database on a different
322
- # specification than the archived one (for example, restoring onto a larger
323
- # or smaller dedicated database). Use `serverless` to restore onto the shared
324
- # pool, or a dedicated specification slug to restore onto a dedicated
325
- # database of that size. The specification must be permitted by the
326
- # organization's plan. `newSpecification` is not supported for
327
- # legacy/TablesDB databases or for bucket restores.
320
+ # For a backup of one database, the restoration resolves its destination
321
+ # before it is queued. When `newResourceId` is omitted, the archived database
322
+ # is restored in place and its own ID is returned in `options`. Pass a
323
+ # different `newResourceId` to restore alongside it as a new database
324
+ # instead.
325
+ #
326
+ # The restoration migration records the archived database in `resourceId` and
327
+ # `resourceType`, and the resolved database in `destinationResourceId` and
328
+ # `destinationResourceType`. Database types are stored canonically as
329
+ # `database`, `documentsdb`, or `vectorsdb`. Project-wide restorations leave
330
+ # these fields empty because they do not have a single source or destination
331
+ # database.
332
+ #
333
+ # To list every migration related to one database, use its canonical type in
334
+ # a nested `OR(AND(...), AND(...), AND(...))` across the root, parent, and
335
+ # destination relation pairs: `(resourceType, resourceId)`,
336
+ # `(parentResourceType, parentResourceId)`, and `(destinationResourceType,
337
+ # destinationResourceId)`. Legacy and TablesDB databases use `database`; the
338
+ # operational `resourceType` of a table migration is not rewritten to
339
+ # `tablesdb`.
340
+ #
341
+ # When restoring a DocumentsDB or VectorsDB database from a dedicated source,
342
+ # the restore provisions a fresh dedicated backing database at the source
343
+ # database's own specification and lands the data there. An in-place restore
344
+ # swaps the database onto that backing only once the restore has succeeded,
345
+ # and retires the backing it displaced only once that swap is confirmed, so
346
+ # the source keeps serving its own data until the restored data is in place
347
+ # and any failure leaves it untouched. A serverless source has no dedicated
348
+ # backing to clone and restores onto the archived database instead.
328
349
  #
329
350
  #
330
351
  # @param [String] archive_id Backup archive ID to restore
331
352
  # @param [Array] services Array of services to restore
332
- # @param [String] new_resource_id Unique 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.
353
+ # @param [String] new_resource_id Destination resource ID. Omit to restore the archived resource in place, or pass a different ID to restore alongside it as a new resource. 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.
333
354
  # @param [String] new_resource_name Database name. Max length: 128 chars.
334
- # @param [String] new_specification Specification to provision the restored database on, when restoring a DocumentsDB or VectorsDB database to a new resource. Defaults to the archived database's specification. Use `serverless` for the shared pool or a dedicated specification slug.
335
355
  #
336
356
  # @return [BackupRestoration]
337
- def create_restoration(archive_id:, services:, new_resource_id: nil, new_resource_name: nil, new_specification: nil)
357
+ def create_restoration(archive_id:, services:, new_resource_id: nil, new_resource_name: nil)
338
358
  api_path = '/backups/restoration'
339
359
 
340
360
  if archive_id.nil?
@@ -350,7 +370,6 @@ module Appwrite
350
370
  services: services,
351
371
  newResourceId: new_resource_id,
352
372
  newResourceName: new_resource_name,
353
- newSpecification: new_specification,
354
373
  }
355
374
 
356
375
  api_headers = {
@@ -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)