appwrite 21.0.0 → 21.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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +1 -1
  3. data/lib/appwrite/enums/backup_services.rb +9 -0
  4. data/lib/appwrite/enums/build_runtime.rb +22 -3
  5. data/lib/appwrite/enums/runtime.rb +22 -3
  6. data/lib/appwrite/enums/scopes.rb +11 -0
  7. data/lib/appwrite/models/activity_event.rb +182 -0
  8. data/lib/appwrite/models/activity_event_list.rb +32 -0
  9. data/lib/appwrite/models/attribute_longtext.rb +8 -3
  10. data/lib/appwrite/models/attribute_mediumtext.rb +8 -3
  11. data/lib/appwrite/models/attribute_text.rb +8 -3
  12. data/lib/appwrite/models/attribute_varchar.rb +8 -3
  13. data/lib/appwrite/models/backup_archive.rb +82 -0
  14. data/lib/appwrite/models/backup_archive_list.rb +32 -0
  15. data/lib/appwrite/models/backup_policy.rb +77 -0
  16. data/lib/appwrite/models/backup_policy_list.rb +32 -0
  17. data/lib/appwrite/models/backup_restoration.rb +77 -0
  18. data/lib/appwrite/models/backup_restoration_list.rb +32 -0
  19. data/lib/appwrite/models/collection.rb +13 -3
  20. data/lib/appwrite/models/column_longtext.rb +8 -3
  21. data/lib/appwrite/models/column_mediumtext.rb +8 -3
  22. data/lib/appwrite/models/column_text.rb +8 -3
  23. data/lib/appwrite/models/column_varchar.rb +8 -3
  24. data/lib/appwrite/models/database.rb +13 -3
  25. data/lib/appwrite/models/table.rb +13 -3
  26. data/lib/appwrite/query.rb +18 -0
  27. data/lib/appwrite/services/activities.rb +64 -0
  28. data/lib/appwrite/services/backups.rb +383 -0
  29. data/lib/appwrite/services/databases.rb +66 -56
  30. data/lib/appwrite/services/health.rb +148 -0
  31. data/lib/appwrite/services/messaging.rb +1 -1
  32. data/lib/appwrite/services/sites.rb +2 -6
  33. data/lib/appwrite/services/storage.rb +2 -2
  34. data/lib/appwrite/services/tables_db.rb +15 -5
  35. data/lib/appwrite/services/teams.rb +2 -2
  36. data/lib/appwrite.rb +11 -1
  37. metadata +13 -3
  38. data/lib/appwrite/enums/roles.rb +0 -9
@@ -133,10 +133,28 @@ module Appwrite
133
133
  return Query.new("offset", nil, offset).to_s
134
134
  end
135
135
 
136
+ # Filter resources where attribute contains the specified value.
137
+ # For string attributes, checks if the string contains the substring.
138
+ #
139
+ # Note: For array attributes, use contains_any or contains_all instead.
136
140
  def contains(attribute, value)
137
141
  return Query.new("contains", attribute, value).to_s
138
142
  end
139
143
 
144
+ # Filter resources where attribute contains ANY of the specified values.
145
+ # For array and relationship attributes, matches documents where the attribute
146
+ # contains at least one of the given values.
147
+ def contains_any(attribute, value)
148
+ return Query.new("containsAny", attribute, value).to_s
149
+ end
150
+
151
+ # Filter resources where attribute contains ALL of the specified values.
152
+ # For array and relationship attributes, matches documents where the attribute
153
+ # contains every one of the given values.
154
+ def contains_all(attribute, value)
155
+ return Query.new("containsAll", attribute, value).to_s
156
+ end
157
+
140
158
  def not_contains(attribute, value)
141
159
  return Query.new("notContains", attribute, value).to_s
142
160
  end
