appwrite 22.0.0 → 23.1.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 (116) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +35 -2
  3. data/lib/appwrite/enums/auth_method.rb +13 -0
  4. data/lib/appwrite/enums/build_runtime.rb +3 -0
  5. data/lib/appwrite/enums/email_template_locale.rb +137 -0
  6. data/lib/appwrite/enums/email_template_type.rb +13 -0
  7. data/lib/appwrite/enums/o_auth_provider.rb +6 -0
  8. data/lib/appwrite/enums/platform_type.rb +11 -0
  9. data/lib/appwrite/enums/project_policy.rb +15 -0
  10. data/lib/appwrite/enums/protocol_id.rb +9 -0
  11. data/lib/appwrite/enums/proxy_resource_type.rb +8 -0
  12. data/lib/appwrite/enums/proxy_rule_deployment_resource_type.rb +8 -0
  13. data/lib/appwrite/enums/proxy_rule_status.rb +9 -0
  14. data/lib/appwrite/enums/runtime.rb +3 -0
  15. data/lib/appwrite/enums/scopes.rb +44 -27
  16. data/lib/appwrite/enums/secure.rb +8 -0
  17. data/lib/appwrite/enums/service_id.rb +23 -0
  18. data/lib/appwrite/enums/status_code.rb +10 -0
  19. data/lib/appwrite/models/attribute_bigint.rb +96 -0
  20. data/lib/appwrite/models/auth_provider.rb +47 -0
  21. data/lib/appwrite/models/billing_limits.rb +62 -0
  22. data/lib/appwrite/models/block.rb +72 -0
  23. data/lib/appwrite/models/column_bigint.rb +96 -0
  24. data/lib/appwrite/models/dev_key.rb +62 -0
  25. data/lib/appwrite/models/email_template.rb +62 -0
  26. data/lib/appwrite/models/email_template_list.rb +32 -0
  27. data/lib/appwrite/models/ephemeral_key.rb +67 -0
  28. data/lib/appwrite/models/key.rb +67 -0
  29. data/lib/appwrite/models/key_list.rb +32 -0
  30. data/lib/appwrite/models/log.rb +5 -0
  31. data/lib/appwrite/models/membership.rb +5 -0
  32. data/lib/appwrite/models/mock_number.rb +42 -0
  33. data/lib/appwrite/models/mock_number_list.rb +32 -0
  34. data/lib/appwrite/models/o_auth2_amazon.rb +42 -0
  35. data/lib/appwrite/models/o_auth2_apple.rb +52 -0
  36. data/lib/appwrite/models/o_auth2_auth0.rb +47 -0
  37. data/lib/appwrite/models/o_auth2_authentik.rb +47 -0
  38. data/lib/appwrite/models/o_auth2_autodesk.rb +42 -0
  39. data/lib/appwrite/models/o_auth2_bitbucket.rb +42 -0
  40. data/lib/appwrite/models/o_auth2_bitly.rb +42 -0
  41. data/lib/appwrite/models/o_auth2_box.rb +42 -0
  42. data/lib/appwrite/models/o_auth2_dailymotion.rb +42 -0
  43. data/lib/appwrite/models/o_auth2_discord.rb +42 -0
  44. data/lib/appwrite/models/o_auth2_disqus.rb +42 -0
  45. data/lib/appwrite/models/o_auth2_dropbox.rb +42 -0
  46. data/lib/appwrite/models/o_auth2_etsy.rb +42 -0
  47. data/lib/appwrite/models/o_auth2_facebook.rb +42 -0
  48. data/lib/appwrite/models/o_auth2_figma.rb +42 -0
  49. data/lib/appwrite/models/o_auth2_fusion_auth.rb +47 -0
  50. data/lib/appwrite/models/o_auth2_github.rb +42 -0
  51. data/lib/appwrite/models/o_auth2_gitlab.rb +47 -0
  52. data/lib/appwrite/models/o_auth2_google.rb +42 -0
  53. data/lib/appwrite/models/o_auth2_keycloak.rb +52 -0
  54. data/lib/appwrite/models/o_auth2_kick.rb +42 -0
  55. data/lib/appwrite/models/o_auth2_linkedin.rb +42 -0
  56. data/lib/appwrite/models/o_auth2_microsoft.rb +47 -0
  57. data/lib/appwrite/models/o_auth2_notion.rb +42 -0
  58. data/lib/appwrite/models/o_auth2_oidc.rb +62 -0
  59. data/lib/appwrite/models/o_auth2_okta.rb +52 -0
  60. data/lib/appwrite/models/o_auth2_paypal.rb +42 -0
  61. data/lib/appwrite/models/o_auth2_podio.rb +42 -0
  62. data/lib/appwrite/models/o_auth2_provider_list.rb +32 -0
  63. data/lib/appwrite/models/o_auth2_salesforce.rb +42 -0
  64. data/lib/appwrite/models/o_auth2_slack.rb +42 -0
  65. data/lib/appwrite/models/o_auth2_spotify.rb +42 -0
  66. data/lib/appwrite/models/o_auth2_stripe.rb +42 -0
  67. data/lib/appwrite/models/o_auth2_tradeshift.rb +42 -0
  68. data/lib/appwrite/models/o_auth2_twitch.rb +42 -0
  69. data/lib/appwrite/models/o_auth2_word_press.rb +42 -0
  70. data/lib/appwrite/models/o_auth2_x.rb +42 -0
  71. data/lib/appwrite/models/o_auth2_yahoo.rb +42 -0
  72. data/lib/appwrite/models/o_auth2_yandex.rb +42 -0
  73. data/lib/appwrite/models/o_auth2_zoho.rb +42 -0
  74. data/lib/appwrite/models/o_auth2_zoom.rb +42 -0
  75. data/lib/appwrite/models/platform_android.rb +71 -0
  76. data/lib/appwrite/models/platform_apple.rb +71 -0
  77. data/lib/appwrite/models/platform_linux.rb +71 -0
  78. data/lib/appwrite/models/platform_list.rb +32 -0
  79. data/lib/appwrite/models/platform_web.rb +71 -0
  80. data/lib/appwrite/models/platform_windows.rb +71 -0
  81. data/lib/appwrite/models/policy_list.rb +32 -0
  82. data/lib/appwrite/models/policy_membership_privacy.rb +52 -0
  83. data/lib/appwrite/models/policy_password_dictionary.rb +32 -0
  84. data/lib/appwrite/models/policy_password_history.rb +32 -0
  85. data/lib/appwrite/models/policy_password_personal_data.rb +32 -0
  86. data/lib/appwrite/models/policy_session_alert.rb +32 -0
  87. data/lib/appwrite/models/policy_session_duration.rb +32 -0
  88. data/lib/appwrite/models/policy_session_invalidation.rb +32 -0
  89. data/lib/appwrite/models/policy_session_limit.rb +32 -0
  90. data/lib/appwrite/models/policy_user_limit.rb +32 -0
  91. data/lib/appwrite/models/project.rb +427 -0
  92. data/lib/appwrite/models/proxy_rule.rb +127 -0
  93. data/lib/appwrite/models/proxy_rule_list.rb +32 -0
  94. data/lib/appwrite/models/webhook.rb +20 -20
  95. data/lib/appwrite/service.rb +1 -1
  96. data/lib/appwrite/services/account.rb +47 -2
  97. data/lib/appwrite/services/activities.rb +3 -1
  98. data/lib/appwrite/services/avatars.rb +9 -1
  99. data/lib/appwrite/services/backups.rb +13 -1
  100. data/lib/appwrite/services/databases.rb +258 -6
  101. data/lib/appwrite/services/functions.rb +40 -8
  102. data/lib/appwrite/services/graphql.rb +5 -3
  103. data/lib/appwrite/services/health.rb +26 -1
  104. data/lib/appwrite/services/locale.rb +9 -1
  105. data/lib/appwrite/services/messaging.rb +49 -1
  106. data/lib/appwrite/services/project.rb +3251 -5
  107. data/lib/appwrite/services/proxy.rb +303 -0
  108. data/lib/appwrite/services/sites.rb +39 -8
  109. data/lib/appwrite/services/storage.rb +14 -1
  110. data/lib/appwrite/services/tables_db.rb +252 -6
  111. data/lib/appwrite/services/teams.rb +14 -1
  112. data/lib/appwrite/services/tokens.rb +6 -1
  113. data/lib/appwrite/services/users.rb +44 -1
  114. data/lib/appwrite/services/webhooks.rb +31 -21
  115. data/lib/appwrite.rb +86 -0
  116. metadata +88 -2
