appwrite 10.1.2 → 11.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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +36 -7
  3. data/lib/appwrite/enums/authentication_factor.rb +10 -0
  4. data/lib/appwrite/enums/authenticator_type.rb +7 -0
  5. data/lib/appwrite/enums/browser.rb +20 -0
  6. data/lib/appwrite/enums/compression.rb +9 -0
  7. data/lib/appwrite/enums/credit_card.rb +22 -0
  8. data/lib/appwrite/enums/execution_method.rb +12 -0
  9. data/lib/appwrite/enums/flag.rb +200 -0
  10. data/lib/appwrite/enums/image_format.rb +11 -0
  11. data/lib/appwrite/enums/image_gravity.rb +15 -0
  12. data/lib/appwrite/enums/index_type.rb +9 -0
  13. data/lib/appwrite/enums/messaging_provider_type.rb +9 -0
  14. data/lib/appwrite/enums/name.rb +19 -0
  15. data/lib/appwrite/enums/o_auth_provider.rb +45 -0
  16. data/lib/appwrite/enums/password_hash.rb +17 -0
  17. data/lib/appwrite/enums/relation_mutate.rb +9 -0
  18. data/lib/appwrite/enums/relationship_type.rb +10 -0
  19. data/lib/appwrite/enums/runtime.rb +50 -0
  20. data/lib/appwrite/enums/smtp_encryption.rb +9 -0
  21. data/lib/appwrite/models/health_certificate.rb +52 -0
  22. data/lib/appwrite/models/jwt.rb +27 -0
  23. data/lib/appwrite/models/membership.rb +5 -0
  24. data/lib/appwrite/models/message.rb +87 -0
  25. data/lib/appwrite/models/message_list.rb +32 -0
  26. data/lib/appwrite/models/mfa_challenge.rb +42 -0
  27. data/lib/appwrite/models/mfa_factors.rb +37 -0
  28. data/lib/appwrite/models/mfa_recovery_codes.rb +27 -0
  29. data/lib/appwrite/models/mfa_type.rb +32 -0
  30. data/lib/appwrite/models/provider.rb +67 -0
  31. data/lib/appwrite/models/provider_list.rb +32 -0
  32. data/lib/appwrite/models/session.rb +18 -3
  33. data/lib/appwrite/models/subscriber.rb +67 -0
  34. data/lib/appwrite/models/subscriber_list.rb +32 -0
  35. data/lib/appwrite/models/target.rb +62 -0
  36. data/lib/appwrite/models/target_list.rb +32 -0
  37. data/lib/appwrite/models/token.rb +8 -3
  38. data/lib/appwrite/models/topic.rb +62 -0
  39. data/lib/appwrite/models/topic_list.rb +32 -0
  40. data/lib/appwrite/models/user.rb +10 -0
  41. data/lib/appwrite/query.rb +53 -28
  42. data/lib/appwrite/services/account.rb +935 -168
  43. data/lib/appwrite/services/avatars.rb +3 -3
  44. data/lib/appwrite/services/databases.rb +22 -16
  45. data/lib/appwrite/services/functions.rb +3 -3
  46. data/lib/appwrite/services/health.rb +138 -0
  47. data/lib/appwrite/services/messaging.rb +1886 -0
  48. data/lib/appwrite/services/storage.rb +4 -4
  49. data/lib/appwrite/services/teams.rb +1 -1
  50. data/lib/appwrite/services/users.rb +475 -4
  51. data/lib/appwrite.rb +36 -0
  52. metadata +37 -2
@@ -18,7 +18,7 @@ module Appwrite
18
18
  # image at source quality. If dimensions are not specified, the default size
19
19
  # of image returned is 100x100px.
20
20
  #
21
- # @param [String] code Browser Code.
21
+ # @param [Browser] code Browser Code.
22
22
  # @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
23
23
  # @param [Integer] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
24
24
  # @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
@@ -61,7 +61,7 @@ module Appwrite
61
61
  # of image returned is 100x100px.
62
62
  #
63
63
  #
64
- # @param [String] code Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.
64
+ # @param [CreditCard] code Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.
65
65
  # @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
