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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +5 -2
  3. data/lib/appwrite/id.rb +11 -0
  4. data/lib/appwrite/models/account.rb +82 -0
  5. data/lib/appwrite/models/algo_argon2.rb +37 -0
  6. data/lib/appwrite/models/algo_bcrypt.rb +22 -0
  7. data/lib/appwrite/models/algo_md5.rb +22 -0
  8. data/lib/appwrite/models/algo_phpass.rb +22 -0
  9. data/lib/appwrite/models/algo_scrypt.rb +42 -0
  10. data/lib/appwrite/models/algo_scrypt_modified.rb +37 -0
  11. data/lib/appwrite/models/algo_sha.rb +22 -0
  12. data/lib/appwrite/models/attribute_datetime.rb +57 -0
  13. data/lib/appwrite/models/bucket.rb +15 -15
  14. data/lib/appwrite/models/collection.rb +10 -15
  15. data/lib/appwrite/models/database.rb +13 -3
  16. data/lib/appwrite/models/document.rb +5 -10
  17. data/lib/appwrite/models/execution.rb +10 -5
  18. data/lib/appwrite/models/file.rb +5 -10
  19. data/lib/appwrite/models/function.rb +2 -2
  20. data/lib/appwrite/models/index.rb +1 -1
  21. data/lib/appwrite/models/user.rb +15 -0
  22. data/lib/appwrite/models/variable.rb +52 -0
  23. data/lib/appwrite/models/variable_list.rb +32 -0
  24. data/lib/appwrite/permission.rb +21 -0
  25. data/lib/appwrite/query.rb +43 -14
  26. data/lib/appwrite/role.rb +31 -0
  27. data/lib/appwrite/services/account.rb +184 -143
  28. data/lib/appwrite/services/avatars.rb +72 -56
  29. data/lib/appwrite/services/databases.rb +638 -552
  30. data/lib/appwrite/services/functions.rb +380 -176
  31. data/lib/appwrite/services/health.rb +33 -10
  32. data/lib/appwrite/services/locale.rb +24 -7
  33. data/lib/appwrite/services/storage.rb +194 -193
  34. data/lib/appwrite/services/teams.rb +137 -128
  35. data/lib/appwrite/services/users.rb +572 -163
  36. data/lib/appwrite.rb +15 -0
  37. metadata +18 -4
@@ -3,6 +3,9 @@
3
3
  module Appwrite
4
4
  class Avatars < Service
5
5
 
6
+ def initialize(client)
7
+ @client = client
8
+ end
6
9
 
7
10
  # You can use this endpoint to show different browser icons to your users.
8
11
  # The code argument receives the browser code as it appears in your user [GET
@@ -14,29 +17,30 @@ module Appwrite
14
17
  # image at source quality. If dimensions are not specified, the default size
15
18
  # of image returned is 100x100px.
16
19
  #
17
- # @param [string] code Browser Code.
18
- # @param [number] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
19
- # @param [number] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
20
- # @param [number] quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
20
+ # @param [String] code Browser Code.
21
+ # @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
22
+ # @param [Integer] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
23
+ # @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
21
24
  #
22
25
  # @return []
23
26
  def get_browser(code:, width: nil, height: nil, quality: nil)
24
- if code.nil?
25
- raise Appwrite::Exception.new('Missing required parameter: "code"')
26
- end
27
27
 
28
28
  path = '/avatars/browsers/{code}'
29
- .gsub('{code}', code)
30
29
 
31
30
  params = {
32
31
  width: width,
33
32
  height: height,
34
33
  quality: quality,
35
34
  }
36
-
35
+
37
36
  headers = {
38
37
  "content-type": 'application/json',
39
38
  }
39
+ if code.nil?
40
+ raise Appwrite::Exception.new('Missing required parameter: "code"')
41
+ end
42
+
43
+ .gsub('{code}', code)
40
44
 
41
45
  @client.call(
42
46
  method: 'GET',
@@ -46,6 +50,7 @@ module Appwrite
46
50
  )
47
51
  end
48
52
 
53
+
49
54
  # The credit card endpoint will return you the icon of the credit card
50
55
  # provider you need. Use width, height and quality arguments to change the
51
56
  # output settings.
@@ -56,29 +61,30 @@ module Appwrite
56
61
  # of image returned is 100x100px.
57
62
  #
58
63
  #