@@ -37,6 +37,7 @@ module Appwrite
37
37
  params: api_params,
38
38
  response_type: Models::DatabaseList
39
39
  )
40
+
40
41
  end
41
42
 
42
43
  #
@@ -78,6 +79,7 @@ module Appwrite
78
79
  params: api_params,
79
80
  response_type: Models::Database
80
81
  )
82
+
81
83
  end
82
84
 
83
85
  # List transactions across all databases.
@@ -102,6 +104,7 @@ module Appwrite
102
104
  params: api_params,
103
105
  response_type: Models::TransactionList
104
106
  )
107
+
105
108
  end
106
109
 
107
110
  # Create a new transaction.
@@ -127,6 +130,7 @@ module Appwrite
127
130
  params: api_params,
128
131
  response_type: Models::Transaction
129
132
  )
133
+
130
134
  end
131
135
 
132
136
  # Get a transaction by its unique ID.
@@ -155,6 +159,7 @@ module Appwrite
155
159
  params: api_params,
156
160
  response_type: Models::Transaction
157
161
  )
162
+
158
163
  end
159
164
 
160
165
  # Update a transaction, to either commit or roll back its operations.
@@ -188,6 +193,7 @@ module Appwrite
188
193
  params: api_params,
189
194
  response_type: Models::Transaction