66
66
  # @param [Integer] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
67
67
  # @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
@@ -136,7 +136,7 @@ module Appwrite
136
136
  # of image returned is 100x100px.
137
137
  #
138
138
  #
139
- # @param [String] code Country Code. ISO Alpha-2 country code format.
139
+ # @param [Flag] code Country Code. ISO Alpha-2 country code format.
140
140
  # @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
141
141
  # @param [Integer] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
142
142
  # @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
@@ -381,7 +381,7 @@ module Appwrite
381
381
  end
382
382
 
383
383
 
384
- #
384
+ # List attributes in the collection.
385
385
  #
386
386
  # @param [String] database_id Database ID.
387
387
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
@@ -472,7 +472,8 @@ module Appwrite
472
472
  end
473
473
 
474
474
 
475
- #
475
+ # Update a boolean attribute. Changing the `default` value will not update
476
+ # already existing documents.
476
477
  #
477
478
  # @param [String] database_id Database ID.
478
479
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
@@ -526,13 +527,13 @@ module Appwrite
526
527
  end
527
528
 
528
529
 
529
- #
530
+ # Create a date time attribute according to the ISO 8601 standard.
530
531
  #
531
532
  # @param [String] database_id Database ID.
532
533
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
533
534
  # @param [String] key Attribute Key.
534
535
  # @param [] required Is attribute required?
535
- # @param [String] default Default value for the attribute in ISO 8601 format. Cannot be set when attribute is required.
536
+ # @param [String] default Default value for the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required.
536
537
  # @param [] array Is attribute an array?
537
538
  #
538
539
  # @return [AttributeDatetime]
@@ -578,7 +579,8 @@ module Appwrite
578
579
  end
579
580
 
580
581
 
581
- #
582
+ # Update a date time attribute. Changing the `default` value will not update
583
+ # already existing documents.
582
584
  #
583
585
  # @param [String] database_id Database ID.
584
586
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
@@ -741,6 +743,8 @@ module Appwrite
741
743
  end
742
744
 
743
745
 
746
+ # Create an enumeration attribute. The `elements` param acts as a white-list
747
+ # of accepted values for this attribute.
744
748
  #
745
749
  #
746
750
  # @param [String] database_id Database ID.
@@ -1229,11 +1233,11 @@ module Appwrite
1229
1233
  # @param [String] database_id Database ID.
1230
1234
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1231
1235
  # @param [String] related_collection_id Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1232
- # @param [String] type Relation type
1236
+ # @param [RelationshipType] type Relation type
1233
1237
  # @param [] two_way Is Two Way?
1234
1238
  # @param [String] key Attribute Key.
1235
1239
  # @param [String] two_way_key Two Way Attribute Key.
1236
- # @param [String] on_delete Constraints option
1240
+ # @param [RelationMutate] on_delete Constraints option
1237
1241
  #
1238
1242
  # @return [AttributeRelationship]
1239
1243
  def create_relationship_attribute(database_id:, collection_id:, related_collection_id:, type:, two_way: nil, key: nil, two_way_key: nil, on_delete: nil)
@@ -1506,7 +1510,7 @@ module Appwrite
1506
1510
  end
1507
1511
 
1508
1512
 
1509
- #
1513
+ # Get attribute by ID.
1510
1514
  #
1511
1515
  # @param [String] database_id Database ID.
1512
1516
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
@@ -1547,7 +1551,7 @@ module Appwrite
1547
1551
  end
1548
1552
 
1549
1553
 
1550
- #
1554
+ # Deletes an attribute.
1551
1555
  #
1552
1556
  # @param [String] database_id Database ID.
1553
1557
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
@@ -1595,7 +1599,7 @@ module Appwrite
1595
1599
  # @param [String] database_id Database ID.
1596
1600
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1597
1601
  # @param [String] key Attribute Key.
1598
- # @param [String] on_delete Constraints option
1602
+ # @param [RelationMutate] on_delete Constraints option
1599
1603
  #
1600
1604
  # @return [AttributeRelationship]
