appwrite 2.1.1 → 2.4.0
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +7 -8
- data/appwrite.gemspec +1 -1
- data/docs/examples/account/create-recovery.md +1 -1
- data/docs/examples/account/create-verification.md +1 -1
- data/docs/examples/account/delete-session.md +1 -1
- data/docs/examples/account/delete-sessions.md +1 -1
- data/docs/examples/account/delete.md +1 -1
- data/docs/examples/account/get-logs.md +1 -1
- data/docs/examples/account/get-prefs.md +1 -1
- data/docs/examples/account/get-session.md +15 -0
- data/docs/examples/account/get-sessions.md +1 -1
- data/docs/examples/account/get.md +1 -1
- data/docs/examples/account/update-email.md +1 -1
- data/docs/examples/account/update-name.md +1 -1
- data/docs/examples/account/update-password.md +1 -1
- data/docs/examples/account/update-prefs.md +1 -1
- data/docs/examples/account/update-recovery.md +1 -1
- data/docs/examples/account/update-verification.md +1 -1
- data/docs/examples/avatars/get-q-r.md +1 -1
- data/docs/examples/functions/create.md +1 -1
- data/docs/examples/health/get-d-b.md +1 -1
- data/docs/examples/locale/get-countries-e-u.md +1 -1
- data/docs/examples/teams/update-membership-status.md +1 -1
- data/docs/examples/users/update-email.md +15 -0
- data/docs/examples/users/update-name.md +15 -0
- data/docs/examples/users/update-password.md +15 -0
- data/docs/examples/users/update-verification.md +15 -0
- data/lib/appwrite/client.rb +3 -3
- data/lib/appwrite/services/account.rb +151 -46
- data/lib/appwrite/services/avatars.rb +125 -42
- data/lib/appwrite/services/database.rb +199 -53
- data/lib/appwrite/services/functions.rb +223 -61
- data/lib/appwrite/services/health.rb +13 -25
- data/lib/appwrite/services/locale.rb +8 -15
- data/lib/appwrite/services/storage.rb +127 -38
- data/lib/appwrite/services/teams.rb +162 -42
- data/lib/appwrite/services/users.rb +197 -33
- metadata +7 -2
@@ -1,30 +1,54 @@
|
|
1
1
|
module Appwrite
|
2
2
|
class Avatars < Service
|
3
3
|
|
4
|
-
def get_browser(code:, width:
|
4
|
+
def get_browser(code:, width: nil, height: nil, quality: nil)
|
5
|
+
if code.nil?
|
6
|
+
raise Appwrite::Exception.new('Missing required parameter: "code"')
|
7
|
+
end
|
8
|
+
|
5
9
|
path = '/avatars/browsers/{code}'
|
6
10
|
.gsub('{code}', code)
|
7
11
|
|
8
|
-
params = {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
12
|
+
params = {}
|
13
|
+
|
14
|
+
if !width.nil?
|
15
|
+
params[:width] = width
|
16
|
+
end
|
17
|
+
|
18
|
+
if !height.nil?
|
19
|
+
params[:height] = height
|
20
|
+
end
|
21
|
+
|
22
|
+
if !quality.nil?
|
23
|
+
params[:quality] = quality
|
24
|
+
end
|
13
25
|
|
14
26
|
return @client.call('get', path, {
|
15
27
|
'content-type' => 'application/json',
|
16
28
|
}, params);
|
17
29
|
end
|
18
30
|
|
19
|
-
def get_credit_card(code:, width:
|
31
|
+
def get_credit_card(code:, width: nil, height: nil, quality: nil)
|
32
|
+
if code.nil?
|
33
|
+
raise Appwrite::Exception.new('Missing required parameter: "code"')
|
34
|
+
end
|
35
|
+
|
20
36
|
path = '/avatars/credit-cards/{code}'
|
21
37
|
.gsub('{code}', code)
|
22
38
|
|
23
|
-
params = {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
39
|
+
params = {}
|
40
|
+
|
41
|
+
if !width.nil?
|
42
|
+
params[:width] = width
|
43
|
+
end
|
44
|
+
|
45
|
+
if !height.nil?
|
46
|
+
params[:height] = height
|
47
|
+
end
|
48
|
+
|
49
|
+
if !quality.nil?
|
50
|
+
params[:quality] = quality
|
51
|
+
end
|
28
52
|
|
29
53
|
return @client.call('get', path, {
|
30
54
|
'content-type' => 'application/json',
|
@@ -32,71 +56,130 @@ module Appwrite
|
|
32
56
|
end
|
33
57
|
|
34
58
|
def get_favicon(url:)
|
59
|
+
if url.nil?
|
60
|
+
raise Appwrite::Exception.new('Missing required parameter: "url"')
|
61
|
+
end
|
62
|
+
|
35
63
|
path = '/avatars/favicon'
|
36
64
|
|
37
|
-
params = {
|
38
|
-
|
39
|
-
|
65
|
+
params = {}
|
66
|
+
|
67
|
+
if !url.nil?
|
68
|
+
params[:url] = url
|
69
|
+
end
|
40
70
|
|
41
71
|
return @client.call('get', path, {
|
42
72
|
'content-type' => 'application/json',
|
43
73
|
}, params);
|
44
74
|
end
|
45
75
|
|
46
|
-
def get_flag(code:, width:
|
76
|
+
def get_flag(code:, width: nil, height: nil, quality: nil)
|
77
|
+
if code.nil?
|
78
|
+
raise Appwrite::Exception.new('Missing required parameter: "code"')
|
79
|
+
end
|
80
|
+
|
47
81
|
path = '/avatars/flags/{code}'
|
48
82
|
.gsub('{code}', code)
|
49
83
|
|
50
|
-
params = {
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
84
|
+
params = {}
|
85
|
+
|
86
|
+
if !width.nil?
|
87
|
+
params[:width] = width
|
88
|
+
end
|
89
|
+
|
90
|
+
if !height.nil?
|
91
|
+
params[:height] = height
|
92
|
+
end
|
93
|
+
|
94
|
+
if !quality.nil?
|
95
|
+
params[:quality] = quality
|
96
|
+
end
|
55
97
|
|
56
98
|
return @client.call('get', path, {
|
57
99
|
'content-type' => 'application/json',
|
58
100
|
}, params);
|
59
101
|
end
|
60
102
|
|
61
|
-
def get_image(url:, width:
|
103
|
+
def get_image(url:, width: nil, height: nil)
|
104
|
+
if url.nil?
|
105
|
+
raise Appwrite::Exception.new('Missing required parameter: "url"')
|
106
|
+
end
|
107
|
+
|
62
108
|
path = '/avatars/image'
|
63
109
|
|
64
|
-
params = {
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
110
|
+
params = {}
|
111
|
+
|
112
|
+
if !url.nil?
|
113
|
+
params[:url] = url
|
114
|
+
end
|
115
|
+
|
116
|
+
if !width.nil?
|
117
|
+
params[:width] = width
|
118
|
+
end
|
119
|
+
|
120
|
+
if !height.nil?
|
121
|
+
params[:height] = height
|
122
|
+
end
|
69
123
|
|
70
124
|
return @client.call('get', path, {
|
71
125
|
'content-type' => 'application/json',
|
72
126
|
}, params);
|
73
127
|
end
|
74
128
|
|
75
|
-
def get_initials(name:
|
129
|
+
def get_initials(name: nil, width: nil, height: nil, color: nil, background: nil)
|
76
130
|
path = '/avatars/initials'
|
77
131
|
|
78
|
-
params = {
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
132
|
+
params = {}
|
133
|
+
|
134
|
+
if !name.nil?
|
135
|
+
params[:name] = name
|
136
|
+
end
|
137
|
+
|
138
|
+
if !width.nil?
|
139
|
+
params[:width] = width
|
140
|
+
end
|
141
|
+
|
142
|
+
if !height.nil?
|
143
|
+
params[:height] = height
|
144
|
+
end
|
145
|
+
|
146
|
+
if !color.nil?
|
147
|
+
params[:color] = color
|
148
|
+
end
|
149
|
+
|
150
|
+
if !background.nil?
|
151
|
+
params[:background] = background
|
152
|
+
end
|
85
153
|
|
86
154
|
return @client.call('get', path, {
|
87
155
|
'content-type' => 'application/json',
|
88
156
|
}, params);
|
89
157
|
end
|
90
158
|
|
91
|
-
def
|
159
|
+
def get_qr(text:, size: nil, margin: nil, download: nil)
|
160
|
+
if text.nil?
|
161
|
+
raise Appwrite::Exception.new('Missing required parameter: "text"')
|
162
|
+
end
|
163
|
+
|
92
164
|
path = '/avatars/qr'
|
93
165
|
|
94
|
-
params = {
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
166
|
+
params = {}
|
167
|
+
|
168
|
+
if !text.nil?
|
169
|
+
params[:text] = text
|
170
|
+
end
|
171
|
+
|
172
|
+
if !size.nil?
|
173
|
+
params[:size] = size
|
174
|
+
end
|
175
|
+
|
176
|
+
if !margin.nil?
|
177
|
+
params[:margin] = margin
|
178
|
+
end
|
179
|
+
|
180
|
+
if !download.nil?
|
181
|
+
params[:download] = download
|
182
|
+
end
|
100
183
|
|
101
184
|
return @client.call('get', path, {
|
102
185
|
'content-type' => 'application/json',
|
@@ -1,15 +1,26 @@
|
|
1
1
|
module Appwrite
|
2
2
|
class Database < Service
|
3
3
|
|
4
|
-
def list_collections(search:
|
4
|
+
def list_collections(search: nil, limit: nil, offset: nil, order_type: nil)
|
5
5
|
path = '/database/collections'
|
6
6
|
|
7
|
-
params = {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
params = {}
|
8
|
+
|
9
|
+
if !search.nil?
|
10
|
+
params[:search] = search
|
11
|
+
end
|
12
|
+
|
13
|
+
if !limit.nil?
|
14
|
+
params[:limit] = limit
|
15
|
+
end
|
16
|
+
|
17
|
+
if !offset.nil?
|
18
|
+
params[:offset] = offset
|
19
|
+
end
|
20
|
+
|
21
|
+
if !order_type.nil?
|
22
|
+
params[:orderType] = order_type
|
23
|
+
end
|
13
24
|
|
14
25
|
return @client.call('get', path, {
|
15
26
|
'content-type' => 'application/json',
|
@@ -17,14 +28,41 @@ module Appwrite
|
|
17
28
|
end
|
18
29
|
|
19
30
|
def create_collection(name:, read:, write:, rules:)
|
31
|
+
if name.nil?
|
32
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
33
|
+
end
|
34
|
+
|
35
|
+
if read.nil?
|
36
|
+
raise Appwrite::Exception.new('Missing required parameter: "read"')
|
37
|
+
end
|
38
|
+
|
39
|
+
if write.nil?
|
40
|
+
raise Appwrite::Exception.new('Missing required parameter: "write"')
|
41
|
+
end
|
42
|
+
|
43
|
+
if rules.nil?
|
44
|
+
raise Appwrite::Exception.new('Missing required parameter: "rules"')
|
45
|
+
end
|
46
|
+
|
20
47
|
path = '/database/collections'
|
21
48
|
|
22
|
-
params = {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
49
|
+
params = {}
|
50
|
+
|
51
|
+
if !name.nil?
|
52
|
+
params[:name] = name
|
53
|
+
end
|
54
|
+
|
55
|
+
if !read.nil?
|
56
|
+
params[:read] = read
|
57
|
+
end
|
58
|
+
|
59
|
+
if !write.nil?
|
60
|
+
params[:write] = write
|
61
|
+
end
|
62
|
+
|
63
|
+
if !rules.nil?
|
64
|
+
params[:rules] = rules
|
65
|
+
end
|
28
66
|
|
29
67
|
return @client.call('post', path, {
|
30
68
|
'content-type' => 'application/json',
|
@@ -32,27 +70,49 @@ module Appwrite
|
|
32
70
|
end
|
33
71
|
|
34
72
|
def get_collection(collection_id:)
|
73
|
+
if collection_id.nil?
|
74
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
75
|
+
end
|
76
|
+
|
35
77
|
path = '/database/collections/{collectionId}'
|
36
78
|
.gsub('{collectionId}', collection_id)
|
37
79
|
|
38
|
-
params = {
|
39
|
-
}
|
80
|
+
params = {}
|
40
81
|
|
41
82
|
return @client.call('get', path, {
|
42
83
|
'content-type' => 'application/json',
|
43
84
|
}, params);
|
44
85
|
end
|
45
86
|
|
46
|
-
def update_collection(collection_id:, name:, read:
|
87
|
+
def update_collection(collection_id:, name:, read: nil, write: nil, rules: nil)
|
88
|
+
if collection_id.nil?
|
89
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
90
|
+
end
|
91
|
+
|
92
|
+
if name.nil?
|
93
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
94
|
+
end
|
95
|
+
|
47
96
|
path = '/database/collections/{collectionId}'
|
48
97
|
.gsub('{collectionId}', collection_id)
|
49
98
|
|
50
|
-
params = {
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
99
|
+
params = {}
|
100
|
+
|
101
|
+
if !name.nil?
|
102
|
+
params[:name] = name
|
103
|
+
end
|
104
|
+
|
105
|
+
if !read.nil?
|
106
|
+
params[:read] = read
|
107
|
+
end
|
108
|
+
|
109
|
+
if !write.nil?
|
110
|
+
params[:write] = write
|
111
|
+
end
|
112
|
+
|
113
|
+
if !rules.nil?
|
114
|
+
params[:rules] = rules
|
115
|
+
end
|
56
116
|
|
57
117
|
return @client.call('put', path, {
|
58
118
|
'content-type' => 'application/json',
|
@@ -60,48 +120,100 @@ module Appwrite
|
|
60
120
|
end
|
61
121
|
|
62
122
|
def delete_collection(collection_id:)
|
123
|
+
if collection_id.nil?
|
124
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
125
|
+
end
|
126
|
+
|
63
127
|
path = '/database/collections/{collectionId}'
|
64
128
|
.gsub('{collectionId}', collection_id)
|
65
129
|
|
66
|
-
params = {
|
67
|
-
}
|
130
|
+
params = {}
|
68
131
|
|
69
132
|
return @client.call('delete', path, {
|
70
133
|
'content-type' => 'application/json',
|
71
134
|
}, params);
|
72
135
|
end
|
73
136
|
|
74
|
-
def list_documents(collection_id:, filters:
|
137
|
+
def list_documents(collection_id:, filters: nil, limit: nil, offset: nil, order_field: nil, order_type: nil, order_cast: nil, search: nil)
|
138
|
+
if collection_id.nil?
|
139
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
140
|
+
end
|
141
|
+
|
75
142
|
path = '/database/collections/{collectionId}/documents'
|
76
143
|
.gsub('{collectionId}', collection_id)
|
77
144
|
|
78
|
-
params = {
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
145
|
+
params = {}
|
146
|
+
|
147
|
+
if !filters.nil?
|
148
|
+
params[:filters] = filters
|
149
|
+
end
|
150
|
+
|
151
|
+
if !limit.nil?
|
152
|
+
params[:limit] = limit
|
153
|
+
end
|
154
|
+
|
155
|
+
if !offset.nil?
|
156
|
+
params[:offset] = offset
|
157
|
+
end
|
158
|
+
|
159
|
+
if !order_field.nil?
|
160
|
+
params[:orderField] = order_field
|
161
|
+
end
|
162
|
+
|
163
|
+
if !order_type.nil?
|
164
|
+
params[:orderType] = order_type
|
165
|
+
end
|
166
|
+
|
167
|
+
if !order_cast.nil?
|
168
|
+
params[:orderCast] = order_cast
|
169
|
+
end
|
170
|
+
|
171
|
+
if !search.nil?
|
172
|
+
params[:search] = search
|
173
|
+
end
|
87
174
|
|
88
175
|
return @client.call('get', path, {
|
89
176
|
'content-type' => 'application/json',
|
90
177
|
}, params);
|
91
178
|
end
|
92
179
|
|
93
|
-
def create_document(collection_id:, data:, read:
|
180
|
+
def create_document(collection_id:, data:, read: nil, write: nil, parent_document: nil, parent_property: nil, parent_property_type: nil)
|
181
|
+
if collection_id.nil?
|
182
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
183
|
+
end
|
184
|
+
|
185
|
+
if data.nil?
|
186
|
+
raise Appwrite::Exception.new('Missing required parameter: "data"')
|
187
|
+
end
|
188
|
+
|
94
189
|
path = '/database/collections/{collectionId}/documents'
|
95
190
|
.gsub('{collectionId}', collection_id)
|
96
191
|
|
97
|
-
params = {
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
192
|
+
params = {}
|
193
|
+
|
194
|
+
if !data.nil?
|
195
|
+
params[:data] = data
|
196
|
+
end
|
197
|
+
|
198
|
+
if !read.nil?
|
199
|
+
params[:read] = read
|
200
|
+
end
|
201
|
+
|
202
|
+
if !write.nil?
|
203
|
+
params[:write] = write
|
204
|
+
end
|
205
|
+
|
206
|
+
if !parent_document.nil?
|
207
|
+
params[:parentDocument] = parent_document
|
208
|
+
end
|
209
|
+
|
210
|
+
if !parent_property.nil?
|
211
|
+
params[:parentProperty] = parent_property
|
212
|
+
end
|
213
|
+
|
214
|
+
if !parent_property_type.nil?
|
215
|
+
params[:parentPropertyType] = parent_property_type
|
216
|
+
end
|
105
217
|
|
106
218
|
return @client.call('post', path, {
|
107
219
|
'content-type' => 'application/json',
|
@@ -109,28 +221,55 @@ module Appwrite
|
|
109
221
|
end
|
110
222
|
|
111
223
|
def get_document(collection_id:, document_id:)
|
224
|
+
if collection_id.nil?
|
225
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
226
|
+
end
|
227
|
+
|
228
|
+
if document_id.nil?
|
229
|
+
raise Appwrite::Exception.new('Missing required parameter: "documentId"')
|
230
|
+
end
|
231
|
+
|
112
232
|
path = '/database/collections/{collectionId}/documents/{documentId}'
|
113
233
|
.gsub('{collectionId}', collection_id)
|
114
234
|
.gsub('{documentId}', document_id)
|
115
235
|
|
116
|
-
params = {
|
117
|
-
}
|
236
|
+
params = {}
|
118
237
|
|
119
238
|
return @client.call('get', path, {
|
120
239
|
'content-type' => 'application/json',
|
121
240
|
}, params);
|
122
241
|
end
|
123
242
|
|
124
|
-
def update_document(collection_id:, document_id:, data:, read:
|
243
|
+
def update_document(collection_id:, document_id:, data:, read: nil, write: nil)
|
244
|
+
if collection_id.nil?
|
245
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
246
|
+
end
|
247
|
+
|
248
|
+
if document_id.nil?
|
249
|
+
raise Appwrite::Exception.new('Missing required parameter: "documentId"')
|
250
|
+
end
|
251
|
+
|
252
|
+
if data.nil?
|
253
|
+
raise Appwrite::Exception.new('Missing required parameter: "data"')
|
254
|
+
end
|
255
|
+
|
125
256
|
path = '/database/collections/{collectionId}/documents/{documentId}'
|
126
257
|
.gsub('{collectionId}', collection_id)
|
127
258
|
.gsub('{documentId}', document_id)
|
128
259
|
|
129
|
-
params = {
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
260
|
+
params = {}
|
261
|
+
|
262
|
+
if !data.nil?
|
263
|
+
params[:data] = data
|
264
|
+
end
|
265
|
+
|
266
|
+
if !read.nil?
|
267
|
+
params[:read] = read
|
268
|
+
end
|
269
|
+
|
270
|
+
if !write.nil?
|
271
|
+
params[:write] = write
|
272
|
+
end
|
134
273
|
|
135
274
|
return @client.call('patch', path, {
|
136
275
|
'content-type' => 'application/json',
|
@@ -138,12 +277,19 @@ module Appwrite
|
|
138
277
|
end
|
139
278
|
|
140
279
|
def delete_document(collection_id:, document_id:)
|
280
|
+
if collection_id.nil?
|
281
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
282
|
+
end
|
283
|
+
|
284
|
+
if document_id.nil?
|
285
|
+
raise Appwrite::Exception.new('Missing required parameter: "documentId"')
|
286
|
+
end
|
287
|
+
|
141
288
|
path = '/database/collections/{collectionId}/documents/{documentId}'
|
142
289
|
.gsub('{collectionId}', collection_id)
|
143
290
|
.gsub('{documentId}', document_id)
|
144
291
|
|
145
|
-
params = {
|
146
|
-
}
|
292
|
+
params = {}
|
147
293
|
|
148
294
|
return @client.call('delete', path, {
|
149
295
|
'content-type' => 'application/json',
|