@@ -0,0 +1,64 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ class Activities < Service
5
+
6
+ def initialize(client)
7
+ @client = client
8
+ end
9
+
10
+ # List all events for selected filters.
11
+ #
12
+ # @param [String] 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). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc.
13
+ #
14
+ # @return [ActivityEventList]
15
+ def list_events(queries: nil)
16
+ api_path = '/activities/events'
17
+
18
+ api_params = {
19
+ queries: queries,
20
+ }
21
+
22
+ api_headers = {
23
+ }
24
+
25
+ @client.call(
26
+ method: 'GET',
27
+ path: api_path,
28
+ headers: api_headers,
29
+ params: api_params,
30
+ response_type: Models::ActivityEventList
31
+ )
32
+ end
33
+
34
+ # Get event by ID.
35
+ #
36
+ #
37
+ # @param [String] event_id Event ID.
38
+ #
39
+ # @return [ActivityEvent]
40
+ def get_event(event_id:)
41
+ api_path = '/activities/events/{eventId}'
42
+ .gsub('{eventId}', event_id)
43
+
44
+ if event_id.nil?
45
+ raise Appwrite::Exception.new('Missing required parameter: "eventId"')
46
+ end
47
+
48
+ api_params = {
49
+ }
50
+
51
+ api_headers = {
52
+ }
53
+
54
+ @client.call(
55
+ method: 'GET',
56
+ path: api_path,
57
+ headers: api_headers,
58
+ params: api_params,
59
+ response_type: Models::ActivityEvent
60
+ )
61
+ end
62
+
63
+ end
64
+ end
@@ -0,0 +1,383 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ class Backups < Service
5
+
6
+ def initialize(client)
7
+ @client = client
8
+ end
9
+
10
+ # List all archives for a project.
11
+ #
12
+ # @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.
13
+ #
14
+ # @return [BackupArchiveList]
15
+ def list_archives(queries: nil)
16
+ api_path = '/backups/archives'
17
+
18
+ api_params = {
19
+ queries: queries,
20
+ }
21
+
22
+ api_headers = {
23
+ }
24
+
25
+ @client.call(
26
+ method: 'GET',
27
+ path: api_path,
28
+ headers: api_headers,
29
+ params: api_params,
30
+ response_type: Models::BackupArchiveList
31
+ )
32
+ end
33
+
34
+ # Create a new archive asynchronously for a project.
35
+ #
36
+ # @param [Array] services Array of services to backup
37
+ # @param [String] resource_id Resource ID. When set, only this single resource will be backed up.
38
+ #
39
+ # @return [BackupArchive]
40
+ def create_archive(services:, resource_id: nil)
41
+ api_path = '/backups/archives'
42
+
43
+ if services.nil?
44
+ raise Appwrite::Exception.new('Missing required parameter: "services"')
45
+ end
46
+
47
+ api_params = {
48
+ services: services,
49
+ resourceId: resource_id,
50
+ }
51
+
52
+ api_headers = {
53
+ "content-type": 'application/json',
54
+ }
55
+
56
+ @client.call(
57
+ method: 'POST',
58
+ path: api_path,
59
+ headers: api_headers,
60
+ params: api_params,
61
+ response_type: Models::BackupArchive
62
+ )
63
+ end
64
+
65
+ # Get a backup archive using it's ID.
66
+ #
67
+ # @param [String] archive_id Archive ID. Choose a custom ID`. 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.
68
+ #
69
+ # @return [BackupArchive]
70
+ def get_archive(archive_id:)
71
+ api_path = '/backups/archives/{archiveId}'
72
+ .gsub('{archiveId}', archive_id)
73
+
74
+ if archive_id.nil?
75
+ raise Appwrite::Exception.new('Missing required parameter: "archiveId"')
76
+ end
77
+
78
+ api_params = {
79
+ }
80
+
81
+ api_headers = {
82
+ }
83
+
84
+ @client.call(
85
+ method: 'GET',
86
+ path: api_path,
87
+ headers: api_headers,
88
+ params: api_params,
89
+ response_type: Models::BackupArchive
90
+ )
91
+ end
92
+
93
+ # Delete an existing archive for a project.
94
+ #
95
+ # @param [String] archive_id Policy 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.
96
+ #
97
+ # @return []
98
+ def delete_archive(archive_id:)
99
+ api_path = '/backups/archives/{archiveId}'
100
+ .gsub('{archiveId}', archive_id)
101
+
102
+ if archive_id.nil?
103
+ raise Appwrite::Exception.new('Missing required parameter: "archiveId"')
104
+ end
105
+
106
+ api_params = {
107
+ }
108
+
109
+ api_headers = {
110
+ "content-type": 'application/json',
111
+ }
112
+
113
+ @client.call(
114
+ method: 'DELETE',
115
+ path: api_path,
116
+ headers: api_headers,
117
+ params: api_params,
118
+ )
119
+ end
120
+
121
+ # List all policies for a project.
122
+ #
123
+ # @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.
124
+ #
125
+ # @return [BackupPolicyList]
126
+ def list_policies(queries: nil)
127
+ api_path = '/backups/policies'
128
+
129
+ api_params = {
130
+ queries: queries,
131
+ }
132
+
133
+ api_headers = {
134
+ }
135
+
136
+ @client.call(
137
+ method: 'GET',
138
+ path: api_path,
139
+ headers: api_headers,
140
+ params: api_params,
141
+ response_type: Models::BackupPolicyList
142
+ )
143
+ end
144
+
145
+ # Create a new backup policy.
146
+ #
147
+ # @param [String] policy_id Policy 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.
148
+ # @param [Array] services Array of services to backup
149
+ # @param [Integer] retention Days to keep backups before deletion
150
+ # @param [String] schedule Schedule CRON syntax.
151
+ # @param [String] name Policy name. Max length: 128 chars.
152
+ # @param [String] resource_id Resource ID. When set, only this single resource will be backed up.
153
+ # @param [] enabled Is policy enabled? When set to 'disabled', no backups will be taken
154
+ #
155
+ # @return [BackupPolicy]
156
+ def create_policy(policy_id:, services:, retention:, schedule:, name: nil, resource_id: nil, enabled: nil)
157
+ api_path = '/backups/policies'
158
+
159
+ if policy_id.nil?
160
+ raise Appwrite::Exception.new('Missing required parameter: "policyId"')
161
+ end
162
+
163
+ if services.nil?
164
+ raise Appwrite::Exception.new('Missing required parameter: "services"')
165
+ end
166
+
167
+ if retention.nil?
168
+ raise Appwrite::Exception.new('Missing required parameter: "retention"')
169
+ end
170
+
171
+ if schedule.nil?
172
+ raise Appwrite::Exception.new('Missing required parameter: "schedule"')
173
+ end
174
+
175
+ api_params = {
176
+ policyId: policy_id,
177
+ name: name,
178
+ services: services,
179
+ resourceId: resource_id,
180
+ enabled: enabled,
181
+ retention: retention,
182
+ schedule: schedule,
183
+ }
184
+
185
+ api_headers = {
186
+ "content-type": 'application/json',
187
+ }
188
+
189
+ @client.call(
190
+ method: 'POST',
191
+ path: api_path,
192
+ headers: api_headers,
193
+ params: api_params,
194
+ response_type: Models::BackupPolicy
195
+ )
196
+ end
197
+
198
+ # Get a backup policy using it's ID.
199
+ #
200
+ # @param [String] policy_id Policy ID. Choose a custom ID`. 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.
201
+ #
202
+ # @return [BackupPolicy]
203
+ def get_policy(policy_id:)
204
+ api_path = '/backups/policies/{policyId}'
205
+ .gsub('{policyId}', policy_id)
206
+
207
+ if policy_id.nil?
208
+ raise Appwrite::Exception.new('Missing required parameter: "policyId"')
209
+ end
210
+
211
+ api_params = {
212
+ }
213
+
214
+ api_headers = {
215
+ }
216
+
217
+ @client.call(
218
+ method: 'GET',
219
+ path: api_path,
220
+ headers: api_headers,
221
+ params: api_params,
222
+ response_type: Models::BackupPolicy
223
+ )
224
+ end
225
+
226
+ # Update an existing policy using it's ID.
227
+ #
228
+ # @param [String] policy_id Policy ID. Choose a custom ID`. 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.
229
+ # @param [String] name Policy name. Max length: 128 chars.
230
+ # @param [Integer] retention Days to keep backups before deletion
231
+ # @param [String] schedule Cron expression
232
+ # @param [] enabled Is Backup enabled? When set to 'disabled', No backup will be taken
233
+ #
234
+ # @return [BackupPolicy]
235
+ def update_policy(policy_id:, name: nil, retention: nil, schedule: nil, enabled: nil)
236
+ api_path = '/backups/policies/{policyId}'
237
+ .gsub('{policyId}', policy_id)
238
+
239
+ if policy_id.nil?
240
+ raise Appwrite::Exception.new('Missing required parameter: "policyId"')
241
+ end
242
+
243
+ api_params = {
244
+ name: name,
245
+ retention: retention,
246
+ schedule: schedule,
247
+ enabled: enabled,
248
+ }
249
+
250
+ api_headers = {
251
+ "content-type": 'application/json',
252
+ }
253
+
254
+ @client.call(
255
+ method: 'PATCH',
256
+ path: api_path,
257
+ headers: api_headers,
258
+ params: api_params,
259
+ response_type: Models::BackupPolicy
260
+ )
261
+ end
262
+
263
+ # Delete a policy using it's ID.
264
+ #
265
+ # @param [String] policy_id Policy 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.
266
+ #
267
+ # @return []
268
+ def delete_policy(policy_id:)
269
+ api_path = '/backups/policies/{policyId}'
270
+ .gsub('{policyId}', policy_id)
271
+
272
+ if policy_id.nil?
273
+ raise Appwrite::Exception.new('Missing required parameter: "policyId"')
274
+ end
275
+
276
+ api_params = {
277
+ }
278
+
279
+ api_headers = {
280
+ "content-type": 'application/json',
281
+ }
282
+
283
+ @client.call(
284
+ method: 'DELETE',
285
+ path: api_path,
286
+ headers: api_headers,
287
+ params: api_params,
288
+ )
289
+ end
290
+
291
+ # Create and trigger a new restoration for a backup on a project.
292
+ #
293
+ # @param [String] archive_id Backup archive ID to restore
294
+ # @param [Array] services Array of services to restore
295
+ # @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.
296
+ # @param [String] new_resource_name Database name. Max length: 128 chars.
297
+ #
298
+ # @return [BackupRestoration]
299
+ def create_restoration(archive_id:, services:, new_resource_id: nil, new_resource_name: nil)
300
+ api_path = '/backups/restoration'
301
+
302
+ if archive_id.nil?
303
+ raise Appwrite::Exception.new('Missing required parameter: "archiveId"')
304
+ end
305
+
306
+ if services.nil?
307
+ raise Appwrite::Exception.new('Missing required parameter: "services"')
308
+ end
309
+
310
+ api_params = {
311
+ archiveId: archive_id,
312
+ services: services,
313
+ newResourceId: new_resource_id,
314
+ newResourceName: new_resource_name,
315
+ }
316
+
317
+ api_headers = {
318
+ "content-type": 'application/json',
319
+ }
320
+
321
+ @client.call(
322
+ method: 'POST',
323
+ path: api_path,
324
+ headers: api_headers,
325
+ params: api_params,
326
+ response_type: Models::BackupRestoration
327
+ )
328
+ end
329
+
330
+ # List all backup restorations for a project.
331
+ #
332
+ # @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.
333
+ #
334
+ # @return [BackupRestorationList]
335
+ def list_restorations(queries: nil)
336
+ api_path = '/backups/restorations'
337
+
338
+ api_params = {
339
+ queries: queries,
340
+ }
341
+
342
+ api_headers = {
343
+ }
344
+
345
+ @client.call(
346
+ method: 'GET',
347
+ path: api_path,
348
+ headers: api_headers,
349
+ params: api_params,
350
+ response_type: Models::BackupRestorationList
351
+ )
352
+ end
353
+
354
+ # Get the current status of a backup restoration.
355
+ #
356
+ # @param [String] restoration_id Restoration ID. Choose a custom ID`. 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.
357
+ #
358
+ # @return [BackupRestoration]
359
+ def get_restoration(restoration_id:)
360
+ api_path = '/backups/restorations/{restorationId}'
361
+ .gsub('{restorationId}', restoration_id)
362
+
363
+ if restoration_id.nil?
364
+ raise Appwrite::Exception.new('Missing required parameter: "restorationId"')
365
+ end
366
+
367
+ api_params = {
368
+ }
369
+
370
+ api_headers = {
371
+ }
372
+
373
+ @client.call(
374
+ method: 'GET',
375
+ path: api_path,
376
+ headers: api_headers,
377
+ params: api_params,
378
+ response_type: Models::BackupRestoration
379
+ )
380
+ end
381
+
382
+ end
383
+ end
@@ -614,7 +614,7 @@ module Appwrite
614
614
  #
