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