190
195
  )
196
+
191
197
  end
192
198
 
193
199
  # Delete a transaction by its unique ID.
@@ -216,6 +222,7 @@ module Appwrite
216
222
  headers: api_headers,
217
223
  params: api_params,
218
224
  )
225
+
219
226
  end
220
227
 
221
228
  # Create multiple operations in a single transaction.
@@ -247,6 +254,7 @@ module Appwrite
247
254
  params: api_params,
248
255
  response_type: Models::Transaction
249
256
  )
257
+
250
258
  end
251
259
 
252
260
  #
@@ -279,6 +287,7 @@ module Appwrite
279
287
  params: api_params,
280
288
  response_type: Models::Database
281
289
  )
290
+
282
291
  end
283
292
 
284
293
  #
@@ -315,6 +324,7 @@ module Appwrite
315
324
  params: api_params,
316
325
  response_type: Models::Database
317
326
  )
327
+
318
328
  end
319
329
 
320
330
  #
@@ -347,6 +357,7 @@ module Appwrite
347
357
  headers: api_headers,
348
358
  params: api_params,
349
359
  )
360
+
350
361
  end
351
362
 
352
363
  #
@@ -385,6 +396,7 @@ module Appwrite
385
396
  params: api_params,
386
397
  response_type: Models::CollectionList
387
398
  )
399
+
388
400
  end
389
401
 
390
402
  #
@@ -442,6 +454,7 @@ module Appwrite
442
454
  params: api_params,
443
455
  response_type: Models::Collection
444
456
  )
457
+
445
458
  end
446
459
 
447
460
  #
@@ -480,6 +493,7 @@ module Appwrite
480
493
  params: api_params,
481
494
  response_type: Models::Collection
482
495
  )
496
+
483
497
  end
484
498
 
485
499
  #
@@ -493,9 +507,10 @@ module Appwrite
493
507
  # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
494
508
  # @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).
495
509
  # @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.
510
+ # @param [] purge When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire.
496
511
  #
497
512
  # @return [Collection]
498
- def update_collection(database_id:, collection_id:, name: nil, permissions: nil, document_security: nil, enabled: nil)
513
+ def update_collection(database_id:, collection_id:, name: nil, permissions: nil, document_security: nil, enabled: nil, purge: nil)
499
514
  api_path = '/databases/{databaseId}/collections/{collectionId}'
500
515
  .gsub('{databaseId}', database_id)
501
516
  .gsub('{collectionId}', collection_id)
@@ -513,6 +528,7 @@ module Appwrite
513
528
  permissions: permissions,
