appwrite 2.2.0 → 3.0.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/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,58 +1,93 @@
|
|
|
1
|
+
#frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Appwrite
|
|
2
4
|
class Storage < Service
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
include Models
|
|
7
|
+
# Get a list of all the user files. You can use the query params to filter
|
|
8
|
+
# your results. On admin mode, this endpoint will return a list of all of the
|
|
9
|
+
# project's files. [Learn more about different API modes](/docs/admin).
|
|
10
|
+
#
|
|
11
|
+
# @param [string] search Search term to filter your list results. Max length: 256 chars.
|
|
12
|
+
# @param [number] limit Maximum number of files to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.
|
|
13
|
+
# @param [number] offset Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)
|
|
14
|
+
# @param [string] cursor ID of the file used as the starting point for the query, excluding the file itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)
|
|
15
|
+
# @param [string] cursor_direction Direction of the cursor.
|
|
16
|
+
# @param [string] order_type Order result by ASC or DESC order.
|
|
17
|
+
#
|
|
18
|
+
# @return [FileList]
|
|
19
|
+
def list_files(search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil)
|
|
5
20
|
path = '/storage/files'
|
|
6
21
|
|
|
7
|
-
params = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
params = {
|
|
23
|
+
search: search,
|
|
24
|
+
limit: limit,
|
|
25
|
+
offset: offset,
|
|
26
|
+
cursor: cursor,
|
|
27
|
+
cursorDirection: cursor_direction,
|
|
28
|
+
orderType: order_type,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
headers = {
|
|
32
|
+
"content-type": 'application/json',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@client.call(
|
|
36
|
+
method: 'GET',
|
|
37
|
+
path: path,
|
|
38
|
+
params: params,
|
|
39
|
+
headers: headers,
|
|
40
|
+
response_type: FileList
|
|
41
|
+
)
|
|
42
|
+
end
|
|
20
43
|
|
|
21
|
-
|
|
22
|
-
|
|
44
|
+
# Create a new file. The user who creates the file will automatically be
|
|
45
|
+
# assigned to read and write access unless he has passed custom values for
|
|
46
|
+
# read and write arguments.
|
|
47
|
+
#
|
|
48
|
+
# @param [string] file_id File ID. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
49
|
+
# @param [File] file Binary file.
|
|
50
|
+
# @param [array] read An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.
|
|
51
|
+
# @param [array] write An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.
|
|
52
|
+
#
|
|
53
|
+
# @return [File]
|
|
54
|
+
def create_file(file_id:, file:, read: nil, write: nil)
|
|
55
|
+
if file_id.nil?
|
|
56
|
+
raise Appwrite::Exception.new('Missing required parameter: "fileId"')
|
|
23
57
|
end
|
|
24
58
|
|
|
25
|
-
return @client.call('get', path, {
|
|
26
|
-
'content-type' => 'application/json',
|
|
27
|
-
}, params);
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def create_file(file:, read: nil, write: nil)
|
|
31
59
|
if file.nil?
|
|
32
60
|
raise Appwrite::Exception.new('Missing required parameter: "file"')
|
|
33
61
|
end
|
|
34
62
|
|
|
35
63
|
path = '/storage/files'
|
|
36
64
|
|
|
37
|
-
params = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
65
|
+
params = {
|
|
66
|
+
fileId: file_id,
|
|
67
|
+
file: file,
|
|
68
|
+
read: read,
|
|
69
|
+
write: write,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
headers = {
|
|
73
|
+
"content-type": 'multipart/form-data',
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@client.call(
|
|
77
|
+
method: 'POST',
|
|
78
|
+
path: path,
|
|
79
|
+
params: params,
|
|
80
|
+
headers: headers,
|
|
81
|
+
response_type: File
|
|
82
|
+
)
|
|
54
83
|
end
|
|
55
84
|
|
|
85
|
+
# Get a file by its unique ID. This endpoint response returns a JSON object
|
|
86
|
+
# with the file metadata.
|
|
87
|
+
#
|
|
88
|
+
# @param [string] file_id File ID.
|
|
89
|
+
#
|
|
90
|
+
# @return [File]
|
|
56
91
|
def get_file(file_id:)
|
|
57
92
|
if file_id.nil?
|
|
58
93
|
raise Appwrite::Exception.new('Missing required parameter: "fileId"')
|
|
@@ -61,13 +96,30 @@ module Appwrite
|
|
|
61
96
|
path = '/storage/files/{fileId}'
|
|
62
97
|
.gsub('{fileId}', file_id)
|
|
63
98
|
|
|
64
|
-
params = {
|
|
99
|
+
params = {
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
headers = {
|
|
103
|
+
"content-type": 'application/json',
|
|
104
|
+
}
|
|
65
105
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
106
|
+
@client.call(
|
|
107
|
+
method: 'GET',
|
|
108
|
+
path: path,
|
|
109
|
+
params: params,
|
|
110
|
+
headers: headers,
|
|
111
|
+
response_type: File
|
|
112
|
+
)
|
|
69
113
|
end
|
|
70
114
|
|
|
115
|
+
# Update a file by its unique ID. Only users with write permissions have
|
|
116
|
+
# access to update this resource.
|
|
117
|
+
#
|
|
118
|
+
# @param [string] file_id File ID.
|
|
119
|
+
# @param [array] read An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.
|
|
120
|
+
# @param [array] write An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.
|
|
121
|
+
#
|
|
122
|
+
# @return [File]
|
|
71
123
|
def update_file(file_id:, read:, write:)
|
|
72
124
|
if file_id.nil?
|
|
73
125
|
raise Appwrite::Exception.new('Missing required parameter: "fileId"')
|
|
@@ -84,21 +136,30 @@ module Appwrite
|
|
|
84
136
|
path = '/storage/files/{fileId}'
|
|
85
137
|
.gsub('{fileId}', file_id)
|
|
86
138
|
|
|
87
|
-
params = {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
139
|
+
params = {
|
|
140
|
+
read: read,
|
|
141
|
+
write: write,
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
headers = {
|
|
145
|
+
"content-type": 'application/json',
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@client.call(
|
|
149
|
+
method: 'PUT',
|
|
150
|
+
path: path,
|
|
151
|
+
params: params,
|
|
152
|
+
headers: headers,
|
|
153
|
+
response_type: File
|
|
154
|
+
)
|
|
100
155
|
end
|
|
101
156
|
|
|
157
|
+
# Delete a file by its unique ID. Only users with write permissions have
|
|
158
|
+
# access to delete this resource.
|
|
159
|
+
#
|
|
160
|
+
# @param [string] file_id File ID.
|
|
161
|
+
#
|
|
162
|
+
# @return []
|
|
102
163
|
def delete_file(file_id:)
|
|
103
164
|
if file_id.nil?
|
|
104
165
|
raise Appwrite::Exception.new('Missing required parameter: "fileId"')
|
|
@@ -107,13 +168,28 @@ module Appwrite
|
|
|
107
168
|
path = '/storage/files/{fileId}'
|
|
108
169
|
.gsub('{fileId}', file_id)
|
|
109
170
|
|
|
110
|
-
params = {
|
|
171
|
+
params = {
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
headers = {
|
|
175
|
+
"content-type": 'application/json',
|
|
176
|
+
}
|
|
111
177
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
178
|
+
@client.call(
|
|
179
|
+
method: 'DELETE',
|
|
180
|
+
path: path,
|
|
181
|
+
params: params,
|
|
182
|
+
headers: headers,
|
|
183
|
+
)
|
|
115
184
|
end
|
|
116
185
|
|
|
186
|
+
# Get a file content by its unique ID. The endpoint response return with a
|
|
187
|
+
# 'Content-Disposition: attachment' header that tells the browser to start
|
|
188
|
+
# downloading the file to user downloads directory.
|
|
189
|
+
#
|
|
190
|
+
# @param [string] file_id File ID.
|
|
191
|
+
#
|
|
192
|
+
# @return []
|
|
117
193
|
def get_file_download(file_id:)
|
|
118
194
|
if file_id.nil?
|
|
119
195
|
raise Appwrite::Exception.new('Missing required parameter: "fileId"')
|
|
@@ -122,14 +198,41 @@ module Appwrite
|
|
|
122
198
|
path = '/storage/files/{fileId}/download'
|
|
123
199
|
.gsub('{fileId}', file_id)
|
|
124
200
|
|
|
125
|
-
params = {
|
|
201
|
+
params = {
|
|
202
|
+
}
|
|
126
203
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
204
|
+
headers = {
|
|
205
|
+
"content-type": 'application/json',
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@client.call(
|
|
209
|
+
method: 'GET',
|
|
210
|
+
path: path,
|
|
211
|
+
params: params,
|
|
212
|
+
headers: headers,
|
|
213
|
+
)
|
|
130
214
|
end
|
|
131
215
|
|
|
132
|
-
|
|
216
|
+
# Get a file preview image. Currently, this method supports preview for image
|
|
217
|
+
# files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
|
|
218
|
+
# and spreadsheets, will return the file icon image. You can also pass query
|
|
219
|
+
# string arguments for cutting and resizing your preview image.
|
|
220
|
+
#
|
|
221
|
+
# @param [string] file_id File ID.
|
|
222
|
+
# @param [number] width Resize preview image width, Pass an integer between 0 to 4000.
|
|
223
|
+
# @param [number] height Resize preview image height, Pass an integer between 0 to 4000.
|
|
224
|
+
# @param [string] gravity Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
|
|
225
|
+
# @param [number] quality Preview image quality. Pass an integer between 0 to 100. Defaults to 100.
|
|
226
|
+
# @param [number] border_width Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.
|
|
227
|
+
# @param [string] border_color Preview image border color. Use a valid HEX color, no # is needed for prefix.
|
|
228
|
+
# @param [number] border_radius Preview image border radius in pixels. Pass an integer between 0 to 4000.
|
|
229
|
+
# @param [number] opacity Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.
|
|
230
|
+
# @param [number] rotation Preview image rotation in degrees. Pass an integer between -360 and 360.
|
|
231
|
+
# @param [string] background Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.
|
|
232
|
+
# @param [string] output Output format type (jpeg, jpg, png, gif and webp).
|
|
233
|
+
#
|
|
234
|
+
# @return []
|
|
235
|
+
def get_file_preview(file_id:, width: nil, height: nil, gravity: nil, quality: nil, border_width: nil, border_color: nil, border_radius: nil, opacity: nil, rotation: nil, background: nil, output: nil)
|
|
133
236
|
if file_id.nil?
|
|
134
237
|
raise Appwrite::Exception.new('Missing required parameter: "fileId"')
|
|
135
238
|
end
|
|
@@ -137,53 +240,39 @@ module Appwrite
|
|
|
137
240
|
path = '/storage/files/{fileId}/preview'
|
|
138
241
|
.gsub('{fileId}', file_id)
|
|
139
242
|
|
|
140
|
-
params = {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
if !opacity.nil?
|
|
167
|
-
params[:opacity] = opacity
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
if !rotation.nil?
|
|
171
|
-
params[:rotation] = rotation
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
if !background.nil?
|
|
175
|
-
params[:background] = background
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
if !output.nil?
|
|
179
|
-
params[:output] = output
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
return @client.call('get', path, {
|
|
183
|
-
'content-type' => 'application/json',
|
|
184
|
-
}, params);
|
|
243
|
+
params = {
|
|
244
|
+
width: width,
|
|
245
|
+
height: height,
|
|
246
|
+
gravity: gravity,
|
|
247
|
+
quality: quality,
|
|
248
|
+
borderWidth: border_width,
|
|
249
|
+
borderColor: border_color,
|
|
250
|
+
borderRadius: border_radius,
|
|
251
|
+
opacity: opacity,
|
|
252
|
+
rotation: rotation,
|
|
253
|
+
background: background,
|
|
254
|
+
output: output,
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
headers = {
|
|
258
|
+
"content-type": 'application/json',
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
@client.call(
|
|
262
|
+
method: 'GET',
|
|
263
|
+
path: path,
|
|
264
|
+
params: params,
|
|
265
|
+
headers: headers,
|
|
266
|
+
)
|
|
185
267
|
end
|
|
186
268
|
|
|
269
|
+
# Get a file content by its unique ID. This endpoint is similar to the
|
|
270
|
+
# download method but returns with no 'Content-Disposition: attachment'
|
|
271
|
+
# header.
|
|
272
|
+
#
|
|
273
|
+
# @param [string] file_id File ID.
|
|
274
|
+
#
|
|
275
|
+
# @return []
|
|
187
276
|
def get_file_view(file_id:)
|
|
188
277
|
if file_id.nil?
|
|
189
278
|
raise Appwrite::Exception.new('Missing required parameter: "fileId"')
|
|
@@ -192,16 +281,20 @@ module Appwrite
|
|
|
192
281
|
path = '/storage/files/{fileId}/view'
|
|
193
282
|
.gsub('{fileId}', file_id)
|
|
194
283
|
|
|
195
|
-
params = {
|
|
196
|
-
|
|
197
|
-
return @client.call('get', path, {
|
|
198
|
-
'content-type' => 'application/json',
|
|
199
|
-
}, params);
|
|
200
|
-
end
|
|
284
|
+
params = {
|
|
285
|
+
}
|
|
201
286
|
|
|
287
|
+
headers = {
|
|
288
|
+
"content-type": 'application/json',
|
|
289
|
+
}
|
|
202
290
|
|
|
203
|
-
|
|
291
|
+
@client.call(
|
|
292
|
+
method: 'GET',
|
|
293
|
+
path: path,
|
|
294
|
+
params: params,
|
|
295
|
+
headers: headers,
|
|
296
|
+
)
|
|
297
|
+
end
|
|
204
298
|
|
|
205
|
-
private
|
|
206
299
|
end
|
|
207
300
|
end
|