615
615
  #
616
616
  # @param [String] database_id Database ID.
617
- # @param [String] collection_id Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
617
+ # @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).
618
618
  # @param [String] key Attribute Key.
619
619
  # @param [] required Is attribute required?
620
620
  # @param [] default Default value for attribute when not provided. Cannot be set when attribute is required.
@@ -1556,9 +1556,10 @@ module Appwrite
1556
1556
  # @param [] required Is attribute required?
1557
1557
  # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
1558
1558
  # @param [] array Is attribute an array?
1559
+ # @param [] encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.
1559
1560
  #
1560
1561
  # @return [AttributeLongtext]
1561
- def create_longtext_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
1562
+ def create_longtext_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil, encrypt: nil)
1562
1563
  api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext'
1563
1564
  .gsub('{databaseId}', database_id)
1564
1565
  .gsub('{collectionId}', collection_id)
@@ -1584,6 +1585,7 @@ module Appwrite
1584
1585
  required: required,
1585
1586
  default: default,
1586
1587
  array: array,
1588
+ encrypt: encrypt,
1587
1589
  }
1588
1590
 
1589
1591
  api_headers = {
@@ -1665,9 +1667,10 @@ module Appwrite
1665
1667
  # @param [] required Is attribute required?
1666
1668
  # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
1667
1669
  # @param [] array Is attribute an array?
1670
+ # @param [] encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.
1668
1671
  #
1669
1672
  # @return [AttributeMediumtext]
1670
- def create_mediumtext_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
1673
+ def create_mediumtext_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil, encrypt: nil)
1671
1674
  api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext'
