appwrite 7.1.0 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/appwrite/client.rb +2 -2
- data/lib/appwrite/models/algo_argon2.rb +5 -0
- data/lib/appwrite/models/algo_bcrypt.rb +5 -0
- data/lib/appwrite/models/algo_md5.rb +5 -0
- data/lib/appwrite/models/algo_phpass.rb +5 -0
- data/lib/appwrite/models/algo_scrypt.rb +5 -0
- data/lib/appwrite/models/algo_scrypt_modified.rb +5 -0
- data/lib/appwrite/models/algo_sha.rb +5 -0
- data/lib/appwrite/models/attribute_boolean.rb +5 -0
- data/lib/appwrite/models/attribute_datetime.rb +5 -0
- data/lib/appwrite/models/attribute_email.rb +5 -0
- data/lib/appwrite/models/attribute_enum.rb +5 -0
- data/lib/appwrite/models/attribute_float.rb +5 -0
- data/lib/appwrite/models/attribute_integer.rb +5 -0
- data/lib/appwrite/models/attribute_ip.rb +5 -0
- data/lib/appwrite/models/attribute_relationship.rb +82 -0
- data/lib/appwrite/models/attribute_string.rb +5 -0
- data/lib/appwrite/models/attribute_url.rb +5 -0
- data/lib/appwrite/models/database.rb +8 -3
- data/lib/appwrite/models/deployment.rb +65 -10
- data/lib/appwrite/models/execution.rb +40 -20
- data/lib/appwrite/models/function.rb +53 -13
- data/lib/appwrite/models/headers.rb +32 -0
- data/lib/appwrite/models/health_status.rb +5 -0
- data/lib/appwrite/models/identity.rb +72 -0
- data/lib/appwrite/models/identity_list.rb +32 -0
- data/lib/appwrite/models/index.rb +5 -0
- data/lib/appwrite/models/locale_code.rb +32 -0
- data/lib/appwrite/models/locale_code_list.rb +32 -0
- data/lib/appwrite/models/team.rb +8 -3
- data/lib/appwrite/models/user.rb +16 -6
- data/lib/appwrite/models/variable.rb +10 -5
- data/lib/appwrite/query.rb +41 -17
- data/lib/appwrite/services/account.rb +120 -65
- data/lib/appwrite/services/avatars.rb +14 -14
- data/lib/appwrite/services/databases.rb +834 -188
- data/lib/appwrite/services/functions.rb +150 -74
- data/lib/appwrite/services/graphql.rb +71 -0
- data/lib/appwrite/services/health.rb +71 -22
- data/lib/appwrite/services/locale.rb +39 -14
- data/lib/appwrite/services/storage.rb +43 -42
- data/lib/appwrite/services/teams.rb +123 -50
- data/lib/appwrite/services/users.rb +158 -60
- data/lib/appwrite.rb +7 -1
- metadata +10 -4
- data/lib/appwrite/models/account.rb +0 -82
@@ -10,12 +10,12 @@ module Appwrite
|
|
10
10
|
# Get a list of all databases from the current Appwrite project. You can use
|
11
11
|
# the search parameter to filter your results.
|
12
12
|
#
|
13
|
-
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/
|
13
|
+
# @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. You may filter on the following attributes: name
|
14
14
|
# @param [String] search Search term to filter your list results. Max length: 256 chars.
|
15
15
|
#
|
16
16
|
# @return [DatabaseList]
|
17
17
|
def list(queries: nil, search: nil)
|
18
|
-
|
18
|
+
api_path = '/databases'
|
19
19
|
|
20
20
|
params = {
|
21
21
|
queries: queries,
|
@@ -28,7 +28,7 @@ module Appwrite
|
|
28
28
|
|
29
29
|
@client.call(
|
30
30
|
method: 'GET',
|
31
|
-
path:
|
31
|
+
path: api_path,
|
32
32
|
headers: headers,
|
33
33
|
params: params,
|
34
34
|
response_type: Models::DatabaseList
|
@@ -39,12 +39,13 @@ module Appwrite
|
|
39
39
|
# Create a new Database.
|
40
40
|
#
|
41
41
|
#
|
42
|
-
# @param [String] database_id Unique Id. Choose
|
43
|
-
# @param [String] name
|
42
|
+
# @param [String] database_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.
|
43
|
+
# @param [String] name Database name. Max length: 128 chars.
|
44
|
+
# @param [] enabled Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
|
44
45
|
#
|
45
46
|
# @return [Database]
|
46
|
-
def create(database_id:, name:)
|
47
|
-
|
47
|
+
def create(database_id:, name:, enabled: nil)
|
48
|
+
api_path = '/databases'
|
48
49
|
|
49
50
|
if database_id.nil?
|
50
51
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
@@ -57,6 +58,7 @@ module Appwrite
|
|
57
58
|
params = {
|
58
59
|
databaseId: database_id,
|
59
60
|
name: name,
|
61
|
+
enabled: enabled,
|
60
62
|
}
|
61
63
|
|
62
64
|
headers = {
|
@@ -65,7 +67,7 @@ module Appwrite
|
|
65
67
|
|
66
68
|
@client.call(
|
67
69
|
method: 'POST',
|
68
|
-
path:
|
70
|
+
path: api_path,
|
69
71
|
headers: headers,
|
70
72
|
params: params,
|
71
73
|
response_type: Models::Database
|
@@ -80,7 +82,7 @@ module Appwrite
|
|
80
82
|
#
|
81
83
|
# @return [Database]
|
82
84
|
def get(database_id:)
|
83
|
-
|
85
|
+
api_path = '/databases/{databaseId}'
|
84
86
|
.gsub('{databaseId}', database_id)
|
85
87
|
|
86
88
|
if database_id.nil?
|
@@ -96,7 +98,7 @@ module Appwrite
|
|
96
98
|
|
97
99
|
@client.call(
|
98
100
|
method: 'GET',
|
99
|
-
path:
|
101
|
+
path: api_path,
|
100
102
|
headers: headers,
|
101
103
|
params: params,
|
102
104
|
response_type: Models::Database
|
@@ -107,11 +109,12 @@ module Appwrite
|
|
107
109
|
# Update a database by its unique ID.
|
108
110
|
#
|
109
111
|
# @param [String] database_id Database ID.
|
110
|
-
# @param [String] name
|
112
|
+
# @param [String] name Database name. Max length: 128 chars.
|
113
|
+
# @param [] enabled Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
|
111
114
|
#
|
112
115
|
# @return [Database]
|
113
|
-
def update(database_id:, name:)
|
114
|
-
|
116
|
+
def update(database_id:, name:, enabled: nil)
|
117
|
+
api_path = '/databases/{databaseId}'
|
115
118
|
.gsub('{databaseId}', database_id)
|
116
119
|
|
117
120
|
if database_id.nil?
|
@@ -124,6 +127,7 @@ module Appwrite
|
|
124
127
|
|
125
128
|
params = {
|
126
129
|
name: name,
|
130
|
+
enabled: enabled,
|
127
131
|
}
|
128
132
|
|
129
133
|
headers = {
|
@@ -132,7 +136,7 @@ module Appwrite
|
|
132
136
|
|
133
137
|
@client.call(
|
134
138
|
method: 'PUT',
|
135
|
-
path:
|
139
|
+
path: api_path,
|
136
140
|
headers: headers,
|
137
141
|
params: params,
|
138
142
|
response_type: Models::Database
|
@@ -147,7 +151,7 @@ module Appwrite
|
|
147
151
|
#
|
148
152
|
# @return []
|
149
153
|
def delete(database_id:)
|
150
|
-
|
154
|
+
api_path = '/databases/{databaseId}'
|
151
155
|
.gsub('{databaseId}', database_id)
|
152
156
|
|
153
157
|
if database_id.nil?
|
@@ -163,7 +167,7 @@ module Appwrite
|
|
163
167
|
|
164
168
|
@client.call(
|
165
169
|
method: 'DELETE',
|
166
|
-
path:
|
170
|
+
path: api_path,
|
167
171
|
headers: headers,
|
168
172
|
params: params,
|
169
173
|
)
|
@@ -174,12 +178,12 @@ module Appwrite
|
|
174
178
|
# can use the search parameter to filter your results.
|
175
179
|
#
|
176
180
|
# @param [String] database_id Database ID.
|
177
|
-
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/
|
181
|
+
# @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. You may filter on the following attributes: name, enabled, documentSecurity
|
178
182
|
# @param [String] search Search term to filter your list results. Max length: 256 chars.
|
179
183
|
#
|
180
184
|
# @return [CollectionList]
|
181
185
|
def list_collections(database_id:, queries: nil, search: nil)
|
182
|
-
|
186
|
+
api_path = '/databases/{databaseId}/collections'
|
183
187
|
.gsub('{databaseId}', database_id)
|
184
188
|
|
185
189
|
if database_id.nil?
|
@@ -197,7 +201,7 @@ module Appwrite
|
|
197
201
|
|
198
202
|
@client.call(
|
199
203
|
method: 'GET',
|
200
|
-
path:
|
204
|
+
path: api_path,
|
201
205
|
headers: headers,
|
202
206
|
params: params,
|
203
207
|
response_type: Models::CollectionList
|
@@ -211,14 +215,15 @@ module Appwrite
|
|
211
215
|
# directly from your database console.
|
212
216
|
#
|
213
217
|
# @param [String] database_id Database ID.
|
214
|
-
# @param [String] collection_id Unique Id. Choose
|
218
|
+
# @param [String] collection_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.
|
215
219
|
# @param [String] name Collection name. Max length: 128 chars.
|
216
|
-
# @param [Array] permissions An array of permissions strings. By default no user is granted with any permissions. [Learn more about permissions](/docs/permissions).
|
220
|
+
# @param [Array] permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](/docs/permissions).
|
217
221
|
# @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](/docs/permissions).
|
222
|
+
# @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.
|
218
223
|
#
|
219
224
|
# @return [Collection]
|
220
|
-
def create_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil)
|
221
|
-
|
225
|
+
def create_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil, enabled: nil)
|
226
|
+
api_path = '/databases/{databaseId}/collections'
|
222
227
|
.gsub('{databaseId}', database_id)
|
223
228
|
|
224
229
|
if database_id.nil?
|
@@ -238,6 +243,7 @@ module Appwrite
|
|
238
243
|
name: name,
|
239
244
|
permissions: permissions,
|
240
245
|
documentSecurity: document_security,
|
246
|
+
enabled: enabled,
|
241
247
|
}
|
242
248
|
|
243
249
|
headers = {
|
@@ -246,7 +252,7 @@ module Appwrite
|
|
246
252
|
|
247
253
|
@client.call(
|
248
254
|
method: 'POST',
|
249
|
-
path:
|
255
|
+
path: api_path,
|
250
256
|
headers: headers,
|
251
257
|
params: params,
|
252
258
|
response_type: Models::Collection
|
@@ -262,7 +268,7 @@ module Appwrite
|
|
262
268
|
#
|
263
269
|
# @return [Collection]
|
264
270
|
def get_collection(database_id:, collection_id:)
|
265
|
-
|
271
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}'
|
266
272
|
.gsub('{databaseId}', database_id)
|
267
273
|
.gsub('{collectionId}', collection_id)
|
268
274
|
|
@@ -283,7 +289,7 @@ module Appwrite
|
|
283
289
|
|
284
290
|
@client.call(
|
285
291
|
method: 'GET',
|
286
|
-
path:
|
292
|
+
path: api_path,
|
287
293
|
headers: headers,
|
288
294
|
params: params,
|
289
295
|
response_type: Models::Collection
|
@@ -296,13 +302,13 @@ module Appwrite
|
|
296
302
|
# @param [String] database_id Database ID.
|
297
303
|
# @param [String] collection_id Collection ID.
|
298
304
|
# @param [String] name Collection name. Max length: 128 chars.
|
299
|
-
# @param [Array] permissions An array of permission strings. By default the current
|
305
|
+
# @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions).
|
300
306
|
# @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](/docs/permissions).
|
301
|
-
# @param [] enabled Is collection enabled?
|
307
|
+
# @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.
|
302
308
|
#
|
303
309
|
# @return [Collection]
|
304
310
|
def update_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil, enabled: nil)
|
305
|
-
|
311
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}'
|
306
312
|
.gsub('{databaseId}', database_id)
|
307
313
|
.gsub('{collectionId}', collection_id)
|
308
314
|
|
@@ -331,7 +337,7 @@ module Appwrite
|
|
331
337
|
|
332
338
|
@client.call(
|
333
339
|
method: 'PUT',
|
334
|
-
path:
|
340
|
+
path: api_path,
|
335
341
|
headers: headers,
|
336
342
|
params: params,
|
337
343
|
response_type: Models::Collection
|
@@ -347,7 +353,7 @@ module Appwrite
|
|
347
353
|
#
|
348
354
|
# @return []
|
349
355
|
def delete_collection(database_id:, collection_id:)
|
350
|
-
|
356
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}'
|
351
357
|
.gsub('{databaseId}', database_id)
|
352
358
|
.gsub('{collectionId}', collection_id)
|
353
359
|
|
@@ -368,7 +374,7 @@ module Appwrite
|
|
368
374
|
|
369
375
|
@client.call(
|
370
376
|
method: 'DELETE',
|
371
|
-
path:
|
377
|
+
path: api_path,
|
372
378
|
headers: headers,
|
373
379
|
params: params,
|
374
380
|
)
|
@@ -379,10 +385,11 @@ module Appwrite
|
|
379
385
|
#
|
380
386
|
# @param [String] database_id Database ID.
|
381
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).
|
388
|
+
# @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. You may filter on the following attributes: key, type, size, required, array, status, error
|
382
389
|
#
|
383
390
|
# @return [AttributeList]
|
384
|
-
def list_attributes(database_id:, collection_id:)
|
385
|
-
|
391
|
+
def list_attributes(database_id:, collection_id:, queries: nil)
|
392
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes'
|
386
393
|
.gsub('{databaseId}', database_id)
|
387
394
|
.gsub('{collectionId}', collection_id)
|
388
395
|
|
@@ -395,6 +402,7 @@ module Appwrite
|
|
395
402
|
end
|
396
403
|
|
397
404
|
params = {
|
405
|
+
queries: queries,
|
398
406
|
}
|
399
407
|
|
400
408
|
headers = {
|
@@ -403,7 +411,7 @@ module Appwrite
|
|
403
411
|
|
404
412
|
@client.call(
|
405
413
|
method: 'GET',
|
406
|
-
path:
|
414
|
+
path: api_path,
|
407
415
|
headers: headers,
|
408
416
|
params: params,
|
409
417
|
response_type: Models::AttributeList
|
@@ -423,7 +431,7 @@ module Appwrite
|
|
423
431
|
#
|
424
432
|
# @return [AttributeBoolean]
|
425
433
|
def create_boolean_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
426
|
-
|
434
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'
|
427
435
|
.gsub('{databaseId}', database_id)
|
428
436
|
.gsub('{collectionId}', collection_id)
|
429
437
|
|
@@ -456,7 +464,7 @@ module Appwrite
|
|
456
464
|
|
457
465
|
@client.call(
|
458
466
|
method: 'POST',
|
459
|
-
path:
|
467
|
+
path: api_path,
|
460
468
|
headers: headers,
|
461
469
|
params: params,
|
462
470
|
response_type: Models::AttributeBoolean
|
@@ -470,14 +478,14 @@ module Appwrite
|
|
470
478
|
# @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).
|
471
479
|
# @param [String] key Attribute Key.
|
472
480
|
# @param [] required Is attribute required?
|
473
|
-
# @param [
|
474
|
-
# @param [] array Is attribute an array?
|
481
|
+
# @param [] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
475
482
|
#
|
476
|
-
# @return [
|
477
|
-
def
|
478
|
-
|
483
|
+
# @return [AttributeBoolean]
|
484
|
+
def update_boolean_attribute(database_id:, collection_id:, key:, required:, default:)
|
485
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'
|
479
486
|
.gsub('{databaseId}', database_id)
|
480
487
|
.gsub('{collectionId}', collection_id)
|
488
|
+
.gsub('{key}', key)
|
481
489
|
|
482
490
|
if database_id.nil?
|
483
491
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
@@ -495,11 +503,13 @@ module Appwrite
|
|
495
503
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
496
504
|
end
|
497
505
|
|
506
|
+
if default.nil?
|
507
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
508
|
+
end
|
509
|
+
|
498
510
|
params = {
|
499
|
-
key: key,
|
500
511
|
required: required,
|
501
512
|
default: default,
|
502
|
-
array: array,
|
503
513
|
}
|
504
514
|
|
505
515
|
headers = {
|
@@ -507,28 +517,27 @@ module Appwrite
|
|
507
517
|
}
|
508
518
|
|
509
519
|
@client.call(
|
510
|
-
method: '
|
511
|
-
path:
|
520
|
+
method: 'PATCH',
|
521
|
+
path: api_path,
|
512
522
|
headers: headers,
|
513
523
|
params: params,
|
514
|
-
response_type: Models::
|
524
|
+
response_type: Models::AttributeBoolean
|
515
525
|
)
|
516
526
|
end
|
517
527
|
|
518
528
|
|
519
|
-
# Create an email attribute.
|
520
529
|
#
|
521
530
|
#
|
522
531
|
# @param [String] database_id Database ID.
|
523
532
|
# @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).
|
524
533
|
# @param [String] key Attribute Key.
|
525
534
|
# @param [] required Is attribute required?
|
526
|
-
# @param [String] default Default value for attribute
|
535
|
+
# @param [String] default Default value for the attribute in ISO 8601 format. Cannot be set when attribute is required.
|
527
536
|
# @param [] array Is attribute an array?
|
528
537
|
#
|
529
|
-
# @return [
|
530
|
-
def
|
531
|
-
|
538
|
+
# @return [AttributeDatetime]
|
539
|
+
def create_datetime_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
540
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'
|
532
541
|
.gsub('{databaseId}', database_id)
|
533
542
|
.gsub('{collectionId}', collection_id)
|
534
543
|
|
@@ -561,10 +570,10 @@ module Appwrite
|
|
561
570
|
|
562
571
|
@client.call(
|
563
572
|
method: 'POST',
|
564
|
-
path:
|
573
|
+
path: api_path,
|
565
574
|
headers: headers,
|
566
575
|
params: params,
|
567
|
-
response_type: Models::
|
576
|
+
response_type: Models::AttributeDatetime
|
568
577
|
)
|
569
578
|
end
|
570
579
|
|
@@ -574,16 +583,15 @@ module Appwrite
|
|
574
583
|
# @param [String] database_id Database ID.
|
575
584
|
# @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).
|
576
585
|
# @param [String] key Attribute Key.
|
577
|
-
# @param [Array] elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 4096 characters long.
|
578
586
|
# @param [] required Is attribute required?
|
579
587
|
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
580
|
-
# @param [] array Is attribute an array?
|
581
588
|
#
|
582
|
-
# @return [
|
583
|
-
def
|
584
|
-
|
589
|
+
# @return [AttributeDatetime]
|
590
|
+
def update_datetime_attribute(database_id:, collection_id:, key:, required:, default:)
|
591
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'
|
585
592
|
.gsub('{databaseId}', database_id)
|
586
593
|
.gsub('{collectionId}', collection_id)
|
594
|
+
.gsub('{key}', key)
|
587
595
|
|
588
596
|
if database_id.nil?
|
589
597
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
@@ -597,20 +605,17 @@ module Appwrite
|
|
597
605
|
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
598
606
|
end
|
599
607
|
|
600
|
-
if elements.nil?
|
601
|
-
raise Appwrite::Exception.new('Missing required parameter: "elements"')
|
602
|
-
end
|
603
|
-
|
604
608
|
if required.nil?
|
605
609
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
606
610
|
end
|
607
611
|
|
612
|
+
if default.nil?
|
613
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
614
|
+
end
|
615
|
+
|
608
616
|
params = {
|
609
|
-
key: key,
|
610
|
-
elements: elements,
|
611
617
|
required: required,
|
612
618
|
default: default,
|
613
|
-
array: array,
|
614
619
|
}
|
615
620
|
|
616
621
|
headers = {
|
@@ -618,31 +623,28 @@ module Appwrite
|
|
618
623
|
}
|
619
624
|
|
620
625
|
@client.call(
|
621
|
-
method: '
|
622
|
-
path:
|
626
|
+
method: 'PATCH',
|
627
|
+
path: api_path,
|
623
628
|
headers: headers,
|
624
629
|
params: params,
|
625
|
-
response_type: Models::
|
630
|
+
response_type: Models::AttributeDatetime
|
626
631
|
)
|
627
632
|
end
|
628
633
|
|
629
634
|
|
630
|
-
# Create
|
631
|
-
# provided.
|
635
|
+
# Create an email attribute.
|
632
636
|
#
|
633
637
|
#
|
634
638
|
# @param [String] database_id Database ID.
|
635
639
|
# @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).
|
636
640
|
# @param [String] key Attribute Key.
|
637
641
|
# @param [] required Is attribute required?
|
638
|
-
# @param [
|
639
|
-
# @param [Float] max Maximum value to enforce on new documents
|
640
|
-
# @param [Float] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
642
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
641
643
|
# @param [] array Is attribute an array?
|
642
644
|
#
|
643
|
-
# @return [
|
644
|
-
def
|
645
|
-
|
645
|
+
# @return [AttributeEmail]
|
646
|
+
def create_email_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
647
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email'
|
646
648
|
.gsub('{databaseId}', database_id)
|
647
649
|
.gsub('{collectionId}', collection_id)
|
648
650
|
|
@@ -665,8 +667,6 @@ module Appwrite
|
|
665
667
|
params = {
|
666
668
|
key: key,
|
667
669
|
required: required,
|
668
|
-
min: min,
|
669
|
-
max: max,
|
670
670
|
default: default,
|
671
671
|
array: array,
|
672
672
|
}
|
@@ -677,32 +677,30 @@ module Appwrite
|
|
677
677
|
|
678
678
|
@client.call(
|
679
679
|
method: 'POST',
|
680
|
-
path:
|
680
|
+
path: api_path,
|
681
681
|
headers: headers,
|
682
682
|
params: params,
|
683
|
-
response_type: Models::
|
683
|
+
response_type: Models::AttributeEmail
|
684
684
|
)
|
685
685
|
end
|
686
686
|
|
687
687
|
|
688
|
-
#
|
689
|
-
#
|
688
|
+
# Update an email attribute. Changing the `default` value will not update
|
689
|
+
# already existing documents.
|
690
690
|
#
|
691
691
|
#
|
692
692
|
# @param [String] database_id Database ID.
|
693
693
|
# @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).
|
694
694
|
# @param [String] key Attribute Key.
|
695
695
|
# @param [] required Is attribute required?
|
696
|
-
# @param [
|
697
|
-
# @param [Integer] max Maximum value to enforce on new documents
|
698
|
-
# @param [Integer] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
699
|
-
# @param [] array Is attribute an array?
|
696
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
700
697
|
#
|
701
|
-
# @return [
|
702
|
-
def
|
703
|
-
|
698
|
+
# @return [AttributeEmail]
|
699
|
+
def update_email_attribute(database_id:, collection_id:, key:, required:, default:)
|
700
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'
|
704
701
|
.gsub('{databaseId}', database_id)
|
705
702
|
.gsub('{collectionId}', collection_id)
|
703
|
+
.gsub('{key}', key)
|
706
704
|
|
707
705
|
if database_id.nil?
|
708
706
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
@@ -720,13 +718,13 @@ module Appwrite
|
|
720
718
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
721
719
|
end
|
722
720
|
|
721
|
+
if default.nil?
|
722
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
723
|
+
end
|
724
|
+
|
723
725
|
params = {
|
724
|
-
key: key,
|
725
726
|
required: required,
|
726
|
-
min: min,
|
727
|
-
max: max,
|
728
727
|
default: default,
|
729
|
-
array: array,
|
730
728
|
}
|
731
729
|
|
732
730
|
headers = {
|
@@ -734,28 +732,28 @@ module Appwrite
|
|
734
732
|
}
|
735
733
|
|
736
734
|
@client.call(
|
737
|
-
method: '
|
738
|
-
path:
|
735
|
+
method: 'PATCH',
|
736
|
+
path: api_path,
|
739
737
|
headers: headers,
|
740
738
|
params: params,
|
741
|
-
response_type: Models::
|
739
|
+
response_type: Models::AttributeEmail
|
742
740
|
)
|
743
741
|
end
|
744
742
|
|
745
743
|
|
746
|
-
# Create IP address attribute.
|
747
744
|
#
|
748
745
|
#
|
749
746
|
# @param [String] database_id Database ID.
|
750
747
|
# @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).
|
751
748
|
# @param [String] key Attribute Key.
|
749
|
+
# @param [Array] elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 4096 characters long.
|
752
750
|
# @param [] required Is attribute required?
|
753
751
|
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
754
752
|
# @param [] array Is attribute an array?
|
755
753
|
#
|
756
|
-
# @return [
|
757
|
-
def
|
758
|
-
|
754
|
+
# @return [AttributeEnum]
|
755
|
+
def create_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default: nil, array: nil)
|
756
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'
|
759
757
|
.gsub('{databaseId}', database_id)
|
760
758
|
.gsub('{collectionId}', collection_id)
|
761
759
|
|
@@ -771,12 +769,17 @@ module Appwrite
|
|
771
769
|
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
772
770
|
end
|
773
771
|
|
772
|
+
if elements.nil?
|
773
|
+
raise Appwrite::Exception.new('Missing required parameter: "elements"')
|
774
|
+
end
|
775
|
+
|
774
776
|
if required.nil?
|
775
777
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
776
778
|
end
|
777
779
|
|
778
780
|
params = {
|
779
781
|
key: key,
|
782
|
+
elements: elements,
|
780
783
|
required: required,
|
781
784
|
default: default,
|
782
785
|
array: array,
|
@@ -788,30 +791,31 @@ module Appwrite
|
|
788
791
|
|
789
792
|
@client.call(
|
790
793
|
method: 'POST',
|
791
|
-
path:
|
794
|
+
path: api_path,
|
792
795
|
headers: headers,
|
793
796
|
params: params,
|
794
|
-
response_type: Models::
|
797
|
+
response_type: Models::AttributeEnum
|
795
798
|
)
|
796
799
|
end
|
797
800
|
|
798
801
|
|
799
|
-
#
|
802
|
+
# Update an enum attribute. Changing the `default` value will not update
|
803
|
+
# already existing documents.
|
800
804
|
#
|
801
805
|
#
|
802
806
|
# @param [String] database_id Database ID.
|
803
807
|
# @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).
|
804
808
|
# @param [String] key Attribute Key.
|
805
|
-
# @param [
|
809
|
+
# @param [Array] elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 4096 characters long.
|
806
810
|
# @param [] required Is attribute required?
|
807
811
|
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
808
|
-
# @param [] array Is attribute an array?
|
809
812
|
#
|
810
|
-
# @return [
|
811
|
-
def
|
812
|
-
|
813
|
+
# @return [AttributeEnum]
|
814
|
+
def update_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default:)
|
815
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'
|
813
816
|
.gsub('{databaseId}', database_id)
|
814
817
|
.gsub('{collectionId}', collection_id)
|
818
|
+
.gsub('{key}', key)
|
815
819
|
|
816
820
|
if database_id.nil?
|
817
821
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
@@ -825,20 +829,22 @@ module Appwrite
|
|
825
829
|
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
826
830
|
end
|
827
831
|
|
828
|
-
if
|
829
|
-
raise Appwrite::Exception.new('Missing required parameter: "
|
832
|
+
if elements.nil?
|
833
|
+
raise Appwrite::Exception.new('Missing required parameter: "elements"')
|
830
834
|
end
|
831
835
|
|
832
836
|
if required.nil?
|
833
837
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
834
838
|
end
|
835
839
|
|
840
|
+
if default.nil?
|
841
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
842
|
+
end
|
843
|
+
|
836
844
|
params = {
|
837
|
-
|
838
|
-
size: size,
|
845
|
+
elements: elements,
|
839
846
|
required: required,
|
840
847
|
default: default,
|
841
|
-
array: array,
|
842
848
|
}
|
843
849
|
|
844
850
|
headers = {
|
@@ -846,28 +852,31 @@ module Appwrite
|
|
846
852
|
}
|
847
853
|
|
848
854
|
@client.call(
|
849
|
-
method: '
|
850
|
-
path:
|
855
|
+
method: 'PATCH',
|
856
|
+
path: api_path,
|
851
857
|
headers: headers,
|
852
858
|
params: params,
|
853
|
-
response_type: Models::
|
859
|
+
response_type: Models::AttributeEnum
|
854
860
|
)
|
855
861
|
end
|
856
862
|
|
857
863
|
|
858
|
-
# Create a
|
864
|
+
# Create a float attribute. Optionally, minimum and maximum values can be
|
865
|
+
# provided.
|
859
866
|
#
|
860
867
|
#
|
861
868
|
# @param [String] database_id Database ID.
|
862
869
|
# @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).
|
863
870
|
# @param [String] key Attribute Key.
|
864
871
|
# @param [] required Is attribute required?
|
865
|
-
# @param [
|
872
|
+
# @param [Float] min Minimum value to enforce on new documents
|
873
|
+
# @param [Float] max Maximum value to enforce on new documents
|
874
|
+
# @param [Float] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
866
875
|
# @param [] array Is attribute an array?
|
867
876
|
#
|
868
|
-
# @return [
|
869
|
-
def
|
870
|
-
|
877
|
+
# @return [AttributeFloat]
|
878
|
+
def create_float_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil)
|
879
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float'
|
871
880
|
.gsub('{databaseId}', database_id)
|
872
881
|
.gsub('{collectionId}', collection_id)
|
873
882
|
|
@@ -890,6 +899,8 @@ module Appwrite
|
|
890
899
|
params = {
|
891
900
|
key: key,
|
892
901
|
required: required,
|
902
|
+
min: min,
|
903
|
+
max: max,
|
893
904
|
default: default,
|
894
905
|
array: array,
|
895
906
|
}
|
@@ -900,23 +911,29 @@ module Appwrite
|
|
900
911
|
|
901
912
|
@client.call(
|
902
913
|
method: 'POST',
|
903
|
-
path:
|
914
|
+
path: api_path,
|
904
915
|
headers: headers,
|
905
916
|
params: params,
|
906
|
-
response_type: Models::
|
917
|
+
response_type: Models::AttributeFloat
|
907
918
|
)
|
908
919
|
end
|
909
920
|
|
910
921
|
|
922
|
+
# Update a float attribute. Changing the `default` value will not update
|
923
|
+
# already existing documents.
|
911
924
|
#
|
912
925
|
#
|
913
926
|
# @param [String] database_id Database ID.
|
914
927
|
# @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).
|
915
928
|
# @param [String] key Attribute Key.
|
929
|
+
# @param [] required Is attribute required?
|
930
|
+
# @param [Float] min Minimum value to enforce on new documents
|
931
|
+
# @param [Float] max Maximum value to enforce on new documents
|
932
|
+
# @param [Float] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
916
933
|
#
|
917
|
-
# @return []
|
918
|
-
def
|
919
|
-
|
934
|
+
# @return [AttributeFloat]
|
935
|
+
def update_float_attribute(database_id:, collection_id:, key:, required:, min:, max:, default:)
|
936
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'
|
920
937
|
.gsub('{databaseId}', database_id)
|
921
938
|
.gsub('{collectionId}', collection_id)
|
922
939
|
.gsub('{key}', key)
|
@@ -933,7 +950,27 @@ module Appwrite
|
|
933
950
|
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
934
951
|
end
|
935
952
|
|
953
|
+
if required.nil?
|
954
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
955
|
+
end
|
956
|
+
|
957
|
+
if min.nil?
|
958
|
+
raise Appwrite::Exception.new('Missing required parameter: "min"')
|
959
|
+
end
|
960
|
+
|
961
|
+
if max.nil?
|
962
|
+
raise Appwrite::Exception.new('Missing required parameter: "max"')
|
963
|
+
end
|
964
|
+
|
965
|
+
if default.nil?
|
966
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
967
|
+
end
|
968
|
+
|
936
969
|
params = {
|
970
|
+
required: required,
|
971
|
+
min: min,
|
972
|
+
max: max,
|
973
|
+
default: default,
|
937
974
|
}
|
938
975
|
|
939
976
|
headers = {
|
@@ -941,26 +978,33 @@ module Appwrite
|
|
941
978
|
}
|
942
979
|
|
943
980
|
@client.call(
|
944
|
-
method: '
|
945
|
-
path:
|
981
|
+
method: 'PATCH',
|
982
|
+
path: api_path,
|
946
983
|
headers: headers,
|
947
984
|
params: params,
|
985
|
+
response_type: Models::AttributeFloat
|
948
986
|
)
|
949
987
|
end
|
950
988
|
|
951
989
|
|
990
|
+
# Create an integer attribute. Optionally, minimum and maximum values can be
|
991
|
+
# provided.
|
952
992
|
#
|
953
993
|
#
|
954
994
|
# @param [String] database_id Database ID.
|
955
995
|
# @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).
|
956
996
|
# @param [String] key Attribute Key.
|
997
|
+
# @param [] required Is attribute required?
|
998
|
+
# @param [Integer] min Minimum value to enforce on new documents
|
999
|
+
# @param [Integer] max Maximum value to enforce on new documents
|
1000
|
+
# @param [Integer] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
1001
|
+
# @param [] array Is attribute an array?
|
957
1002
|
#
|
958
|
-
# @return []
|
959
|
-
def
|
960
|
-
|
1003
|
+
# @return [AttributeInteger]
|
1004
|
+
def create_integer_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil)
|
1005
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'
|
961
1006
|
.gsub('{databaseId}', database_id)
|
962
1007
|
.gsub('{collectionId}', collection_id)
|
963
|
-
.gsub('{key}', key)
|
964
1008
|
|
965
1009
|
if database_id.nil?
|
966
1010
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
@@ -974,7 +1018,17 @@ module Appwrite
|
|
974
1018
|
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
975
1019
|
end
|
976
1020
|
|
1021
|
+
if required.nil?
|
1022
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
1023
|
+
end
|
1024
|
+
|
977
1025
|
params = {
|
1026
|
+
key: key,
|
1027
|
+
required: required,
|
1028
|
+
min: min,
|
1029
|
+
max: max,
|
1030
|
+
default: default,
|
1031
|
+
array: array,
|
978
1032
|
}
|
979
1033
|
|
980
1034
|
headers = {
|
@@ -982,28 +1036,33 @@ module Appwrite
|
|
982
1036
|
}
|
983
1037
|
|
984
1038
|
@client.call(
|
985
|
-
method: '
|
986
|
-
path:
|
1039
|
+
method: 'POST',
|
1040
|
+
path: api_path,
|
987
1041
|
headers: headers,
|
988
1042
|
params: params,
|
1043
|
+
response_type: Models::AttributeInteger
|
989
1044
|
)
|
990
1045
|
end
|
991
1046
|
|
992
1047
|
|
993
|
-
#
|
994
|
-
#
|
995
|
-
#
|
996
|
-
# [Learn more about different API modes](/docs/admin).
|
1048
|
+
# Update an integer attribute. Changing the `default` value will not update
|
1049
|
+
# already existing documents.
|
1050
|
+
#
|
997
1051
|
#
|
998
1052
|
# @param [String] database_id Database ID.
|
999
1053
|
# @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).
|
1000
|
-
# @param [
|
1054
|
+
# @param [String] key Attribute Key.
|
1055
|
+
# @param [] required Is attribute required?
|
1056
|
+
# @param [Integer] min Minimum value to enforce on new documents
|
1057
|
+
# @param [Integer] max Maximum value to enforce on new documents
|
1058
|
+
# @param [Integer] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
1001
1059
|
#
|
1002
|
-
# @return [
|
1003
|
-
def
|
1004
|
-
|
1060
|
+
# @return [AttributeInteger]
|
1061
|
+
def update_integer_attribute(database_id:, collection_id:, key:, required:, min:, max:, default:)
|
1062
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'
|
1005
1063
|
.gsub('{databaseId}', database_id)
|
1006
1064
|
.gsub('{collectionId}', collection_id)
|
1065
|
+
.gsub('{key}', key)
|
1007
1066
|
|
1008
1067
|
if database_id.nil?
|
1009
1068
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
@@ -1013,8 +1072,31 @@ module Appwrite
|
|
1013
1072
|
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1014
1073
|
end
|
1015
1074
|
|
1075
|
+
if key.nil?
|
1076
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1077
|
+
end
|
1078
|
+
|
1079
|
+
if required.nil?
|
1080
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
1081
|
+
end
|
1082
|
+
|
1083
|
+
if min.nil?
|
1084
|
+
raise Appwrite::Exception.new('Missing required parameter: "min"')
|
1085
|
+
end
|
1086
|
+
|
1087
|
+
if max.nil?
|
1088
|
+
raise Appwrite::Exception.new('Missing required parameter: "max"')
|
1089
|
+
end
|
1090
|
+
|
1091
|
+
if default.nil?
|
1092
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
1093
|
+
end
|
1094
|
+
|
1016
1095
|
params = {
|
1017
|
-
|
1096
|
+
required: required,
|
1097
|
+
min: min,
|
1098
|
+
max: max,
|
1099
|
+
default: default,
|
1018
1100
|
}
|
1019
1101
|
|
1020
1102
|
headers = {
|
@@ -1022,29 +1104,28 @@ module Appwrite
|
|
1022
1104
|
}
|
1023
1105
|
|
1024
1106
|
@client.call(
|
1025
|
-
method: '
|
1026
|
-
path:
|
1107
|
+
method: 'PATCH',
|
1108
|
+
path: api_path,
|
1027
1109
|
headers: headers,
|
1028
1110
|
params: params,
|
1029
|
-
response_type: Models::
|
1111
|
+
response_type: Models::AttributeInteger
|
1030
1112
|
)
|
1031
1113
|
end
|
1032
1114
|
|
1033
1115
|
|
1034
|
-
# Create
|
1035
|
-
#
|
1036
|
-
# integration](/docs/server/databases#databasesCreateCollection) API or
|
1037
|
-
# directly from your database console.
|
1116
|
+
# Create IP address attribute.
|
1117
|
+
#
|
1038
1118
|
#
|
1039
1119
|
# @param [String] database_id Database ID.
|
1040
|
-
# @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).
|
1041
|
-
# @param [String]
|
1042
|
-
# @param [
|
1043
|
-
# @param [
|
1120
|
+
# @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).
|
1121
|
+
# @param [String] key Attribute Key.
|
1122
|
+
# @param [] required Is attribute required?
|
1123
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
1124
|
+
# @param [] array Is attribute an array?
|
1044
1125
|
#
|
1045
|
-
# @return [
|
1046
|
-
def
|
1047
|
-
|
1126
|
+
# @return [AttributeIp]
|
1127
|
+
def create_ip_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
1128
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'
|
1048
1129
|
.gsub('{databaseId}', database_id)
|
1049
1130
|
.gsub('{collectionId}', collection_id)
|
1050
1131
|
|
@@ -1056,18 +1137,19 @@ module Appwrite
|
|
1056
1137
|
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1057
1138
|
end
|
1058
1139
|
|
1059
|
-
if
|
1060
|
-
raise Appwrite::Exception.new('Missing required parameter: "
|
1140
|
+
if key.nil?
|
1141
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1061
1142
|
end
|
1062
1143
|
|
1063
|
-
if
|
1064
|
-
raise Appwrite::Exception.new('Missing required parameter: "
|
1144
|
+
if required.nil?
|
1145
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
1065
1146
|
end
|
1066
1147
|
|
1067
1148
|
params = {
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1149
|
+
key: key,
|
1150
|
+
required: required,
|
1151
|
+
default: default,
|
1152
|
+
array: array,
|
1071
1153
|
}
|
1072
1154
|
|
1073
1155
|
headers = {
|
@@ -1076,24 +1158,585 @@ module Appwrite
|
|
1076
1158
|
|
1077
1159
|
@client.call(
|
1078
1160
|
method: 'POST',
|
1079
|
-
path:
|
1161
|
+
path: api_path,
|
1080
1162
|
headers: headers,
|
1081
1163
|
params: params,
|
1082
|
-
response_type: Models::
|
1164
|
+
response_type: Models::AttributeIp
|
1083
1165
|
)
|
1084
1166
|
end
|
1085
1167
|
|
1086
1168
|
|
1087
|
-
#
|
1088
|
-
#
|
1169
|
+
# Update an ip attribute. Changing the `default` value will not update
|
1170
|
+
# already existing documents.
|
1171
|
+
#
|
1089
1172
|
#
|
1090
1173
|
# @param [String] database_id Database ID.
|
1091
1174
|
# @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).
|
1092
|
-
# @param [String]
|
1093
|
-
#
|
1175
|
+
# @param [String] key Attribute Key.
|
1176
|
+
# @param [] required Is attribute required?
|
1177
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
1178
|
+
#
|
1179
|
+
# @return [AttributeIp]
|
1180
|
+
def update_ip_attribute(database_id:, collection_id:, key:, required:, default:)
|
1181
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'
|
1182
|
+
.gsub('{databaseId}', database_id)
|
1183
|
+
.gsub('{collectionId}', collection_id)
|
1184
|
+
.gsub('{key}', key)
|
1185
|
+
|
1186
|
+
if database_id.nil?
|
1187
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1188
|
+
end
|
1189
|
+
|
1190
|
+
if collection_id.nil?
|
1191
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1192
|
+
end
|
1193
|
+
|
1194
|
+
if key.nil?
|
1195
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1196
|
+
end
|
1197
|
+
|
1198
|
+
if required.nil?
|
1199
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
1200
|
+
end
|
1201
|
+
|
1202
|
+
if default.nil?
|
1203
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
1204
|
+
end
|
1205
|
+
|
1206
|
+
params = {
|
1207
|
+
required: required,
|
1208
|
+
default: default,
|
1209
|
+
}
|
1210
|
+
|
1211
|
+
headers = {
|
1212
|
+
"content-type": 'application/json',
|
1213
|
+
}
|
1214
|
+
|
1215
|
+
@client.call(
|
1216
|
+
method: 'PATCH',
|
1217
|
+
path: api_path,
|
1218
|
+
headers: headers,
|
1219
|
+
params: params,
|
1220
|
+
response_type: Models::AttributeIp
|
1221
|
+
)
|
1222
|
+
end
|
1223
|
+
|
1224
|
+
|
1225
|
+
# Create relationship attribute. [Learn more about relationship
|
1226
|
+
# attributes](/docs/databases-relationships#relationship-attributes).
|
1227
|
+
#
|
1228
|
+
#
|
1229
|
+
# @param [String] database_id Database ID.
|
1230
|
+
# @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
|
+
# @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
|
1233
|
+
# @param [] two_way Is Two Way?
|
1234
|
+
# @param [String] key Attribute Key.
|
1235
|
+
# @param [String] two_way_key Two Way Attribute Key.
|
1236
|
+
# @param [String] on_delete Constraints option
|
1237
|
+
#
|
1238
|
+
# @return [AttributeRelationship]
|
1239
|
+
def create_relationship_attribute(database_id:, collection_id:, related_collection_id:, type:, two_way: nil, key: nil, two_way_key: nil, on_delete: nil)
|
1240
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'
|
1241
|
+
.gsub('{databaseId}', database_id)
|
1242
|
+
.gsub('{collectionId}', collection_id)
|
1243
|
+
|
1244
|
+
if database_id.nil?
|
1245
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1246
|
+
end
|
1247
|
+
|
1248
|
+
if collection_id.nil?
|
1249
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1250
|
+
end
|
1251
|
+
|
1252
|
+
if related_collection_id.nil?
|
1253
|
+
raise Appwrite::Exception.new('Missing required parameter: "relatedCollectionId"')
|
1254
|
+
end
|
1255
|
+
|
1256
|
+
if type.nil?
|
1257
|
+
raise Appwrite::Exception.new('Missing required parameter: "type"')
|
1258
|
+
end
|
1259
|
+
|
1260
|
+
params = {
|
1261
|
+
relatedCollectionId: related_collection_id,
|
1262
|
+
type: type,
|
1263
|
+
twoWay: two_way,
|
1264
|
+
key: key,
|
1265
|
+
twoWayKey: two_way_key,
|
1266
|
+
onDelete: on_delete,
|
1267
|
+
}
|
1268
|
+
|
1269
|
+
headers = {
|
1270
|
+
"content-type": 'application/json',
|
1271
|
+
}
|
1272
|
+
|
1273
|
+
@client.call(
|
1274
|
+
method: 'POST',
|
1275
|
+
path: api_path,
|
1276
|
+
headers: headers,
|
1277
|
+
params: params,
|
1278
|
+
response_type: Models::AttributeRelationship
|
1279
|
+
)
|
1280
|
+
end
|
1281
|
+
|
1282
|
+
|
1283
|
+
# Create a string attribute.
|
1284
|
+
#
|
1285
|
+
#
|
1286
|
+
# @param [String] database_id Database ID.
|
1287
|
+
# @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).
|
1288
|
+
# @param [String] key Attribute Key.
|
1289
|
+
# @param [Integer] size Attribute size for text attributes, in number of characters.
|
1290
|
+
# @param [] required Is attribute required?
|
1291
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
1292
|
+
# @param [] array Is attribute an array?
|
1293
|
+
# @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.
|
1294
|
+
#
|
1295
|
+
# @return [AttributeString]
|
1296
|
+
def create_string_attribute(database_id:, collection_id:, key:, size:, required:, default: nil, array: nil, encrypt: nil)
|
1297
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string'
|
1298
|
+
.gsub('{databaseId}', database_id)
|
1299
|
+
.gsub('{collectionId}', collection_id)
|
1300
|
+
|
1301
|
+
if database_id.nil?
|
1302
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1303
|
+
end
|
1304
|
+
|
1305
|
+
if collection_id.nil?
|
1306
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1307
|
+
end
|
1308
|
+
|
1309
|
+
if key.nil?
|
1310
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1311
|
+
end
|
1312
|
+
|
1313
|
+
if size.nil?
|
1314
|
+
raise Appwrite::Exception.new('Missing required parameter: "size"')
|
1315
|
+
end
|
1316
|
+
|
1317
|
+
if required.nil?
|
1318
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
1319
|
+
end
|
1320
|
+
|
1321
|
+
params = {
|
1322
|
+
key: key,
|
1323
|
+
size: size,
|
1324
|
+
required: required,
|
1325
|
+
default: default,
|
1326
|
+
array: array,
|
1327
|
+
encrypt: encrypt,
|
1328
|
+
}
|
1329
|
+
|
1330
|
+
headers = {
|
1331
|
+
"content-type": 'application/json',
|
1332
|
+
}
|
1333
|
+
|
1334
|
+
@client.call(
|
1335
|
+
method: 'POST',
|
1336
|
+
path: api_path,
|
1337
|
+
headers: headers,
|
1338
|
+
params: params,
|
1339
|
+
response_type: Models::AttributeString
|
1340
|
+
)
|
1341
|
+
end
|
1342
|
+
|
1343
|
+
|
1344
|
+
# Update a string attribute. Changing the `default` value will not update
|
1345
|
+
# already existing documents.
|
1346
|
+
#
|
1347
|
+
#
|
1348
|
+
# @param [String] database_id Database ID.
|
1349
|
+
# @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).
|
1350
|
+
# @param [String] key Attribute Key.
|
1351
|
+
# @param [] required Is attribute required?
|
1352
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
1353
|
+
#
|
1354
|
+
# @return [AttributeString]
|
1355
|
+
def update_string_attribute(database_id:, collection_id:, key:, required:, default:)
|
1356
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'
|
1357
|
+
.gsub('{databaseId}', database_id)
|
1358
|
+
.gsub('{collectionId}', collection_id)
|
1359
|
+
.gsub('{key}', key)
|
1360
|
+
|
1361
|
+
if database_id.nil?
|
1362
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1363
|
+
end
|
1364
|
+
|
1365
|
+
if collection_id.nil?
|
1366
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1367
|
+
end
|
1368
|
+
|
1369
|
+
if key.nil?
|
1370
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1371
|
+
end
|
1372
|
+
|
1373
|
+
if required.nil?
|
1374
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
1375
|
+
end
|
1376
|
+
|
1377
|
+
if default.nil?
|
1378
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
1379
|
+
end
|
1380
|
+
|
1381
|
+
params = {
|
1382
|
+
required: required,
|
1383
|
+
default: default,
|
1384
|
+
}
|
1385
|
+
|
1386
|
+
headers = {
|
1387
|
+
"content-type": 'application/json',
|
1388
|
+
}
|
1389
|
+
|
1390
|
+
@client.call(
|
1391
|
+
method: 'PATCH',
|
1392
|
+
path: api_path,
|
1393
|
+
headers: headers,
|
1394
|
+
params: params,
|
1395
|
+
response_type: Models::AttributeString
|
1396
|
+
)
|
1397
|
+
end
|
1398
|
+
|
1399
|
+
|
1400
|
+
# Create a URL attribute.
|
1401
|
+
#
|
1402
|
+
#
|
1403
|
+
# @param [String] database_id Database ID.
|
1404
|
+
# @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).
|
1405
|
+
# @param [String] key Attribute Key.
|
1406
|
+
# @param [] required Is attribute required?
|
1407
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
1408
|
+
# @param [] array Is attribute an array?
|
1409
|
+
#
|
1410
|
+
# @return [AttributeUrl]
|
1411
|
+
def create_url_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
1412
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url'
|
1413
|
+
.gsub('{databaseId}', database_id)
|
1414
|
+
.gsub('{collectionId}', collection_id)
|
1415
|
+
|
1416
|
+
if database_id.nil?
|
1417
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1418
|
+
end
|
1419
|
+
|
1420
|
+
if collection_id.nil?
|
1421
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1422
|
+
end
|
1423
|
+
|
1424
|
+
if key.nil?
|
1425
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1426
|
+
end
|
1427
|
+
|
1428
|
+
if required.nil?
|
1429
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
1430
|
+
end
|
1431
|
+
|
1432
|
+
params = {
|
1433
|
+
key: key,
|
1434
|
+
required: required,
|
1435
|
+
default: default,
|
1436
|
+
array: array,
|
1437
|
+
}
|
1438
|
+
|
1439
|
+
headers = {
|
1440
|
+
"content-type": 'application/json',
|
1441
|
+
}
|
1442
|
+
|
1443
|
+
@client.call(
|
1444
|
+
method: 'POST',
|
1445
|
+
path: api_path,
|
1446
|
+
headers: headers,
|
1447
|
+
params: params,
|
1448
|
+
response_type: Models::AttributeUrl
|
1449
|
+
)
|
1450
|
+
end
|
1451
|
+
|
1452
|
+
|
1453
|
+
# Update an url attribute. Changing the `default` value will not update
|
1454
|
+
# already existing documents.
|
1455
|
+
#
|
1456
|
+
#
|
1457
|
+
# @param [String] database_id Database ID.
|
1458
|
+
# @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).
|
1459
|
+
# @param [String] key Attribute Key.
|
1460
|
+
# @param [] required Is attribute required?
|
1461
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
1462
|
+
#
|
1463
|
+
# @return [AttributeUrl]
|
1464
|
+
def update_url_attribute(database_id:, collection_id:, key:, required:, default:)
|
1465
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'
|
1466
|
+
.gsub('{databaseId}', database_id)
|
1467
|
+
.gsub('{collectionId}', collection_id)
|
1468
|
+
.gsub('{key}', key)
|
1469
|
+
|
1470
|
+
if database_id.nil?
|
1471
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1472
|
+
end
|
1473
|
+
|
1474
|
+
if collection_id.nil?
|
1475
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1476
|
+
end
|
1477
|
+
|
1478
|
+
if key.nil?
|
1479
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1480
|
+
end
|
1481
|
+
|
1482
|
+
if required.nil?
|
1483
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
1484
|
+
end
|
1485
|
+
|
1486
|
+
if default.nil?
|
1487
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
1488
|
+
end
|
1489
|
+
|
1490
|
+
params = {
|
1491
|
+
required: required,
|
1492
|
+
default: default,
|
1493
|
+
}
|
1494
|
+
|
1495
|
+
headers = {
|
1496
|
+
"content-type": 'application/json',
|
1497
|
+
}
|
1498
|
+
|
1499
|
+
@client.call(
|
1500
|
+
method: 'PATCH',
|
1501
|
+
path: api_path,
|
1502
|
+
headers: headers,
|
1503
|
+
params: params,
|
1504
|
+
response_type: Models::AttributeUrl
|
1505
|
+
)
|
1506
|
+
end
|
1507
|
+
|
1508
|
+
|
1509
|
+
#
|
1510
|
+
#
|
1511
|
+
# @param [String] database_id Database ID.
|
1512
|
+
# @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).
|
1513
|
+
# @param [String] key Attribute Key.
|
1514
|
+
#
|
1515
|
+
# @return []
|
1516
|
+
def get_attribute(database_id:, collection_id:, key:)
|
1517
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'
|
1518
|
+
.gsub('{databaseId}', database_id)
|
1519
|
+
.gsub('{collectionId}', collection_id)
|
1520
|
+
.gsub('{key}', key)
|
1521
|
+
|
1522
|
+
if database_id.nil?
|
1523
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1524
|
+
end
|
1525
|
+
|
1526
|
+
if collection_id.nil?
|
1527
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1528
|
+
end
|
1529
|
+
|
1530
|
+
if key.nil?
|
1531
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1532
|
+
end
|
1533
|
+
|
1534
|
+
params = {
|
1535
|
+
}
|
1536
|
+
|
1537
|
+
headers = {
|
1538
|
+
"content-type": 'application/json',
|
1539
|
+
}
|
1540
|
+
|
1541
|
+
@client.call(
|
1542
|
+
method: 'GET',
|
1543
|
+
path: api_path,
|
1544
|
+
headers: headers,
|
1545
|
+
params: params,
|
1546
|
+
)
|
1547
|
+
end
|
1548
|
+
|
1549
|
+
|
1550
|
+
#
|
1551
|
+
#
|
1552
|
+
# @param [String] database_id Database ID.
|
1553
|
+
# @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).
|
1554
|
+
# @param [String] key Attribute Key.
|
1555
|
+
#
|
1556
|
+
# @return []
|
1557
|
+
def delete_attribute(database_id:, collection_id:, key:)
|
1558
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'
|
1559
|
+
.gsub('{databaseId}', database_id)
|
1560
|
+
.gsub('{collectionId}', collection_id)
|
1561
|
+
.gsub('{key}', key)
|
1562
|
+
|
1563
|
+
if database_id.nil?
|
1564
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1565
|
+
end
|
1566
|
+
|
1567
|
+
if collection_id.nil?
|
1568
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1569
|
+
end
|
1570
|
+
|
1571
|
+
if key.nil?
|
1572
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1573
|
+
end
|
1574
|
+
|
1575
|
+
params = {
|
1576
|
+
}
|
1577
|
+
|
1578
|
+
headers = {
|
1579
|
+
"content-type": 'application/json',
|
1580
|
+
}
|
1581
|
+
|
1582
|
+
@client.call(
|
1583
|
+
method: 'DELETE',
|
1584
|
+
path: api_path,
|
1585
|
+
headers: headers,
|
1586
|
+
params: params,
|
1587
|
+
)
|
1588
|
+
end
|
1589
|
+
|
1590
|
+
|
1591
|
+
# Update relationship attribute. [Learn more about relationship
|
1592
|
+
# attributes](/docs/databases-relationships#relationship-attributes).
|
1593
|
+
#
|
1594
|
+
#
|
1595
|
+
# @param [String] database_id Database ID.
|
1596
|
+
# @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
|
+
# @param [String] key Attribute Key.
|
1598
|
+
# @param [String] on_delete Constraints option
|
1599
|
+
#
|
1600
|
+
# @return [AttributeRelationship]
|
1601
|
+
def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: nil)
|
1602
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'
|
1603
|
+
.gsub('{databaseId}', database_id)
|
1604
|
+
.gsub('{collectionId}', collection_id)
|
1605
|
+
.gsub('{key}', key)
|
1606
|
+
|
1607
|
+
if database_id.nil?
|
1608
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1609
|
+
end
|
1610
|
+
|
1611
|
+
if collection_id.nil?
|
1612
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1613
|
+
end
|
1614
|
+
|
1615
|
+
if key.nil?
|
1616
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1617
|
+
end
|
1618
|
+
|
1619
|
+
params = {
|
1620
|
+
onDelete: on_delete,
|
1621
|
+
}
|
1622
|
+
|
1623
|
+
headers = {
|
1624
|
+
"content-type": 'application/json',
|
1625
|
+
}
|
1626
|
+
|
1627
|
+
@client.call(
|
1628
|
+
method: 'PATCH',
|
1629
|
+
path: api_path,
|
1630
|
+
headers: headers,
|
1631
|
+
params: params,
|
1632
|
+
response_type: Models::AttributeRelationship
|
1633
|
+
)
|
1634
|
+
end
|
1635
|
+
|
1636
|
+
|
1637
|
+
# Get a list of all the user's documents in a given collection. You can use
|
1638
|
+
# the query params to filter your results.
|
1639
|
+
#
|
1640
|
+
# @param [String] database_id Database ID.
|
1641
|
+
# @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).
|
1642
|
+
# @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.
|
1643
|
+
#
|
1644
|
+
# @return [DocumentList]
|
1645
|
+
def list_documents(database_id:, collection_id:, queries: nil)
|
1646
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/documents'
|
1647
|
+
.gsub('{databaseId}', database_id)
|
1648
|
+
.gsub('{collectionId}', collection_id)
|
1649
|
+
|
1650
|
+
if database_id.nil?
|
1651
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1652
|
+
end
|
1653
|
+
|
1654
|
+
if collection_id.nil?
|
1655
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1656
|
+
end
|
1657
|
+
|
1658
|
+
params = {
|
1659
|
+
queries: queries,
|
1660
|
+
}
|
1661
|
+
|
1662
|
+
headers = {
|
1663
|
+
"content-type": 'application/json',
|
1664
|
+
}
|
1665
|
+
|
1666
|
+
@client.call(
|
1667
|
+
method: 'GET',
|
1668
|
+
path: api_path,
|
1669
|
+
headers: headers,
|
1670
|
+
params: params,
|
1671
|
+
response_type: Models::DocumentList
|
1672
|
+
)
|
1673
|
+
end
|
1674
|
+
|
1675
|
+
|
1676
|
+
# Create a new Document. Before using this route, you should create a new
|
1677
|
+
# collection resource using either a [server
|
1678
|
+
# integration](/docs/server/databases#databasesCreateCollection) API or
|
1679
|
+
# directly from your database console.
|
1680
|
+
#
|
1681
|
+
# @param [String] database_id Database ID.
|
1682
|
+
# @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). Make sure to define attributes before creating documents.
|
1683
|
+
# @param [String] document_id Document 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.
|
1684
|
+
# @param [Hash] data Document data as JSON object.
|
1685
|
+
# @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](/docs/permissions).
|
1686
|
+
#
|
1687
|
+
# @return [Document]
|
1688
|
+
def create_document(database_id:, collection_id:, document_id:, data:, permissions: nil)
|
1689
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/documents'
|
1690
|
+
.gsub('{databaseId}', database_id)
|
1691
|
+
.gsub('{collectionId}', collection_id)
|
1692
|
+
|
1693
|
+
if database_id.nil?
|
1694
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1695
|
+
end
|
1696
|
+
|
1697
|
+
if collection_id.nil?
|
1698
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1699
|
+
end
|
1700
|
+
|
1701
|
+
if document_id.nil?
|
1702
|
+
raise Appwrite::Exception.new('Missing required parameter: "documentId"')
|
1703
|
+
end
|
1704
|
+
|
1705
|
+
if data.nil?
|
1706
|
+
raise Appwrite::Exception.new('Missing required parameter: "data"')
|
1707
|
+
end
|
1708
|
+
|
1709
|
+
params = {
|
1710
|
+
documentId: document_id,
|
1711
|
+
data: data,
|
1712
|
+
permissions: permissions,
|
1713
|
+
}
|
1714
|
+
|
1715
|
+
headers = {
|
1716
|
+
"content-type": 'application/json',
|
1717
|
+
}
|
1718
|
+
|
1719
|
+
@client.call(
|
1720
|
+
method: 'POST',
|
1721
|
+
path: api_path,
|
1722
|
+
headers: headers,
|
1723
|
+
params: params,
|
1724
|
+
response_type: Models::Document
|
1725
|
+
)
|
1726
|
+
end
|
1727
|
+
|
1728
|
+
|
1729
|
+
# Get a document by its unique ID. This endpoint response returns a JSON
|
1730
|
+
# object with the document data.
|
1731
|
+
#
|
1732
|
+
# @param [String] database_id Database ID.
|
1733
|
+
# @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
|
+
# @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.
|
1736
|
+
#
|
1094
1737
|
# @return [Document]
|
1095
|
-
def get_document(database_id:, collection_id:, document_id:)
|
1096
|
-
|
1738
|
+
def get_document(database_id:, collection_id:, document_id:, queries: nil)
|
1739
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
|
1097
1740
|
.gsub('{databaseId}', database_id)
|
1098
1741
|
.gsub('{collectionId}', collection_id)
|
1099
1742
|
.gsub('{documentId}', document_id)
|
@@ -1111,6 +1754,7 @@ module Appwrite
|
|
1111
1754
|
end
|
1112
1755
|
|
1113
1756
|
params = {
|
1757
|
+
queries: queries,
|
1114
1758
|
}
|
1115
1759
|
|
1116
1760
|
headers = {
|
@@ -1119,7 +1763,7 @@ module Appwrite
|
|
1119
1763
|
|
1120
1764
|
@client.call(
|
1121
1765
|
method: 'GET',
|
1122
|
-
path:
|
1766
|
+
path: api_path,
|
1123
1767
|
headers: headers,
|
1124
1768
|
params: params,
|
1125
1769
|
response_type: Models::Document
|
@@ -1134,11 +1778,11 @@ module Appwrite
|
|
1134
1778
|
# @param [String] collection_id Collection ID.
|
1135
1779
|
# @param [String] document_id Document ID.
|
1136
1780
|
# @param [Hash] data Document data as JSON object. Include only attribute and value pairs to be updated.
|
1137
|
-
# @param [Array] permissions An array of permissions strings. By default the current permissions are inherited. [Learn more about permissions](/docs/permissions).
|
1781
|
+
# @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions).
|
1138
1782
|
#
|
1139
1783
|
# @return [Document]
|
1140
1784
|
def update_document(database_id:, collection_id:, document_id:, data: nil, permissions: nil)
|
1141
|
-
|
1785
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
|
1142
1786
|
.gsub('{databaseId}', database_id)
|
1143
1787
|
.gsub('{collectionId}', collection_id)
|
1144
1788
|
.gsub('{documentId}', document_id)
|
@@ -1166,7 +1810,7 @@ module Appwrite
|
|
1166
1810
|
|
1167
1811
|
@client.call(
|
1168
1812
|
method: 'PATCH',
|
1169
|
-
path:
|
1813
|
+
path: api_path,
|
1170
1814
|
headers: headers,
|
1171
1815
|
params: params,
|
1172
1816
|
response_type: Models::Document
|
@@ -1182,7 +1826,7 @@ module Appwrite
|
|
1182
1826
|
#
|
1183
1827
|
# @return []
|
1184
1828
|
def delete_document(database_id:, collection_id:, document_id:)
|
1185
|
-
|
1829
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
|
1186
1830
|
.gsub('{databaseId}', database_id)
|
1187
1831
|
.gsub('{collectionId}', collection_id)
|
1188
1832
|
.gsub('{documentId}', document_id)
|
@@ -1208,7 +1852,7 @@ module Appwrite
|
|
1208
1852
|
|
1209
1853
|
@client.call(
|
1210
1854
|
method: 'DELETE',
|
1211
|
-
path:
|
1855
|
+
path: api_path,
|
1212
1856
|
headers: headers,
|
1213
1857
|
params: params,
|
1214
1858
|
)
|
@@ -1219,10 +1863,11 @@ module Appwrite
|
|
1219
1863
|
#
|
1220
1864
|
# @param [String] database_id Database ID.
|
1221
1865
|
# @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).
|
1866
|
+
# @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. You may filter on the following attributes: key, type, status, attributes, error
|
1222
1867
|
#
|
1223
1868
|
# @return [IndexList]
|
1224
|
-
def list_indexes(database_id:, collection_id:)
|
1225
|
-
|
1869
|
+
def list_indexes(database_id:, collection_id:, queries: nil)
|
1870
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/indexes'
|
1226
1871
|
.gsub('{databaseId}', database_id)
|
1227
1872
|
.gsub('{collectionId}', collection_id)
|
1228
1873
|
|
@@ -1235,6 +1880,7 @@ module Appwrite
|
|
1235
1880
|
end
|
1236
1881
|
|
1237
1882
|
params = {
|
1883
|
+
queries: queries,
|
1238
1884
|
}
|
1239
1885
|
|
1240
1886
|
headers = {
|
@@ -1243,7 +1889,7 @@ module Appwrite
|
|
1243
1889
|
|
1244
1890
|
@client.call(
|
1245
1891
|
method: 'GET',
|
1246
|
-
path:
|
1892
|
+
path: api_path,
|
1247
1893
|
headers: headers,
|
1248
1894
|
params: params,
|
1249
1895
|
response_type: Models::IndexList
|
@@ -1262,7 +1908,7 @@ module Appwrite
|
|
1262
1908
|
#
|
1263
1909
|
# @return [Index]
|
1264
1910
|
def create_index(database_id:, collection_id:, key:, type:, attributes:, orders: nil)
|
1265
|
-
|
1911
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/indexes'
|
1266
1912
|
.gsub('{databaseId}', database_id)
|
1267
1913
|
.gsub('{collectionId}', collection_id)
|
1268
1914
|
|
@@ -1299,7 +1945,7 @@ module Appwrite
|
|
1299
1945
|
|
1300
1946
|
@client.call(
|
1301
1947
|
method: 'POST',
|
1302
|
-
path:
|
1948
|
+
path: api_path,
|
1303
1949
|
headers: headers,
|
1304
1950
|
params: params,
|
1305
1951
|
response_type: Models::Index
|
@@ -1315,7 +1961,7 @@ module Appwrite
|
|
1315
1961
|
#
|
1316
1962
|
# @return [Index]
|
1317
1963
|
def get_index(database_id:, collection_id:, key:)
|
1318
|
-
|
1964
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'
|
1319
1965
|
.gsub('{databaseId}', database_id)
|
1320
1966
|
.gsub('{collectionId}', collection_id)
|
1321
1967
|
.gsub('{key}', key)
|
@@ -1341,7 +1987,7 @@ module Appwrite
|
|
1341
1987
|
|
1342
1988
|
@client.call(
|
1343
1989
|
method: 'GET',
|
1344
|
-
path:
|
1990
|
+
path: api_path,
|
1345
1991
|
headers: headers,
|
1346
1992
|
params: params,
|
1347
1993
|
response_type: Models::Index
|
@@ -1357,7 +2003,7 @@ module Appwrite
|
|
1357
2003
|
#
|
1358
2004
|
# @return []
|
1359
2005
|
def delete_index(database_id:, collection_id:, key:)
|
1360
|
-
|
2006
|
+
api_path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'
|
1361
2007
|
.gsub('{databaseId}', database_id)
|
1362
2008
|
.gsub('{collectionId}', collection_id)
|
1363
2009
|
.gsub('{key}', key)
|
@@ -1383,7 +2029,7 @@ module Appwrite
|
|
1383
2029
|
|
1384
2030
|
@client.call(
|
1385
2031
|
method: 'DELETE',
|
1386
|
-
path:
|
2032
|
+
path: api_path,
|
1387
2033
|
headers: headers,
|
1388
2034
|
params: params,
|
1389
2035
|
)
|