appwrite 22.0.0 → 23.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 +9 -2
  3. data/lib/appwrite/enums/build_runtime.rb +2 -0
  4. data/lib/appwrite/enums/o_auth_provider.rb +1 -0
  5. data/lib/appwrite/enums/platform_type.rb +11 -0
  6. data/lib/appwrite/enums/protocol_id.rb +9 -0
  7. data/lib/appwrite/enums/runtime.rb +2 -0
  8. data/lib/appwrite/enums/scopes.rb +4 -0
  9. data/lib/appwrite/enums/service_id.rb +23 -0
  10. data/lib/appwrite/models/auth_provider.rb +47 -0
  11. data/lib/appwrite/models/billing_limits.rb +62 -0
  12. data/lib/appwrite/models/block.rb +47 -0
  13. data/lib/appwrite/models/dev_key.rb +62 -0
  14. data/lib/appwrite/models/key.rb +67 -0
  15. data/lib/appwrite/models/key_list.rb +32 -0
  16. data/lib/appwrite/models/log.rb +5 -0
  17. data/lib/appwrite/models/mock_number.rb +32 -0
  18. data/lib/appwrite/models/platform_android.rb +71 -0
  19. data/lib/appwrite/models/platform_apple.rb +71 -0
  20. data/lib/appwrite/models/platform_linux.rb +71 -0
  21. data/lib/appwrite/models/platform_list.rb +32 -0
  22. data/lib/appwrite/models/platform_web.rb +71 -0
  23. data/lib/appwrite/models/platform_windows.rb +71 -0
  24. data/lib/appwrite/models/project.rb +412 -0
  25. data/lib/appwrite/models/webhook.rb +20 -20
  26. data/lib/appwrite/service.rb +1 -1
  27. data/lib/appwrite/services/account.rb +47 -2
  28. data/lib/appwrite/services/activities.rb +3 -1
  29. data/lib/appwrite/services/avatars.rb +9 -1
  30. data/lib/appwrite/services/backups.rb +13 -1
  31. data/lib/appwrite/services/databases.rb +132 -6
  32. data/lib/appwrite/services/functions.rb +27 -1
  33. data/lib/appwrite/services/graphql.rb +5 -3
  34. data/lib/appwrite/services/health.rb +26 -1
  35. data/lib/appwrite/services/locale.rb +9 -1
  36. data/lib/appwrite/services/messaging.rb +49 -1
  37. data/lib/appwrite/services/project.rb +840 -1
  38. data/lib/appwrite/services/sites.rb +26 -1
  39. data/lib/appwrite/services/storage.rb +14 -1
  40. data/lib/appwrite/services/tables_db.rb +132 -6
  41. data/lib/appwrite/services/teams.rb +14 -1
  42. data/lib/appwrite/services/tokens.rb +6 -1
  43. data/lib/appwrite/services/users.rb +44 -1
  44. data/lib/appwrite/services/webhooks.rb +31 -21
  45. data/lib/appwrite.rb +17 -0
  46. metadata +19 -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,7 @@ module Appwrite
605
623
  params: api_params,
606
624
  response_type: Models::AttributeList
607
625
  )
626
+
608
627
  end
609
628
 
610
629
  #
@@ -660,6 +679,7 @@ module Appwrite
660
679
  params: api_params,
661
680
  response_type: Models::AttributeBoolean
662
681
  )
682
+
663
683
  end
664
684
 
665
685
  #
@@ -719,6 +739,7 @@ module Appwrite
719
739
  params: api_params,
720
740
  response_type: Models::AttributeBoolean
721
741
  )
742
+
722
743
  end
723
744
 
724
745
  #
@@ -773,6 +794,7 @@ module Appwrite
773
794
  params: api_params,
774
795
  response_type: Models::AttributeDatetime
775
796
  )
797
+
776
798
  end
777
799
 
778
800
  #