514
529
  documentSecurity: document_security,
515
530
  enabled: enabled,
531
+ purge: purge,
516
532
  }
517
533
 
518
534
  api_headers = {
@@ -526,6 +542,7 @@ module Appwrite
526
542
  params: api_params,
527
543
  response_type: Models::Collection
528
544
  )
545
+
529
546
  end
530
547
 
531
548
  #
@@ -564,6 +581,7 @@ module Appwrite
564
581
  headers: api_headers,
565
582
  params: api_params,
566
583
  )
584
+
567
585
  end
568
586
 
569
587
  #
@@ -605,6 +623,133 @@ module Appwrite
605
623
  params: api_params,
606
624
  response_type: Models::AttributeList
607
625
  )
626
+
627
+ end
628
+
629
+ #
630
+ # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createBigIntColumn` instead.
631
+ #
632
+ # Create a bigint attribute. Optionally, minimum and maximum values can be
633
+ # provided.
634
+ #
635
+ #
636
+ # @param [String] database_id Database ID.
637
+ # @param [String] collection_id Collection ID.
638
+ # @param [String] key Attribute Key.
639
+ # @param [] required Is attribute required?
640
+ # @param [Integer] min Minimum value
641
+ # @param [Integer] max Maximum value
642
+ # @param [Integer] default Default value. Cannot be set when attribute is required.
643
+ # @param [] array Is attribute an array?
644
+ #
645
+ # @return [AttributeBigint]
646
+ def create_big_int_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil)
647
+ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint'
648
+ .gsub('{databaseId}', database_id)
649
+ .gsub('{collectionId}', collection_id)
650
+
651
+ if database_id.nil?
652
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
653
+ end
654
+
655
+ if collection_id.nil?
656
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
657
+ end
658
+
659
+ if key.nil?
660
+ raise Appwrite::Exception.new('Missing required parameter: "key"')
661
+ end
662
+
663
+ if required.nil?
664
+ raise Appwrite::Exception.new('Missing required parameter: "required"')
665
+ end
666
+
667
+ api_params = {
668
+ key: key,
669
+ required: required,
670
+ min: min,
671
+ max: max,
672
+ default: default,
673
+ array: array,
674
+ }
675
+
676
+ api_headers = {
677
+ "content-type": 'application/json',
678
+ }
679
+
680
+ @client.call(
681
+ method: 'POST',
682
+ path: api_path,
683
+ headers: api_headers,
684
+ params: api_params,
685
+ response_type: Models::AttributeBigint
686
+ )
687
+
688
+ end
689
+
690
+ #
691
+ # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateBigIntColumn` instead.
692
+ #
693
+ # Update a bigint attribute. Changing the `default` value will not update
694
+ # already existing documents.
695
+ #
696
+ #
697
+ # @param [String] database_id Database ID.
698
+ # @param [String] collection_id Collection ID.
699
+ # @param [String] key Attribute Key.
700
+ # @param [] required Is attribute required?
701
+ # @param [Integer] default Default value. Cannot be set when attribute is required.
702
+ # @param [Integer] min Minimum value
703
+ # @param [Integer] max Maximum value
704
+ # @param [String] new_key New Attribute Key.
705
+ #
706
+ # @return [AttributeBigint]
707
+ def update_big_int_attribute(database_id:, collection_id:, key:, required:, default:, min: nil, max: nil, new_key: nil)
708
+ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key}'
709
+ .gsub('{databaseId}', database_id)
710
+ .gsub('{collectionId}', collection_id)
711
+ .gsub('{key}', key)
712
+
713
+ if database_id.nil?
714
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
715
+ end
716
+
717
+ if collection_id.nil?
718
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
719
+ end
720
+
721
+ if key.nil?
722
+ raise Appwrite::Exception.new('Missing required parameter: "key"')
723
+ end
724
+
725
+ if required.nil?
726
+ raise Appwrite::Exception.new('Missing required parameter: "required"')
727
+ end
728
+
729
+ if default.nil?
730
+ raise Appwrite::Exception.new('Missing required parameter: "default"')
731
+ end
732
+
733
+ api_params = {
734
+ required: required,
735
+ min: min,
736
+ max: max,
737
+ default: default,
738
+ newKey: new_key,
739
+ }
740
+
741
+ api_headers = {
742
+ "content-type": 'application/json',
743
+ }
744
+
745
+ @client.call(
746
+ method: 'PATCH',
747
+ path: api_path,
748
+ headers: api_headers,
749
+ params: api_params,
750
+ response_type: Models::AttributeBigint
751
+ )
752
+
608
753
  end
