appwrite 5.0.0 → 7.0.0.pre.RC2

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