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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faf26d54d0dd35ecb6279029fc13a153e824c91a0f6daa78dd0b3aa9b14e7337
|
4
|
+
data.tar.gz: 35bfcac6e7bcc0aeadc0a91a5ae07a9c18ab9f2d01e17f4e2132ff243f0f2690
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 072d20868a6b076d8dfa50f2c18d9f1c263523b871307cbaebd98df406f388bf6b7b6aff4b499a9f03168df2ead42cb45d20f4354559e38149e407d34f6a8d73
|
7
|
+
data.tar.gz: 52e32436fd5f535fabbc46bf0bde38df598a8ef7a0b2cc092ee9867943877854c00cfd8aa845d86090789b9a84eb0eeaeb0456460a4a8176c6a370f4f6747c03
|
data/lib/appwrite/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
#frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'net/http'
|
2
4
|
require 'uri'
|
3
5
|
require 'json'
|
@@ -5,136 +7,211 @@ require 'cgi'
|
|
5
7
|
|
6
8
|
module Appwrite
|
7
9
|
class Client
|
8
|
-
|
9
|
-
|
10
|
-
METHOD_POST = 'post'
|
11
|
-
METHOD_PUT = 'put'
|
12
|
-
METHOD_PATCH = 'patch'
|
13
|
-
METHOD_DELETE = 'delete'
|
14
|
-
METHOD_HEAD = 'head'
|
15
|
-
METHOD_OPTIONS = 'options'
|
16
|
-
METHOD_CONNECT = 'connect'
|
17
|
-
METHOD_TRACE = 'trace'
|
18
|
-
|
19
|
-
def initialize()
|
10
|
+
|
11
|
+
def initialize
|
20
12
|
@headers = {
|
21
|
-
'content-type' => '',
|
22
13
|
'user-agent' => RUBY_PLATFORM + ':ruby-' + RUBY_VERSION,
|
23
|
-
'x-sdk-version' => 'appwrite:ruby:
|
24
|
-
'X-Appwrite-Response-Format' => '0.
|
14
|
+
'x-sdk-version' => 'appwrite:ruby:3.0.0',
|
15
|
+
'X-Appwrite-Response-Format' => '0.12.0'
|
25
16
|
}
|
26
|
-
@endpoint = 'https://
|
17
|
+
@endpoint = 'https://HOSTNAME/v1'
|
27
18
|
end
|
28
19
|
|
20
|
+
# Set Project
|
21
|
+
#
|
22
|
+
# Your project ID
|
23
|
+
#
|
24
|
+
# @param [String] value The value to set for the Project header
|
25
|
+
#
|
26
|
+
# @return [self]
|
29
27
|
def set_project(value)
|
30
28
|
add_header('x-appwrite-project', value)
|
31
29
|
|
32
|
-
|
30
|
+
self
|
33
31
|
end
|
34
32
|
|
33
|
+
# Set Key
|
34
|
+
#
|
35
|
+
# Your secret API key
|
36
|
+
#
|
37
|
+
# @param [String] value The value to set for the Key header
|
38
|
+
#
|
39
|
+
# @return [self]
|
35
40
|
def set_key(value)
|
36
41
|
add_header('x-appwrite-key', value)
|
37
42
|
|
38
|
-
|
43
|
+
self
|
39
44
|
end
|
40
45
|
|
46
|
+
# Set JWT
|
47
|
+
#
|
48
|
+
# Your secret JSON Web Token
|
49
|
+
#
|
50
|
+
# @param [String] value The value to set for the JWT header
|
51
|
+
#
|
52
|
+
# @return [self]
|
41
53
|
def set_jwt(value)
|
42
54
|
add_header('x-appwrite-jwt', value)
|
43
55
|
|
44
|
-
|
56
|
+
self
|
45
57
|
end
|
46
58
|
|
59
|
+
# Set Locale
|
60
|
+
#
|
61
|
+
# @param [String] value The value to set for the Locale header
|
62
|
+
#
|
63
|
+
# @return [self]
|
47
64
|
def set_locale(value)
|
48
65
|
add_header('x-appwrite-locale', value)
|
49
66
|
|
50
|
-
|
67
|
+
self
|
51
68
|
end
|
52
69
|
|
70
|
+
# Set endpoint.
|
71
|
+
#
|
72
|
+
# @param [String] endpoint The endpoint to set
|
73
|
+
#
|
74
|
+
# @return [self]
|
53
75
|
def set_endpoint(endpoint)
|
54
76
|
@endpoint = endpoint
|
55
77
|
|
56
|
-
|
78
|
+
self
|
57
79
|
end
|
58
|
-
|
80
|
+
|
81
|
+
# Set self signed.
|
82
|
+
#
|
83
|
+
# @param [String] self_signed Whether to allow self signed certificates.
|
84
|
+
#
|
85
|
+
# @return [self]
|
86
|
+
def set_self_signed(self_signed = true)
|
87
|
+
@self_signed = self_signed
|
88
|
+
|
89
|
+
self
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
# Add Header
|
94
|
+
#
|
95
|
+
# @param [String] key The key for the header to add
|
96
|
+
# @param [String] value The value for the header to add
|
97
|
+
#
|
98
|
+
# @return [self]
|
59
99
|
def add_header(key, value)
|
60
100
|
@headers[key.downcase] = value
|
61
101
|
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
|
-
def call(method, path = '', headers = {}, params = {})
|
66
|
-
uri = URI.parse(@endpoint + path + ((method == METHOD_GET && params.length) ? '?' + encode(params) : ''))
|
67
|
-
return fetch(method, uri, headers, params)
|
102
|
+
self
|
68
103
|
end
|
69
104
|
|
70
|
-
|
105
|
+
# Send the HTTP request.
|
106
|
+
#
|
107
|
+
# @param [String] method The HTTP method for the request
|
108
|
+
# @param [String] path The path for the request
|
109
|
+
# @param [Hash] headers The headers to send with the request
|
110
|
+
# @param [Hash] params The parameters to send with the request
|
111
|
+
# @param [Class] response_type The type of response to return
|
112
|
+
#
|
113
|
+
# @return [self]
|
114
|
+
def call(
|
115
|
+
method:,
|
116
|
+
path: '',
|
117
|
+
headers: {},
|
118
|
+
params: {},
|
119
|
+
response_type: nil
|
120
|
+
)
|
121
|
+
uri = URI.parse(@endpoint + path + ((method == "GET" && params.length) ? '?' + encode(params) : ''))
|
122
|
+
|
123
|
+
fetch(method, uri, headers, params, response_type)
|
124
|
+
end
|
71
125
|
|
72
126
|
private
|
73
127
|
|
74
|
-
def fetch(
|
128
|
+
def fetch(
|
129
|
+
method,
|
130
|
+
uri,
|
131
|
+
headers,
|
132
|
+
params,
|
133
|
+
response_type = nil,
|
134
|
+
limit = 5
|
135
|
+
)
|
75
136
|
raise ArgumentError, 'Too Many HTTP Redirects' if limit == 0
|
76
137
|
|
77
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
78
|
-
http.use_ssl =
|
138
|
+
@http = Net::HTTP.new(uri.host, uri.port) unless defined? @http
|
139
|
+
@http.use_ssl = !@self_signed
|
79
140
|
payload = ''
|
80
141
|
|
81
142
|
headers = @headers.merge(headers)
|
82
|
-
|
83
|
-
|
84
|
-
|
143
|
+
|
144
|
+
@boundary = "----A30#3ad1"
|
145
|
+
if method != "GET"
|
146
|
+
case headers[:'content-type']
|
85
147
|
when 'application/json'
|
86
148
|
payload = params.to_json
|
87
149
|
when 'multipart/form-data'
|
88
|
-
payload = "--#{@
|
89
|
-
headers['content-type'] = "multipart/form-data; boundary=#{@
|
150
|
+
payload = "--#{@boundary}\r\n" + encode_form_data(params)
|
151
|
+
headers[:'content-type'] = "multipart/form-data; boundary=#{@boundary}"
|
90
152
|
else
|
91
153
|
payload = encode(params)
|
92
154
|
end
|
93
155
|
end
|
94
156
|
|
95
157
|
begin
|
96
|
-
response = http.send_request(method
|
158
|
+
response = @http.send_request(method, uri.request_uri, payload, headers)
|
97
159
|
rescue => error
|
98
160
|
raise Appwrite::Exception.new(error.message)
|
99
161
|
end
|
100
162
|
|
101
163
|
# Handle Redirects
|
102
|
-
if
|
164
|
+
if response.class == Net::HTTPRedirection || response.class == Net::HTTPMovedPermanently
|
103
165
|
location = response['location']
|
104
166
|
uri = URI.parse(uri.scheme + "://" + uri.host + "" + location)
|
105
167
|
|
106
|
-
return fetch(method, uri, headers, {}, limit - 1)
|
168
|
+
return fetch(method, uri, headers, {}, response_type, limit - 1)
|
107
169
|
end
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
170
|
+
|
171
|
+
if response.content_type == 'application/json'
|
172
|
+
begin
|
173
|
+
result = JSON.parse(response.body)
|
174
|
+
rescue JSON::ParserError => e
|
175
|
+
raise Appwrite::Exception.new(response.body, response.code, response)
|
176
|
+
end
|
177
|
+
|
178
|
+
if response.code.to_i >= 400
|
179
|
+
raise Appwrite::Exception.new(result['message'], result['status'], result)
|
180
|
+
end
|
181
|
+
|
182
|
+
unless response_type.respond_to?("from")
|
183
|
+
return result
|
184
|
+
end
|
185
|
+
|
186
|
+
return response_type.from(map: result)
|
113
187
|
end
|
114
188
|
|
115
|
-
if
|
116
|
-
raise Appwrite::Exception.new(
|
189
|
+
if response.code.to_i >= 400
|
190
|
+
raise Appwrite::Exception.new(response.body, response.code, response)
|
117
191
|
end
|
118
192
|
|
119
|
-
return
|
193
|
+
return response.body if response.body_permitted?
|
120
194
|
end
|
121
195
|
|
122
|
-
def
|
196
|
+
def encode_form_data(value, key=nil)
|
123
197
|
case value
|
124
|
-
when Hash
|
125
|
-
|
126
|
-
when
|
198
|
+
when Hash
|
199
|
+
value.map { |k,v| encode_form_data(v,k) }.join
|
200
|
+
when Array
|
201
|
+
value.map { |v| encode_form_data(v, "#{key}[]") }.join
|
202
|
+
when nil
|
203
|
+
''
|
127
204
|
else
|
128
205
|
post_body = []
|
129
|
-
if
|
206
|
+
if value.instance_of? File
|
130
207
|
post_body << "Content-Disposition: form-data; name=\"#{key}\"; filename=\"#{value.name}\"\r\n"
|
131
|
-
post_body << "Content-Type: #{value.
|
208
|
+
post_body << "Content-Type: #{value.mime_type}\r\n\r\n"
|
132
209
|
post_body << value.content
|
133
|
-
post_body << "\r\n--#{@
|
210
|
+
post_body << "\r\n--#{@boundary}--\r\n"
|
134
211
|
else
|
135
212
|
post_body << "Content-Disposition: form-data; name=\"#{key}\"\r\n\r\n"
|
136
213
|
post_body << "#{value.to_s}"
|
137
|
-
post_body << "\r\n--#{@
|
214
|
+
post_body << "\r\n--#{@boundary}\r\n"
|
138
215
|
end
|
139
216
|
post_body.join
|
140
217
|
end
|
@@ -154,4 +231,4 @@ module Appwrite
|
|
154
231
|
root_key.nil? ? key : "#{root_key}[#{key.to_s}]"
|
155
232
|
end
|
156
233
|
end
|
157
|
-
end
|
234
|
+
end
|
data/lib/appwrite/exception.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
module Appwrite
|
2
2
|
class Exception < StandardError
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
def initialize(message, code, response)
|
3
|
+
attr_reader :code
|
4
|
+
attr_reader :response
|
5
|
+
|
6
|
+
def initialize(message, code = 0, response = nil)
|
7
7
|
super(message)
|
8
8
|
@code = code
|
9
9
|
@response = response
|
10
10
|
end
|
11
|
-
attr_reader :code
|
12
|
-
attr_reader :response
|
13
11
|
end
|
14
|
-
end
|
12
|
+
end
|
data/lib/appwrite/file.rb
CHANGED
@@ -2,22 +2,14 @@ require 'mime/types'
|
|
2
2
|
|
3
3
|
module Appwrite
|
4
4
|
class File
|
5
|
+
attr_reader :name
|
6
|
+
attr_reader :content
|
7
|
+
attr_reader :mime_type
|
8
|
+
|
5
9
|
def initialize(path)
|
6
10
|
@name = ::File.basename(path)
|
7
11
|
@content = ::File.read(path)
|
8
|
-
@
|
9
|
-
end
|
10
|
-
|
11
|
-
def name
|
12
|
-
@name
|
13
|
-
end
|
14
|
-
|
15
|
-
def content
|
16
|
-
@content
|
17
|
-
end
|
18
|
-
|
19
|
-
def mimeType
|
20
|
-
@mimeType
|
12
|
+
@mime_type = MIME::Types.type_for(path)
|
21
13
|
end
|
22
14
|
end
|
23
15
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appwrite
|
4
|
+
module Models
|
5
|
+
class AttributeBoolean
|
6
|
+
attr_reader :key
|
7
|
+
attr_reader :type
|
8
|
+
attr_reader :status
|
9
|
+
attr_reader :required
|
10
|
+
attr_reader :array
|
11
|
+
attr_reader :default
|
12
|
+
|
13
|
+
def initialize(
|
14
|
+
key:,
|
15
|
+
type:,
|
16
|
+
status:,
|
17
|
+
required:,
|
18
|
+
array: ,
|
19
|
+
default:
|
20
|
+
)
|
21
|
+
@key = key
|
22
|
+
@type = type
|
23
|
+
@status = status
|
24
|
+
@required = required
|
25
|
+
@array = array
|
26
|
+
@default = default
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.from(map:)
|
30
|
+
AttributeBoolean.new(
|
31
|
+
key: map["key"],
|
32
|
+
type: map["type"],
|
33
|
+
status: map["status"],
|
34
|
+
required: map["required"],
|
35
|
+
array: map["array"],
|
36
|
+
default: map["default"]
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_map
|
41
|
+
{
|
42
|
+
"key": @key,
|
43
|
+
"type": @type,
|
44
|
+
"status": @status,
|
45
|
+
"required": @required,
|
46
|
+
"array": @array,
|
47
|
+
"default": @default
|
48
|
+
}
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appwrite
|
4
|
+
module Models
|
5
|
+
class AttributeEmail
|
6
|
+
attr_reader :key
|
7
|
+
attr_reader :type
|
8
|
+
attr_reader :status
|
9
|
+
attr_reader :required
|
10
|
+
attr_reader :array
|
11
|
+
attr_reader :format
|
12
|
+
attr_reader :default
|
13
|
+
|
14
|
+
def initialize(
|
15
|
+
key:,
|
16
|
+
type:,
|
17
|
+
status:,
|
18
|
+
required:,
|
19
|
+
array: ,
|
20
|
+
format:,
|
21
|
+
default:
|
22
|
+
)
|
23
|
+
@key = key
|
24
|
+
@type = type
|
25
|
+
@status = status
|
26
|
+
@required = required
|
27
|
+
@array = array
|
28
|
+
@format = format
|
29
|
+
@default = default
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.from(map:)
|
33
|
+
AttributeEmail.new(
|
34
|
+
key: map["key"],
|
35
|
+
type: map["type"],
|
36
|
+
status: map["status"],
|
37
|
+
required: map["required"],
|
38
|
+
array: map["array"],
|
39
|
+
format: map["format"],
|
40
|
+
default: map["default"]
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_map
|
45
|
+
{
|
46
|
+
"key": @key,
|
47
|
+
"type": @type,
|
48
|
+
"status": @status,
|
49
|
+
"required": @required,
|
50
|
+
"array": @array,
|
51
|
+
"format": @format,
|
52
|
+
"default": @default
|
53
|
+
}
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appwrite
|
4
|
+
module Models
|
5
|
+
class AttributeEnum
|
6
|
+
attr_reader :key
|
7
|
+
attr_reader :type
|
8
|
+
attr_reader :status
|
9
|
+
attr_reader :required
|
10
|
+
attr_reader :array
|
11
|
+
attr_reader :elements
|
12
|
+
attr_reader :format
|
13
|
+
attr_reader :default
|
14
|
+
|
15
|
+
def initialize(
|
16
|
+
key:,
|
17
|
+
type:,
|
18
|
+
status:,
|
19
|
+
required:,
|
20
|
+
array: ,
|
21
|
+
elements:,
|
22
|
+
format:,
|
23
|
+
default:
|
24
|
+
)
|
25
|
+
@key = key
|
26
|
+
@type = type
|
27
|
+
@status = status
|
28
|
+
@required = required
|
29
|
+
@array = array
|
30
|
+
@elements = elements
|
31
|
+
@format = format
|
32
|
+
@default = default
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.from(map:)
|
36
|
+
AttributeEnum.new(
|
37
|
+
key: map["key"],
|
38
|
+
type: map["type"],
|
39
|
+
status: map["status"],
|
40
|
+
required: map["required"],
|
41
|
+
array: map["array"],
|
42
|
+
elements: map["elements"],
|
43
|
+
format: map["format"],
|
44
|
+
default: map["default"]
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_map
|
49
|
+
{
|
50
|
+
"key": @key,
|
51
|
+
"type": @type,
|
52
|
+
"status": @status,
|
53
|
+
"required": @required,
|
54
|
+
"array": @array,
|
55
|
+
"elements": @elements,
|
56
|
+
"format": @format,
|
57
|
+
"default": @default
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appwrite
|
4
|
+
module Models
|
5
|
+
class AttributeFloat
|
6
|
+
attr_reader :key
|
7
|
+
attr_reader :type
|
8
|
+
attr_reader :status
|
9
|
+
attr_reader :required
|
10
|
+
attr_reader :array
|
11
|
+
attr_reader :min
|
12
|
+
attr_reader :max
|
13
|
+
attr_reader :default
|
14
|
+
|
15
|
+
def initialize(
|
16
|
+
key:,
|
17
|
+
type:,
|
18
|
+
status:,
|
19
|
+
required:,
|
20
|
+
array: ,
|
21
|
+
min: ,
|
22
|
+
max: ,
|
23
|
+
default:
|
24
|
+
)
|
25
|
+
@key = key
|
26
|
+
@type = type
|
27
|
+
@status = status
|
28
|
+
@required = required
|
29
|
+
@array = array
|
30
|
+
@min = min
|
31
|
+
@max = max
|
32
|
+
@default = default
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.from(map:)
|
36
|
+
AttributeFloat.new(
|
37
|
+
key: map["key"],
|
38
|
+
type: map["type"],
|
39
|
+
status: map["status"],
|
40
|
+
required: map["required"],
|
41
|
+
array: map["array"],
|
42
|
+
min: map["min"],
|
43
|
+
max: map["max"],
|
44
|
+
default: map["default"]
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_map
|
49
|
+
{
|
50
|
+
"key": @key,
|
51
|
+
"type": @type,
|
52
|
+
"status": @status,
|
53
|
+
"required": @required,
|
54
|
+
"array": @array,
|
55
|
+
"min": @min,
|
56
|
+
"max": @max,
|
57
|
+
"default": @default
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appwrite
|
4
|
+
module Models
|
5
|
+
class AttributeInteger
|
6
|
+
attr_reader :key
|
7
|
+
attr_reader :type
|
8
|
+
attr_reader :status
|
9
|
+
attr_reader :required
|
10
|
+
attr_reader :array
|
11
|
+
attr_reader :min
|
12
|
+
attr_reader :max
|
13
|
+
attr_reader :default
|
14
|
+
|
15
|
+
def initialize(
|
16
|
+
key:,
|
17
|
+
type:,
|
18
|
+
status:,
|
19
|
+
required:,
|
20
|
+
array: ,
|
21
|
+
min: ,
|
22
|
+
max: ,
|
23
|
+
default:
|
24
|
+
)
|
25
|
+
@key = key
|
26
|
+
@type = type
|
27
|
+
@status = status
|
28
|
+
@required = required
|
29
|
+
@array = array
|
30
|
+
@min = min
|
31
|
+
@max = max
|
32
|
+
@default = default
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.from(map:)
|
36
|
+
AttributeInteger.new(
|
37
|
+
key: map["key"],
|
38
|
+
type: map["type"],
|
39
|
+
status: map["status"],
|
40
|
+
required: map["required"],
|
41
|
+
array: map["array"],
|
42
|
+
min: map["min"],
|
43
|
+
max: map["max"],
|
44
|
+
default: map["default"]
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_map
|
49
|
+
{
|
50
|
+
"key": @key,
|
51
|
+
"type": @type,
|
52
|
+
"status": @status,
|
53
|
+
"required": @required,
|
54
|
+
"array": @array,
|
55
|
+
"min": @min,
|
56
|
+
"max": @max,
|
57
|
+
"default": @default
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|