1672
1675
  .gsub('{databaseId}', database_id)
1673
1676
  .gsub('{collectionId}', collection_id)
@@ -1693,6 +1696,7 @@ module Appwrite
1693
1696
  required: required,
1694
1697
  default: default,
1695
1698
  array: array,
1699
+ encrypt: encrypt,
1696
1700
  }
1697
1701
 
1698
1702
  api_headers = {
@@ -2039,6 +2043,56 @@ module Appwrite
2039
2043
  )
2040
2044
  end
2041
2045
 
2046
+ #
2047
+ # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead.
2048
+ #
2049
+ # Update relationship attribute. [Learn more about relationship
2050
+ # attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
2051
+ #
2052
+ #
2053
+ # @param [String] database_id Database ID.
2054
+ # @param [String] collection_id Collection ID.
2055
+ # @param [String] key Attribute Key.
2056
+ # @param [RelationMutate] on_delete Constraints option
2057
+ # @param [String] new_key New Attribute Key.
2058
+ #
2059
+ # @return [AttributeRelationship]
2060
+ def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: nil, new_key: nil)
2061
+ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}'
2062
+ .gsub('{databaseId}', database_id)
2063
+ .gsub('{collectionId}', collection_id)
2064
+ .gsub('{key}', key)
2065
+
2066
+ if database_id.nil?
2067
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
2068
+ end
2069
+
2070
+ if collection_id.nil?
2071
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
2072
+ end
2073
+
2074
+ if key.nil?
2075
+ raise Appwrite::Exception.new('Missing required parameter: "key"')
2076
+ end
2077
+
2078
+ api_params = {
2079
+ onDelete: on_delete,
2080
+ newKey: new_key,
2081
+ }
2082
+
2083
+ api_headers = {
2084
+ "content-type": 'application/json',
2085
+ }
2086
+
2087
+ @client.call(
2088
+ method: 'PATCH',
2089
+ path: api_path,
2090
+ headers: api_headers,
2091
+ params: api_params,
2092
+ response_type: Models::AttributeRelationship
2093
+ )
2094
+ end
2095
+
2042
2096
  #