609
754
 
610
755
  #
@@ -660,6 +805,7 @@ module Appwrite
660
805
  params: api_params,
661
806
  response_type: Models::AttributeBoolean
662
807
  )
808
+
663
809
  end
664
810
 
665
811
  #
@@ -719,6 +865,7 @@ module Appwrite
719
865
  params: api_params,
720
866
  response_type: Models::AttributeBoolean
721
867
  )
868
+
722
869
  end
723
870
 
724
871
  #
@@ -773,6 +920,7 @@ module Appwrite
773
920
  params: api_params,
774
921
  response_type: Models::AttributeDatetime
775
922
  )
923
+
776
924
  end
777
925
 
778
926
  #
@@ -832,6 +980,7 @@ module Appwrite
832
980
  params: api_params,
833
981
  response_type: Models::AttributeDatetime
834
982
  )
983
+
835
984
  end
836
985
 
837
986
  #
@@ -887,6 +1036,7 @@ module Appwrite
887
1036
  params: api_params,
888
1037
  response_type: Models::AttributeEmail
889
1038
  )
1039
+
890
1040
  end
891
1041
 
892
1042
  #
@@ -947,6 +1097,7 @@ module Appwrite
947
1097
  params: api_params,
948
1098
  response_type: Models::AttributeEmail
949
1099
  )
1100
+
950
1101
  end
951
1102
 
952
1103
  #
@@ -1009,6 +1160,7 @@ module Appwrite
1009
1160
  params: api_params,
1010
1161
  response_type: Models::AttributeEnum
1011
1162
  )
1163
+
1012
1164
  end
1013
1165
 
1014
1166
  #
@@ -1075,6 +1227,7 @@ module Appwrite
1075
1227
  params: api_params,
1076
1228
  response_type: Models::AttributeEnum
1077
1229
  )
1230
+
1078
1231
  end
1079
1232
 
1080
1233
  #
@@ -1135,6 +1288,7 @@ module Appwrite
1135
1288
  params: api_params,
1136
1289
  response_type: Models::AttributeFloat
1137
1290
  )
1291
+
1138
1292
  end
1139
1293
 
1140
1294
  #
@@ -1199,6 +1353,7 @@ module Appwrite
1199
1353
  params: api_params,
1200
1354
  response_type: Models::AttributeFloat
1201
1355
  )
1356
+
1202
1357
  end
1203
1358
 
1204
1359
  #
@@ -1259,6 +1414,7 @@ module Appwrite
1259
1414
  params: api_params,
1260
1415
  response_type: Models::AttributeInteger
1261
1416
  )
1417
+
1262
1418
  end
1263
1419
 
1264
1420
  #
@@ -1323,6 +1479,7 @@ module Appwrite
1323
1479
  params: api_params,
1324
1480
  response_type: Models::AttributeInteger
1325
1481
  )
1482
+
1326
1483
  end
1327
1484
 
1328
1485
  #
@@ -1378,6 +1535,7 @@ module Appwrite
1378
1535
  params: api_params,
1379
1536
  response_type: Models::AttributeIp
1380
1537
  )
1538
+
1381
1539
  end
1382
1540
 
1383
1541
  #
@@ -1438,6 +1596,7 @@ module Appwrite
1438
1596
  params: api_params,
1439
1597
  response_type: Models::AttributeIp
1440
1598
  )
1599
+
1441
1600
  end
1442
1601
 
1443
1602
  #
@@ -1490,6 +1649,7 @@ module Appwrite
1490
1649
  params: api_params,
1491
1650
  response_type: Models::AttributeLine
1492
1651
  )
1652
+
1493
1653
  end
1494
1654
 
1495
1655
  #
@@ -1545,6 +1705,7 @@ module Appwrite
1545
1705
  params: api_params,
1546
1706
  response_type: Models::AttributeLine