59
- # @param [string] code Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.
60
- # @param [number] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
61
- # @param [number] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
62
- # @param [number] quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
64
+ # @param [String] code Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.
65
+ # @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
66
+ # @param [Integer] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
67
+ # @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
63
68
  #
64
69
  # @return []
65
70
  def get_credit_card(code:, width: nil, height: nil, quality: nil)
66
- if code.nil?
67
- raise Appwrite::Exception.new('Missing required parameter: "code"')
68
- end
69
71
 
70
72
  path = '/avatars/credit-cards/{code}'
71
- .gsub('{code}', code)
72
73
 
73
74
  params = {
74
75
  width: width,
75
76
  height: height,
76
77
  quality: quality,
77
78
  }
78
-
79
+
79
80
  headers = {
80
81
  "content-type": 'application/json',
81
82
  }
83
+ if code.nil?
84
+ raise Appwrite::Exception.new('Missing required parameter: "code"')
85
+ end
86
+
87
+ .gsub('{code}', code)
82
88
 
83
89
  @client.call(
84
90
  method: 'GET',
@@ -88,27 +94,29 @@ module Appwrite
88
94
  )
89
95
  end
90
96
 
97
+
91
98
  # Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
92
99
  # website URL.
93
100
  #
94
101
  #
95
- # @param [string] url Website URL which you want to fetch the favicon from.
102
+ # @param [String] url Website URL which you want to fetch the favicon from.
96
103
  #
97
104
  # @return []
98
105
  def get_favicon(url:)
99
- if url.nil?
100
- raise Appwrite::Exception.new('Missing required parameter: "url"')
101
- end
102
106
 
103
107
  path = '/avatars/favicon'
104
108
 
105
109
  params = {
106
110
  url: url,
107
111
  }
108
-
112
+
109
113
  headers = {
110
114
  "content-type": 'application/json',
111
115
  }
116
+ if url.nil?
117
+ raise Appwrite::Exception.new('Missing required parameter: "url"')
118
+ end
119
+
112
120
 
113
121
  @client.call(
114
122
  method: 'GET',
@@ -118,9 +126,11 @@ module Appwrite
118
126
  )
119
127
  end
120
128
 
129
+
121
130
  # You can use this endpoint to show different country flags icons to your
122
131
  # users. The code argument receives the 2 letter country code. Use width,
123
- # height and quality arguments to change the output settings.
132
+ # height and quality arguments to change the output settings. Country codes
133
+ # follow the [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) standard.
124
134
  #
125
135
  # When one dimension is specified and the other is 0, the image is scaled
126
136
  # with preserved aspect ratio. If both dimensions are 0, the API provides an
@@ -128,29 +138,30 @@ module Appwrite
128
138
  # of image returned is 100x100px.
129
139
  #
130
140
  #
131
- # @param [string] code Country Code. ISO Alpha-2 country code format.
132
- # @param [number] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
133
- # @param [number] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
134
- # @param [number] quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
141
+ # @param [String] code Country Code. ISO Alpha-2 country code format.
142
+ # @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
143
+ # @param [Integer] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
144
+ # @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
135
145
  #
136
146
  # @return []
137
147
  def get_flag(code:, width: nil, height: nil, quality: nil)
138
- if code.nil?
139
- raise Appwrite::Exception.new('Missing required parameter: "code"')
140
- end
141
148
 
142
149
  path = '/avatars/flags/{code}'
143
- .gsub('{code}', code)
144
150
 
145
151
  params = {
146
152
  width: width,
147
153
  height: height,
148
154
  quality: quality,
149
155
  }
150
-
156
+
151
157
  headers = {
152
158
  "content-type": 'application/json',
153
159
  }
160
+ if code.nil?
161
+ raise Appwrite::Exception.new('Missing required parameter: "code"')
162
+ end
163
+
164
+ .gsub('{code}', code)
154
165
 
155
166
  @client.call(
156
167
  method: 'GET',
@@ -160,6 +171,7 @@ module Appwrite
160
171
  )
161
172
  end
162
173
 
174
+
163
175
  # Use this endpoint to fetch a remote image URL and crop it to any image size
164
176
  # you want. This endpoint is very useful if you need to crop and display
165
177
  # remote images in your app or in case you want to make sure a 3rd party
@@ -171,15 +183,12 @@ module Appwrite
171
183
  # of image returned is 400x400px.
172
184
  #
173
185
  #