1601
1605
  def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: nil)
@@ -1732,7 +1736,7 @@ module Appwrite
1732
1736
  # @param [String] database_id Database ID.
1733
1737
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1734
1738
  # @param [String] document_id Document ID.
1735
- # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only method allowed is select.
1739
+ # @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.
1736
1740
  #
1737
1741
  # @return [Document]
1738
1742
  def get_document(database_id:, collection_id:, document_id:, queries: nil)
@@ -1859,7 +1863,7 @@ module Appwrite
1859
1863
  end
1860
1864
 
1861
1865
 
1862
- #
1866
+ # List indexes in the collection.
1863
1867
  #
1864
1868
  # @param [String] database_id Database ID.
1865
1869
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
@@ -1897,12 +1901,14 @@ module Appwrite
1897
1901
  end
1898
1902
 
1899
1903
 
1900
- #
1904
+ # Creates an index on the attributes listed. Your index should include all
1905
+ # the attributes you will query in a single request.
1906
+ # Attributes can be `key`, `fulltext`, and `unique`.
1901
1907
  #
1902
1908
  # @param [String] database_id Database ID.
1903
1909
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1904
1910
  # @param [String] key Index Key.
1905
- # @param [String] type Index type.
1911
+ # @param [IndexType] type Index type.
1906
1912
  # @param [Array] attributes Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.
1907
1913
  # @param [Array] orders Array of index orders. Maximum of 100 orders are allowed.
1908
1914
  #
@@ -1953,7 +1959,7 @@ module Appwrite
1953
1959
  end
1954
1960
 
1955
1961
 
1956
- #
1962
+ # Get index by ID.
1957
1963
  #
1958
1964
  # @param [String] database_id Database ID.
1959
1965
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
@@ -1995,7 +2001,7 @@ module Appwrite
1995
2001
  end
1996
2002
 
1997
2003
 
1998
- #
2004
+ # Delete an index.
1999
2005
  #
2000
2006
  # @param [String] database_id Database ID.
2001
2007
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
@@ -43,7 +43,7 @@ module Appwrite
43
43
  #
44
44
  # @param [String] function_id Function 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.
45
45
  # @param [String] name Function name. Max length: 128 chars.
46
- # @param [String] runtime Execution runtime.
46
+ # @param [Runtime] runtime Execution runtime.
47
47
  # @param [Array] execute An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
48
48
  # @param [Array] events Events list. Maximum of 100 events are allowed.
49
49
  # @param [String] schedule Schedule CRON syntax.
@@ -173,7 +173,7 @@ module Appwrite
173
173
  #
174
174
  # @param [String] function_id Function ID.
175
175
  # @param [String] name Function name. Max length: 128 chars.
176
- # @param [String] runtime Execution runtime.
176
+ # @param [Runtime] runtime Execution runtime.
177
177
  # @param [Array] execute An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
178
178
  # @param [Array] events Events list. Maximum of 100 events are allowed.
179
179
  # @param [String] schedule Schedule CRON syntax.
@@ -588,7 +588,7 @@ module Appwrite
588
588
  # @param [String] body HTTP body of execution. Default value is empty string.
589
589
  # @param [] async Execute code in the background. Default value is false.
590
590
  # @param [String] xpath HTTP path of execution. Path can include query params. Default value is /
591
- # @param [String] method HTTP method of execution. Default value is GET.
591
+ # @param [ExecutionMethod] method HTTP method of execution. Default value is GET.
592
592
  # @param [Hash] headers HTTP headers of execution. Defaults to empty.
593
593
  #
594
594
  # @return [Execution]
@@ -80,6 +80,32 @@ module Appwrite
80
80
  end
81
81
 
82
82
 
83
+ # Get the SSL certificate for a domain
84
+ #
85
+ # @param [String] domain string
86
+ #
87
+ # @return [HealthCertificate]
88
+ def get_certificate(domain: nil)
89
+ api_path = '/health/certificate'
90
+
91
+ api_params = {
92
+ domain: domain,
93
+ }
94
+
95
+ api_headers = {
96
+ "content-type": 'application/json',
97
+ }
98
+
99
+ @client.call(
100
+ method: 'GET',
101
+ path: api_path,
102
+ headers: api_headers,
103
+ params: api_params,
104
+ response_type: Models::HealthCertificate
105
+ )
106
+ end
107
+
108
+
83
109
  # Check the Appwrite database servers are up and connection is successful.