1547
1707
  )
1708
+
1548
1709
  end
1549
1710
 
1550
1711
  # Create a longtext attribute.
@@ -1599,6 +1760,7 @@ module Appwrite
1599
1760
  params: api_params,
1600
1761
  response_type: Models::AttributeLongtext
1601
1762
  )
1763
+
1602
1764
  end
1603
1765
 
1604
1766
  # Update a longtext attribute. Changing the `default` value will not update
@@ -1656,6 +1818,7 @@ module Appwrite
1656
1818
  params: api_params,
1657
1819
  response_type: Models::AttributeLongtext
1658
1820
  )
1821
+
1659
1822
  end
1660
1823
 
1661
1824
  # Create a mediumtext attribute.
@@ -1710,6 +1873,7 @@ module Appwrite
1710
1873
  params: api_params,
1711
1874
  response_type: Models::AttributeMediumtext
1712
1875
  )
1876
+
1713
1877
  end
1714
1878
 
1715
1879
  # Update a mediumtext attribute. Changing the `default` value will not update
@@ -1767,6 +1931,7 @@ module Appwrite
1767
1931
  params: api_params,
1768
1932
  response_type: Models::AttributeMediumtext
1769
1933
  )
1934
+
1770
1935
  end
1771
1936
 
1772
1937
  #
@@ -1819,6 +1984,7 @@ module Appwrite
1819
1984
  params: api_params,
1820
1985
  response_type: Models::AttributePoint
1821
1986
  )
1987
+
1822
1988
  end
1823
1989
 
1824
1990
  #
@@ -1874,6 +2040,7 @@ module Appwrite
1874
2040
  params: api_params,
1875
2041
  response_type: Models::AttributePoint
1876
2042
  )
2043
+
1877
2044
  end
1878
2045
 
1879
2046
  #
@@ -1926,6 +2093,7 @@ module Appwrite
1926
2093
  params: api_params,
1927
2094
  response_type: Models::AttributePolygon
1928
2095
  )
2096
+
1929
2097
  end
1930
2098
 
1931
2099
  #
@@ -1981,6 +2149,7 @@ module Appwrite
1981
2149
  params: api_params,
1982
2150
  response_type: Models::AttributePolygon
1983
2151
  )
2152
+
1984
2153
  end
1985
2154
 
1986
2155
  #
@@ -2041,6 +2210,7 @@ module Appwrite
2041
2210
  params: api_params,
2042
2211
  response_type: Models::AttributeRelationship
2043
2212
  )
2213
+
2044
2214
  end
2045
2215
 
2046
2216
  #
@@ -2091,6 +2261,7 @@ module Appwrite
2091
2261
  params: api_params,
2092
2262
  response_type: Models::AttributeRelationship
2093
2263
  )
2264
+
2094
2265
  end
2095
2266
 
2096
2267
  #
@@ -2154,6 +2325,7 @@ module Appwrite
2154
2325
  params: api_params,
2155
2326
  response_type: Models::AttributeString
2156
2327
  )
2328
+
2157
2329
  end
2158
2330
 
2159
2331
  #
@@ -2216,6 +2388,7 @@ module Appwrite
2216
2388
  params: api_params,
2217
2389
  response_type: Models::AttributeString
2218
2390
  )
2391
+
2219
2392
  end
2220
2393
 
2221
2394
  # Create a text attribute.
@@ -2270,6 +2443,7 @@ module Appwrite
2270
2443
  params: api_params,
2271
2444
  response_type: Models::AttributeText
2272
2445
  )
2446
+
2273
2447
  end
2274
2448
 
2275
2449
  # Update a text attribute. Changing the `default` value will not update
@@ -2327,6 +2501,7 @@ module Appwrite
2327
2501
  params: api_params,
2328
2502
  response_type: Models::AttributeText
2329
2503
  )
2504
+
2330
2505
  end
2331
2506
 
2332
2507
  #
@@ -2382,6 +2557,7 @@ module Appwrite
2382
2557
  params: api_params,
2383
2558
  response_type: Models::AttributeUrl
2384
2559
  )
2560
+
2385
2561
  end
2386
2562
 
2387
2563
  #
