appwrite 9.0.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/appwrite/client.rb +3 -3
- data/lib/appwrite/role.rb +56 -0
- data/lib/appwrite/services/account.rb +88 -88
- data/lib/appwrite/services/avatars.rb +28 -28
- data/lib/appwrite/services/databases.rb +168 -168
- data/lib/appwrite/services/functions.rb +85 -89
- data/lib/appwrite/services/graphql.rb +8 -8
- data/lib/appwrite/services/health.rb +48 -48
- data/lib/appwrite/services/locale.rb +32 -32
- data/lib/appwrite/services/storage.rb +52 -52
- data/lib/appwrite/services/teams.rb +54 -58
- data/lib/appwrite/services/users.rb +113 -113
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d5c5b64f3c5542a42ce36575c69c578044089ee688d3fb399c5528bd7e606d6
|
4
|
+
data.tar.gz: 932d79d838f53ea8502729f4088bc4a04e828942344b54c693176bac47e983e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 466b53426f967b9cc995a3681a3cecc966eb46b030496ea11583c9f64ee2872ffc408e8354c41dc84b6623d23b9da0df1de79ddf8ef80d9116f796ed5b31ea35
|
7
|
+
data.tar.gz: 8eaf1129799d71e314f29e40136d323aa4726d38db39d5edd3054e6f1003377e339e80fb83c7091fc23ccd2ccc04b9d7d8cad9ee5f40dce17ce21df9fe30e9a9
|
data/lib/appwrite/client.rb
CHANGED
@@ -15,7 +15,7 @@ module Appwrite
|
|
15
15
|
'x-sdk-name'=> 'Ruby',
|
16
16
|
'x-sdk-platform'=> 'server',
|
17
17
|
'x-sdk-language'=> 'ruby',
|
18
|
-
'x-sdk-version'=> '
|
18
|
+
'x-sdk-version'=> '10.0.0',
|
19
19
|
'X-Appwrite-Response-Format' => '1.4.0'
|
20
20
|
}
|
21
21
|
@endpoint = 'https://HOSTNAME/v1'
|
@@ -170,7 +170,7 @@ module Appwrite
|
|
170
170
|
params: {}
|
171
171
|
)
|
172
172
|
chunks_uploaded = current['chunksUploaded'].to_i
|
173
|
-
offset =
|
173
|
+
offset = chunks_uploaded * @chunk_size
|
174
174
|
end
|
175
175
|
|
176
176
|
while offset < size
|
@@ -187,7 +187,7 @@ module Appwrite
|
|
187
187
|
mime_type: input_file.mime_type
|
188
188
|
)
|
189
189
|
|
190
|
-
headers['content-range'] = "bytes #{offset}-#{[offset + @chunk_size - 1, size].min}/#{size}"
|
190
|
+
headers['content-range'] = "bytes #{offset}-#{[offset + @chunk_size - 1, size - 1].min}/#{size}"
|
191
191
|
|
192
192
|
result = call(
|
193
193
|
method: 'POST',
|
data/lib/appwrite/role.rb
CHANGED
@@ -1,9 +1,26 @@
|
|
1
1
|
module Appwrite
|
2
|
+
|
3
|
+
# Helper class to generate role strings for `Permission`.
|
2
4
|
class Role
|
5
|
+
|
6
|
+
# Grants access to anyone.
|
7
|
+
#
|
8
|
+
# This includes authenticated and unauthenticated users.
|
9
|
+
#
|
10
|
+
# @return [String]
|
3
11
|
def self.any
|
4
12
|
'any'
|
5
13
|
end
|
6
14
|
|
15
|
+
# Grants access to a specific user by user ID.
|
16
|
+
#
|
17
|
+
# You can optionally pass verified or unverified for
|
18
|
+
# `status` to target specific types of users.
|
19
|
+
#
|
20
|
+
# @param [String] id
|
21
|
+
# @param [String] status
|
22
|
+
#
|
23
|
+
# @return [String]
|
7
24
|
def self.user(id, status = "")
|
8
25
|
if(status.empty?)
|
9
26
|
"user:#{id}"
|
@@ -12,6 +29,14 @@ module Appwrite
|
|
12
29
|
end
|
13
30
|
end
|
14
31
|
|
32
|
+
# Grants access to any authenticated or anonymous user.
|
33
|
+
#
|
34
|
+
# You can optionally pass verified or unverified for
|
35
|
+
# `status` to target specific types of users.
|
36
|
+
#
|
37
|
+
# @param [String] status
|
38
|
+
#
|
39
|
+
# @return [String]
|
15
40
|
def self.users(status = "")
|
16
41
|
if(status.empty?)
|
17
42
|
'users'
|
@@ -20,10 +45,24 @@ module Appwrite
|
|
20
45
|
end
|
21
46
|
end
|
22
47
|
|
48
|
+
# Grants access to any guest user without a session.
|
49
|
+
#
|
50
|
+
# Authenticated users don't have access to this role.
|
51
|
+
#
|
52
|
+
# @return [String]
|
23
53
|
def self.guests
|
24
54
|
'guests'
|
25
55
|
end
|
26
56
|
|
57
|
+
# Grants access to a team by team ID.
|
58
|
+
#
|
59
|
+
# You can optionally pass a role for `role` to target
|
60
|
+
# team members with the specified role.
|
61
|
+
#
|
62
|
+
# @param [String] id
|
63
|
+
# @param [String] role
|
64
|
+
#
|
65
|
+
# @return [String]
|
27
66
|
def self.team(id, role = "")
|
28
67
|
if(role.empty?)
|
29
68
|
"team:#{id}"
|
@@ -32,8 +71,25 @@ module Appwrite
|
|
32
71
|
end
|
33
72
|
end
|
34
73
|
|
74
|
+
# Grants access to a specific member of a team.
|
75
|
+
#
|
76
|
+
# When the member is removed from the team, they will
|
77
|
+
# no longer have access.
|
78
|
+
#
|
79
|
+
# @param [String] id
|
80
|
+
#
|
81
|
+
# @return [String]
|
35
82
|
def self.member(id)
|
36
83
|
"member:#{id}"
|
37
84
|
end
|
85
|
+
|
86
|
+
# Grants access to a user with the specified label.
|
87
|
+
#
|
88
|
+
# @param [String] name
|
89
|
+
#
|
90
|
+
# @return [String]
|
91
|
+
def self.label(name)
|
92
|
+
"label:#{name}"
|
93
|
+
end
|
38
94
|
end
|
39
95
|
end
|
@@ -14,18 +14,18 @@ module Appwrite
|
|
14
14
|
def get()
|
15
15
|
api_path = '/account'
|
16
16
|
|
17
|
-
|
17
|
+
api_params = {
|
18
18
|
}
|
19
19
|
|
20
|
-
|
20
|
+
api_headers = {
|
21
21
|
"content-type": 'application/json',
|
22
22
|
}
|
23
23
|
|
24
24
|
@client.call(
|
25
25
|
method: 'GET',
|
26
26
|
path: api_path,
|
27
|
-
headers:
|
28
|
-
params:
|
27
|
+
headers: api_headers,
|
28
|
+
params: api_params,
|
29
29
|
response_type: Models::User
|
30
30
|
)
|
31
31
|
end
|
@@ -55,20 +55,20 @@ module Appwrite
|
|
55
55
|
raise Appwrite::Exception.new('Missing required parameter: "password"')
|
56
56
|
end
|
57
57
|
|
58
|
-
|
58
|
+
api_params = {
|
59
59
|
email: email,
|
60
60
|
password: password,
|
61
61
|
}
|
62
62
|
|
63
|
-
|
63
|
+
api_headers = {
|
64
64
|
"content-type": 'application/json',
|
65
65
|
}
|
66
66
|
|
67
67
|
@client.call(
|
68
68
|
method: 'PATCH',
|
69
69
|
path: api_path,
|
70
|
-
headers:
|
71
|
-
params:
|
70
|
+
headers: api_headers,
|
71
|
+
params: api_params,
|
72
72
|
response_type: Models::User
|
73
73
|
)
|
74
74
|
end
|
@@ -82,19 +82,19 @@ module Appwrite
|
|
82
82
|
def list_identities(queries: nil)
|
83
83
|
api_path = '/account/identities'
|
84
84
|
|
85
|
-
|
85
|
+
api_params = {
|
86
86
|
queries: queries,
|
87
87
|
}
|
88
88
|
|
89
|
-
|
89
|
+
api_headers = {
|
90
90
|
"content-type": 'application/json',
|
91
91
|
}
|
92
92
|
|
93
93
|
@client.call(
|
94
94
|
method: 'GET',
|
95
95
|
path: api_path,
|
96
|
-
headers:
|
97
|
-
params:
|
96
|
+
headers: api_headers,
|
97
|
+
params: api_params,
|
98
98
|
response_type: Models::IdentityList
|
99
99
|
)
|
100
100
|
end
|
@@ -113,18 +113,18 @@ module Appwrite
|
|
113
113
|
raise Appwrite::Exception.new('Missing required parameter: "identityId"')
|
114
114
|
end
|
115
115
|
|
116
|
-
|
116
|
+
api_params = {
|
117
117
|
}
|
118
118
|
|
119
|
-
|
119
|
+
api_headers = {
|
120
120
|
"content-type": 'application/json',
|
121
121
|
}
|
122
122
|
|
123
123
|
@client.call(
|
124
124
|
method: 'DELETE',
|
125
125
|
path: api_path,
|
126
|
-
headers:
|
127
|
-
params:
|
126
|
+
headers: api_headers,
|
127
|
+
params: api_params,
|
128
128
|
)
|
129
129
|
end
|
130
130
|
|
@@ -138,19 +138,19 @@ module Appwrite
|
|
138
138
|
def list_logs(queries: nil)
|
139
139
|
api_path = '/account/logs'
|
140
140
|
|
141
|
-
|
141
|
+
api_params = {
|
142
142
|
queries: queries,
|
143
143
|
}
|
144
144
|
|
145
|
-
|
145
|
+
api_headers = {
|
146
146
|
"content-type": 'application/json',
|
147
147
|
}
|
148
148
|
|
149
149
|
@client.call(
|
150
150
|
method: 'GET',
|
151
151
|
path: api_path,
|
152
|
-
headers:
|
153
|
-
params:
|
152
|
+
headers: api_headers,
|
153
|
+
params: api_params,
|
154
154
|
response_type: Models::LogList
|
155
155
|
)
|
156
156
|
end
|
@@ -168,19 +168,19 @@ module Appwrite
|
|
168
168
|
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
169
169
|
end
|
170
170
|
|
171
|
-
|
171
|
+
api_params = {
|
172
172
|
name: name,
|
173
173
|
}
|
174
174
|
|
175
|
-
|
175
|
+
api_headers = {
|
176
176
|
"content-type": 'application/json',
|
177
177
|
}
|
178
178
|
|
179
179
|
@client.call(
|
180
180
|
method: 'PATCH',
|
181
181
|
path: api_path,
|
182
|
-
headers:
|
183
|
-
params:
|
182
|
+
headers: api_headers,
|
183
|
+
params: api_params,
|
184
184
|
response_type: Models::User
|
185
185
|
)
|
186
186
|
end
|
@@ -201,20 +201,20 @@ module Appwrite
|
|
201
201
|
raise Appwrite::Exception.new('Missing required parameter: "password"')
|
202
202
|
end
|
203
203
|
|
204
|
-
|
204
|
+
api_params = {
|
205
205
|
password: password,
|
206
206
|
oldPassword: old_password,
|
207
207
|
}
|
208
208
|
|
209
|
-
|
209
|
+
api_headers = {
|
210
210
|
"content-type": 'application/json',
|
211
211
|
}
|
212
212
|
|
213
213
|
@client.call(
|
214
214
|
method: 'PATCH',
|
215
215
|
path: api_path,
|
216
|
-
headers:
|
217
|
-
params:
|
216
|
+
headers: api_headers,
|
217
|
+
params: api_params,
|
218
218
|
response_type: Models::User
|
219
219
|
)
|
220
220
|
end
|
@@ -241,20 +241,20 @@ module Appwrite
|
|
241
241
|
raise Appwrite::Exception.new('Missing required parameter: "password"')
|
242
242
|
end
|
243
243
|
|
244
|
-
|
244
|
+
api_params = {
|
245
245
|
phone: phone,
|
246
246
|
password: password,
|
247
247
|
}
|
248
248
|
|
249
|
-
|
249
|
+
api_headers = {
|
250
250
|
"content-type": 'application/json',
|
251
251
|
}
|
252
252
|
|
253
253
|
@client.call(
|
254
254
|
method: 'PATCH',
|
255
255
|
path: api_path,
|
256
|
-
headers:
|
257
|
-
params:
|
256
|
+
headers: api_headers,
|
257
|
+
params: api_params,
|
258
258
|
response_type: Models::User
|
259
259
|
)
|
260
260
|
end
|
@@ -267,18 +267,18 @@ module Appwrite
|
|
267
267
|
def get_prefs()
|
268
268
|
api_path = '/account/prefs'
|
269
269
|
|
270
|
-
|
270
|
+
api_params = {
|
271
271
|
}
|
272
272
|
|
273
|
-
|
273
|
+
api_headers = {
|
274
274
|
"content-type": 'application/json',
|
275
275
|
}
|
276
276
|
|
277
277
|
@client.call(
|
278
278
|
method: 'GET',
|
279
279
|
path: api_path,
|
280
|
-
headers:
|
281
|
-
params:
|
280
|
+
headers: api_headers,
|
281
|
+
params: api_params,
|
282
282
|
response_type: Models::Preferences
|
283
283
|
)
|
284
284
|
end
|
@@ -298,19 +298,19 @@ module Appwrite
|
|
298
298
|
raise Appwrite::Exception.new('Missing required parameter: "prefs"')
|
299
299
|
end
|
300
300
|
|
301
|
-
|
301
|
+
api_params = {
|
302
302
|
prefs: prefs,
|
303
303
|
}
|
304
304
|
|
305
|
-
|
305
|
+
api_headers = {
|
306
306
|
"content-type": 'application/json',
|
307
307
|
}
|
308
308
|
|
309
309
|
@client.call(
|
310
310
|
method: 'PATCH',
|
311
311
|
path: api_path,
|
312
|
-
headers:
|
313
|
-
params:
|
312
|
+
headers: api_headers,
|
313
|
+
params: api_params,
|
314
314
|
response_type: Models::User
|
315
315
|
)
|
316
316
|
end
|
@@ -340,20 +340,20 @@ module Appwrite
|
|
340
340
|
raise Appwrite::Exception.new('Missing required parameter: "url"')
|
341
341
|
end
|
342
342
|
|
343
|
-
|
343
|
+
api_params = {
|
344
344
|
email: email,
|
345
345
|
url: url,
|
346
346
|
}
|
347
347
|
|
348
|
-
|
348
|
+
api_headers = {
|
349
349
|
"content-type": 'application/json',
|
350
350
|
}
|
351
351
|
|
352
352
|
@client.call(
|
353
353
|
method: 'POST',
|
354
354
|
path: api_path,
|
355
|
-
headers:
|
356
|
-
params:
|
355
|
+
headers: api_headers,
|
356
|
+
params: api_params,
|
357
357
|
response_type: Models::Token
|
358
358
|
)
|
359
359
|
end
|
@@ -394,22 +394,22 @@ module Appwrite
|
|
394
394
|
raise Appwrite::Exception.new('Missing required parameter: "passwordAgain"')
|
395
395
|
end
|
396
396
|
|
397
|
-
|
397
|
+
api_params = {
|
398
398
|
userId: user_id,
|
399
399
|
secret: secret,
|
400
400
|
password: password,
|
401
401
|
passwordAgain: password_again,
|
402
402
|
}
|
403
403
|
|
404
|
-
|
404
|
+
api_headers = {
|
405
405
|
"content-type": 'application/json',
|
406
406
|
}
|
407
407
|
|
408
408
|
@client.call(
|
409
409
|
method: 'PUT',
|
410
410
|
path: api_path,
|
411
|
-
headers:
|
412
|
-
params:
|
411
|
+
headers: api_headers,
|
412
|
+
params: api_params,
|
413
413
|
response_type: Models::Token
|
414
414
|
)
|
415
415
|
end
|
@@ -423,18 +423,18 @@ module Appwrite
|
|
423
423
|
def list_sessions()
|
424
424
|
api_path = '/account/sessions'
|
425
425
|
|
426
|
-
|
426
|
+
api_params = {
|
427
427
|
}
|
428
428
|
|
429
|
-
|
429
|
+
api_headers = {
|
430
430
|
"content-type": 'application/json',
|
431
431
|
}
|
432
432
|
|
433
433
|
@client.call(
|
434
434
|
method: 'GET',
|
435
435
|
path: api_path,
|
436
|
-
headers:
|
437
|
-
params:
|
436
|
+
headers: api_headers,
|
437
|
+
params: api_params,
|
438
438
|
response_type: Models::SessionList
|
439
439
|
)
|
440
440
|
end
|
@@ -448,18 +448,18 @@ module Appwrite
|
|
448
448
|
def delete_sessions()
|
449
449
|
api_path = '/account/sessions'
|
450
450
|
|
451
|
-
|
451
|
+
api_params = {
|
452
452
|
}
|
453
453
|
|
454
|
-
|
454
|
+
api_headers = {
|
455
455
|
"content-type": 'application/json',
|
456
456
|
}
|
457
457
|
|
458
458
|
@client.call(
|
459
459
|
method: 'DELETE',
|
460
460
|
path: api_path,
|
461
|
-
headers:
|
462
|
-
params:
|
461
|
+
headers: api_headers,
|
462
|
+
params: api_params,
|
463
463
|
)
|
464
464
|
end
|
465
465
|
|
@@ -478,18 +478,18 @@ module Appwrite
|
|
478
478
|
raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
|
479
479
|
end
|
480
480
|
|
481
|
-
|
481
|
+
api_params = {
|
482
482
|
}
|
483
483
|
|
484
|
-
|
484
|
+
api_headers = {
|
485
485
|
"content-type": 'application/json',
|
486
486
|
}
|
487
487
|
|
488
488
|
@client.call(
|
489
489
|
method: 'GET',
|
490
490
|
path: api_path,
|
491
|
-
headers:
|
492
|
-
params:
|
491
|
+
headers: api_headers,
|
492
|
+
params: api_params,
|
493
493
|
response_type: Models::Session
|
494
494
|
)
|
495
495
|
end
|
@@ -510,18 +510,18 @@ module Appwrite
|
|
510
510
|
raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
|
511
511
|
end
|
512
512
|
|
513
|
-
|
513
|
+
api_params = {
|
514
514
|
}
|
515
515
|
|
516
|
-
|
516
|
+
api_headers = {
|
517
517
|
"content-type": 'application/json',
|
518
518
|
}
|
519
519
|
|
520
520
|
@client.call(
|
521
521
|
method: 'PATCH',
|
522
522
|
path: api_path,
|
523
|
-
headers:
|
524
|
-
params:
|
523
|
+
headers: api_headers,
|
524
|
+
params: api_params,
|
525
525
|
response_type: Models::Session
|
526
526
|
)
|
527
527
|
end
|
@@ -543,18 +543,18 @@ module Appwrite
|
|
543
543
|
raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
|
544
544
|
end
|
545
545
|
|
546
|
-
|
546
|
+
api_params = {
|
547
547
|
}
|
548
548
|
|
549
|
-
|
549
|
+
api_headers = {
|
550
550
|
"content-type": 'application/json',
|
551
551
|
}
|
552
552
|
|
553
553
|
@client.call(
|
554
554
|
method: 'DELETE',
|
555
555
|
path: api_path,
|
556
|
-
headers:
|
557
|
-
params:
|
556
|
+
headers: api_headers,
|
557
|
+
params: api_params,
|
558
558
|
)
|
559
559
|
end
|
560
560
|
|
@@ -568,18 +568,18 @@ module Appwrite
|
|
568
568
|
def update_status()
|
569
569
|
api_path = '/account/status'
|
570
570
|
|
571
|
-
|
571
|
+
api_params = {
|
572
572
|
}
|
573
573
|
|
574
|
-
|
574
|
+
api_headers = {
|
575
575
|
"content-type": 'application/json',
|
576
576
|
}
|
577
577
|
|
578
578
|
@client.call(
|
579
579
|
method: 'PATCH',
|
580
580
|
path: api_path,
|
581
|
-
headers:
|
582
|
-
params:
|
581
|
+
headers: api_headers,
|
582
|
+
params: api_params,
|
583
583
|
response_type: Models::User
|
584
584
|
)
|
585
585
|
end
|
@@ -611,19 +611,19 @@ module Appwrite
|
|
611
611
|
raise Appwrite::Exception.new('Missing required parameter: "url"')
|
612
612
|
end
|
613
613
|
|
614
|
-
|
614
|
+
api_params = {
|
615
615
|
url: url,
|
616
616
|
}
|
617
617
|
|
618
|
-
|
618
|
+
api_headers = {
|
619
619
|
"content-type": 'application/json',
|
620
620
|
}
|
621
621
|
|
622
622
|
@client.call(
|
623
623
|
method: 'POST',
|
624
624
|
path: api_path,
|
625
|
-
headers:
|
626
|
-
params:
|
625
|
+
headers: api_headers,
|
626
|
+
params: api_params,
|
627
627
|
response_type: Models::Token
|
628
628
|
)
|
629
629
|
end
|
@@ -649,20 +649,20 @@ module Appwrite
|
|
649
649
|
raise Appwrite::Exception.new('Missing required parameter: "secret"')
|
650
650
|
end
|
651
651
|
|
652
|
-
|
652
|
+
api_params = {
|
653
653
|
userId: user_id,
|
654
654
|
secret: secret,
|
655
655
|
}
|
656
656
|
|
657
|
-
|
657
|
+
api_headers = {
|
658
658
|
"content-type": 'application/json',
|
659
659
|
}
|
660
660
|
|
661
661
|
@client.call(
|
662
662
|
method: 'PUT',
|
663
663
|
path: api_path,
|
664
|
-
headers:
|
665
|
-
params:
|
664
|
+
headers: api_headers,
|
665
|
+
params: api_params,
|
666
666
|
response_type: Models::Token
|
667
667
|
)
|
668
668
|
end
|
@@ -680,18 +680,18 @@ module Appwrite
|
|
680
680
|
def create_phone_verification()
|
681
681
|
api_path = '/account/verification/phone'
|
682
682
|
|
683
|
-
|
683
|
+
api_params = {
|
684
684
|
}
|
685
685
|
|
686
|
-
|
686
|
+
api_headers = {
|
687
687
|
"content-type": 'application/json',
|
688
688
|
}
|
689
689
|
|
690
690
|
@client.call(
|
691
691
|
method: 'POST',
|
692
692
|
path: api_path,
|
693
|
-
headers:
|
694
|
-
params:
|
693
|
+
headers: api_headers,
|
694
|
+
params: api_params,
|
695
695
|
response_type: Models::Token
|
696
696
|
)
|
697
697
|
end
|
@@ -717,20 +717,20 @@ module Appwrite
|
|
717
717
|
raise Appwrite::Exception.new('Missing required parameter: "secret"')
|
718
718
|
end
|
719
719
|
|
720
|
-
|
720
|
+
api_params = {
|
721
721
|
userId: user_id,
|
722
722
|
secret: secret,
|
723
723
|
}
|
724
724
|
|
725
|
-
|
725
|
+
api_headers = {
|
726
726
|
"content-type": 'application/json',
|
727
727
|
}
|
728
728
|
|
729
729
|
@client.call(
|
730
730
|
method: 'PUT',
|
731
731
|
path: api_path,
|
732
|
-
headers:
|
733
|
-
params:
|
732
|
+
headers: api_headers,
|
733
|
+
params: api_params,
|
734
734
|
response_type: Models::Token
|
735
735
|
)
|
736
736
|
end
|