@@ -832,6 +854,7 @@ module Appwrite
832
854
  params: api_params,
833
855
  response_type: Models::AttributeDatetime
834
856
  )
857
+
835
858
  end
836
859
 
837
860
  #
@@ -887,6 +910,7 @@ module Appwrite
887
910
  params: api_params,
888
911
  response_type: Models::AttributeEmail
889
912
  )
913
+
890
914
  end
891
915
 
892
916
  #
@@ -947,6 +971,7 @@ module Appwrite
947
971
  params: api_params,
948
972
  response_type: Models::AttributeEmail
949
973
  )
974
+
950
975
  end
951
976
 
952
977
  #
@@ -1009,6 +1034,7 @@ module Appwrite
1009
1034
  params: api_params,
1010
1035
  response_type: Models::AttributeEnum
1011
1036
  )
1037
+
1012
1038
  end
1013
1039
 
1014
1040
  #
@@ -1075,6 +1101,7 @@ module Appwrite
1075
1101
  params: api_params,
1076
1102
  response_type: Models::AttributeEnum
1077
1103
  )
1104
+
1078
1105
  end
1079
1106
 
1080
1107
  #
@@ -1135,6 +1162,7 @@ module Appwrite
1135
1162
  params: api_params,
1136
1163
  response_type: Models::AttributeFloat
1137
1164
  )
1165
+
1138
1166
  end
1139
1167
 
1140
1168
  #
@@ -1199,6 +1227,7 @@ module Appwrite
1199
1227
  params: api_params,
1200
1228
  response_type: Models::AttributeFloat
1201
1229
  )
1230
+
1202
1231
  end
1203
1232
 
1204
1233
  #
@@ -1259,6 +1288,7 @@ module Appwrite
1259
1288
  params: api_params,
1260
1289
  response_type: Models::AttributeInteger
1261
1290
  )
1291
+
1262
1292
  end
1263
1293
 
1264
1294
  #
@@ -1323,6 +1353,7 @@ module Appwrite
1323
1353
  params: api_params,
1324
1354
  response_type: Models::AttributeInteger
1325
1355
  )
1356
+
1326
1357
  end
1327
1358
 
1328
1359
  #
@@ -1378,6 +1409,7 @@ module Appwrite
1378
1409
  params: api_params,
1379
1410
  response_type: Models::AttributeIp
1380
1411
  )
1412
+
1381
1413
  end
1382
1414
 
1383
1415
  #
@@ -1438,6 +1470,7 @@ module Appwrite
1438
1470
  params: api_params,
1439
1471
  response_type: Models::AttributeIp
1440
1472
  )
1473
+
1441
1474
  end
1442
1475
 
1443
1476
  #
@@ -1490,6 +1523,7 @@ module Appwrite
1490
1523
  params: api_params,
1491
1524
  response_type: Models::AttributeLine
1492
1525
  )
1526
+
1493
1527
  end
1494
1528
 
1495
1529
  #
@@ -1545,6 +1579,7 @@ module Appwrite
1545
1579
  params: api_params,
1546
1580
  response_type: Models::AttributeLine
1547
1581
  )
1582
+
1548
1583
  end
1549
1584
 
1550
1585
  # Create a longtext attribute.
@@ -1599,6 +1634,7 @@ module Appwrite
1599
1634
  params: api_params,
1600
1635
  response_type: Models::AttributeLongtext
1601
1636
  )
1637
+
1602
1638
  end
1603
1639
 
1604
1640
  # Update a longtext attribute. Changing the `default` value will not update
@@ -1656,6 +1692,7 @@ module Appwrite
1656
1692
  params: api_params,
1657
1693
  response_type: Models::AttributeLongtext
1658
1694
  )
1695
+
1659
1696
  end
1660
1697
 
1661
1698
  # Create a mediumtext attribute.
@@ -1710,6 +1747,7 @@ module Appwrite
1710
1747
  params: api_params,