2043
2097
  # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createStringColumn` instead.
2044
2098
  #
@@ -2173,9 +2227,10 @@ module Appwrite
2173
2227
  # @param [] required Is attribute required?
2174
2228
  # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
2175
2229
  # @param [] array Is attribute an array?
2230
+ # @param [] encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.
2176
2231
  #
2177
2232
  # @return [AttributeText]
2178
- def create_text_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
2233
+ def create_text_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil, encrypt: nil)
2179
2234
  api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/text'
2180
2235
  .gsub('{databaseId}', database_id)
2181
2236
  .gsub('{collectionId}', collection_id)
@@ -2201,6 +2256,7 @@ module Appwrite
2201
2256
  required: required,
2202
2257
  default: default,
2203
2258
  array: array,
2259
+ encrypt: encrypt,
2204
2260
  }
2205
2261
 
2206
2262
  api_headers = {
@@ -2398,9 +2454,10 @@ module Appwrite
2398
2454
  # @param [] required Is attribute required?
2399
2455
  # @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
2400
2456
  # @param [] array Is attribute an array?
2457
+ # @param [] encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.
2401
2458
  #
2402
2459
  # @return [AttributeVarchar]
2403
- def create_varchar_attribute(database_id:, collection_id:, key:, size:, required:, default: nil, array: nil)
2460
+ def create_varchar_attribute(database_id:, collection_id:, key:, size:, required:, default: nil, array: nil, encrypt: nil)
2404
2461
  api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar'
2405
2462
  .gsub('{databaseId}', database_id)
2406
2463
  .gsub('{collectionId}', collection_id)
@@ -2431,6 +2488,7 @@ module Appwrite
2431
2488
  required: required,
2432
2489
  default: default,
2433
2490
  array: array,
2491
+ encrypt: encrypt,
2434
2492
  }