@@ -2442,6 +2618,7 @@ module Appwrite
2442
2618
  params: api_params,
2443
2619
  response_type: Models::AttributeUrl
2444
2620
  )
2621
+
2445
2622
  end
2446
2623
 
2447
2624
  # Create a varchar attribute.
@@ -2502,6 +2679,7 @@ module Appwrite
2502
2679
  params: api_params,
2503
2680
  response_type: Models::AttributeVarchar
2504
2681
  )
2682
+
2505
2683
  end
2506
2684
 
2507
2685
  # Update a varchar attribute. Changing the `default` value will not update
@@ -2561,6 +2739,7 @@ module Appwrite
2561
2739
  params: api_params,
2562
2740
  response_type: Models::AttributeVarchar
2563
2741
  )
2742
+
2564
2743
  end
2565
2744
 
2566
2745
  #
@@ -2572,7 +2751,7 @@ module Appwrite
2572
2751
  # @param [String] collection_id Collection ID.
2573
2752
  # @param [String] key Attribute Key.
2574
2753
  #
2575
- # @return []
2754
+ # @return [AttributeBoolean, AttributeInteger, AttributeFloat, AttributeEmail, AttributeEnum, AttributeUrl, AttributeIp, AttributeDatetime, AttributeRelationship, AttributeString]
2576
2755
  def get_attribute(database_id:, collection_id:, key:)
2577
2756
  api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'
2578
2757
  .gsub('{databaseId}', database_id)
@@ -2597,13 +2776,69 @@ module Appwrite
2597
2776
  api_headers = {
2598
2777
  }
2599
2778
 
2600
- @client.call(
2779
+ response = @client.call(
2601
2780
  method: 'GET',
2602
2781
  path: api_path,
2603
2782
  headers: api_headers,
2604
2783
  params: api_params,
2605
- response_type: Models::AttributeBoolean
2606
2784
  )
2785
+
2786
+ unless response.is_a?(Hash)
2787
+ raise Exception, "Expected object response when hydrating a response model"
2788
+ end
2789
+
2790
+ if response['type'] == 'string' && response['format'] == 'email'
2791
+
2792
+ return Models::AttributeEmail.from(map: response)
2793
+ end
2794
+
2795
+ if response['type'] == 'string' && response['format'] == 'enum'
2796
+
2797
+ return Models::AttributeEnum.from(map: response)
2798
+ end
2799
+
2800
+ if response['type'] == 'string' && response['format'] == 'url'
2801
+
2802
+ return Models::AttributeUrl.from(map: response)
2803
+ end
2804
+
2805
+ if response['type'] == 'string' && response['format'] == 'ip'
2806
+
2807
+ return Models::AttributeIp.from(map: response)
2808
+ end
2809
+
2810
+ if response['type'] == 'boolean'
2811
+
2812
+ return Models::AttributeBoolean.from(map: response)
2813
+ end
2814
+
2815
+ if response['type'] == 'integer'
2816
+
2817
+ return Models::AttributeInteger.from(map: response)
2818
+ end
2819
+
2820
+ if response['type'] == 'double'
2821
+
2822
+ return Models::AttributeFloat.from(map: response)
2823
+ end
2824
+
2825
+ if response['type'] == 'datetime'
2826
+
2827
+ return Models::AttributeDatetime.from(map: response)
2828
+ end
2829
+
2830
+ if response['type'] == 'relationship'
2831
+
2832
+ return Models::AttributeRelationship.from(map: response)
2833
+ end
2834
+
2835
+ if response['type'] == 'string'
2836
+
2837
+ return Models::AttributeString.from(map: response)
2838
+ end
2839
+
2840
+ raise Exception, "Unable to match response to any expected response model"
2841
+
2607
2842
  end
2608
2843
 
2609
2844
  #
@@ -2647,6 +2882,7 @@ module Appwrite
2647
2882
  headers: api_headers,
2648
2883
  params: api_params,
2649
2884
  )
2885
+
2650
2886
  end
2651
2887
 
2652
2888
  #
@@ -2660,7 +2896,7 @@ module Appwrite
2660
2896
  # @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.
2661
2897
  # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction.
2662
2898
  # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