1711
1748
  response_type: Models::AttributeMediumtext
1712
1749
  )
1750
+
1713
1751
  end
1714
1752
 
1715
1753
  # Update a mediumtext attribute. Changing the `default` value will not update
@@ -1767,6 +1805,7 @@ module Appwrite
1767
1805
  params: api_params,
1768
1806
  response_type: Models::AttributeMediumtext
1769
1807
  )
1808
+
1770
1809
  end
1771
1810
 
1772
1811
  #
@@ -1819,6 +1858,7 @@ module Appwrite
1819
1858
  params: api_params,
1820
1859
  response_type: Models::AttributePoint
1821
1860
  )
1861
+
1822
1862
  end
1823
1863
 
1824
1864
  #
@@ -1874,6 +1914,7 @@ module Appwrite
1874
1914
  params: api_params,
1875
1915
  response_type: Models::AttributePoint
1876
1916
  )
1917
+
1877
1918
  end
1878
1919
 
1879
1920
  #
@@ -1926,6 +1967,7 @@ module Appwrite
1926
1967
  params: api_params,
1927
1968
  response_type: Models::AttributePolygon
1928
1969
  )
1970
+
1929
1971
  end
1930
1972
 
1931
1973
  #
@@ -1981,6 +2023,7 @@ module Appwrite
1981
2023
  params: api_params,
1982
2024
  response_type: Models::AttributePolygon
1983
2025
  )
2026
+
1984
2027
  end
1985
2028
 
1986
2029
  #
@@ -2041,6 +2084,7 @@ module Appwrite
2041
2084
  params: api_params,
2042
2085
  response_type: Models::AttributeRelationship
2043
2086
  )
2087
+
2044
2088
  end
2045
2089
 
2046
2090
  #
@@ -2091,6 +2135,7 @@ module Appwrite
2091
2135
  params: api_params,
2092
2136
  response_type: Models::AttributeRelationship
2093
2137
  )
2138
+
2094
2139
  end
2095
2140
 
2096
2141
  #
@@ -2154,6 +2199,7 @@ module Appwrite
2154
2199
  params: api_params,
2155
2200
  response_type: Models::AttributeString
2156
2201
  )
2202
+
2157
2203
  end
2158
2204
 
2159
2205
  #
@@ -2216,6 +2262,7 @@ module Appwrite
2216
2262
  params: api_params,
2217
2263
  response_type: Models::AttributeString
2218
2264
  )
2265
+
2219
2266
  end
2220
2267
 
2221
2268
  # Create a text attribute.
@@ -2270,6 +2317,7 @@ module Appwrite
2270
2317
  params: api_params,
2271
2318
  response_type: Models::AttributeText
2272
2319
  )
2320
+
2273
2321
  end
2274
2322
 
2275
2323
  # Update a text attribute. Changing the `default` value will not update
@@ -2327,6 +2375,7 @@ module Appwrite
2327
2375
  params: api_params,
2328
2376
  response_type: Models::AttributeText
2329
2377
  )
2378
+
2330
2379
  end
2331
2380
 
2332
2381
  #
@@ -2382,6 +2431,7 @@ module Appwrite
2382
2431
  params: api_params,
2383
2432
  response_type: Models::AttributeUrl
2384
2433
  )
2434
+
2385
2435
  end
2386
2436
 
2387
2437
  #
@@ -2442,6 +2492,7 @@ module Appwrite
2442
2492
  params: api_params,
2443
2493
  response_type: Models::AttributeUrl
2444
2494
  )
2495
+
2445
2496
  end
2446
2497
 
2447
2498
  # Create a varchar attribute.
@@ -2502,6 +2553,7 @@ module Appwrite
2502
2553
  params: api_params,
2503
2554
  response_type: Models::AttributeVarchar
2504
2555
  )
2556
+
2505
2557
  end
2506
2558
 
2507
2559
  # Update a varchar attribute. Changing the `default` value will not update
