appwrite 2.2.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/appwrite/client.rb +134 -57
- data/lib/appwrite/exception.rb +5 -7
- data/lib/appwrite/file.rb +5 -13
- data/lib/appwrite/models/attribute_boolean.rb +52 -0
- data/lib/appwrite/models/attribute_email.rb +57 -0
- data/lib/appwrite/models/attribute_enum.rb +62 -0
- data/lib/appwrite/models/attribute_float.rb +62 -0
- data/lib/appwrite/models/attribute_integer.rb +62 -0
- data/lib/appwrite/models/attribute_ip.rb +57 -0
- data/lib/appwrite/models/attribute_list.rb +32 -0
- data/lib/appwrite/models/attribute_string.rb +57 -0
- data/lib/appwrite/models/attribute_url.rb +57 -0
- data/lib/appwrite/models/collection.rb +62 -0
- data/lib/appwrite/models/collection_list.rb +32 -0
- data/lib/appwrite/models/continent.rb +32 -0
- data/lib/appwrite/models/continent_list.rb +32 -0
- data/lib/appwrite/models/country.rb +32 -0
- data/lib/appwrite/models/country_list.rb +32 -0
- data/lib/appwrite/models/currency.rb +57 -0
- data/lib/appwrite/models/currency_list.rb +32 -0
- data/lib/appwrite/models/document.rb +50 -0
- data/lib/appwrite/models/document_list.rb +36 -0
- data/lib/appwrite/models/execution.rb +72 -0
- data/lib/appwrite/models/execution_list.rb +32 -0
- data/lib/appwrite/models/file.rb +62 -0
- data/lib/appwrite/models/file_list.rb +32 -0
- data/lib/appwrite/models/function.rb +92 -0
- data/lib/appwrite/models/function_list.rb +32 -0
- data/lib/appwrite/models/health_antivirus.rb +32 -0
- data/lib/appwrite/models/health_queue.rb +27 -0
- data/lib/appwrite/models/health_status.rb +32 -0
- data/lib/appwrite/models/health_time.rb +37 -0
- data/lib/appwrite/models/index.rb +47 -0
- data/lib/appwrite/models/index_list.rb +32 -0
- data/lib/appwrite/models/language.rb +37 -0
- data/lib/appwrite/models/language_list.rb +32 -0
- data/lib/appwrite/models/locale.rb +57 -0
- data/lib/appwrite/models/log.rb +127 -0
- data/lib/appwrite/models/log_list.rb +32 -0
- data/lib/appwrite/models/membership.rb +67 -0
- data/lib/appwrite/models/membership_list.rb +32 -0
- data/lib/appwrite/models/phone.rb +37 -0
- data/lib/appwrite/models/phone_list.rb +32 -0
- data/lib/appwrite/models/preferences.rb +30 -0
- data/lib/appwrite/models/runtime.rb +57 -0
- data/lib/appwrite/models/runtime_list.rb +32 -0
- data/lib/appwrite/models/session.rb +132 -0
- data/lib/appwrite/models/session_list.rb +32 -0
- data/lib/appwrite/models/tag.rb +47 -0
- data/lib/appwrite/models/tag_list.rb +32 -0
- data/lib/appwrite/models/team.rb +42 -0
- data/lib/appwrite/models/team_list.rb +32 -0
- data/lib/appwrite/models/token.rb +42 -0
- data/lib/appwrite/models/user.rb +62 -0
- data/lib/appwrite/models/user_list.rb +32 -0
- data/lib/appwrite/query.rb +42 -0
- data/lib/appwrite/service.rb +0 -5
- data/lib/appwrite/services/account.rb +380 -133
- data/lib/appwrite/services/avatars.rb +189 -125
- data/lib/appwrite/services/database.rb +876 -130
- data/lib/appwrite/services/functions.rb +366 -184
- data/lib/appwrite/services/health.rb +202 -58
- data/lib/appwrite/services/locale.rb +134 -32
- data/lib/appwrite/services/storage.rb +211 -118
- data/lib/appwrite/services/teams.rb +299 -118
- data/lib/appwrite/services/users.rb +372 -85
- data/lib/appwrite.rb +55 -0
- metadata +72 -103
- data/.travis.yml +0 -16
- data/CHANGELOG.md +0 -1
- data/Gemfile +0 -4
- data/LICENSE +0 -12
- data/README.md +0 -97
- data/appwrite.gemspec +0 -11
- data/docs/examples/account/create-recovery.md +0 -15
- data/docs/examples/account/create-verification.md +0 -15
- data/docs/examples/account/delete-session.md +0 -15
- data/docs/examples/account/delete-sessions.md +0 -15
- data/docs/examples/account/delete.md +0 -15
- data/docs/examples/account/get-logs.md +0 -15
- data/docs/examples/account/get-prefs.md +0 -15
- data/docs/examples/account/get-sessions.md +0 -15
- data/docs/examples/account/get.md +0 -15
- data/docs/examples/account/update-email.md +0 -15
- data/docs/examples/account/update-name.md +0 -15
- data/docs/examples/account/update-password.md +0 -15
- data/docs/examples/account/update-prefs.md +0 -15
- data/docs/examples/account/update-recovery.md +0 -15
- data/docs/examples/account/update-verification.md +0 -15
- data/docs/examples/avatars/get-browser.md +0 -15
- data/docs/examples/avatars/get-credit-card.md +0 -15
- data/docs/examples/avatars/get-favicon.md +0 -15
- data/docs/examples/avatars/get-flag.md +0 -15
- data/docs/examples/avatars/get-image.md +0 -15
- data/docs/examples/avatars/get-initials.md +0 -15
- data/docs/examples/avatars/get-q-r.md +0 -15
- data/docs/examples/database/create-collection.md +0 -15
- data/docs/examples/database/create-document.md +0 -15
- data/docs/examples/database/delete-collection.md +0 -15
- data/docs/examples/database/delete-document.md +0 -15
- data/docs/examples/database/get-collection.md +0 -15
- data/docs/examples/database/get-document.md +0 -15
- data/docs/examples/database/list-collections.md +0 -15
- data/docs/examples/database/list-documents.md +0 -15
- data/docs/examples/database/update-collection.md +0 -15
- data/docs/examples/database/update-document.md +0 -15
- data/docs/examples/functions/create-execution.md +0 -15
- data/docs/examples/functions/create-tag.md +0 -15
- data/docs/examples/functions/create.md +0 -15
- data/docs/examples/functions/delete-tag.md +0 -15
- data/docs/examples/functions/delete.md +0 -15
- data/docs/examples/functions/get-execution.md +0 -15
- data/docs/examples/functions/get-tag.md +0 -15
- data/docs/examples/functions/get.md +0 -15
- data/docs/examples/functions/list-executions.md +0 -15
- data/docs/examples/functions/list-tags.md +0 -15
- data/docs/examples/functions/list.md +0 -15
- data/docs/examples/functions/update-tag.md +0 -15
- data/docs/examples/functions/update.md +0 -15
- data/docs/examples/health/get-anti-virus.md +0 -15
- data/docs/examples/health/get-cache.md +0 -15
- data/docs/examples/health/get-d-b.md +0 -15
- data/docs/examples/health/get-queue-certificates.md +0 -15
- data/docs/examples/health/get-queue-functions.md +0 -15
- data/docs/examples/health/get-queue-logs.md +0 -15
- data/docs/examples/health/get-queue-tasks.md +0 -15
- data/docs/examples/health/get-queue-usage.md +0 -15
- data/docs/examples/health/get-queue-webhooks.md +0 -15
- data/docs/examples/health/get-storage-local.md +0 -15
- data/docs/examples/health/get-time.md +0 -15
- data/docs/examples/health/get.md +0 -15
- data/docs/examples/locale/get-continents.md +0 -15
- data/docs/examples/locale/get-countries-e-u.md +0 -15
- data/docs/examples/locale/get-countries-phones.md +0 -15
- data/docs/examples/locale/get-countries.md +0 -15
- data/docs/examples/locale/get-currencies.md +0 -15
- data/docs/examples/locale/get-languages.md +0 -15
- data/docs/examples/locale/get.md +0 -15
- data/docs/examples/storage/create-file.md +0 -15
- data/docs/examples/storage/delete-file.md +0 -15
- data/docs/examples/storage/get-file-download.md +0 -15
- data/docs/examples/storage/get-file-preview.md +0 -15
- data/docs/examples/storage/get-file-view.md +0 -15
- data/docs/examples/storage/get-file.md +0 -15
- data/docs/examples/storage/list-files.md +0 -15
- data/docs/examples/storage/update-file.md +0 -15
- data/docs/examples/teams/create-membership.md +0 -15
- data/docs/examples/teams/create.md +0 -15
- data/docs/examples/teams/delete-membership.md +0 -15
- data/docs/examples/teams/delete.md +0 -15
- data/docs/examples/teams/get-memberships.md +0 -15
- data/docs/examples/teams/get.md +0 -15
- data/docs/examples/teams/list.md +0 -15
- data/docs/examples/teams/update-membership-roles.md +0 -15
- data/docs/examples/teams/update-membership-status.md +0 -15
- data/docs/examples/teams/update.md +0 -15
- data/docs/examples/users/create.md +0 -15
- data/docs/examples/users/delete-session.md +0 -15
- data/docs/examples/users/delete-sessions.md +0 -15
- data/docs/examples/users/delete.md +0 -15
- data/docs/examples/users/get-logs.md +0 -15
- data/docs/examples/users/get-prefs.md +0 -15
- data/docs/examples/users/get-sessions.md +0 -15
- data/docs/examples/users/get.md +0 -15
- data/docs/examples/users/list.md +0 -15
- data/docs/examples/users/update-prefs.md +0 -15
- data/docs/examples/users/update-status.md +0 -15
@@ -1,6 +1,20 @@
|
|
1
|
+
#frozen_string_literal: true
|
2
|
+
|
1
3
|
module Appwrite
|
2
4
|
class Avatars < Service
|
3
5
|
|
6
|
+
include Models
|
7
|
+
# You can use this endpoint to show different browser icons to your users.
|
8
|
+
# The code argument receives the browser code as it appears in your user
|
9
|
+
# /account/sessions endpoint. Use width, height and quality arguments to
|
10
|
+
# change the output settings.
|
11
|
+
#
|
12
|
+
# @param [string] code Browser Code.
|
13
|
+
# @param [number] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
|
14
|
+
# @param [number] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
|
15
|
+
# @param [number] quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
|
16
|
+
#
|
17
|
+
# @return []
|
4
18
|
def get_browser(code:, width: nil, height: nil, quality: nil)
|
5
19
|
if code.nil?
|
6
20
|
raise Appwrite::Exception.new('Missing required parameter: "code"')
|
@@ -9,25 +23,34 @@ module Appwrite
|
|
9
23
|
path = '/avatars/browsers/{code}'
|
10
24
|
.gsub('{code}', code)
|
11
25
|
|
12
|
-
params = {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
}, params);
|
26
|
+
params = {
|
27
|
+
width: width,
|
28
|
+
height: height,
|
29
|
+
quality: quality,
|
30
|
+
}
|
31
|
+
|
32
|
+
headers = {
|
33
|
+
"content-type": 'application/json',
|
34
|
+
}
|
35
|
+
|
36
|
+
@client.call(
|
37
|
+
method: 'GET',
|
38
|
+
path: path,
|
39
|
+
params: params,
|
40
|
+
headers: headers,
|
41
|
+
)
|
29
42
|
end
|
30
43
|
|
44
|
+
# The credit card endpoint will return you the icon of the credit card
|
45
|
+
# provider you need. Use width, height and quality arguments to change the
|
46
|
+
# output settings.
|
47
|
+
#
|
48
|
+
# @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.
|
49
|
+
# @param [number] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
|
50
|
+
# @param [number] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
|
51
|
+
# @param [number] quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
|
52
|
+
#
|
53
|
+
# @return []
|
31
54
|
def get_credit_card(code:, width: nil, height: nil, quality: nil)
|
32
55
|
if code.nil?
|
33
56
|
raise Appwrite::Exception.new('Missing required parameter: "code"')
|
@@ -36,25 +59,31 @@ module Appwrite
|
|
36
59
|
path = '/avatars/credit-cards/{code}'
|
37
60
|
.gsub('{code}', code)
|
38
61
|
|
39
|
-
params = {
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}, params);
|
62
|
+
params = {
|
63
|
+
width: width,
|
64
|
+
height: height,
|
65
|
+
quality: quality,
|
66
|
+
}
|
67
|
+
|
68
|
+
headers = {
|
69
|
+
"content-type": 'application/json',
|
70
|
+
}
|
71
|
+
|
72
|
+
@client.call(
|
73
|
+
method: 'GET',
|
74
|
+
path: path,
|
75
|
+
params: params,
|
76
|
+
headers: headers,
|
77
|
+
)
|
56
78
|
end
|
57
79
|
|
80
|
+
# Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
|
81
|
+
# website URL.
|
82
|
+
#
|
83
|
+
#
|
84
|
+
# @param [string] url Website URL which you want to fetch the favicon from.
|
85
|
+
#
|
86
|
+
# @return []
|
58
87
|
def get_favicon(url:)
|
59
88
|
if url.nil?
|
60
89
|
raise Appwrite::Exception.new('Missing required parameter: "url"')
|
@@ -62,17 +91,32 @@ module Appwrite
|
|
62
91
|
|
63
92
|
path = '/avatars/favicon'
|
64
93
|
|
65
|
-
params = {
|
94
|
+
params = {
|
95
|
+
url: url,
|
96
|
+
}
|
66
97
|
|
67
|
-
|
68
|
-
|
69
|
-
|
98
|
+
headers = {
|
99
|
+
"content-type": 'application/json',
|
100
|
+
}
|
70
101
|
|
71
|
-
|
72
|
-
|
73
|
-
|
102
|
+
@client.call(
|
103
|
+
method: 'GET',
|
104
|
+
path: path,
|
105
|
+
params: params,
|
106
|
+
headers: headers,
|
107
|
+
)
|
74
108
|
end
|
75
109
|
|
110
|
+
# You can use this endpoint to show different country flags icons to your
|
111
|
+
# users. The code argument receives the 2 letter country code. Use width,
|
112
|
+
# height and quality arguments to change the output settings.
|
113
|
+
#
|
114
|
+
# @param [string] code Country Code. ISO Alpha-2 country code format.
|
115
|
+
# @param [number] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
|
116
|
+
# @param [number] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
|
117
|
+
# @param [number] quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
|
118
|
+
#
|
119
|
+
# @return []
|
76
120
|
def get_flag(code:, width: nil, height: nil, quality: nil)
|
77
121
|
if code.nil?
|
78
122
|
raise Appwrite::Exception.new('Missing required parameter: "code"')
|
@@ -81,25 +125,34 @@ module Appwrite
|
|
81
125
|
path = '/avatars/flags/{code}'
|
82
126
|
.gsub('{code}', code)
|
83
127
|
|
84
|
-
params = {
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
}, params);
|
128
|
+
params = {
|
129
|
+
width: width,
|
130
|
+
height: height,
|
131
|
+
quality: quality,
|
132
|
+
}
|
133
|
+
|
134
|
+
headers = {
|
135
|
+
"content-type": 'application/json',
|
136
|
+
}
|
137
|
+
|
138
|
+
@client.call(
|
139
|
+
method: 'GET',
|
140
|
+
path: path,
|
141
|
+
params: params,
|
142
|
+
headers: headers,
|
143
|
+
)
|
101
144
|
end
|
102
145
|
|
146
|
+
# Use this endpoint to fetch a remote image URL and crop it to any image size
|
147
|
+
# you want. This endpoint is very useful if you need to crop and display
|
148
|
+
# remote images in your app or in case you want to make sure a 3rd party
|
149
|
+
# image is properly served using a TLS protocol.
|
150
|
+
#
|
151
|
+
# @param [string] url Image URL which you want to crop.
|
152
|
+
# @param [number] width Resize preview image width, Pass an integer between 0 to 2000.
|
153
|
+
# @param [number] height Resize preview image height, Pass an integer between 0 to 2000.
|
154
|
+
#
|
155
|
+
# @return []
|
103
156
|
def get_image(url:, width: nil, height: nil)
|
104
157
|
if url.nil?
|
105
158
|
raise Appwrite::Exception.new('Missing required parameter: "url"')
|
@@ -107,55 +160,74 @@ module Appwrite
|
|
107
160
|
|
108
161
|
path = '/avatars/image'
|
109
162
|
|
110
|
-
params = {
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
}, params);
|
163
|
+
params = {
|
164
|
+
url: url,
|
165
|
+
width: width,
|
166
|
+
height: height,
|
167
|
+
}
|
168
|
+
|
169
|
+
headers = {
|
170
|
+
"content-type": 'application/json',
|
171
|
+
}
|
172
|
+
|
173
|
+
@client.call(
|
174
|
+
method: 'GET',
|
175
|
+
path: path,
|
176
|
+
params: params,
|
177
|
+
headers: headers,
|
178
|
+
)
|
127
179
|
end
|
128
180
|
|
181
|
+
# Use this endpoint to show your user initials avatar icon on your website or
|
182
|
+
# app. By default, this route will try to print your logged-in user name or
|
183
|
+
# email initials. You can also overwrite the user name if you pass the 'name'
|
184
|
+
# parameter. If no name is given and no user is logged, an empty avatar will
|
185
|
+
# be returned.
|
186
|
+
#
|
187
|
+
# You can use the color and background params to change the avatar colors. By
|
188
|
+
# default, a random theme will be selected. The random theme will persist for
|
189
|
+
# the user's initials when reloading the same theme will always return for
|
190
|
+
# the same initials.
|
191
|
+
#
|
192
|
+
# @param [string] name Full Name. When empty, current user name or email will be used. Max length: 128 chars.
|
193
|
+
# @param [number] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
|
194
|
+
# @param [number] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
|
195
|
+
# @param [string] color Changes text color. By default a random color will be picked and stay will persistent to the given name.
|
196
|
+
# @param [string] background Changes background color. By default a random color will be picked and stay will persistent to the given name.
|
197
|
+
#
|
198
|
+
# @return []
|
129
199
|
def get_initials(name: nil, width: nil, height: nil, color: nil, background: nil)
|
130
200
|
path = '/avatars/initials'
|
131
201
|
|
132
|
-
params = {
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
params
|
148
|
-
|
149
|
-
|
150
|
-
if !background.nil?
|
151
|
-
params[:background] = background
|
152
|
-
end
|
153
|
-
|
154
|
-
return @client.call('get', path, {
|
155
|
-
'content-type' => 'application/json',
|
156
|
-
}, params);
|
202
|
+
params = {
|
203
|
+
name: name,
|
204
|
+
width: width,
|
205
|
+
height: height,
|
206
|
+
color: color,
|
207
|
+
background: background,
|
208
|
+
}
|
209
|
+
|
210
|
+
headers = {
|
211
|
+
"content-type": 'application/json',
|
212
|
+
}
|
213
|
+
|
214
|
+
@client.call(
|
215
|
+
method: 'GET',
|
216
|
+
path: path,
|
217
|
+
params: params,
|
218
|
+
headers: headers,
|
219
|
+
)
|
157
220
|
end
|
158
221
|
|
222
|
+
# Converts a given plain text to a QR code image. You can use the query
|
223
|
+
# parameters to change the size and style of the resulting image.
|
224
|
+
#
|
225
|
+
# @param [string] text Plain text to be converted to QR code image.
|
226
|
+
# @param [number] size QR code size. Pass an integer between 0 to 1000. Defaults to 400.
|
227
|
+
# @param [number] margin Margin from edge. Pass an integer between 0 to 10. Defaults to 1.
|
228
|
+
# @param [boolean] 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.
|
229
|
+
#
|
230
|
+
# @return []
|
159
231
|
def get_qr(text:, size: nil, margin: nil, download: nil)
|
160
232
|
if text.nil?
|
161
233
|
raise Appwrite::Exception.new('Missing required parameter: "text"')
|
@@ -163,32 +235,24 @@ module Appwrite
|
|
163
235
|
|
164
236
|
path = '/avatars/qr'
|
165
237
|
|
166
|
-
params = {
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
return @client.call('get', path, {
|
185
|
-
'content-type' => 'application/json',
|
186
|
-
}, params);
|
238
|
+
params = {
|
239
|
+
text: text,
|
240
|
+
size: size,
|
241
|
+
margin: margin,
|
242
|
+
download: download,
|
243
|
+
}
|
244
|
+
|
245
|
+
headers = {
|
246
|
+
"content-type": 'application/json',
|
247
|
+
}
|
248
|
+
|
249
|
+
@client.call(
|
250
|
+
method: 'GET',
|
251
|
+
path: path,
|
252
|
+
params: params,
|
253
|
+
headers: headers,
|
254
|
+
)
|
187
255
|
end
|
188
256
|
|
189
|
-
|
190
|
-
protected
|
191
|
-
|
192
|
-
private
|
193
257
|
end
|
194
258
|
end
|