2435
2493
 
2436
2494
  api_headers = {
@@ -2591,56 +2649,6 @@ module Appwrite
2591
2649
  )
2592
2650
  end
2593
2651
 
2594
- #
2595
- # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead.
2596
- #
2597
- # Update relationship attribute. [Learn more about relationship
2598
- # attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
2599
- #
2600
- #
2601
- # @param [String] database_id Database ID.
2602
- # @param [String] collection_id Collection ID.
2603
- # @param [String] key Attribute Key.
2604
- # @param [RelationMutate] on_delete Constraints option
2605
- # @param [String] new_key New Attribute Key.
2606
- #
2607
- # @return [AttributeRelationship]
2608
- def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: nil, new_key: nil)
2609
- api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'
2610
- .gsub('{databaseId}', database_id)
2611
- .gsub('{collectionId}', collection_id)
2612
- .gsub('{key}', key)
2613
-
2614
- if database_id.nil?
2615
- raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
2616
- end
2617
-
2618
- if collection_id.nil?
2619
- raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
2620
- end
2621
-
2622
- if key.nil?
2623
- raise Appwrite::Exception.new('Missing required parameter: "key"')
2624
- end
2625
-
2626
- api_params = {
2627
- onDelete: on_delete,
2628
- newKey: new_key,
2629
- }
2630
-
2631
- api_headers = {
2632
- "content-type": 'application/json',
2633
- }
2634
-
2635
- @client.call(
2636
- method: 'PATCH',
2637
- path: api_path,
2638
- headers: api_headers,
2639
- params: api_params,
2640
- response_type: Models::AttributeRelationship
2641
- )
2642
- end
2643
-
2644
2652
  #
2645
2653
  # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead.
2646
2654
  #
@@ -2652,9 +2660,10 @@ module Appwrite
2652
2660
  # @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.
2653
2661
  # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction.
2654
2662
  # @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).
2655
2664
  #
2656
2665
  # @return [DocumentList]
2657
- def list_documents(database_id:, collection_id:, queries: nil, transaction_id: nil, total: nil)
2666
+ def list_documents(database_id:, collection_id:, queries: nil, transaction_id: nil, total: nil, ttl: nil)
2658
2667
  api_path = '/databases/{databaseId}/collections/{collectionId}/documents'
2659
2668
  .gsub('{databaseId}', database_id)
2660
2669
  .gsub('{collectionId}', collection_id)
@@ -2671,6 +2680,7 @@ module Appwrite
2671
2680
  queries: queries,
2672
2681
  transactionId: transaction_id,
2673
2682
  total: total,
2683
+ ttl: ttl,
2674
2684
  }
2675
2685
 
2676
2686
  api_headers = {