@@ -2561,6 +2613,7 @@ module Appwrite
2561
2613
  params: api_params,
2562
2614
  response_type: Models::AttributeVarchar
2563
2615
  )
2616
+
2564
2617
  end
2565
2618
 
2566
2619
  #
@@ -2572,7 +2625,7 @@ module Appwrite
2572
2625
  # @param [String] collection_id Collection ID.
2573
2626
  # @param [String] key Attribute Key.
2574
2627
  #
2575
- # @return []
2628
+ # @return [AttributeBoolean, AttributeInteger, AttributeFloat, AttributeEmail, AttributeEnum, AttributeUrl, AttributeIp, AttributeDatetime, AttributeRelationship, AttributeString]
2576
2629
  def get_attribute(database_id:, collection_id:, key:)
2577
2630
  api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'
2578
2631
  .gsub('{databaseId}', database_id)
@@ -2597,13 +2650,69 @@ module Appwrite
2597
2650
  api_headers = {
2598
2651
  }
2599
2652
 
2600
- @client.call(
2653
+ response = @client.call(
2601
2654
  method: 'GET',
2602
2655
  path: api_path,
2603
2656
  headers: api_headers,
2604
2657
  params: api_params,
2605
- response_type: Models::AttributeBoolean
2606
2658
  )
2659
+
2660
+ unless response.is_a?(Hash)
2661
+ raise Exception, "Expected object response when hydrating a response model"
2662
+ end
2663
+
2664
+ if response['type'] == 'string' && response['format'] == 'email'
2665
+
2666
+ return Models::AttributeEmail.from(map: response)
2667
+ end
2668
+
2669
+ if response['type'] == 'string' && response['format'] == 'enum'
2670
+
2671
+ return Models::AttributeEnum.from(map: response)
2672
+ end
2673
+
2674
+ if response['type'] == 'string' && response['format'] == 'url'
2675
+
2676
+ return Models::AttributeUrl.from(map: response)
2677
+ end
2678
+
2679
+ if response['type'] == 'string' && response['format'] == 'ip'
2680
+
2681
+ return Models::AttributeIp.from(map: response)
2682
+ end
2683
+
2684
+ if response['type'] == 'boolean'
2685
+
2686
+ return Models::AttributeBoolean.from(map: response)
2687
+ end
2688
+
2689
+ if response['type'] == 'integer'
2690
+
2691
+ return Models::AttributeInteger.from(map: response)
2692
+ end
2693
+
2694
+ if response['type'] == 'double'
2695
+
2696
+ return Models::AttributeFloat.from(map: response)
2697
+ end
2698
+
2699
+ if response['type'] == 'datetime'
2700
+
2701
+ return Models::AttributeDatetime.from(map: response)
2702
+ end
2703
+
2704
+ if response['type'] == 'relationship'
2705
+
2706
+ return Models::AttributeRelationship.from(map: response)
2707
+ end
2708
+
2709
+ if response['type'] == 'string'
2710
+
2711
+ return Models::AttributeString.from(map: response)
2712
+ end
2713
+
2714
+ raise Exception, "Unable to match response to any expected response model"
2715
+
2607
2716
  end
2608
2717
 
2609
2718
  #
@@ -2647,6 +2756,7 @@ module Appwrite
2647
2756
  headers: api_headers,
2648
2757
  params: api_params,
2649
2758
  )
2759
+
2650
2760
  end
2651
2761
 
2652
2762
  #
@@ -2660,7 +2770,7 @@ module Appwrite
2660
2770
  # @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
2771
  # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction.
2662
2772
  # @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).
2773
+ # @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
2774
  #
2665
2775
  # @return [DocumentList]
2666
2776
  def list_documents(database_id:, collection_id:, queries: nil, transaction_id: nil, total: nil, ttl: nil)
@@ -2693,6 +2803,7 @@ module Appwrite
2693
2803
  params: api_params,
