appwrite 6.0.0 → 7.0.0.pre.RC1
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.
- checksums.yaml +4 -4
- data/lib/appwrite/client.rb +5 -2
- data/lib/appwrite/id.rb +11 -0
- data/lib/appwrite/models/account.rb +82 -0
- data/lib/appwrite/models/algo_argon2.rb +37 -0
- data/lib/appwrite/models/algo_bcrypt.rb +22 -0
- data/lib/appwrite/models/algo_md5.rb +22 -0
- data/lib/appwrite/models/algo_phpass.rb +22 -0
- data/lib/appwrite/models/algo_scrypt.rb +42 -0
- data/lib/appwrite/models/algo_scrypt_modified.rb +37 -0
- data/lib/appwrite/models/algo_sha.rb +22 -0
- data/lib/appwrite/models/attribute_datetime.rb +57 -0
- data/lib/appwrite/models/bucket.rb +15 -15
- data/lib/appwrite/models/collection.rb +10 -15
- data/lib/appwrite/models/database.rb +13 -3
- data/lib/appwrite/models/document.rb +5 -10
- data/lib/appwrite/models/execution.rb +10 -5
- data/lib/appwrite/models/file.rb +5 -10
- data/lib/appwrite/models/function.rb +2 -2
- data/lib/appwrite/models/index.rb +1 -1
- data/lib/appwrite/models/user.rb +15 -0
- data/lib/appwrite/models/variable.rb +52 -0
- data/lib/appwrite/models/variable_list.rb +32 -0
- data/lib/appwrite/permission.rb +21 -0
- data/lib/appwrite/query.rb +43 -14
- data/lib/appwrite/role.rb +31 -0
- data/lib/appwrite/services/account.rb +184 -143
- data/lib/appwrite/services/avatars.rb +72 -56
- data/lib/appwrite/services/databases.rb +638 -552
- data/lib/appwrite/services/functions.rb +380 -176
- data/lib/appwrite/services/health.rb +33 -10
- data/lib/appwrite/services/locale.rb +24 -7
- data/lib/appwrite/services/storage.rb +194 -193
- data/lib/appwrite/services/teams.rb +137 -128
- data/lib/appwrite/services/users.rb +572 -163
- data/lib/appwrite.rb +15 -0
- metadata +18 -4
@@ -3,34 +3,26 @@
|
|
3
3
|
module Appwrite
|
4
4
|
class Databases < Service
|
5
5
|
|
6
|
-
|
7
|
-
def initialize(client, database_id:)
|
6
|
+
def initialize(client)
|
8
7
|
@client = client
|
9
|
-
@database_id = database_id
|
10
8
|
end
|
11
9
|
|
12
|
-
#
|
10
|
+
# Get a list of all databases from the current Appwrite project. You can use
|
11
|
+
# the search parameter to filter your results.
|
13
12
|
#
|
14
|
-
# @param [
|
15
|
-
# @param [
|
16
|
-
# @param [number] offset Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)
|
17
|
-
# @param [string] cursor ID of the collection used as the starting point for the query, excluding the collection itself. Should be used for efficient pagination when working with large sets of data.
|
18
|
-
# @param [string] cursor_direction Direction of the cursor, can be either 'before' or 'after'.
|
19
|
-
# @param [string] order_type Order result by ASC or DESC order.
|
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/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name
|
14
|
+
# @param [String] search Search term to filter your list results. Max length: 256 chars.
|
20
15
|
#
|
21
16
|
# @return [DatabaseList]
|
22
|
-
def list(
|
17
|
+
def list(queries: nil, search: nil)
|
18
|
+
|
23
19
|
path = '/databases'
|
24
20
|
|
25
21
|
params = {
|
22
|
+
queries: queries,
|
26
23
|
search: search,
|
27
|
-
limit: limit,
|
28
|
-
offset: offset,
|
29
|
-
cursor: cursor,
|
30
|
-
cursorDirection: cursor_direction,
|
31
|
-
orderType: order_type,
|
32
24
|
}
|
33
|
-
|
25
|
+
|
34
26
|
headers = {
|
35
27
|
"content-type": 'application/json',
|
36
28
|
}
|
@@ -44,31 +36,34 @@ module Appwrite
|
|
44
36
|
)
|
45
37
|
end
|
46
38
|
|
39
|
+
|
40
|
+
# Create a new Database.
|
47
41
|
#
|
48
42
|
#
|
49
|
-
# @param [
|
50
|
-
# @param [
|
43
|
+
# @param [String] database_id Unique Id. Choose your own unique ID or pass the string "unique()" to auto generate it. 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.
|
44
|
+
# @param [String] name Collection name. Max length: 128 chars.
|
51
45
|
#
|
52
46
|
# @return [Database]
|
53
|
-
def create(name:)
|
54
|
-
if @database_id.nil?
|
55
|
-
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
56
|
-
end
|
57
|
-
|
58
|
-
if name.nil?
|
59
|
-
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
60
|
-
end
|
47
|
+
def create(database_id:, name:)
|
61
48
|
|
62
49
|
path = '/databases'
|
63
50
|
|
64
51
|
params = {
|
65
|
-
databaseId:
|
52
|
+
databaseId: database_id,
|
66
53
|
name: name,
|
67
54
|
}
|
68
|
-
|
55
|
+
|
69
56
|
headers = {
|
70
57
|
"content-type": 'application/json',
|
71
58
|
}
|
59
|
+
if database_id.nil?
|
60
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
61
|
+
end
|
62
|
+
|
63
|
+
if name.nil?
|
64
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
65
|
+
end
|
66
|
+
|
72
67
|
|
73
68
|
@client.call(
|
74
69
|
method: 'POST',
|
@@ -79,89 +74,97 @@ module Appwrite
|
|
79
74
|
)
|
80
75
|
end
|
81
76
|
|
82
|
-
|
77
|
+
|
78
|
+
# Get a database by its unique ID. This endpoint response returns a JSON
|
79
|
+
# object with the database metadata.
|
83
80
|
#
|
84
|
-
# @param [
|
81
|
+
# @param [String] database_id Database ID.
|
85
82
|
#
|
86
|
-
# @return [
|
87
|
-
def get()
|
88
|
-
if @database_id.nil?
|
89
|
-
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
90
|
-
end
|
83
|
+
# @return [Database]
|
84
|
+
def get(database_id:)
|
91
85
|
|
92
86
|
path = '/databases/{databaseId}'
|
93
|
-
.gsub('{databaseId}', @database_id)
|
94
87
|
|
95
88
|
params = {
|
96
89
|
}
|
97
|
-
|
90
|
+
|
98
91
|
headers = {
|
99
92
|
"content-type": 'application/json',
|
100
93
|
}
|
94
|
+
if database_id.nil?
|
95
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
96
|
+
end
|
97
|
+
|
98
|
+
.gsub('{databaseId}', database_id)
|
101
99
|
|
102
100
|
@client.call(
|
103
101
|
method: 'GET',
|
104
102
|
path: path,
|
105
103
|
headers: headers,
|
106
104
|
params: params,
|
107
|
-
response_type: Models::
|
105
|
+
response_type: Models::Database
|
108
106
|
)
|
109
107
|
end
|
110
108
|
|
111
|
-
|
109
|
+
|
110
|
+
# Update a database by its unique ID.
|
112
111
|
#
|
113
|
-
# @param [
|
114
|
-
# @param [
|
112
|
+
# @param [String] database_id Database ID.
|
113
|
+
# @param [String] name Collection name. Max length: 128 chars.
|
115
114
|
#
|
116
|
-
# @return [
|
117
|
-
def update(name:)
|
118
|
-
if @database_id.nil?
|
119
|
-
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
120
|
-
end
|
121
|
-
|
122
|
-
if name.nil?
|
123
|
-
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
124
|
-
end
|
115
|
+
# @return [Database]
|
116
|
+
def update(database_id:, name:)
|
125
117
|
|
126
118
|
path = '/databases/{databaseId}'
|
127
|
-
.gsub('{databaseId}', @database_id)
|
128
119
|
|
129
120
|
params = {
|
130
121
|
name: name,
|
131
122
|
}
|
132
|
-
|
123
|
+
|
133
124
|
headers = {
|
134
125
|
"content-type": 'application/json',
|
135
126
|
}
|
127
|
+
if database_id.nil?
|
128
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
129
|
+
end
|
130
|
+
|
131
|
+
if name.nil?
|
132
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
133
|
+
end
|
134
|
+
|
135
|
+
.gsub('{databaseId}', database_id)
|
136
136
|
|
137
137
|
@client.call(
|
138
138
|
method: 'PUT',
|
139
139
|
path: path,
|
140
140
|
headers: headers,
|
141
141
|
params: params,
|
142
|
-
response_type: Models::
|
142
|
+
response_type: Models::Database
|
143
143
|
)
|
144
144
|
end
|
145
145
|
|
146
|
-
|
146
|
+
|
147
|
+
# Delete a database by its unique ID. Only API keys with with databases.write
|
148
|
+
# scope can delete a database.
|
147
149
|
#
|
148
|
-
# @param [
|
150
|
+
# @param [String] database_id Database ID.
|
149
151
|
#
|
150
152
|
# @return []
|
151
|
-
def delete()
|
152
|
-
if @database_id.nil?
|
153
|
-
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
154
|
-
end
|
153
|
+
def delete(database_id:)
|
155
154
|
|
156
155
|
path = '/databases/{databaseId}'
|
157
|
-
.gsub('{databaseId}', @database_id)
|
158
156
|
|
159
157
|
params = {
|
160
158
|
}
|
161
|
-
|
159
|
+
|
162
160
|
headers = {
|
163
161
|
"content-type": 'application/json',
|
164
162
|
}
|
163
|
+
if database_id.nil?
|
164
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
165
|
+
end
|
166
|
+
|
167
|
+
.gsub('{databaseId}', database_id)
|
165
168
|
|
166
169
|
@client.call(
|
167
170
|
method: 'DELETE',
|
@@ -171,37 +174,32 @@ module Appwrite
|
|
171
174
|
)
|
172
175
|
end
|
173
176
|
|
174
|
-
|
177
|
+
|
178
|
+
# Get a list of all collections that belong to the provided databaseId. You
|
179
|
+
# can use the search parameter to filter your results.
|
175
180
|
#
|
176
|
-
# @param [
|
177
|
-
# @param [
|
178
|
-
# @param [
|
179
|
-
# @param [number] offset Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)
|
180
|
-
# @param [string] cursor ID of the collection used as the starting point for the query, excluding the collection itself. Should be used for efficient pagination when working with large sets of data.
|
181
|
-
# @param [string] cursor_direction Direction of the cursor, can be either 'before' or 'after'.
|
182
|
-
# @param [string] order_type Order result by ASC or DESC order.
|
181
|
+
# @param [String] database_id Database ID.
|
182
|
+
# @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). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity
|
183
|
+
# @param [String] search Search term to filter your list results. Max length: 256 chars.
|
183
184
|
#
|
184
185
|
# @return [CollectionList]
|
185
|
-
def list_collections(
|
186
|
-
if @database_id.nil?
|
187
|
-
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
188
|
-
end
|
186
|
+
def list_collections(database_id:, queries: nil, search: nil)
|
189
187
|
|
190
188
|
path = '/databases/{databaseId}/collections'
|
191
|
-
.gsub('{databaseId}', @database_id)
|
192
189
|
|
193
190
|
params = {
|
191
|
+
queries: queries,
|
194
192
|
search: search,
|
195
|
-
limit: limit,
|
196
|
-
offset: offset,
|
197
|
-
cursor: cursor,
|
198
|
-
cursorDirection: cursor_direction,
|
199
|
-
orderType: order_type,
|
200
193
|
}
|
201
|
-
|
194
|
+
|
202
195
|
headers = {
|
203
196
|
"content-type": 'application/json',
|
204
197
|
}
|
198
|
+
if database_id.nil?
|
199
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
200
|
+
end
|
201
|
+
|
202
|
+
.gsub('{databaseId}', database_id)
|
205
203
|
|
206
204
|
@client.call(
|
207
205
|
method: 'GET',
|
@@ -212,18 +210,34 @@ module Appwrite
|
|
212
210
|
)
|
213
211
|
end
|
214
212
|
|
215
|
-
|
213
|
+
|
214
|
+
# Create a new Collection. Before using this route, you should create a new
|
215
|
+
# database resource using either a [server
|
216
|
+
# integration](/docs/server/databases#databasesCreateCollection) API or
|
217
|
+
# directly from your database console.
|
216
218
|
#
|
217
|
-
# @param [
|
218
|
-
# @param [
|
219
|
-
# @param [
|
220
|
-
# @param [
|
221
|
-
# @param [
|
222
|
-
# @param [array] write An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.
|
219
|
+
# @param [String] database_id Database ID.
|
220
|
+
# @param [String] collection_id Unique Id. Choose your own unique ID or pass the string "unique()" to auto generate it. 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.
|
221
|
+
# @param [String] name Collection name. Max length: 128 chars.
|
222
|
+
# @param [Array] permissions An array of permissions strings. By default no user is granted with any permissions. [Learn more about permissions](/docs/permissions).
|
223
|
+
# @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).
|
223
224
|
#
|
224
225
|
# @return [Collection]
|
225
|
-
def create_collection(collection_id:, name:,
|
226
|
-
|
226
|
+
def create_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil)
|
227
|
+
|
228
|
+
path = '/databases/{databaseId}/collections'
|
229
|
+
|
230
|
+
params = {
|
231
|
+
collectionId: collection_id,
|
232
|
+
name: name,
|
233
|
+
permissions: permissions,
|
234
|
+
documentSecurity: document_security,
|
235
|
+
}
|
236
|
+
|
237
|
+
headers = {
|
238
|
+
"content-type": 'application/json',
|
239
|
+
}
|
240
|
+
if database_id.nil?
|
227
241
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
228
242
|
end
|
229
243
|
|
@@ -235,32 +249,7 @@ module Appwrite
|
|
235
249
|
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
236
250
|
end
|
237
251
|
|
238
|
-
|
239
|
-
raise Appwrite::Exception.new('Missing required parameter: "permission"')
|
240
|
-
end
|
241
|
-
|
242
|
-
if read.nil?
|
243
|
-
raise Appwrite::Exception.new('Missing required parameter: "read"')
|
244
|
-
end
|
245
|
-
|
246
|
-
if write.nil?
|
247
|
-
raise Appwrite::Exception.new('Missing required parameter: "write"')
|
248
|
-
end
|
249
|
-
|
250
|
-
path = '/databases/{databaseId}/collections'
|
251
|
-
.gsub('{databaseId}', @database_id)
|
252
|
-
|
253
|
-
params = {
|
254
|
-
collectionId: collection_id,
|
255
|
-
name: name,
|
256
|
-
permission: permission,
|
257
|
-
read: read,
|
258
|
-
write: write,
|
259
|
-
}
|
260
|
-
|
261
|
-
headers = {
|
262
|
-
"content-type": 'application/json',
|
263
|
-
}
|
252
|
+
.gsub('{databaseId}', database_id)
|
264
253
|
|
265
254
|
@client.call(
|
266
255
|
method: 'POST',
|
@@ -271,31 +260,34 @@ module Appwrite
|
|
271
260
|
)
|
272
261
|
end
|
273
262
|
|
274
|
-
|
263
|
+
|
264
|
+
# Get a collection by its unique ID. This endpoint response returns a JSON
|
265
|
+
# object with the collection metadata.
|
275
266
|
#
|
276
|
-
# @param [
|
277
|
-
# @param [
|
267
|
+
# @param [String] database_id Database ID.
|
268
|
+
# @param [String] collection_id Collection ID.
|
278
269
|
#
|
279
270
|
# @return [Collection]
|
280
|
-
def get_collection(collection_id:)
|
281
|
-
if @database_id.nil?
|
282
|
-
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
283
|
-
end
|
284
|
-
|
285
|
-
if collection_id.nil?
|
286
|
-
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
287
|
-
end
|
271
|
+
def get_collection(database_id:, collection_id:)
|
288
272
|
|
289
273
|
path = '/databases/{databaseId}/collections/{collectionId}'
|
290
|
-
.gsub('{databaseId}', @database_id)
|
291
|
-
.gsub('{collectionId}', collection_id)
|
292
274
|
|
293
275
|
params = {
|
294
276
|
}
|
295
|
-
|
277
|
+
|
296
278
|
headers = {
|
297
279
|
"content-type": 'application/json',
|
298
280
|
}
|
281
|
+
if database_id.nil?
|
282
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
283
|
+
end
|
284
|
+
|
285
|
+
if collection_id.nil?
|
286
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
287
|
+
end
|
288
|
+
|
289
|
+
.gsub('{databaseId}', database_id)
|
290
|
+
.gsub('{collectionId}', collection_id)
|
299
291
|
|
300
292
|
@client.call(
|
301
293
|
method: 'GET',
|
@@ -306,19 +298,32 @@ module Appwrite
|
|
306
298
|
)
|
307
299
|
end
|
308
300
|
|
309
|
-
|
301
|
+
|
302
|
+
# Update a collection by its unique ID.
|
310
303
|
#
|
311
|
-
# @param [
|
312
|
-
# @param [
|
313
|
-
# @param [
|
314
|
-
# @param [
|
315
|
-
# @param [
|
316
|
-
# @param [
|
317
|
-
# @param [boolean] enabled Is collection enabled?
|
304
|
+
# @param [String] database_id Database ID.
|
305
|
+
# @param [String] collection_id Collection ID.
|
306
|
+
# @param [String] name Collection name. Max length: 128 chars.
|
307
|
+
# @param [Array] permissions An array of permission strings. By default the current permission are inherited. [Learn more about permissions](/docs/permissions).
|
308
|
+
# @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).
|
309
|
+
# @param [] enabled Is collection enabled?
|
318
310
|
#
|
319
311
|
# @return [Collection]
|
320
|
-
def update_collection(collection_id:, name:,
|
321
|
-
|
312
|
+
def update_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil, enabled: nil)
|
313
|
+
|
314
|
+
path = '/databases/{databaseId}/collections/{collectionId}'
|
315
|
+
|
316
|
+
params = {
|
317
|
+
name: name,
|
318
|
+
permissions: permissions,
|
319
|
+
documentSecurity: document_security,
|
320
|
+
enabled: enabled,
|
321
|
+
}
|
322
|
+
|
323
|
+
headers = {
|
324
|
+
"content-type": 'application/json',
|
325
|
+
}
|
326
|
+
if database_id.nil?
|
322
327
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
323
328
|
end
|
324
329
|
|
@@ -330,26 +335,9 @@ module Appwrite
|
|
330
335
|
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
331
336
|
end
|
332
337
|
|
333
|
-
|
334
|
-
raise Appwrite::Exception.new('Missing required parameter: "permission"')
|
335
|
-
end
|
336
|
-
|
337
|
-
path = '/databases/{databaseId}/collections/{collectionId}'
|
338
|
-
.gsub('{databaseId}', @database_id)
|
338
|
+
.gsub('{databaseId}', database_id)
|
339
339
|
.gsub('{collectionId}', collection_id)
|
340
340
|
|
341
|
-
params = {
|
342
|
-
name: name,
|
343
|
-
permission: permission,
|
344
|
-
read: read,
|
345
|
-
write: write,
|
346
|
-
enabled: enabled,
|
347
|
-
}
|
348
|
-
|
349
|
-
headers = {
|
350
|
-
"content-type": 'application/json',
|
351
|
-
}
|
352
|
-
|
353
341
|
@client.call(
|
354
342
|
method: 'PUT',
|
355
343
|
path: path,
|
@@ -359,31 +347,34 @@ module Appwrite
|
|
359
347
|
)
|
360
348
|
end
|
361
349
|
|
362
|
-
|
350
|
+
|
351
|
+
# Delete a collection by its unique ID. Only users with write permissions
|
352
|
+
# have access to delete this resource.
|
363
353
|
#
|
364
|
-
# @param [
|
365
|
-
# @param [
|
354
|
+
# @param [String] database_id Database ID.
|
355
|
+
# @param [String] collection_id Collection ID.
|
366
356
|
#
|
367
357
|
# @return []
|
368
|
-
def delete_collection(collection_id:)
|
369
|
-
if @database_id.nil?
|
370
|
-
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
371
|
-
end
|
372
|
-
|
373
|
-
if collection_id.nil?
|
374
|
-
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
375
|
-
end
|
358
|
+
def delete_collection(database_id:, collection_id:)
|
376
359
|
|
377
360
|
path = '/databases/{databaseId}/collections/{collectionId}'
|
378
|
-
.gsub('{databaseId}', @database_id)
|
379
|
-
.gsub('{collectionId}', collection_id)
|
380
361
|
|
381
362
|
params = {
|
382
363
|
}
|
383
|
-
|
364
|
+
|
384
365
|
headers = {
|
385
366
|
"content-type": 'application/json',
|
386
367
|
}
|
368
|
+
if database_id.nil?
|
369
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
370
|
+
end
|
371
|
+
|
372
|
+
if collection_id.nil?
|
373
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
374
|
+
end
|
375
|
+
|
376
|
+
.gsub('{databaseId}', database_id)
|
377
|
+
.gsub('{collectionId}', collection_id)
|
387
378
|
|
388
379
|
@client.call(
|
389
380
|
method: 'DELETE',
|
@@ -393,31 +384,33 @@ module Appwrite
|
|
393
384
|
)
|
394
385
|
end
|
395
386
|
|
387
|
+
|
396
388
|
#
|
397
389
|
#
|
398
|
-
# @param [
|
399
|
-
# @param [
|
390
|
+
# @param [String] database_id Database ID.
|
391
|
+
# @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).
|
400
392
|
#
|
401
393
|
# @return [AttributeList]
|
402
|
-
def list_attributes(collection_id:)
|
403
|
-
if @database_id.nil?
|
404
|
-
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
405
|
-
end
|
406
|
-
|
407
|
-
if collection_id.nil?
|
408
|
-
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
409
|
-
end
|
394
|
+
def list_attributes(database_id:, collection_id:)
|
410
395
|
|
411
396
|
path = '/databases/{databaseId}/collections/{collectionId}/attributes'
|
412
|
-
.gsub('{databaseId}', @database_id)
|
413
|
-
.gsub('{collectionId}', collection_id)
|
414
397
|
|
415
398
|
params = {
|
416
399
|
}
|
417
|
-
|
400
|
+
|
418
401
|
headers = {
|
419
402
|
"content-type": 'application/json',
|
420
403
|
}
|
404
|
+
if database_id.nil?
|
405
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
406
|
+
end
|
407
|
+
|
408
|
+
if collection_id.nil?
|
409
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
410
|
+
end
|
411
|
+
|
412
|
+
.gsub('{databaseId}', database_id)
|
413
|
+
.gsub('{collectionId}', collection_id)
|
421
414
|
|
422
415
|
@client.call(
|
423
416
|
method: 'GET',
|
@@ -428,18 +421,33 @@ module Appwrite
|
|
428
421
|
)
|
429
422
|
end
|
430
423
|
|
424
|
+
|
425
|
+
# Create a boolean attribute.
|
431
426
|
#
|
432
427
|
#
|
433
|
-
# @param [
|
434
|
-
# @param [
|
435
|
-
# @param [
|
436
|
-
# @param [
|
437
|
-
# @param [
|
438
|
-
# @param [
|
428
|
+
# @param [String] database_id Database ID.
|
429
|
+
# @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).
|
430
|
+
# @param [String] key Attribute Key.
|
431
|
+
# @param [] required Is attribute required?
|
432
|
+
# @param [] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
433
|
+
# @param [] array Is attribute an array?
|
439
434
|
#
|
440
435
|
# @return [AttributeBoolean]
|
441
|
-
def create_boolean_attribute(collection_id:, key:, required:, default: nil, array: nil)
|
442
|
-
|
436
|
+
def create_boolean_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
437
|
+
|
438
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'
|
439
|
+
|
440
|
+
params = {
|
441
|
+
key: key,
|
442
|
+
required: required,
|
443
|
+
default: default,
|
444
|
+
array: array,
|
445
|
+
}
|
446
|
+
|
447
|
+
headers = {
|
448
|
+
"content-type": 'application/json',
|
449
|
+
}
|
450
|
+
if database_id.nil?
|
443
451
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
444
452
|
end
|
445
453
|
|
@@ -455,21 +463,9 @@ module Appwrite
|
|
455
463
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
456
464
|
end
|
457
465
|
|
458
|
-
|
459
|
-
.gsub('{databaseId}', @database_id)
|
466
|
+
.gsub('{databaseId}', database_id)
|
460
467
|
.gsub('{collectionId}', collection_id)
|
461
468
|
|
462
|
-
params = {
|
463
|
-
key: key,
|
464
|
-
required: required,
|
465
|
-
default: default,
|
466
|
-
array: array,
|
467
|
-
}
|
468
|
-
|
469
|
-
headers = {
|
470
|
-
"content-type": 'application/json',
|
471
|
-
}
|
472
|
-
|
473
469
|
@client.call(
|
474
470
|
method: 'POST',
|
475
471
|
path: path,
|
@@ -479,18 +475,32 @@ module Appwrite
|
|
479
475
|
)
|
480
476
|
end
|
481
477
|
|
478
|
+
|
482
479
|
#
|
483
480
|
#
|
484
|
-
# @param [
|
485
|
-
# @param [
|
486
|
-
# @param [
|
487
|
-
# @param [
|
488
|
-
# @param [
|
489
|
-
# @param [
|
481
|
+
# @param [String] database_id Database ID.
|
482
|
+
# @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).
|
483
|
+
# @param [String] key Attribute Key.
|
484
|
+
# @param [] required Is attribute required?
|
485
|
+
# @param [String] default Default value for the attribute in ISO 8601 format. Cannot be set when attribute is required.
|
486
|
+
# @param [] array Is attribute an array?
|
490
487
|
#
|
491
|
-
# @return [
|
492
|
-
def
|
493
|
-
|
488
|
+
# @return [AttributeDatetime]
|
489
|
+
def create_datetime_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
490
|
+
|
491
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'
|
492
|
+
|
493
|
+
params = {
|
494
|
+
key: key,
|
495
|
+
required: required,
|
496
|
+
default: default,
|
497
|
+
array: array,
|
498
|
+
}
|
499
|
+
|
500
|
+
headers = {
|
501
|
+
"content-type": 'application/json',
|
502
|
+
}
|
503
|
+
if database_id.nil?
|
494
504
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
495
505
|
end
|
496
506
|
|
@@ -506,20 +516,62 @@ module Appwrite
|
|
506
516
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
507
517
|
end
|
508
518
|
|
509
|
-
|
510
|
-
.gsub('{databaseId}', @database_id)
|
519
|
+
.gsub('{databaseId}', database_id)
|
511
520
|
.gsub('{collectionId}', collection_id)
|
512
521
|
|
522
|
+
@client.call(
|
523
|
+
method: 'POST',
|
524
|
+
path: path,
|
525
|
+
headers: headers,
|
526
|
+
params: params,
|
527
|
+
response_type: Models::AttributeDatetime
|
528
|
+
)
|
529
|
+
end
|
530
|
+
|
531
|
+
|
532
|
+
# Create an email attribute.
|
533
|
+
#
|
534
|
+
#
|
535
|
+
# @param [String] database_id Database ID.
|
536
|
+
# @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).
|
537
|
+
# @param [String] key Attribute Key.
|
538
|
+
# @param [] required Is attribute required?
|
539
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
540
|
+
# @param [] array Is attribute an array?
|
541
|
+
#
|
542
|
+
# @return [AttributeEmail]
|
543
|
+
def create_email_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
544
|
+
|
545
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/email'
|
546
|
+
|
513
547
|
params = {
|
514
548
|
key: key,
|
515
549
|
required: required,
|
516
550
|
default: default,
|
517
551
|
array: array,
|
518
552
|
}
|
519
|
-
|
553
|
+
|
520
554
|
headers = {
|
521
555
|
"content-type": 'application/json',
|
522
556
|
}
|
557
|
+
if database_id.nil?
|
558
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
559
|
+
end
|
560
|
+
|
561
|
+
if collection_id.nil?
|
562
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
563
|
+
end
|
564
|
+
|
565
|
+
if key.nil?
|
566
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
567
|
+
end
|
568
|
+
|
569
|
+
if required.nil?
|
570
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
571
|
+
end
|
572
|
+
|
573
|
+
.gsub('{databaseId}', database_id)
|
574
|
+
.gsub('{collectionId}', collection_id)
|
523
575
|
|
524
576
|
@client.call(
|
525
577
|
method: 'POST',
|
@@ -530,19 +582,34 @@ module Appwrite
|
|
530
582
|
)
|
531
583
|
end
|
532
584
|
|
585
|
+
|
533
586
|
#
|
534
587
|
#
|
535
|
-
# @param [
|
536
|
-
# @param [
|
537
|
-
# @param [
|
538
|
-
# @param [
|
539
|
-
# @param [
|
540
|
-
# @param [
|
541
|
-
# @param [
|
588
|
+
# @param [String] database_id Database ID.
|
589
|
+
# @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).
|
590
|
+
# @param [String] key Attribute Key.
|
591
|
+
# @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.
|
592
|
+
# @param [] required Is attribute required?
|
593
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
594
|
+
# @param [] array Is attribute an array?
|
542
595
|
#
|
543
596
|
# @return [AttributeEnum]
|
544
|
-
def create_enum_attribute(collection_id:, key:, elements:, required:, default: nil, array: nil)
|
545
|
-
|
597
|
+
def create_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default: nil, array: nil)
|
598
|
+
|
599
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'
|
600
|
+
|
601
|
+
params = {
|
602
|
+
key: key,
|
603
|
+
elements: elements,
|
604
|
+
required: required,
|
605
|
+
default: default,
|
606
|
+
array: array,
|
607
|
+
}
|
608
|
+
|
609
|
+
headers = {
|
610
|
+
"content-type": 'application/json',
|
611
|
+
}
|
612
|
+
if database_id.nil?
|
546
613
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
547
614
|
end
|
548
615
|
|
@@ -562,22 +629,9 @@ module Appwrite
|
|
562
629
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
563
630
|
end
|
564
631
|
|
565
|
-
|
566
|
-
.gsub('{databaseId}', @database_id)
|
632
|
+
.gsub('{databaseId}', database_id)
|
567
633
|
.gsub('{collectionId}', collection_id)
|
568
634
|
|
569
|
-
params = {
|
570
|
-
key: key,
|
571
|
-
elements: elements,
|
572
|
-
required: required,
|
573
|
-
default: default,
|
574
|
-
array: array,
|
575
|
-
}
|
576
|
-
|
577
|
-
headers = {
|
578
|
-
"content-type": 'application/json',
|
579
|
-
}
|
580
|
-
|
581
635
|
@client.call(
|
582
636
|
method: 'POST',
|
583
637
|
path: path,
|
@@ -587,20 +641,38 @@ module Appwrite
|
|
587
641
|
)
|
588
642
|
end
|
589
643
|
|
644
|
+
|
645
|
+
# Create a float attribute. Optionally, minimum and maximum values can be
|
646
|
+
# provided.
|
590
647
|
#
|
591
648
|
#
|
592
|
-
# @param [
|
593
|
-
# @param [
|
594
|
-
# @param [
|
595
|
-
# @param [
|
596
|
-
# @param [
|
597
|
-
# @param [
|
598
|
-
# @param [
|
599
|
-
# @param [
|
649
|
+
# @param [String] database_id Database ID.
|
650
|
+
# @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).
|
651
|
+
# @param [String] key Attribute Key.
|
652
|
+
# @param [] required Is attribute required?
|
653
|
+
# @param [Float] min Minimum value to enforce on new documents
|
654
|
+
# @param [Float] max Maximum value to enforce on new documents
|
655
|
+
# @param [Float] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
656
|
+
# @param [] array Is attribute an array?
|
600
657
|
#
|
601
658
|
# @return [AttributeFloat]
|
602
|
-
def create_float_attribute(collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil)
|
603
|
-
|
659
|
+
def create_float_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil)
|
660
|
+
|
661
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/float'
|
662
|
+
|
663
|
+
params = {
|
664
|
+
key: key,
|
665
|
+
required: required,
|
666
|
+
min: min,
|
667
|
+
max: max,
|
668
|
+
default: default,
|
669
|
+
array: array,
|
670
|
+
}
|
671
|
+
|
672
|
+
headers = {
|
673
|
+
"content-type": 'application/json',
|
674
|
+
}
|
675
|
+
if database_id.nil?
|
604
676
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
605
677
|
end
|
606
678
|
|
@@ -616,23 +688,9 @@ module Appwrite
|
|
616
688
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
617
689
|
end
|
618
690
|
|
619
|
-
|
620
|
-
.gsub('{databaseId}', @database_id)
|
691
|
+
.gsub('{databaseId}', database_id)
|
621
692
|
.gsub('{collectionId}', collection_id)
|
622
693
|
|
623
|
-
params = {
|
624
|
-
key: key,
|
625
|
-
required: required,
|
626
|
-
min: min,
|
627
|
-
max: max,
|
628
|
-
default: default,
|
629
|
-
array: array,
|
630
|
-
}
|
631
|
-
|
632
|
-
headers = {
|
633
|
-
"content-type": 'application/json',
|
634
|
-
}
|
635
|
-
|
636
694
|
@client.call(
|
637
695
|
method: 'POST',
|
638
696
|
path: path,
|
@@ -642,20 +700,38 @@ module Appwrite
|
|
642
700
|
)
|
643
701
|
end
|
644
702
|
|
703
|
+
|
704
|
+
# Create an integer attribute. Optionally, minimum and maximum values can be
|
705
|
+
# provided.
|
645
706
|
#
|
646
707
|
#
|
647
|
-
# @param [
|
648
|
-
# @param [
|
649
|
-
# @param [
|
650
|
-
# @param [
|
651
|
-
# @param [
|
652
|
-
# @param [
|
653
|
-
# @param [
|
654
|
-
# @param [
|
708
|
+
# @param [String] database_id Database ID.
|
709
|
+
# @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).
|
710
|
+
# @param [String] key Attribute Key.
|
711
|
+
# @param [] required Is attribute required?
|
712
|
+
# @param [Integer] min Minimum value to enforce on new documents
|
713
|
+
# @param [Integer] max Maximum value to enforce on new documents
|
714
|
+
# @param [Integer] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
715
|
+
# @param [] array Is attribute an array?
|
655
716
|
#
|
656
717
|
# @return [AttributeInteger]
|
657
|
-
def create_integer_attribute(collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil)
|
658
|
-
|
718
|
+
def create_integer_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil)
|
719
|
+
|
720
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'
|
721
|
+
|
722
|
+
params = {
|
723
|
+
key: key,
|
724
|
+
required: required,
|
725
|
+
min: min,
|
726
|
+
max: max,
|
727
|
+
default: default,
|
728
|
+
array: array,
|
729
|
+
}
|
730
|
+
|
731
|
+
headers = {
|
732
|
+
"content-type": 'application/json',
|
733
|
+
}
|
734
|
+
if database_id.nil?
|
659
735
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
660
736
|
end
|
661
737
|
|
@@ -671,23 +747,9 @@ module Appwrite
|
|
671
747
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
672
748
|
end
|
673
749
|
|
674
|
-
|
675
|
-
.gsub('{databaseId}', @database_id)
|
750
|
+
.gsub('{databaseId}', database_id)
|
676
751
|
.gsub('{collectionId}', collection_id)
|
677
752
|
|
678
|
-
params = {
|
679
|
-
key: key,
|
680
|
-
required: required,
|
681
|
-
min: min,
|
682
|
-
max: max,
|
683
|
-
default: default,
|
684
|
-
array: array,
|
685
|
-
}
|
686
|
-
|
687
|
-
headers = {
|
688
|
-
"content-type": 'application/json',
|
689
|
-
}
|
690
|
-
|
691
753
|
@client.call(
|
692
754
|
method: 'POST',
|
693
755
|
path: path,
|
@@ -697,36 +759,21 @@ module Appwrite
|
|
697
759
|
)
|
698
760
|
end
|
699
761
|
|
762
|
+
|
763
|
+
# Create IP address attribute.
|
700
764
|
#
|
701
765
|
#
|
702
|
-
# @param [
|
703
|
-
# @param [
|
704
|
-
# @param [
|
705
|
-
# @param [
|
706
|
-
# @param [
|
707
|
-
# @param [
|
766
|
+
# @param [String] database_id Database ID.
|
767
|
+
# @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).
|
768
|
+
# @param [String] key Attribute Key.
|
769
|
+
# @param [] required Is attribute required?
|
770
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
771
|
+
# @param [] array Is attribute an array?
|
708
772
|
#
|
709
773
|
# @return [AttributeIp]
|
710
|
-
def create_ip_attribute(collection_id:, key:, required:, default: nil, array: nil)
|
711
|
-
if @database_id.nil?
|
712
|
-
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
713
|
-
end
|
714
|
-
|
715
|
-
if collection_id.nil?
|
716
|
-
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
717
|
-
end
|
718
|
-
|
719
|
-
if key.nil?
|
720
|
-
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
721
|
-
end
|
722
|
-
|
723
|
-
if required.nil?
|
724
|
-
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
725
|
-
end
|
774
|
+
def create_ip_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
726
775
|
|
727
776
|
path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'
|
728
|
-
.gsub('{databaseId}', @database_id)
|
729
|
-
.gsub('{collectionId}', collection_id)
|
730
777
|
|
731
778
|
params = {
|
732
779
|
key: key,
|
@@ -734,10 +781,28 @@ module Appwrite
|
|
734
781
|
default: default,
|
735
782
|
array: array,
|
736
783
|
}
|
784
|
+
|
785
|
+
headers = {
|
786
|
+
"content-type": 'application/json',
|
787
|
+
}
|
788
|
+
if database_id.nil?
|
789
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
790
|
+
end
|
791
|
+
|
792
|
+
if collection_id.nil?
|
793
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
794
|
+
end
|
795
|
+
|
796
|
+
if key.nil?
|
797
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
798
|
+
end
|
737
799
|
|
738
|
-
|
739
|
-
"
|
740
|
-
|
800
|
+
if required.nil?
|
801
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
802
|
+
end
|
803
|
+
|
804
|
+
.gsub('{databaseId}', database_id)
|
805
|
+
.gsub('{collectionId}', collection_id)
|
741
806
|
|
742
807
|
@client.call(
|
743
808
|
method: 'POST',
|
@@ -748,19 +813,35 @@ module Appwrite
|
|
748
813
|
)
|
749
814
|
end
|
750
815
|
|
816
|
+
|
817
|
+
# Create a string attribute.
|
751
818
|
#
|
752
819
|
#
|
753
|
-
# @param [
|
754
|
-
# @param [
|
755
|
-
# @param [
|
756
|
-
# @param [
|
757
|
-
# @param [
|
758
|
-
# @param [
|
759
|
-
# @param [
|
820
|
+
# @param [String] database_id Database ID.
|
821
|
+
# @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).
|
822
|
+
# @param [String] key Attribute Key.
|
823
|
+
# @param [Integer] size Attribute size for text attributes, in number of characters.
|
824
|
+
# @param [] required Is attribute required?
|
825
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
826
|
+
# @param [] array Is attribute an array?
|
760
827
|
#
|
761
828
|
# @return [AttributeString]
|
762
|
-
def create_string_attribute(collection_id:, key:, size:, required:, default: nil, array: nil)
|
763
|
-
|
829
|
+
def create_string_attribute(database_id:, collection_id:, key:, size:, required:, default: nil, array: nil)
|
830
|
+
|
831
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/string'
|
832
|
+
|
833
|
+
params = {
|
834
|
+
key: key,
|
835
|
+
size: size,
|
836
|
+
required: required,
|
837
|
+
default: default,
|
838
|
+
array: array,
|
839
|
+
}
|
840
|
+
|
841
|
+
headers = {
|
842
|
+
"content-type": 'application/json',
|
843
|
+
}
|
844
|
+
if database_id.nil?
|
764
845
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
765
846
|
end
|
766
847
|
|
@@ -780,22 +861,9 @@ module Appwrite
|
|
780
861
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
781
862
|
end
|
782
863
|
|
783
|
-
|
784
|
-
.gsub('{databaseId}', @database_id)
|
864
|
+
.gsub('{databaseId}', database_id)
|
785
865
|
.gsub('{collectionId}', collection_id)
|
786
866
|
|
787
|
-
params = {
|
788
|
-
key: key,
|
789
|
-
size: size,
|
790
|
-
required: required,
|
791
|
-
default: default,
|
792
|
-
array: array,
|
793
|
-
}
|
794
|
-
|
795
|
-
headers = {
|
796
|
-
"content-type": 'application/json',
|
797
|
-
}
|
798
|
-
|
799
867
|
@client.call(
|
800
868
|
method: 'POST',
|
801
869
|
path: path,
|
@@ -805,18 +873,33 @@ module Appwrite
|
|
805
873
|
)
|
806
874
|
end
|
807
875
|
|
876
|
+
|
877
|
+
# Create a URL attribute.
|
808
878
|
#
|
809
879
|
#
|
810
|
-
# @param [
|
811
|
-
# @param [
|
812
|
-
# @param [
|
813
|
-
# @param [
|
814
|
-
# @param [
|
815
|
-
# @param [
|
880
|
+
# @param [String] database_id Database ID.
|
881
|
+
# @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).
|
882
|
+
# @param [String] key Attribute Key.
|
883
|
+
# @param [] required Is attribute required?
|
884
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
885
|
+
# @param [] array Is attribute an array?
|
816
886
|
#
|
817
887
|
# @return [AttributeUrl]
|
818
|
-
def create_url_attribute(collection_id:, key:, required:, default: nil, array: nil)
|
819
|
-
|
888
|
+
def create_url_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
889
|
+
|
890
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/url'
|
891
|
+
|
892
|
+
params = {
|
893
|
+
key: key,
|
894
|
+
required: required,
|
895
|
+
default: default,
|
896
|
+
array: array,
|
897
|
+
}
|
898
|
+
|
899
|
+
headers = {
|
900
|
+
"content-type": 'application/json',
|
901
|
+
}
|
902
|
+
if database_id.nil?
|
820
903
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
821
904
|
end
|
822
905
|
|
@@ -832,21 +915,9 @@ module Appwrite
|
|
832
915
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
833
916
|
end
|
834
917
|
|
835
|
-
|
836
|
-
.gsub('{databaseId}', @database_id)
|
918
|
+
.gsub('{databaseId}', database_id)
|
837
919
|
.gsub('{collectionId}', collection_id)
|
838
920
|
|
839
|
-
params = {
|
840
|
-
key: key,
|
841
|
-
required: required,
|
842
|
-
default: default,
|
843
|
-
array: array,
|
844
|
-
}
|
845
|
-
|
846
|
-
headers = {
|
847
|
-
"content-type": 'application/json',
|
848
|
-
}
|
849
|
-
|
850
921
|
@client.call(
|
851
922
|
method: 'POST',
|
852
923
|
path: path,
|
@@ -856,15 +927,25 @@ module Appwrite
|
|
856
927
|
)
|
857
928
|
end
|
858
929
|
|
930
|
+
|
859
931
|
#
|
860
932
|
#
|
861
|
-
# @param [
|
862
|
-
# @param [
|
863
|
-
# @param [
|
933
|
+
# @param [String] database_id Database ID.
|
934
|
+
# @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).
|
935
|
+
# @param [String] key Attribute Key.
|
864
936
|
#
|
865
937
|
# @return []
|
866
|
-
def get_attribute(collection_id:, key:)
|
867
|
-
|
938
|
+
def get_attribute(database_id:, collection_id:, key:)
|
939
|
+
|
940
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'
|
941
|
+
|
942
|
+
params = {
|
943
|
+
}
|
944
|
+
|
945
|
+
headers = {
|
946
|
+
"content-type": 'application/json',
|
947
|
+
}
|
948
|
+
if database_id.nil?
|
868
949
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
869
950
|
end
|
870
951
|
|
@@ -876,18 +957,10 @@ module Appwrite
|
|
876
957
|
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
877
958
|
end
|
878
959
|
|
879
|
-
|
880
|
-
.gsub('{databaseId}', @database_id)
|
960
|
+
.gsub('{databaseId}', database_id)
|
881
961
|
.gsub('{collectionId}', collection_id)
|
882
962
|
.gsub('{key}', key)
|
883
963
|
|
884
|
-
params = {
|
885
|
-
}
|
886
|
-
|
887
|
-
headers = {
|
888
|
-
"content-type": 'application/json',
|
889
|
-
}
|
890
|
-
|
891
964
|
@client.call(
|
892
965
|
method: 'GET',
|
893
966
|
path: path,
|
@@ -896,15 +969,25 @@ module Appwrite
|
|
896
969
|
)
|
897
970
|
end
|
898
971
|
|
972
|
+
|
899
973
|
#
|
900
974
|
#
|
901
|
-
# @param [
|
902
|
-
# @param [
|
903
|
-
# @param [
|
975
|
+
# @param [String] database_id Database ID.
|
976
|
+
# @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).
|
977
|
+
# @param [String] key Attribute Key.
|
904
978
|
#
|
905
979
|
# @return []
|
906
|
-
def delete_attribute(collection_id:, key:)
|
907
|
-
|
980
|
+
def delete_attribute(database_id:, collection_id:, key:)
|
981
|
+
|
982
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'
|
983
|
+
|
984
|
+
params = {
|
985
|
+
}
|
986
|
+
|
987
|
+
headers = {
|
988
|
+
"content-type": 'application/json',
|
989
|
+
}
|
990
|
+
if database_id.nil?
|
908
991
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
909
992
|
end
|
910
993
|
|
@@ -916,18 +999,10 @@ module Appwrite
|
|
916
999
|
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
917
1000
|
end
|
918
1001
|
|
919
|
-
|
920
|
-
.gsub('{databaseId}', @database_id)
|
1002
|
+
.gsub('{databaseId}', database_id)
|
921
1003
|
.gsub('{collectionId}', collection_id)
|
922
1004
|
.gsub('{key}', key)
|
923
1005
|
|
924
|
-
params = {
|
925
|
-
}
|
926
|
-
|
927
|
-
headers = {
|
928
|
-
"content-type": 'application/json',
|
929
|
-
}
|
930
|
-
|
931
1006
|
@client.call(
|
932
1007
|
method: 'DELETE',
|
933
1008
|
path: path,
|
@@ -936,45 +1011,38 @@ module Appwrite
|
|
936
1011
|
)
|
937
1012
|
end
|
938
1013
|
|
939
|
-
|
1014
|
+
|
1015
|
+
# Get a list of all the user's documents in a given collection. You can use
|
1016
|
+
# the query params to filter your results. On admin mode, this endpoint will
|
1017
|
+
# return a list of all of documents belonging to the provided collectionId.
|
1018
|
+
# [Learn more about different API modes](/docs/admin).
|
940
1019
|
#
|
941
|
-
# @param [
|
942
|
-
# @param [
|
943
|
-
# @param [
|
944
|
-
# @param [number] limit Maximum number of documents to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.
|
945
|
-
# @param [number] offset Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)
|
946
|
-
# @param [string] cursor ID of the document used as the starting point for the query, excluding the document itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)
|
947
|
-
# @param [string] cursor_direction Direction of the cursor, can be either 'before' or 'after'.
|
948
|
-
# @param [array] order_attributes Array of attributes used to sort results. Maximum of 100 order attributes are allowed, each 4096 characters long.
|
949
|
-
# @param [array] order_types Array of order directions for sorting attribtues. Possible values are DESC for descending order, or ASC for ascending order. Maximum of 100 order types are allowed.
|
1020
|
+
# @param [String] database_id Database ID.
|
1021
|
+
# @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).
|
1022
|
+
# @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). Maximum of 100 queries are allowed, each 4096 characters long.
|
950
1023
|
#
|
951
1024
|
# @return [DocumentList]
|
952
|
-
def list_documents(collection_id:, queries: nil
|
953
|
-
if @database_id.nil?
|
954
|
-
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
955
|
-
end
|
956
|
-
|
957
|
-
if collection_id.nil?
|
958
|
-
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
959
|
-
end
|
1025
|
+
def list_documents(database_id:, collection_id:, queries: nil)
|
960
1026
|
|
961
1027
|
path = '/databases/{databaseId}/collections/{collectionId}/documents'
|
962
|
-
.gsub('{databaseId}', @database_id)
|
963
|
-
.gsub('{collectionId}', collection_id)
|
964
1028
|
|
965
1029
|
params = {
|
966
1030
|
queries: queries,
|
967
|
-
limit: limit,
|
968
|
-
offset: offset,
|
969
|
-
cursor: cursor,
|
970
|
-
cursorDirection: cursor_direction,
|
971
|
-
orderAttributes: order_attributes,
|
972
|
-
orderTypes: order_types,
|
973
1031
|
}
|
974
|
-
|
1032
|
+
|
975
1033
|
headers = {
|
976
1034
|
"content-type": 'application/json',
|
977
1035
|
}
|
1036
|
+
if database_id.nil?
|
1037
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1038
|
+
end
|
1039
|
+
|
1040
|
+
if collection_id.nil?
|
1041
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1042
|
+
end
|
1043
|
+
|
1044
|
+
.gsub('{databaseId}', database_id)
|
1045
|
+
.gsub('{collectionId}', collection_id)
|
978
1046
|
|
979
1047
|
@client.call(
|
980
1048
|
method: 'GET',
|
@@ -985,18 +1053,33 @@ module Appwrite
|
|
985
1053
|
)
|
986
1054
|
end
|
987
1055
|
|
988
|
-
|
1056
|
+
|
1057
|
+
# Create a new Document. Before using this route, you should create a new
|
1058
|
+
# collection resource using either a [server
|
1059
|
+
# integration](/docs/server/databases#databasesCreateCollection) API or
|
1060
|
+
# directly from your database console.
|
989
1061
|
#
|
990
|
-
# @param [
|
991
|
-
# @param [
|
992
|
-
# @param [
|
993
|
-
# @param [
|
994
|
-
# @param [
|
995
|
-
# @param [array] write An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.
|
1062
|
+
# @param [String] database_id Database ID.
|
1063
|
+
# @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.
|
1064
|
+
# @param [String] document_id Document ID. Choose your own unique ID or pass the string "unique()" to auto generate it. 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.
|
1065
|
+
# @param [Hash] data Document data as JSON object.
|
1066
|
+
# @param [Array] permissions An array of permissions strings. By default the current user is granted with all permissions. [Learn more about permissions](/docs/permissions).
|
996
1067
|
#
|
997
1068
|
# @return [Document]
|
998
|
-
def create_document(collection_id:, document_id:, data:,
|
999
|
-
|
1069
|
+
def create_document(database_id:, collection_id:, document_id:, data:, permissions: nil)
|
1070
|
+
|
1071
|
+
path = '/databases/{databaseId}/collections/{collectionId}/documents'
|
1072
|
+
|
1073
|
+
params = {
|
1074
|
+
documentId: document_id,
|
1075
|
+
data: data,
|
1076
|
+
permissions: permissions,
|
1077
|
+
}
|
1078
|
+
|
1079
|
+
headers = {
|
1080
|
+
"content-type": 'application/json',
|
1081
|
+
}
|
1082
|
+
if database_id.nil?
|
1000
1083
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1001
1084
|
end
|
1002
1085
|
|
@@ -1012,21 +1095,9 @@ module Appwrite
|
|
1012
1095
|
raise Appwrite::Exception.new('Missing required parameter: "data"')
|
1013
1096
|
end
|
1014
1097
|
|
1015
|
-
|
1016
|
-
.gsub('{databaseId}', @database_id)
|
1098
|
+
.gsub('{databaseId}', database_id)
|
1017
1099
|
.gsub('{collectionId}', collection_id)
|
1018
1100
|
|
1019
|
-
params = {
|
1020
|
-
documentId: document_id,
|
1021
|
-
data: data,
|
1022
|
-
read: read,
|
1023
|
-
write: write,
|
1024
|
-
}
|
1025
|
-
|
1026
|
-
headers = {
|
1027
|
-
"content-type": 'application/json',
|
1028
|
-
}
|
1029
|
-
|
1030
1101
|
@client.call(
|
1031
1102
|
method: 'POST',
|
1032
1103
|
path: path,
|
@@ -1036,15 +1107,26 @@ module Appwrite
|
|
1036
1107
|
)
|
1037
1108
|
end
|
1038
1109
|
|
1039
|
-
|
1110
|
+
|
1111
|
+
# Get a document by its unique ID. This endpoint response returns a JSON
|
1112
|
+
# object with the document data.
|
1040
1113
|
#
|
1041
|
-
# @param [
|
1042
|
-
# @param [
|
1043
|
-
# @param [
|
1114
|
+
# @param [String] database_id Database ID.
|
1115
|
+
# @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).
|
1116
|
+
# @param [String] document_id Document ID.
|
1044
1117
|
#
|
1045
1118
|
# @return [Document]
|
1046
|
-
def get_document(collection_id:, document_id:)
|
1047
|
-
|
1119
|
+
def get_document(database_id:, collection_id:, document_id:)
|
1120
|
+
|
1121
|
+
path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
|
1122
|
+
|
1123
|
+
params = {
|
1124
|
+
}
|
1125
|
+
|
1126
|
+
headers = {
|
1127
|
+
"content-type": 'application/json',
|
1128
|
+
}
|
1129
|
+
if database_id.nil?
|
1048
1130
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1049
1131
|
end
|
1050
1132
|
|
@@ -1056,18 +1138,10 @@ module Appwrite
|
|
1056
1138
|
raise Appwrite::Exception.new('Missing required parameter: "documentId"')
|
1057
1139
|
end
|
1058
1140
|
|
1059
|
-
|
1060
|
-
.gsub('{databaseId}', @database_id)
|
1141
|
+
.gsub('{databaseId}', database_id)
|
1061
1142
|
.gsub('{collectionId}', collection_id)
|
1062
1143
|
.gsub('{documentId}', document_id)
|
1063
1144
|
|
1064
|
-
params = {
|
1065
|
-
}
|
1066
|
-
|
1067
|
-
headers = {
|
1068
|
-
"content-type": 'application/json',
|
1069
|
-
}
|
1070
|
-
|
1071
1145
|
@client.call(
|
1072
1146
|
method: 'GET',
|
1073
1147
|
path: path,
|
@@ -1077,18 +1151,30 @@ module Appwrite
|
|
1077
1151
|
)
|
1078
1152
|
end
|
1079
1153
|
|
1080
|
-
|
1154
|
+
|
1155
|
+
# Update a document by its unique ID. Using the patch method you can pass
|
1156
|
+
# only specific fields that will get updated.
|
1081
1157
|
#
|
1082
|
-
# @param [
|
1083
|
-
# @param [
|
1084
|
-
# @param [
|
1085
|
-
# @param [
|
1086
|
-
# @param [
|
1087
|
-
# @param [array] write An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.
|
1158
|
+
# @param [String] database_id Database ID.
|
1159
|
+
# @param [String] collection_id Collection ID.
|
1160
|
+
# @param [String] document_id Document ID.
|
1161
|
+
# @param [Hash] data Document data as JSON object. Include only attribute and value pairs to be updated.
|
1162
|
+
# @param [Array] permissions An array of permissions strings. By default the current permissions are inherited. [Learn more about permissions](/docs/permissions).
|
1088
1163
|
#
|
1089
1164
|
# @return [Document]
|
1090
|
-
def update_document(collection_id:, document_id:, data: nil,
|
1091
|
-
|
1165
|
+
def update_document(database_id:, collection_id:, document_id:, data: nil, permissions: nil)
|
1166
|
+
|
1167
|
+
path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
|
1168
|
+
|
1169
|
+
params = {
|
1170
|
+
data: data,
|
1171
|
+
permissions: permissions,
|
1172
|
+
}
|
1173
|
+
|
1174
|
+
headers = {
|
1175
|
+
"content-type": 'application/json',
|
1176
|
+
}
|
1177
|
+
if database_id.nil?
|
1092
1178
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1093
1179
|
end
|
1094
1180
|
|
@@ -1100,21 +1186,10 @@ module Appwrite
|
|
1100
1186
|
raise Appwrite::Exception.new('Missing required parameter: "documentId"')
|
1101
1187
|
end
|
1102
1188
|
|
1103
|
-
|
1104
|
-
.gsub('{databaseId}', @database_id)
|
1189
|
+
.gsub('{databaseId}', database_id)
|
1105
1190
|
.gsub('{collectionId}', collection_id)
|
1106
1191
|
.gsub('{documentId}', document_id)
|
1107
1192
|
|
1108
|
-
params = {
|
1109
|
-
data: data,
|
1110
|
-
read: read,
|
1111
|
-
write: write,
|
1112
|
-
}
|
1113
|
-
|
1114
|
-
headers = {
|
1115
|
-
"content-type": 'application/json',
|
1116
|
-
}
|
1117
|
-
|
1118
1193
|
@client.call(
|
1119
1194
|
method: 'PATCH',
|
1120
1195
|
path: path,
|
@@ -1124,15 +1199,25 @@ module Appwrite
|
|
1124
1199
|
)
|
1125
1200
|
end
|
1126
1201
|
|
1127
|
-
|
1202
|
+
|
1203
|
+
# Delete a document by its unique ID.
|
1128
1204
|
#
|
1129
|
-
# @param [
|
1130
|
-
# @param [
|
1131
|
-
# @param [
|
1205
|
+
# @param [String] database_id Database ID.
|
1206
|
+
# @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).
|
1207
|
+
# @param [String] document_id Document ID.
|
1132
1208
|
#
|
1133
1209
|
# @return []
|
1134
|
-
def delete_document(collection_id:, document_id:)
|
1135
|
-
|
1210
|
+
def delete_document(database_id:, collection_id:, document_id:)
|
1211
|
+
|
1212
|
+
path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
|
1213
|
+
|
1214
|
+
params = {
|
1215
|
+
}
|
1216
|
+
|
1217
|
+
headers = {
|
1218
|
+
"content-type": 'application/json',
|
1219
|
+
}
|
1220
|
+
if database_id.nil?
|
1136
1221
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1137
1222
|
end
|
1138
1223
|
|
@@ -1144,18 +1229,10 @@ module Appwrite
|
|
1144
1229
|
raise Appwrite::Exception.new('Missing required parameter: "documentId"')
|
1145
1230
|
end
|
1146
1231
|
|
1147
|
-
|
1148
|
-
.gsub('{databaseId}', @database_id)
|
1232
|
+
.gsub('{databaseId}', database_id)
|
1149
1233
|
.gsub('{collectionId}', collection_id)
|
1150
1234
|
.gsub('{documentId}', document_id)
|
1151
1235
|
|
1152
|
-
params = {
|
1153
|
-
}
|
1154
|
-
|
1155
|
-
headers = {
|
1156
|
-
"content-type": 'application/json',
|
1157
|
-
}
|
1158
|
-
|
1159
1236
|
@client.call(
|
1160
1237
|
method: 'DELETE',
|
1161
1238
|
path: path,
|
@@ -1164,31 +1241,33 @@ module Appwrite
|
|
1164
1241
|
)
|
1165
1242
|
end
|
1166
1243
|
|
1244
|
+
|
1167
1245
|
#
|
1168
1246
|
#
|
1169
|
-
# @param [
|
1170
|
-
# @param [
|
1247
|
+
# @param [String] database_id Database ID.
|
1248
|
+
# @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).
|
1171
1249
|
#
|
1172
1250
|
# @return [IndexList]
|
1173
|
-
def list_indexes(collection_id:)
|
1174
|
-
if @database_id.nil?
|
1175
|
-
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1176
|
-
end
|
1177
|
-
|
1178
|
-
if collection_id.nil?
|
1179
|
-
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1180
|
-
end
|
1251
|
+
def list_indexes(database_id:, collection_id:)
|
1181
1252
|
|
1182
1253
|
path = '/databases/{databaseId}/collections/{collectionId}/indexes'
|
1183
|
-
.gsub('{databaseId}', @database_id)
|
1184
|
-
.gsub('{collectionId}', collection_id)
|
1185
1254
|
|
1186
1255
|
params = {
|
1187
1256
|
}
|
1188
|
-
|
1257
|
+
|
1189
1258
|
headers = {
|
1190
1259
|
"content-type": 'application/json',
|
1191
1260
|
}
|
1261
|
+
if database_id.nil?
|
1262
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1263
|
+
end
|
1264
|
+
|
1265
|
+
if collection_id.nil?
|
1266
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1267
|
+
end
|
1268
|
+
|
1269
|
+
.gsub('{databaseId}', database_id)
|
1270
|
+
.gsub('{collectionId}', collection_id)
|
1192
1271
|
|
1193
1272
|
@client.call(
|
1194
1273
|
method: 'GET',
|
@@ -1199,18 +1278,32 @@ module Appwrite
|
|
1199
1278
|
)
|
1200
1279
|
end
|
1201
1280
|
|
1281
|
+
|
1202
1282
|
#
|
1203
1283
|
#
|
1204
|
-
# @param [
|
1205
|
-
# @param [
|
1206
|
-
# @param [
|
1207
|
-
# @param [
|
1208
|
-
# @param [
|
1209
|
-
# @param [
|
1284
|
+
# @param [String] database_id Database ID.
|
1285
|
+
# @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).
|
1286
|
+
# @param [String] key Index Key.
|
1287
|
+
# @param [String] type Index type.
|
1288
|
+
# @param [Array] attributes Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.
|
1289
|
+
# @param [Array] orders Array of index orders. Maximum of 100 orders are allowed.
|
1210
1290
|
#
|
1211
1291
|
# @return [Index]
|
1212
|
-
def create_index(collection_id:, key:, type:, attributes:, orders: nil)
|
1213
|
-
|
1292
|
+
def create_index(database_id:, collection_id:, key:, type:, attributes:, orders: nil)
|
1293
|
+
|
1294
|
+
path = '/databases/{databaseId}/collections/{collectionId}/indexes'
|
1295
|
+
|
1296
|
+
params = {
|
1297
|
+
key: key,
|
1298
|
+
type: type,
|
1299
|
+
attributes: attributes,
|
1300
|
+
orders: orders,
|
1301
|
+
}
|
1302
|
+
|
1303
|
+
headers = {
|
1304
|
+
"content-type": 'application/json',
|
1305
|
+
}
|
1306
|
+
if database_id.nil?
|
1214
1307
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1215
1308
|
end
|
1216
1309
|
|
@@ -1230,21 +1323,9 @@ module Appwrite
|
|
1230
1323
|
raise Appwrite::Exception.new('Missing required parameter: "attributes"')
|
1231
1324
|
end
|
1232
1325
|
|
1233
|
-
|
1234
|
-
.gsub('{databaseId}', @database_id)
|
1326
|
+
.gsub('{databaseId}', database_id)
|
1235
1327
|
.gsub('{collectionId}', collection_id)
|
1236
1328
|
|
1237
|
-
params = {
|
1238
|
-
key: key,
|
1239
|
-
type: type,
|
1240
|
-
attributes: attributes,
|
1241
|
-
orders: orders,
|
1242
|
-
}
|
1243
|
-
|
1244
|
-
headers = {
|
1245
|
-
"content-type": 'application/json',
|
1246
|
-
}
|
1247
|
-
|
1248
1329
|
@client.call(
|
1249
1330
|
method: 'POST',
|
1250
1331
|
path: path,
|
@@ -1254,15 +1335,25 @@ module Appwrite
|
|
1254
1335
|
)
|
1255
1336
|
end
|
1256
1337
|
|
1338
|
+
|
1257
1339
|
#
|
1258
1340
|
#
|
1259
|
-
# @param [
|
1260
|
-
# @param [
|
1261
|
-
# @param [
|
1341
|
+
# @param [String] database_id Database ID.
|
1342
|
+
# @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).
|
1343
|
+
# @param [String] key Index Key.
|
1262
1344
|
#
|
1263
1345
|
# @return [Index]
|
1264
|
-
def get_index(collection_id:, key:)
|
1265
|
-
|
1346
|
+
def get_index(database_id:, collection_id:, key:)
|
1347
|
+
|
1348
|
+
path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'
|
1349
|
+
|
1350
|
+
params = {
|
1351
|
+
}
|
1352
|
+
|
1353
|
+
headers = {
|
1354
|
+
"content-type": 'application/json',
|
1355
|
+
}
|
1356
|
+
if database_id.nil?
|
1266
1357
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1267
1358
|
end
|
1268
1359
|
|
@@ -1274,18 +1365,10 @@ module Appwrite
|
|
1274
1365
|
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1275
1366
|
end
|
1276
1367
|
|
1277
|
-
|
1278
|
-
.gsub('{databaseId}', @database_id)
|
1368
|
+
.gsub('{databaseId}', database_id)
|
1279
1369
|
.gsub('{collectionId}', collection_id)
|
1280
1370
|
.gsub('{key}', key)
|
1281
1371
|
|
1282
|
-
params = {
|
1283
|
-
}
|
1284
|
-
|
1285
|
-
headers = {
|
1286
|
-
"content-type": 'application/json',
|
1287
|
-
}
|
1288
|
-
|
1289
1372
|
@client.call(
|
1290
1373
|
method: 'GET',
|
1291
1374
|
path: path,
|
@@ -1295,15 +1378,25 @@ module Appwrite
|
|
1295
1378
|
)
|
1296
1379
|
end
|
1297
1380
|
|
1381
|
+
|
1298
1382
|
#
|
1299
1383
|
#
|
1300
|
-
# @param [
|
1301
|
-
# @param [
|
1302
|
-
# @param [
|
1384
|
+
# @param [String] database_id Database ID.
|
1385
|
+
# @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).
|
1386
|
+
# @param [String] key Index Key.
|
1303
1387
|
#
|
1304
1388
|
# @return []
|
1305
|
-
def delete_index(collection_id:, key:)
|
1306
|
-
|
1389
|
+
def delete_index(database_id:, collection_id:, key:)
|
1390
|
+
|
1391
|
+
path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'
|
1392
|
+
|
1393
|
+
params = {
|
1394
|
+
}
|
1395
|
+
|
1396
|
+
headers = {
|
1397
|
+
"content-type": 'application/json',
|
1398
|
+
}
|
1399
|
+
if database_id.nil?
|
1307
1400
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1308
1401
|
end
|
1309
1402
|
|
@@ -1315,18 +1408,10 @@ module Appwrite
|
|
1315
1408
|
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1316
1409
|
end
|
1317
1410
|
|
1318
|
-
|
1319
|
-
.gsub('{databaseId}', @database_id)
|
1411
|
+
.gsub('{databaseId}', database_id)
|
1320
1412
|
.gsub('{collectionId}', collection_id)
|
1321
1413
|
.gsub('{key}', key)
|
1322
1414
|
|
1323
|
-
params = {
|
1324
|
-
}
|
1325
|
-
|
1326
|
-
headers = {
|
1327
|
-
"content-type": 'application/json',
|
1328
|
-
}
|
1329
|
-
|
1330
1415
|
@client.call(
|
1331
1416
|
method: 'DELETE',
|
1332
1417
|
path: path,
|
@@ -1335,5 +1420,6 @@ module Appwrite
|
|
1335
1420
|
)
|
1336
1421
|
end
|
1337
1422
|
|
1423
|
+
|
1338
1424
|
end
|
1339
1425
|
end
|