84
110
  #
85
111
  #
@@ -264,8 +290,42 @@ module Appwrite
264
290
  end
265
291
 
266
292
 
293
+ # Returns the amount of failed jobs in a given queue.
267
294
  #
268
295
  #
296
+ # @param [Name] name The name of the queue
297
+ # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
298
+ #
299
+ # @return [HealthQueue]
300
+ def get_failed_jobs(name:, threshold: nil)
301
+ api_path = '/health/queue/failed/{name}'
302
+ .gsub('{name}', name)
303
+
304
+ if name.nil?
305
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
306
+ end
307
+
308
+ api_params = {
309
+ threshold: threshold,
310
+ }
311
+
312
+ api_headers = {
313
+ "content-type": 'application/json',
314
+ }
315
+
316
+ @client.call(
317
+ method: 'GET',
318
+ path: api_path,
319
+ headers: api_headers,
320
+ params: api_params,
321
+ response_type: Models::HealthQueue
322
+ )
323
+ end
324
+
325
+
326
+ # Get the number of function executions that are waiting to be processed in
327
+ # the Appwrite internal queue server.
328
+ #
269
329
  # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
270
330
  #
271
331
  # @return [HealthQueue]
@@ -398,6 +458,60 @@ module Appwrite
398
458
  end
399
459
 
400
460
 
461
+ # Get the number of metrics that are waiting to be processed in the Appwrite
462
+ # internal queue server.
463
+ #
464
+ # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
465
+ #
466
+ # @return [HealthQueue]
467
+ def get_queue_usage(threshold: nil)
468
+ api_path = '/health/queue/usage'
469
+
470
+ api_params = {
471
+ threshold: threshold,
472
+ }
473
+
474
+ api_headers = {
475
+ "content-type": 'application/json',
476
+ }
477
+
478
+ @client.call(
479
+ method: 'GET',
480
+ path: api_path,
481
+ headers: api_headers,
482
+ params: api_params,
483
+ response_type: Models::HealthQueue
484
+ )
485
+ end
486
+
487
+
488
+ # Get the number of projects containing metrics that are waiting to be
489
+ # processed in the Appwrite internal queue server.
490
+ #
491
+ # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
492
+ #
493
+ # @return [HealthQueue]
494
+ def get_queue_usage_dump(threshold: nil)
495
+ api_path = '/health/queue/usage-dump'
496
+
497
+ api_params = {
498
+ threshold: threshold,
499
+ }
500
+
501
+ api_headers = {
502
+ "content-type": 'application/json',
503
+ }
504
+
505
+ @client.call(
506
+ method: 'GET',
507
+ path: api_path,
508
+ headers: api_headers,
509
+ params: api_params,
510
+ response_type: Models::HealthQueue
511
+ )
512
+ end
513
+
514
+
401
515
  # Get the number of webhooks that are waiting to be processed in the Appwrite
402
516
  # internal queue server.
403
517
  #
@@ -425,6 +539,30 @@ module Appwrite
425
539
  end
426
540
 
427
541
 
542
+ # Check the Appwrite storage device is up and connection is successful.
543
+ #
544
+ #
545
+ # @return [HealthStatus]
546
+ def get_storage()
547
+ api_path = '/health/storage'
548
+
549
+ api_params = {
550
+ }
551
+
552
+ api_headers = {
553
+ "content-type": 'application/json',
554
+ }
555
+
556
+ @client.call(
557
+ method: 'GET',
558
+ path: api_path,
559
+ headers: api_headers,
560
+ params: api_params,
561
+ response_type: Models::HealthStatus
562
+ )
563
+ end
564
+
565
+
428
566
  # Check the Appwrite local storage device is up and connection is successful.
429
567
  #
430
568
  #