2694
2804
  response_type: Models::DocumentList
2695
2805
  )
2806
+
2696
2807
  end
2697
2808
 
2698
2809
  #
@@ -2750,6 +2861,7 @@ module Appwrite
2750
2861
  params: api_params,
2751
2862
  response_type: Models::Document
2752
2863
  )
2864
+
2753
2865
  end
2754
2866
 
2755
2867
  #
@@ -2799,6 +2911,7 @@ module Appwrite
2799
2911
  params: api_params,
2800
2912
  response_type: Models::DocumentList
2801
2913
  )
2914
+
2802
2915
  end
2803
2916
 
2804
2917
  #
@@ -2849,6 +2962,7 @@ module Appwrite
2849
2962
  params: api_params,
2850
2963
  response_type: Models::DocumentList
2851
2964
  )
2965
+
2852
2966
  end
2853
2967
 
2854
2968
  #
@@ -2895,6 +3009,7 @@ module Appwrite
2895
3009
  params: api_params,
2896
3010
  response_type: Models::DocumentList
2897
3011
  )
3012
+
2898
3013
  end
2899
3014
 
2900
3015
  #
@@ -2938,6 +3053,7 @@ module Appwrite
2938
3053
  params: api_params,
2939
3054
  response_type: Models::DocumentList
2940
3055
  )
3056
+
2941
3057
  end
2942
3058
 
2943
3059
  #
@@ -2986,6 +3102,7 @@ module Appwrite
2986
3102
  params: api_params,
2987
3103
  response_type: Models::Document
2988
3104
  )
3105
+
2989
3106
  end
2990
3107
 
2991
3108
  #
@@ -3039,6 +3156,7 @@ module Appwrite
3039
3156
  params: api_params,
3040
3157
  response_type: Models::Document
3041
3158
  )
3159
+
3042
3160
  end
3043
3161
 
3044
3162
  #
@@ -3090,6 +3208,7 @@ module Appwrite
3090
3208
  params: api_params,
3091
3209
  response_type: Models::Document
3092
3210
  )
3211
+
3093
3212
  end
3094
3213
 
3095
3214
  #
@@ -3135,6 +3254,7 @@ module Appwrite
3135
3254
  headers: api_headers,
3136
3255
  params: api_params,
3137
3256
  )
3257
+
3138
3258
  end
3139
3259
 
3140
3260
  #
@@ -3191,6 +3311,7 @@ module Appwrite
3191
3311
  params: api_params,
3192
3312
  response_type: Models::Document
3193
3313
  )
3314
+
3194
3315
  end
3195
3316
 
3196
3317
  #
@@ -3247,6 +3368,7 @@ module Appwrite
3247
3368
  params: api_params,
3248
3369
  response_type: Models::Document
3249
3370
  )
3371
+
3250
3372
  end
3251
3373
 
3252
3374
  #
@@ -3288,6 +3410,7 @@ module Appwrite
3288
3410
  params: api_params,
3289
3411
  response_type: Models::IndexList
3290
3412
  )
3413
+
3291
3414
  end
3292
3415
 
3293
3416
  #
@@ -3350,6 +3473,7 @@ module Appwrite
3350
3473
  params: api_params,
3351
3474
  response_type: Models::Index
3352
3475
  )
3476
+
3353
3477
  end
3354
3478
 
3355
3479
  #
@@ -3393,6 +3517,7 @@ module Appwrite
3393
3517
  params: api_params,
3394
3518
  response_type: Models::Index
3395
3519
  )
3520
+
3396
3521
  end
3397
3522
 
3398
3523
  #
@@ -3436,7 +3561,8 @@ module Appwrite
3436
3561
  headers: api_headers,
3437
3562
  params: api_params,
3438
3563
  )
3564
+
3439
3565
  end
3440
3566
 
3441
3567
  end
3442
- end
3568
+ end