174
- # @param [string] url Image URL which you want to crop.
175
- # @param [number] width Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400.
176
- # @param [number] height Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.
186
+ # @param [String] url Image URL which you want to crop.
187
+ # @param [Integer] width Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400.
188
+ # @param [Integer] height Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.
177
189
  #
178
190
  # @return []
179
191
  def get_image(url:, width: nil, height: nil)
180
- if url.nil?
181
- raise Appwrite::Exception.new('Missing required parameter: "url"')
182
- end
183
192
 
184
193
  path = '/avatars/image'
185
194
 
@@ -188,10 +197,14 @@ module Appwrite
188
197
  width: width,
189
198
  height: height,
190
199
  }
191
-
200
+
192
201
  headers = {
193
202
  "content-type": 'application/json',
194
203
  }
204
+ if url.nil?
205
+ raise Appwrite::Exception.new('Missing required parameter: "url"')
206
+ end
207
+
195
208
 
196
209
  @client.call(
197
210
  method: 'GET',
@@ -201,6 +214,7 @@ module Appwrite
201
214
  )
202
215
  end
203
216
 
217
+
204
218
  # Use this endpoint to show your user initials avatar icon on your website or
205
219
  # app. By default, this route will try to print your logged-in user name or
206
220
  # email initials. You can also overwrite the user name if you pass the 'name'
@@ -218,24 +232,23 @@ module Appwrite
218
232
  # of image returned is 100x100px.
219
233
  #
220
234
  #
221
- # @param [string] name Full Name. When empty, current user name or email will be used. Max length: 128 chars.
222
- # @param [number] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
223
- # @param [number] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
224
- # @param [string] color Changes text color. By default a random color will be picked and stay will persistent to the given name.
225
- # @param [string] background Changes background color. By default a random color will be picked and stay will persistent to the given name.
235
+ # @param [String] name Full Name. When empty, current user name or email will be used. Max length: 128 chars.
236
+ # @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
237
+ # @param [Integer] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
238
+ # @param [String] background Changes background color. By default a random color will be picked and stay will persistent to the given name.
226
239
  #
227
240
  # @return []
228
- def get_initials(name: nil, width: nil, height: nil, color: nil, background: nil)
241
+ def get_initials(name: nil, width: nil, height: nil, background: nil)
242
+
229
243
  path = '/avatars/initials'
230
244
 
231
245
  params = {
232
246
  name: name,
233
247
  width: width,
234
248
  height: height,
235
- color: color,
236
249
  background: background,
237
250
  }
238
-
251
+
239
252
  headers = {
240
253
  "content-type": 'application/json',
241
254
  }
@@ -248,20 +261,18 @@ module Appwrite
248
261
  )
249
262
  end
250
263
 
264
+
251
265
  # Converts a given plain text to a QR code image. You can use the query
252
266
  # parameters to change the size and style of the resulting image.
253
267
  #
254
268
  #
255
- # @param [string] text Plain text to be converted to QR code image.
256
- # @param [number] size QR code size. Pass an integer between 1 to 1000. Defaults to 400.
257
- # @param [number] margin Margin from edge. Pass an integer between 0 to 10. Defaults to 1.
258
- # @param [boolean] download Return resulting image with &#039;Content-Disposition: attachment &#039; headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.
269
+ # @param [String] text Plain text to be converted to QR code image.
270
+ # @param [Integer] size QR code size. Pass an integer between 1 to 1000. Defaults to 400.
271
+ # @param [Integer] margin Margin from edge. Pass an integer between 0 to 10. Defaults to 1.
272
+ # @param [] download Return resulting image with &#039;Content-Disposition: attachment &#039; headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.
259
273
  #
260
274
  # @return []
261
275
  def get_qr(text:, size: nil, margin: nil, download: nil)
262
- if text.nil?
263
- raise Appwrite::Exception.new('Missing required parameter: "text"')
264
- end
265
276
 
266
277
  path = '/avatars/qr'
267
278
 
@@ -271,10 +282,14 @@ module Appwrite
271
282
  margin: margin,
272
283
  download: download,
273
284
  }
274
-
285
+
275
286
  headers = {
276
287
  "content-type": 'application/json',
277
288
  }
289
+ if text.nil?
290
+ raise Appwrite::Exception.new('Missing required parameter: "text"')
291
+ end
292
+
278
293
 
279
294
  @client.call(
280
295
  method: 'GET',
@@ -284,5 +299,6 @@ module Appwrite
284
299
  )
285
300
  end
286
301
 
302
+
287
303
  end
288
304
  end