2663
- # @param [Integer] ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).
2899
+ # @param [Integer] ttl TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours).
2664
2900
  #
2665
2901
  # @return [DocumentList]
2666
2902
  def list_documents(database_id:, collection_id:, queries: nil, transaction_id: nil, total: nil, ttl: nil)
@@ -2693,6 +2929,7 @@ module Appwrite
2693
2929
  params: api_params,
2694
2930
  response_type: Models::DocumentList
2695
2931
  )
2932
+
2696
2933
  end
2697
2934
 
2698
2935
  #
@@ -2750,6 +2987,7 @@ module Appwrite
2750
2987
  params: api_params,
2751
2988
  response_type: Models::Document
2752
2989
  )
2990
+
2753
2991
  end
2754
2992
 
2755
2993
  #
@@ -2799,6 +3037,7 @@ module Appwrite
2799
3037
  params: api_params,
2800
3038
  response_type: Models::DocumentList
2801
3039
  )
3040
+
2802
3041
  end
2803
3042
 
2804
3043
  #
@@ -2849,6 +3088,7 @@ module Appwrite
2849
3088
  params: api_params,
2850
3089
  response_type: Models::DocumentList
2851
3090
  )
3091
+
2852
3092
  end
2853
3093
 
2854
3094
  #
@@ -2895,6 +3135,7 @@ module Appwrite
2895
3135
  params: api_params,
2896
3136
  response_type: Models::DocumentList
2897
3137
  )
3138
+
2898
3139
  end
2899
3140
 
2900
3141
  #
@@ -2938,6 +3179,7 @@ module Appwrite
2938
3179
  params: api_params,
2939
3180
  response_type: Models::DocumentList
2940
3181
  )
3182
+
2941
3183
  end
2942
3184
 
2943
3185
  #
@@ -2986,6 +3228,7 @@ module Appwrite
2986
3228
  params: api_params,
2987
3229
  response_type: Models::Document
2988
3230
  )
3231
+
2989
3232
  end
2990
3233
 
2991
3234
  #
@@ -3039,6 +3282,7 @@ module Appwrite
3039
3282
  params: api_params,
3040
3283
  response_type: Models::Document
3041
3284
  )
3285
+
3042
3286
  end
3043
3287
 
3044
3288
  #
@@ -3090,6 +3334,7 @@ module Appwrite
3090
3334
  params: api_params,
3091
3335
  response_type: Models::Document
3092
3336
  )
3337
+
3093
3338
  end
3094
3339
 
3095
3340
  #
@@ -3135,6 +3380,7 @@ module Appwrite
3135
3380
  headers: api_headers,
3136
3381
  params: api_params,
3137
3382
  )
3383
+
3138
3384
  end
3139
3385
 
3140
3386
  #
@@ -3191,6 +3437,7 @@ module Appwrite
3191
3437
  params: api_params,
3192
3438
  response_type: Models::Document
3193
3439
  )
3440
+
3194
3441
  end
3195
3442
 
3196
3443
  #
@@ -3247,6 +3494,7 @@ module Appwrite
3247
3494
  params: api_params,
3248
3495
  response_type: Models::Document
3249
3496
  )
3497
+
3250
3498
  end
3251
3499
 
3252
3500
  #
@@ -3288,6 +3536,7 @@ module Appwrite
3288
3536
  params: api_params,
3289
3537
  response_type: Models::IndexList
3290
3538
  )
3539
+
3291
3540
  end
3292
3541
 
3293
3542
  #
@@ -3350,6 +3599,7 @@ module Appwrite
3350
3599
  params: api_params,
3351
3600
  response_type: Models::Index
3352
3601
  )
3602
+
3353
3603
  end
3354
3604
 
3355
3605
  #
@@ -3393,6 +3643,7 @@ module Appwrite
3393
3643
  params: api_params,
3394
3644
  response_type: Models::Index
3395
3645
  )
3646
+
3396
3647
  end
3397
3648
 
3398
3649
  #
@@ -3436,7 +3687,8 @@ module Appwrite
3436
3687
  headers: api_headers,
3437
3688
  params: api_params,
3438
3689
  )
3690
+
3439
3691
  end
3440
3692
 
3441
3693
  end
3442
- end
3694
+ end