appwrite 9.0.0 → 9.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9f3fda23d3f2943c0e41b560c3195f13c0130105d18a790c4e1110b02daea6f
4
- data.tar.gz: 31c3ce255470e07986dadc415966b73859f4fff1e1de4d93a90bdf608d7e0e3c
3
+ metadata.gz: 18592d674132d41fd96084e13cd69f58286ed43bfde4be1bc74401e72b3a3c94
4
+ data.tar.gz: 370cb83347b54e2fb9008e7bd64a2d63e4318943e2688c54898da05416b0be96
5
5
  SHA512:
6
- metadata.gz: ebf9c4fae105faa4bc971bcdcf05197b8b4f1b8481cb138ae10c9632575136f662c992bc907aca7bb2cf84ea725a832fc41e3cdc750385c07441a642a4722816
7
- data.tar.gz: 5a69deb9c936e526e7e88b3466246ae246132f8710a7b95b2c1d43d208ddbacff301b8b93f3b1031e755b13cca2535893235ee5097c02122e3c58a49f4c59217
6
+ metadata.gz: ad64a8dd43d47dd5a161e19ac7dd46c318f0d68102e81e9afe5e8602969b22b5cf18162eb9affc8f6bc18488f653aade7e546b0a901c3e2420d4279dbb70a072
7
+ data.tar.gz: dad348a020f49a082a50096966c447dfb618689fa4ac87d014d275d9415f71fb0047d24ec765f6f7b7672adaa6d268d050326857bf8700812023b446412a412e
@@ -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'=> '9.0.0',
18
+ 'x-sdk-version'=> '9.0.1',
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 = [size, (chunks_uploaded * @chunk_size)].min
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
- params = {
17
+ api_params = {
18
18
  }
19
19
 
20
- headers = {
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: headers,
28
- params: 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
- params = {
58
+ api_params = {
59
59
  email: email,
60
60
  password: password,
61
61
  }
62
62
 
63
- headers = {
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: headers,
71
- params: 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
- params = {
85
+ api_params = {
86
86
  queries: queries,
87
87
  }
88
88
 
89
- headers = {
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: headers,
97
- params: 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
- params = {
116
+ api_params = {
117
117
  }
118
118
 
119
- headers = {
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: headers,
127
- params: 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
- params = {
141
+ api_params = {
142
142
  queries: queries,
143
143
  }
144
144
 
145
- headers = {
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: headers,
153
- params: 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
- params = {
171
+ api_params = {
172
172
  name: name,
173
173
  }
174
174
 
175
- headers = {
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: headers,
183
- params: 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
- params = {
204
+ api_params = {
205
205
  password: password,
206
206
  oldPassword: old_password,
207
207
  }
208
208
 
209
- headers = {
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: headers,
217
- params: 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
- params = {
244
+ api_params = {
245
245
  phone: phone,
246
246
  password: password,
247
247
  }
248
248
 
249
- headers = {
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: headers,
257
- params: 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
- params = {
270
+ api_params = {
271
271
  }
272
272
 
273
- headers = {
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: headers,
281
- params: 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
- params = {
301
+ api_params = {
302
302
  prefs: prefs,
303
303
  }
304
304
 
305
- headers = {
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: headers,
313
- params: 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
- params = {
343
+ api_params = {
344
344
  email: email,
345
345
  url: url,
346
346
  }
347
347
 
348
- headers = {
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: headers,
356
- params: 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
- params = {
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
- headers = {
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: headers,
412
- params: 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
- params = {
426
+ api_params = {
427
427
  }
428
428
 
429
- headers = {
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: headers,
437
- params: 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
- params = {
451
+ api_params = {
452
452
  }
453
453
 
454
- headers = {
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: headers,
462
- params: 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
- params = {
481
+ api_params = {
482
482
  }
483
483
 
484
- headers = {
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: headers,
492
- params: 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
- params = {
513
+ api_params = {
514
514
  }
515
515
 
516
- headers = {
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: headers,
524
- params: 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
- params = {
546
+ api_params = {
547
547
  }
548
548
 
549
- headers = {
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: headers,
557
- params: 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
- params = {
571
+ api_params = {
572
572
  }
573
573
 
574
- headers = {
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: headers,
582
- params: 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
- params = {
614
+ api_params = {
615
615
  url: url,
616
616
  }
617
617
 
618
- headers = {
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: headers,
626
- params: 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
- params = {
652
+ api_params = {
653
653
  userId: user_id,
654
654
  secret: secret,
655
655
  }
656
656
 
657
- headers = {
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: headers,
665
- params: 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
- params = {
683
+ api_params = {
684
684
  }
685
685
 
686
- headers = {
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: headers,
694
- params: 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
- params = {
720
+ api_params = {
721
721
  userId: user_id,
722
722
  secret: secret,
723
723
  }
724
724
 
725
- headers = {
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: headers,
733
- params: params,
732
+ headers: api_headers,
733
+ params: api_params,
734
734
  response_type: Models::Token
735
735
  )
736
736
  end