groupdocs_storage_cloud 18.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/GroupDocs/Storage/api/storage_api.rb +982 -0
- data/lib/GroupDocs/Storage/api_client.rb +408 -0
- data/lib/GroupDocs/Storage/api_error.rb +54 -0
- data/lib/GroupDocs/Storage/configuration.rb +203 -0
- data/lib/GroupDocs/Storage/models/copy_file_response.rb +214 -0
- data/lib/GroupDocs/Storage/models/create_folder_response.rb +214 -0
- data/lib/GroupDocs/Storage/models/disc_usage.rb +219 -0
- data/lib/GroupDocs/Storage/models/disc_usage_response.rb +223 -0
- data/lib/GroupDocs/Storage/models/file_exist.rb +219 -0
- data/lib/GroupDocs/Storage/models/file_exist_response.rb +223 -0
- data/lib/GroupDocs/Storage/models/file_response.rb +265 -0
- data/lib/GroupDocs/Storage/models/file_version.rb +283 -0
- data/lib/GroupDocs/Storage/models/file_versions_response.rb +225 -0
- data/lib/GroupDocs/Storage/models/files_response.rb +225 -0
- data/lib/GroupDocs/Storage/models/group_docs_response.rb +214 -0
- data/lib/GroupDocs/Storage/models/move_file_response.rb +214 -0
- data/lib/GroupDocs/Storage/models/move_folder_response.rb +214 -0
- data/lib/GroupDocs/Storage/models/remove_file_response.rb +214 -0
- data/lib/GroupDocs/Storage/models/remove_folder_response.rb +214 -0
- data/lib/GroupDocs/Storage/models/requests/delete_file_request.rb +57 -0
- data/lib/GroupDocs/Storage/models/requests/delete_folder_request.rb +57 -0
- data/lib/GroupDocs/Storage/models/requests/get_disc_usage_request.rb +47 -0
- data/lib/GroupDocs/Storage/models/requests/get_download_request.rb +57 -0
- data/lib/GroupDocs/Storage/models/requests/get_is_exist_request.rb +57 -0
- data/lib/GroupDocs/Storage/models/requests/get_is_storage_exist_request.rb +47 -0
- data/lib/GroupDocs/Storage/models/requests/get_list_file_versions_request.rb +52 -0
- data/lib/GroupDocs/Storage/models/requests/get_list_files_request.rb +52 -0
- data/lib/GroupDocs/Storage/models/requests/post_move_file_request.rb +67 -0
- data/lib/GroupDocs/Storage/models/requests/post_move_folder_request.rb +62 -0
- data/lib/GroupDocs/Storage/models/requests/put_copy_folder_request.rb +62 -0
- data/lib/GroupDocs/Storage/models/requests/put_copy_request.rb +67 -0
- data/lib/GroupDocs/Storage/models/requests/put_create_folder_request.rb +57 -0
- data/lib/GroupDocs/Storage/models/requests/put_create_request.rb +62 -0
- data/lib/GroupDocs/Storage/models/storage_exist_response.rb +223 -0
- data/lib/GroupDocs/Storage/models/upload_response.rb +214 -0
- data/lib/GroupDocs/Storage/version.rb +29 -0
- data/lib/groupdocs_storage_cloud.rb +71 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: df1ca3b6e590551e108c207edfcc3980e0769f7e06c357149265fe97f663f976
|
4
|
+
data.tar.gz: 1383ad34f7f6478f8e6e3b37efe129af66161a38b0cb8f07b1cca5875f4588e8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a49a068596b1e621ed99231c36e6015cb4f998b0d1e40c0f5fe962a4aebf8c9ef7e64d15db5a41a545306e86606aba2392067083388b6f4488be483977c2ff37
|
7
|
+
data.tar.gz: 3df5c4d5a9ed48ff238dddc3ade723d9d76844a094ca4b13f41a5fc331eeb2d1241baed43b1f2b91feac7bfaeff3b2a31f30f0286c27892dfdffe4cc19e6668f
|
@@ -0,0 +1,982 @@
|
|
1
|
+
# --------------------------------------------------------------------------------------------------------------------
|
2
|
+
# <copyright company="Aspose Pty Ltd" file="storage_api.rb">
|
3
|
+
# Copyright (c) 2018 GroupDocs.Storage for Cloud
|
4
|
+
# </copyright>
|
5
|
+
# <summary>
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
# </summary>
|
24
|
+
# --------------------------------------------------------------------------------------------------------------------
|
25
|
+
|
26
|
+
require 'uri'
|
27
|
+
|
28
|
+
module GroupDocsStorageCloud
|
29
|
+
#
|
30
|
+
# GroupDocs.Storage for Cloud API
|
31
|
+
#
|
32
|
+
class StorageApi
|
33
|
+
attr_accessor :api_client
|
34
|
+
|
35
|
+
def initialize(api_client = ApiClient.default)
|
36
|
+
@api_client = api_client
|
37
|
+
require_all '../models/requests'
|
38
|
+
end
|
39
|
+
|
40
|
+
# Remove a specific file
|
41
|
+
#
|
42
|
+
# @param request DeleteFileRequest
|
43
|
+
# @return [RemoveFileResponse]
|
44
|
+
def delete_file(request)
|
45
|
+
data, _status_code, _headers = delete_file_with_http_info(request)
|
46
|
+
data
|
47
|
+
end
|
48
|
+
|
49
|
+
# Remove a specific file
|
50
|
+
#
|
51
|
+
# @param request DeleteFileRequest
|
52
|
+
# @return [Array<(RemoveFileResponse, Fixnum, Hash)>]
|
53
|
+
# RemoveFileResponse data, response status code and response headers
|
54
|
+
private def delete_file_with_http_info(request)
|
55
|
+
unless request.is_a? DeleteFileRequest
|
56
|
+
raise ArgumentError, 'Incorrect request type'
|
57
|
+
end
|
58
|
+
|
59
|
+
if @api_client.config.debugging
|
60
|
+
@api_client.config.logger.debug 'Calling API: StorageApi.delete_file ...'
|
61
|
+
end
|
62
|
+
# verify the required parameter 'path' is set
|
63
|
+
if @api_client.config.client_side_validation && request.path.nil?
|
64
|
+
raise ArgumentError, 'Missing the required parameter path when calling StorageApi.delete_file'
|
65
|
+
end
|
66
|
+
# resource path
|
67
|
+
local_var_path = '/storage/file'
|
68
|
+
|
69
|
+
# query parameters
|
70
|
+
query_params = {}
|
71
|
+
query_params[downcase_first_letter('path')] = request.path
|
72
|
+
query_params[downcase_first_letter('path')] = request.path unless request.path.nil?
|
73
|
+
query_params[downcase_first_letter('versionId')] = request.version_id unless request.version_id.nil?
|
74
|
+
query_params[downcase_first_letter('storage')] = request.storage unless request.storage.nil?
|
75
|
+
|
76
|
+
# header parameters
|
77
|
+
header_params = {}
|
78
|
+
# HTTP header 'Accept' (if needed)
|
79
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
80
|
+
# HTTP header 'Content-Type'
|
81
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
82
|
+
|
83
|
+
# form parameters
|
84
|
+
form_params = {}
|
85
|
+
|
86
|
+
request_token
|
87
|
+
# http body (model)
|
88
|
+
post_body = nil
|
89
|
+
auth_names = ['oauth']
|
90
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
91
|
+
header_params: header_params,
|
92
|
+
query_params: query_params,
|
93
|
+
form_params: form_params,
|
94
|
+
body: post_body,
|
95
|
+
auth_names: auth_names,
|
96
|
+
return_type: 'RemoveFileResponse')
|
97
|
+
if @api_client.config.debugging
|
98
|
+
@api_client.config.logger.debug "API called:
|
99
|
+
StorageApi#delete_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
100
|
+
end
|
101
|
+
[data, status_code, headers]
|
102
|
+
end
|
103
|
+
|
104
|
+
# Remove a specific folder
|
105
|
+
#
|
106
|
+
# @param request DeleteFolderRequest
|
107
|
+
# @return [RemoveFolderResponse]
|
108
|
+
def delete_folder(request)
|
109
|
+
data, _status_code, _headers = delete_folder_with_http_info(request)
|
110
|
+
data
|
111
|
+
end
|
112
|
+
|
113
|
+
# Remove a specific folder
|
114
|
+
#
|
115
|
+
# @param request DeleteFolderRequest
|
116
|
+
# @return [Array<(RemoveFolderResponse, Fixnum, Hash)>]
|
117
|
+
# RemoveFolderResponse data, response status code and response headers
|
118
|
+
private def delete_folder_with_http_info(request)
|
119
|
+
unless request.is_a? DeleteFolderRequest
|
120
|
+
raise ArgumentError, 'Incorrect request type'
|
121
|
+
end
|
122
|
+
|
123
|
+
if @api_client.config.debugging
|
124
|
+
@api_client.config.logger.debug 'Calling API: StorageApi.delete_folder ...'
|
125
|
+
end
|
126
|
+
# verify the required parameter 'path' is set
|
127
|
+
if @api_client.config.client_side_validation && request.path.nil?
|
128
|
+
raise ArgumentError, 'Missing the required parameter path when calling StorageApi.delete_folder'
|
129
|
+
end
|
130
|
+
# resource path
|
131
|
+
local_var_path = '/storage/folder'
|
132
|
+
|
133
|
+
# query parameters
|
134
|
+
query_params = {}
|
135
|
+
query_params[downcase_first_letter('path')] = request.path
|
136
|
+
query_params[downcase_first_letter('path')] = request.path unless request.path.nil?
|
137
|
+
query_params[downcase_first_letter('storage')] = request.storage unless request.storage.nil?
|
138
|
+
query_params[downcase_first_letter('recursive')] = request.recursive unless request.recursive.nil?
|
139
|
+
|
140
|
+
# header parameters
|
141
|
+
header_params = {}
|
142
|
+
# HTTP header 'Accept' (if needed)
|
143
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
144
|
+
# HTTP header 'Content-Type'
|
145
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
146
|
+
|
147
|
+
# form parameters
|
148
|
+
form_params = {}
|
149
|
+
|
150
|
+
request_token
|
151
|
+
# http body (model)
|
152
|
+
post_body = nil
|
153
|
+
auth_names = ['oauth']
|
154
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
155
|
+
header_params: header_params,
|
156
|
+
query_params: query_params,
|
157
|
+
form_params: form_params,
|
158
|
+
body: post_body,
|
159
|
+
auth_names: auth_names,
|
160
|
+
return_type: 'RemoveFolderResponse')
|
161
|
+
if @api_client.config.debugging
|
162
|
+
@api_client.config.logger.debug "API called:
|
163
|
+
StorageApi#delete_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
164
|
+
end
|
165
|
+
[data, status_code, headers]
|
166
|
+
end
|
167
|
+
|
168
|
+
# Check the disk usage of the current account
|
169
|
+
#
|
170
|
+
# @param request GetDiscUsageRequest
|
171
|
+
# @return [DiscUsageResponse]
|
172
|
+
def get_disc_usage(request)
|
173
|
+
data, _status_code, _headers = get_disc_usage_with_http_info(request)
|
174
|
+
data
|
175
|
+
end
|
176
|
+
|
177
|
+
# Check the disk usage of the current account
|
178
|
+
#
|
179
|
+
# @param request GetDiscUsageRequest
|
180
|
+
# @return [Array<(DiscUsageResponse, Fixnum, Hash)>]
|
181
|
+
# DiscUsageResponse data, response status code and response headers
|
182
|
+
private def get_disc_usage_with_http_info(request)
|
183
|
+
unless request.is_a? GetDiscUsageRequest
|
184
|
+
raise ArgumentError, 'Incorrect request type'
|
185
|
+
end
|
186
|
+
|
187
|
+
if @api_client.config.debugging
|
188
|
+
@api_client.config.logger.debug 'Calling API: StorageApi.get_disc_usage ...'
|
189
|
+
end
|
190
|
+
# resource path
|
191
|
+
local_var_path = '/storage/disc'
|
192
|
+
|
193
|
+
# query parameters
|
194
|
+
query_params = {}
|
195
|
+
query_params[downcase_first_letter('storage')] = request.storage unless request.storage.nil?
|
196
|
+
|
197
|
+
# header parameters
|
198
|
+
header_params = {}
|
199
|
+
# HTTP header 'Accept' (if needed)
|
200
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
201
|
+
# HTTP header 'Content-Type'
|
202
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
203
|
+
|
204
|
+
# form parameters
|
205
|
+
form_params = {}
|
206
|
+
|
207
|
+
request_token
|
208
|
+
# http body (model)
|
209
|
+
post_body = nil
|
210
|
+
auth_names = ['oauth']
|
211
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
212
|
+
header_params: header_params,
|
213
|
+
query_params: query_params,
|
214
|
+
form_params: form_params,
|
215
|
+
body: post_body,
|
216
|
+
auth_names: auth_names,
|
217
|
+
return_type: 'DiscUsageResponse')
|
218
|
+
if @api_client.config.debugging
|
219
|
+
@api_client.config.logger.debug "API called:
|
220
|
+
StorageApi#get_disc_usage\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
221
|
+
end
|
222
|
+
[data, status_code, headers]
|
223
|
+
end
|
224
|
+
|
225
|
+
# Download a specific file
|
226
|
+
#
|
227
|
+
# @param request GetDownloadRequest
|
228
|
+
# @return [File]
|
229
|
+
def get_download(request)
|
230
|
+
data, _status_code, _headers = get_download_with_http_info(request)
|
231
|
+
data
|
232
|
+
end
|
233
|
+
|
234
|
+
# Download a specific file
|
235
|
+
#
|
236
|
+
# @param request GetDownloadRequest
|
237
|
+
# @return [Array<(File, Fixnum, Hash)>]
|
238
|
+
# File data, response status code and response headers
|
239
|
+
private def get_download_with_http_info(request)
|
240
|
+
unless request.is_a? GetDownloadRequest
|
241
|
+
raise ArgumentError, 'Incorrect request type'
|
242
|
+
end
|
243
|
+
|
244
|
+
if @api_client.config.debugging
|
245
|
+
@api_client.config.logger.debug 'Calling API: StorageApi.get_download ...'
|
246
|
+
end
|
247
|
+
# verify the required parameter 'path' is set
|
248
|
+
if @api_client.config.client_side_validation && request.path.nil?
|
249
|
+
raise ArgumentError, 'Missing the required parameter path when calling StorageApi.get_download'
|
250
|
+
end
|
251
|
+
# resource path
|
252
|
+
local_var_path = '/storage/file'
|
253
|
+
|
254
|
+
# query parameters
|
255
|
+
query_params = {}
|
256
|
+
query_params[downcase_first_letter('path')] = request.path
|
257
|
+
query_params[downcase_first_letter('path')] = request.path unless request.path.nil?
|
258
|
+
query_params[downcase_first_letter('versionId')] = request.version_id unless request.version_id.nil?
|
259
|
+
query_params[downcase_first_letter('storage')] = request.storage unless request.storage.nil?
|
260
|
+
|
261
|
+
# header parameters
|
262
|
+
header_params = {}
|
263
|
+
# HTTP header 'Accept' (if needed)
|
264
|
+
header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])
|
265
|
+
# HTTP header 'Content-Type'
|
266
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
267
|
+
|
268
|
+
# form parameters
|
269
|
+
form_params = {}
|
270
|
+
|
271
|
+
request_token
|
272
|
+
# http body (model)
|
273
|
+
post_body = nil
|
274
|
+
auth_names = ['oauth']
|
275
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
276
|
+
header_params: header_params,
|
277
|
+
query_params: query_params,
|
278
|
+
form_params: form_params,
|
279
|
+
body: post_body,
|
280
|
+
auth_names: auth_names,
|
281
|
+
return_type: 'File')
|
282
|
+
if @api_client.config.debugging
|
283
|
+
@api_client.config.logger.debug "API called:
|
284
|
+
StorageApi#get_download\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
285
|
+
end
|
286
|
+
[data, status_code, headers]
|
287
|
+
end
|
288
|
+
|
289
|
+
# Check if a specific file or folder exists
|
290
|
+
#
|
291
|
+
# @param request GetIsExistRequest
|
292
|
+
# @return [FileExistResponse]
|
293
|
+
def get_is_exist(request)
|
294
|
+
data, _status_code, _headers = get_is_exist_with_http_info(request)
|
295
|
+
data
|
296
|
+
end
|
297
|
+
|
298
|
+
# Check if a specific file or folder exists
|
299
|
+
#
|
300
|
+
# @param request GetIsExistRequest
|
301
|
+
# @return [Array<(FileExistResponse, Fixnum, Hash)>]
|
302
|
+
# FileExistResponse data, response status code and response headers
|
303
|
+
private def get_is_exist_with_http_info(request)
|
304
|
+
unless request.is_a? GetIsExistRequest
|
305
|
+
raise ArgumentError, 'Incorrect request type'
|
306
|
+
end
|
307
|
+
|
308
|
+
if @api_client.config.debugging
|
309
|
+
@api_client.config.logger.debug 'Calling API: StorageApi.get_is_exist ...'
|
310
|
+
end
|
311
|
+
# verify the required parameter 'path' is set
|
312
|
+
if @api_client.config.client_side_validation && request.path.nil?
|
313
|
+
raise ArgumentError, 'Missing the required parameter path when calling StorageApi.get_is_exist'
|
314
|
+
end
|
315
|
+
# resource path
|
316
|
+
local_var_path = '/storage/exist'
|
317
|
+
|
318
|
+
# query parameters
|
319
|
+
query_params = {}
|
320
|
+
query_params[downcase_first_letter('path')] = request.path
|
321
|
+
query_params[downcase_first_letter('path')] = request.path unless request.path.nil?
|
322
|
+
query_params[downcase_first_letter('versionId')] = request.version_id unless request.version_id.nil?
|
323
|
+
query_params[downcase_first_letter('storage')] = request.storage unless request.storage.nil?
|
324
|
+
|
325
|
+
# header parameters
|
326
|
+
header_params = {}
|
327
|
+
# HTTP header 'Accept' (if needed)
|
328
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
329
|
+
# HTTP header 'Content-Type'
|
330
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
331
|
+
|
332
|
+
# form parameters
|
333
|
+
form_params = {}
|
334
|
+
|
335
|
+
request_token
|
336
|
+
# http body (model)
|
337
|
+
post_body = nil
|
338
|
+
auth_names = ['oauth']
|
339
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
340
|
+
header_params: header_params,
|
341
|
+
query_params: query_params,
|
342
|
+
form_params: form_params,
|
343
|
+
body: post_body,
|
344
|
+
auth_names: auth_names,
|
345
|
+
return_type: 'FileExistResponse')
|
346
|
+
if @api_client.config.debugging
|
347
|
+
@api_client.config.logger.debug "API called:
|
348
|
+
StorageApi#get_is_exist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
349
|
+
end
|
350
|
+
[data, status_code, headers]
|
351
|
+
end
|
352
|
+
|
353
|
+
# Check if storage exists
|
354
|
+
#
|
355
|
+
# @param request GetIsStorageExistRequest
|
356
|
+
# @return [StorageExistResponse]
|
357
|
+
def get_is_storage_exist(request)
|
358
|
+
data, _status_code, _headers = get_is_storage_exist_with_http_info(request)
|
359
|
+
data
|
360
|
+
end
|
361
|
+
|
362
|
+
# Check if storage exists
|
363
|
+
#
|
364
|
+
# @param request GetIsStorageExistRequest
|
365
|
+
# @return [Array<(StorageExistResponse, Fixnum, Hash)>]
|
366
|
+
# StorageExistResponse data, response status code and response headers
|
367
|
+
private def get_is_storage_exist_with_http_info(request)
|
368
|
+
unless request.is_a? GetIsStorageExistRequest
|
369
|
+
raise ArgumentError, 'Incorrect request type'
|
370
|
+
end
|
371
|
+
|
372
|
+
if @api_client.config.debugging
|
373
|
+
@api_client.config.logger.debug 'Calling API: StorageApi.get_is_storage_exist ...'
|
374
|
+
end
|
375
|
+
# verify the required parameter 'name' is set
|
376
|
+
if @api_client.config.client_side_validation && request.name.nil?
|
377
|
+
raise ArgumentError, 'Missing the required parameter name when calling StorageApi.get_is_storage_exist'
|
378
|
+
end
|
379
|
+
# resource path
|
380
|
+
local_var_path = '/storage/{name}/exist'
|
381
|
+
local_var_path = local_var_path.sub('{' + downcase_first_letter('name') + '}', request.name.to_s)
|
382
|
+
|
383
|
+
# query parameters
|
384
|
+
query_params = {}
|
385
|
+
|
386
|
+
# header parameters
|
387
|
+
header_params = {}
|
388
|
+
# HTTP header 'Accept' (if needed)
|
389
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
390
|
+
# HTTP header 'Content-Type'
|
391
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
392
|
+
|
393
|
+
# form parameters
|
394
|
+
form_params = {}
|
395
|
+
|
396
|
+
request_token
|
397
|
+
# http body (model)
|
398
|
+
post_body = nil
|
399
|
+
auth_names = ['oauth']
|
400
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
401
|
+
header_params: header_params,
|
402
|
+
query_params: query_params,
|
403
|
+
form_params: form_params,
|
404
|
+
body: post_body,
|
405
|
+
auth_names: auth_names,
|
406
|
+
return_type: 'StorageExistResponse')
|
407
|
+
if @api_client.config.debugging
|
408
|
+
@api_client.config.logger.debug "API called:
|
409
|
+
StorageApi#get_is_storage_exist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
410
|
+
end
|
411
|
+
[data, status_code, headers]
|
412
|
+
end
|
413
|
+
|
414
|
+
# Get the file's versions list
|
415
|
+
#
|
416
|
+
# @param request GetListFileVersionsRequest
|
417
|
+
# @return [FileVersionsResponse]
|
418
|
+
def get_list_file_versions(request)
|
419
|
+
data, _status_code, _headers = get_list_file_versions_with_http_info(request)
|
420
|
+
data
|
421
|
+
end
|
422
|
+
|
423
|
+
# Get the file's versions list
|
424
|
+
#
|
425
|
+
# @param request GetListFileVersionsRequest
|
426
|
+
# @return [Array<(FileVersionsResponse, Fixnum, Hash)>]
|
427
|
+
# FileVersionsResponse data, response status code and response headers
|
428
|
+
private def get_list_file_versions_with_http_info(request)
|
429
|
+
unless request.is_a? GetListFileVersionsRequest
|
430
|
+
raise ArgumentError, 'Incorrect request type'
|
431
|
+
end
|
432
|
+
|
433
|
+
if @api_client.config.debugging
|
434
|
+
@api_client.config.logger.debug 'Calling API: StorageApi.get_list_file_versions ...'
|
435
|
+
end
|
436
|
+
# verify the required parameter 'path' is set
|
437
|
+
if @api_client.config.client_side_validation && request.path.nil?
|
438
|
+
raise ArgumentError, 'Missing the required parameter path when calling StorageApi.get_list_file_versions'
|
439
|
+
end
|
440
|
+
# resource path
|
441
|
+
local_var_path = '/storage/version'
|
442
|
+
|
443
|
+
# query parameters
|
444
|
+
query_params = {}
|
445
|
+
query_params[downcase_first_letter('path')] = request.path
|
446
|
+
query_params[downcase_first_letter('path')] = request.path unless request.path.nil?
|
447
|
+
query_params[downcase_first_letter('storage')] = request.storage unless request.storage.nil?
|
448
|
+
|
449
|
+
# header parameters
|
450
|
+
header_params = {}
|
451
|
+
# HTTP header 'Accept' (if needed)
|
452
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
453
|
+
# HTTP header 'Content-Type'
|
454
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
455
|
+
|
456
|
+
# form parameters
|
457
|
+
form_params = {}
|
458
|
+
|
459
|
+
request_token
|
460
|
+
# http body (model)
|
461
|
+
post_body = nil
|
462
|
+
auth_names = ['oauth']
|
463
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
464
|
+
header_params: header_params,
|
465
|
+
query_params: query_params,
|
466
|
+
form_params: form_params,
|
467
|
+
body: post_body,
|
468
|
+
auth_names: auth_names,
|
469
|
+
return_type: 'FileVersionsResponse')
|
470
|
+
if @api_client.config.debugging
|
471
|
+
@api_client.config.logger.debug "API called:
|
472
|
+
StorageApi#get_list_file_versions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
473
|
+
end
|
474
|
+
[data, status_code, headers]
|
475
|
+
end
|
476
|
+
|
477
|
+
# Get the file listing of a specific folder
|
478
|
+
#
|
479
|
+
# @param request GetListFilesRequest
|
480
|
+
# @return [FilesResponse]
|
481
|
+
def get_list_files(request)
|
482
|
+
data, _status_code, _headers = get_list_files_with_http_info(request)
|
483
|
+
data
|
484
|
+
end
|
485
|
+
|
486
|
+
# Get the file listing of a specific folder
|
487
|
+
#
|
488
|
+
# @param request GetListFilesRequest
|
489
|
+
# @return [Array<(FilesResponse, Fixnum, Hash)>]
|
490
|
+
# FilesResponse data, response status code and response headers
|
491
|
+
private def get_list_files_with_http_info(request)
|
492
|
+
unless request.is_a? GetListFilesRequest
|
493
|
+
raise ArgumentError, 'Incorrect request type'
|
494
|
+
end
|
495
|
+
|
496
|
+
if @api_client.config.debugging
|
497
|
+
@api_client.config.logger.debug 'Calling API: StorageApi.get_list_files ...'
|
498
|
+
end
|
499
|
+
# resource path
|
500
|
+
local_var_path = '/storage/folder'
|
501
|
+
|
502
|
+
# query parameters
|
503
|
+
query_params = {}
|
504
|
+
query_params[downcase_first_letter('path')] = request.path unless request.path.nil?
|
505
|
+
query_params[downcase_first_letter('storage')] = request.storage unless request.storage.nil?
|
506
|
+
|
507
|
+
# header parameters
|
508
|
+
header_params = {}
|
509
|
+
# HTTP header 'Accept' (if needed)
|
510
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
511
|
+
# HTTP header 'Content-Type'
|
512
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
513
|
+
|
514
|
+
# form parameters
|
515
|
+
form_params = {}
|
516
|
+
|
517
|
+
request_token
|
518
|
+
# http body (model)
|
519
|
+
post_body = nil
|
520
|
+
auth_names = ['oauth']
|
521
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
522
|
+
header_params: header_params,
|
523
|
+
query_params: query_params,
|
524
|
+
form_params: form_params,
|
525
|
+
body: post_body,
|
526
|
+
auth_names: auth_names,
|
527
|
+
return_type: 'FilesResponse')
|
528
|
+
if @api_client.config.debugging
|
529
|
+
@api_client.config.logger.debug "API called:
|
530
|
+
StorageApi#get_list_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
531
|
+
end
|
532
|
+
[data, status_code, headers]
|
533
|
+
end
|
534
|
+
|
535
|
+
# Move a specific file
|
536
|
+
#
|
537
|
+
# @param request PostMoveFileRequest
|
538
|
+
# @return [MoveFileResponse]
|
539
|
+
def post_move_file(request)
|
540
|
+
data, _status_code, _headers = post_move_file_with_http_info(request)
|
541
|
+
data
|
542
|
+
end
|
543
|
+
|
544
|
+
# Move a specific file
|
545
|
+
#
|
546
|
+
# @param request PostMoveFileRequest
|
547
|
+
# @return [Array<(MoveFileResponse, Fixnum, Hash)>]
|
548
|
+
# MoveFileResponse data, response status code and response headers
|
549
|
+
private def post_move_file_with_http_info(request)
|
550
|
+
unless request.is_a? PostMoveFileRequest
|
551
|
+
raise ArgumentError, 'Incorrect request type'
|
552
|
+
end
|
553
|
+
|
554
|
+
if @api_client.config.debugging
|
555
|
+
@api_client.config.logger.debug 'Calling API: StorageApi.post_move_file ...'
|
556
|
+
end
|
557
|
+
# verify the required parameter 'src' is set
|
558
|
+
if @api_client.config.client_side_validation && request.src.nil?
|
559
|
+
raise ArgumentError, 'Missing the required parameter src when calling StorageApi.post_move_file'
|
560
|
+
end
|
561
|
+
# verify the required parameter 'dest' is set
|
562
|
+
if @api_client.config.client_side_validation && request.dest.nil?
|
563
|
+
raise ArgumentError, 'Missing the required parameter dest when calling StorageApi.post_move_file'
|
564
|
+
end
|
565
|
+
# resource path
|
566
|
+
local_var_path = '/storage/file'
|
567
|
+
|
568
|
+
# query parameters
|
569
|
+
query_params = {}
|
570
|
+
query_params[downcase_first_letter('src')] = request.src
|
571
|
+
query_params[downcase_first_letter('dest')] = request.dest
|
572
|
+
query_params[downcase_first_letter('src')] = request.src unless request.src.nil?
|
573
|
+
query_params[downcase_first_letter('dest')] = request.dest unless request.dest.nil?
|
574
|
+
query_params[downcase_first_letter('versionId')] = request.version_id unless request.version_id.nil?
|
575
|
+
query_params[downcase_first_letter('storage')] = request.storage unless request.storage.nil?
|
576
|
+
query_params[downcase_first_letter('destStorage')] = request.dest_storage unless request.dest_storage.nil?
|
577
|
+
|
578
|
+
# header parameters
|
579
|
+
header_params = {}
|
580
|
+
# HTTP header 'Accept' (if needed)
|
581
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
582
|
+
# HTTP header 'Content-Type'
|
583
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
584
|
+
|
585
|
+
# form parameters
|
586
|
+
form_params = {}
|
587
|
+
|
588
|
+
request_token
|
589
|
+
# http body (model)
|
590
|
+
post_body = nil
|
591
|
+
auth_names = ['oauth']
|
592
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
593
|
+
header_params: header_params,
|
594
|
+
query_params: query_params,
|
595
|
+
form_params: form_params,
|
596
|
+
body: post_body,
|
597
|
+
auth_names: auth_names,
|
598
|
+
return_type: 'MoveFileResponse')
|
599
|
+
if @api_client.config.debugging
|
600
|
+
@api_client.config.logger.debug "API called:
|
601
|
+
StorageApi#post_move_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
602
|
+
end
|
603
|
+
[data, status_code, headers]
|
604
|
+
end
|
605
|
+
|
606
|
+
# Move a specific folder
|
607
|
+
#
|
608
|
+
# @param request PostMoveFolderRequest
|
609
|
+
# @return [MoveFolderResponse]
|
610
|
+
def post_move_folder(request)
|
611
|
+
data, _status_code, _headers = post_move_folder_with_http_info(request)
|
612
|
+
data
|
613
|
+
end
|
614
|
+
|
615
|
+
# Move a specific folder
|
616
|
+
#
|
617
|
+
# @param request PostMoveFolderRequest
|
618
|
+
# @return [Array<(MoveFolderResponse, Fixnum, Hash)>]
|
619
|
+
# MoveFolderResponse data, response status code and response headers
|
620
|
+
private def post_move_folder_with_http_info(request)
|
621
|
+
unless request.is_a? PostMoveFolderRequest
|
622
|
+
raise ArgumentError, 'Incorrect request type'
|
623
|
+
end
|
624
|
+
|
625
|
+
if @api_client.config.debugging
|
626
|
+
@api_client.config.logger.debug 'Calling API: StorageApi.post_move_folder ...'
|
627
|
+
end
|
628
|
+
# verify the required parameter 'src' is set
|
629
|
+
if @api_client.config.client_side_validation && request.src.nil?
|
630
|
+
raise ArgumentError, 'Missing the required parameter src when calling StorageApi.post_move_folder'
|
631
|
+
end
|
632
|
+
# verify the required parameter 'dest' is set
|
633
|
+
if @api_client.config.client_side_validation && request.dest.nil?
|
634
|
+
raise ArgumentError, 'Missing the required parameter dest when calling StorageApi.post_move_folder'
|
635
|
+
end
|
636
|
+
# resource path
|
637
|
+
local_var_path = '/storage/folder'
|
638
|
+
|
639
|
+
# query parameters
|
640
|
+
query_params = {}
|
641
|
+
query_params[downcase_first_letter('src')] = request.src
|
642
|
+
query_params[downcase_first_letter('dest')] = request.dest
|
643
|
+
query_params[downcase_first_letter('src')] = request.src unless request.src.nil?
|
644
|
+
query_params[downcase_first_letter('dest')] = request.dest unless request.dest.nil?
|
645
|
+
query_params[downcase_first_letter('storage')] = request.storage unless request.storage.nil?
|
646
|
+
query_params[downcase_first_letter('destStorage')] = request.dest_storage unless request.dest_storage.nil?
|
647
|
+
|
648
|
+
# header parameters
|
649
|
+
header_params = {}
|
650
|
+
# HTTP header 'Accept' (if needed)
|
651
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
652
|
+
# HTTP header 'Content-Type'
|
653
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
654
|
+
|
655
|
+
# form parameters
|
656
|
+
form_params = {}
|
657
|
+
|
658
|
+
request_token
|
659
|
+
# http body (model)
|
660
|
+
post_body = nil
|
661
|
+
auth_names = ['oauth']
|
662
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
663
|
+
header_params: header_params,
|
664
|
+
query_params: query_params,
|
665
|
+
form_params: form_params,
|
666
|
+
body: post_body,
|
667
|
+
auth_names: auth_names,
|
668
|
+
return_type: 'MoveFolderResponse')
|
669
|
+
if @api_client.config.debugging
|
670
|
+
@api_client.config.logger.debug "API called:
|
671
|
+
StorageApi#post_move_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
672
|
+
end
|
673
|
+
[data, status_code, headers]
|
674
|
+
end
|
675
|
+
|
676
|
+
# Copy a specific file
|
677
|
+
#
|
678
|
+
# @param request PutCopyRequest
|
679
|
+
# @return [CopyFileResponse]
|
680
|
+
def put_copy(request)
|
681
|
+
data, _status_code, _headers = put_copy_with_http_info(request)
|
682
|
+
data
|
683
|
+
end
|
684
|
+
|
685
|
+
# Copy a specific file
|
686
|
+
#
|
687
|
+
# @param request PutCopyRequest
|
688
|
+
# @return [Array<(CopyFileResponse, Fixnum, Hash)>]
|
689
|
+
# CopyFileResponse data, response status code and response headers
|
690
|
+
private def put_copy_with_http_info(request)
|
691
|
+
unless request.is_a? PutCopyRequest
|
692
|
+
raise ArgumentError, 'Incorrect request type'
|
693
|
+
end
|
694
|
+
|
695
|
+
if @api_client.config.debugging
|
696
|
+
@api_client.config.logger.debug 'Calling API: StorageApi.put_copy ...'
|
697
|
+
end
|
698
|
+
# verify the required parameter 'path' is set
|
699
|
+
if @api_client.config.client_side_validation && request.path.nil?
|
700
|
+
raise ArgumentError, 'Missing the required parameter path when calling StorageApi.put_copy'
|
701
|
+
end
|
702
|
+
# verify the required parameter 'newdest' is set
|
703
|
+
if @api_client.config.client_side_validation && request.newdest.nil?
|
704
|
+
raise ArgumentError, 'Missing the required parameter newdest when calling StorageApi.put_copy'
|
705
|
+
end
|
706
|
+
# resource path
|
707
|
+
local_var_path = '/storage/file'
|
708
|
+
|
709
|
+
# query parameters
|
710
|
+
query_params = {}
|
711
|
+
query_params[downcase_first_letter('path')] = request.path
|
712
|
+
query_params[downcase_first_letter('newdest')] = request.newdest
|
713
|
+
|
714
|
+
|
715
|
+
|
716
|
+
query_params[downcase_first_letter('versionId')] = request.version_id unless request.version_id.nil?
|
717
|
+
query_params[downcase_first_letter('storage')] = request.storage unless request.storage.nil?
|
718
|
+
query_params[downcase_first_letter('destStorage')] = request.dest_storage unless request.dest_storage.nil?
|
719
|
+
|
720
|
+
# header parameters
|
721
|
+
header_params = {}
|
722
|
+
# HTTP header 'Accept' (if needed)
|
723
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
724
|
+
# HTTP header 'Content-Type'
|
725
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
726
|
+
|
727
|
+
# form parameters
|
728
|
+
form_params = {}
|
729
|
+
|
730
|
+
request_token
|
731
|
+
# http body (model)
|
732
|
+
post_body = nil
|
733
|
+
auth_names = ['oauth']
|
734
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
735
|
+
header_params: header_params,
|
736
|
+
query_params: query_params,
|
737
|
+
form_params: form_params,
|
738
|
+
body: post_body,
|
739
|
+
auth_names: auth_names,
|
740
|
+
return_type: 'CopyFileResponse')
|
741
|
+
if @api_client.config.debugging
|
742
|
+
@api_client.config.logger.debug "API called:
|
743
|
+
StorageApi#put_copy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
744
|
+
end
|
745
|
+
[data, status_code, headers]
|
746
|
+
end
|
747
|
+
|
748
|
+
# Copy a folder
|
749
|
+
#
|
750
|
+
# @param request PutCopyFolderRequest
|
751
|
+
# @return [CreateFolderResponse]
|
752
|
+
def put_copy_folder(request)
|
753
|
+
data, _status_code, _headers = put_copy_folder_with_http_info(request)
|
754
|
+
data
|
755
|
+
end
|
756
|
+
|
757
|
+
# Copy a folder
|
758
|
+
#
|
759
|
+
# @param request PutCopyFolderRequest
|
760
|
+
# @return [Array<(CreateFolderResponse, Fixnum, Hash)>]
|
761
|
+
# CreateFolderResponse data, response status code and response headers
|
762
|
+
private def put_copy_folder_with_http_info(request)
|
763
|
+
unless request.is_a? PutCopyFolderRequest
|
764
|
+
raise ArgumentError, 'Incorrect request type'
|
765
|
+
end
|
766
|
+
|
767
|
+
if @api_client.config.debugging
|
768
|
+
@api_client.config.logger.debug 'Calling API: StorageApi.put_copy_folder ...'
|
769
|
+
end
|
770
|
+
# verify the required parameter 'path' is set
|
771
|
+
if @api_client.config.client_side_validation && request.path.nil?
|
772
|
+
raise ArgumentError, 'Missing the required parameter path when calling StorageApi.put_copy_folder'
|
773
|
+
end
|
774
|
+
# verify the required parameter 'newdest' is set
|
775
|
+
if @api_client.config.client_side_validation && request.newdest.nil?
|
776
|
+
raise ArgumentError, 'Missing the required parameter newdest when calling StorageApi.put_copy_folder'
|
777
|
+
end
|
778
|
+
# resource path
|
779
|
+
local_var_path = '/storage/folder'
|
780
|
+
|
781
|
+
# query parameters
|
782
|
+
query_params = {}
|
783
|
+
query_params[downcase_first_letter('path')] = request.path
|
784
|
+
query_params[downcase_first_letter('newdest')] = request.newdest
|
785
|
+
query_params[downcase_first_letter('path')] = request.path unless request.path.nil?
|
786
|
+
query_params[downcase_first_letter('newdest')] = request.newdest unless request.newdest.nil?
|
787
|
+
query_params[downcase_first_letter('storage')] = request.storage unless request.storage.nil?
|
788
|
+
query_params[downcase_first_letter('destStorage')] = request.dest_storage unless request.dest_storage.nil?
|
789
|
+
|
790
|
+
# header parameters
|
791
|
+
header_params = {}
|
792
|
+
# HTTP header 'Accept' (if needed)
|
793
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
794
|
+
# HTTP header 'Content-Type'
|
795
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
796
|
+
|
797
|
+
# form parameters
|
798
|
+
form_params = {}
|
799
|
+
|
800
|
+
request_token
|
801
|
+
# http body (model)
|
802
|
+
post_body = nil
|
803
|
+
auth_names = ['oauth']
|
804
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
805
|
+
header_params: header_params,
|
806
|
+
query_params: query_params,
|
807
|
+
form_params: form_params,
|
808
|
+
body: post_body,
|
809
|
+
auth_names: auth_names,
|
810
|
+
return_type: 'CreateFolderResponse')
|
811
|
+
if @api_client.config.debugging
|
812
|
+
@api_client.config.logger.debug "API called:
|
813
|
+
StorageApi#put_copy_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
814
|
+
end
|
815
|
+
[data, status_code, headers]
|
816
|
+
end
|
817
|
+
|
818
|
+
# Create the folder
|
819
|
+
#
|
820
|
+
# @param request PutCreateFolderRequest
|
821
|
+
# @return [CreateFolderResponse]
|
822
|
+
def put_create_folder(request)
|
823
|
+
data, _status_code, _headers = put_create_folder_with_http_info(request)
|
824
|
+
data
|
825
|
+
end
|
826
|
+
|
827
|
+
# Create the folder
|
828
|
+
#
|
829
|
+
# @param request PutCreateFolderRequest
|
830
|
+
# @return [Array<(CreateFolderResponse, Fixnum, Hash)>]
|
831
|
+
# CreateFolderResponse data, response status code and response headers
|
832
|
+
private def put_create_folder_with_http_info(request)
|
833
|
+
unless request.is_a? PutCreateFolderRequest
|
834
|
+
raise ArgumentError, 'Incorrect request type'
|
835
|
+
end
|
836
|
+
|
837
|
+
if @api_client.config.debugging
|
838
|
+
@api_client.config.logger.debug 'Calling API: StorageApi.put_create_folder ...'
|
839
|
+
end
|
840
|
+
# verify the required parameter 'path' is set
|
841
|
+
if @api_client.config.client_side_validation && request.path.nil?
|
842
|
+
raise ArgumentError, 'Missing the required parameter path when calling StorageApi.put_create_folder'
|
843
|
+
end
|
844
|
+
# resource path
|
845
|
+
local_var_path = '/storage/folder'
|
846
|
+
|
847
|
+
# query parameters
|
848
|
+
query_params = {}
|
849
|
+
query_params[downcase_first_letter('path')] = request.path
|
850
|
+
|
851
|
+
|
852
|
+
query_params[downcase_first_letter('storage')] = request.storage unless request.storage.nil?
|
853
|
+
query_params[downcase_first_letter('destStorage')] = request.dest_storage unless request.dest_storage.nil?
|
854
|
+
|
855
|
+
# header parameters
|
856
|
+
header_params = {}
|
857
|
+
# HTTP header 'Accept' (if needed)
|
858
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
859
|
+
# HTTP header 'Content-Type'
|
860
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
861
|
+
|
862
|
+
# form parameters
|
863
|
+
form_params = {}
|
864
|
+
|
865
|
+
request_token
|
866
|
+
# http body (model)
|
867
|
+
post_body = nil
|
868
|
+
auth_names = ['oauth']
|
869
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
870
|
+
header_params: header_params,
|
871
|
+
query_params: query_params,
|
872
|
+
form_params: form_params,
|
873
|
+
body: post_body,
|
874
|
+
auth_names: auth_names,
|
875
|
+
return_type: 'CreateFolderResponse')
|
876
|
+
if @api_client.config.debugging
|
877
|
+
@api_client.config.logger.debug "API called:
|
878
|
+
StorageApi#put_create_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
879
|
+
end
|
880
|
+
[data, status_code, headers]
|
881
|
+
end
|
882
|
+
|
883
|
+
# Upload a specific file
|
884
|
+
#
|
885
|
+
# @param request PutCreateRequest
|
886
|
+
# @return [UploadResponse]
|
887
|
+
def put_create(request)
|
888
|
+
data, _status_code, _headers = put_create_with_http_info(request)
|
889
|
+
data
|
890
|
+
end
|
891
|
+
|
892
|
+
# Upload a specific file
|
893
|
+
#
|
894
|
+
# @param request PutCreateRequest
|
895
|
+
# @return [Array<(UploadResponse, Fixnum, Hash)>]
|
896
|
+
# UploadResponse data, response status code and response headers
|
897
|
+
private def put_create_with_http_info(request)
|
898
|
+
unless request.is_a? PutCreateRequest
|
899
|
+
raise ArgumentError, 'Incorrect request type'
|
900
|
+
end
|
901
|
+
|
902
|
+
if @api_client.config.debugging
|
903
|
+
@api_client.config.logger.debug 'Calling API: StorageApi.put_create ...'
|
904
|
+
end
|
905
|
+
# verify the required parameter 'path' is set
|
906
|
+
if @api_client.config.client_side_validation && request.path.nil?
|
907
|
+
raise ArgumentError, 'Missing the required parameter path when calling StorageApi.put_create'
|
908
|
+
end
|
909
|
+
# verify the required parameter 'file' is set
|
910
|
+
if @api_client.config.client_side_validation && request.file.nil?
|
911
|
+
raise ArgumentError, 'Missing the required parameter file when calling StorageApi.put_create'
|
912
|
+
end
|
913
|
+
# resource path
|
914
|
+
local_var_path = '/storage/file'
|
915
|
+
|
916
|
+
# query parameters
|
917
|
+
query_params = {}
|
918
|
+
query_params[downcase_first_letter('path')] = request.path
|
919
|
+
query_params[downcase_first_letter('path')] = request.path unless request.path.nil?
|
920
|
+
query_params[downcase_first_letter('versionId')] = request.version_id unless request.version_id.nil?
|
921
|
+
query_params[downcase_first_letter('storage')] = request.storage unless request.storage.nil?
|
922
|
+
|
923
|
+
# header parameters
|
924
|
+
header_params = {}
|
925
|
+
# HTTP header 'Accept' (if needed)
|
926
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
927
|
+
# HTTP header 'Content-Type'
|
928
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
929
|
+
|
930
|
+
# form parameters
|
931
|
+
form_params = {}
|
932
|
+
form_params[downcase_first_letter('File')] = request.file
|
933
|
+
|
934
|
+
request_token
|
935
|
+
# http body (model)
|
936
|
+
post_body = nil
|
937
|
+
auth_names = ['oauth']
|
938
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
939
|
+
header_params: header_params,
|
940
|
+
query_params: query_params,
|
941
|
+
form_params: form_params,
|
942
|
+
body: post_body,
|
943
|
+
auth_names: auth_names,
|
944
|
+
return_type: 'UploadResponse')
|
945
|
+
if @api_client.config.debugging
|
946
|
+
@api_client.config.logger.debug "API called:
|
947
|
+
StorageApi#put_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
948
|
+
end
|
949
|
+
[data, status_code, headers]
|
950
|
+
end
|
951
|
+
#
|
952
|
+
# Helper method to convert first letter to downcase
|
953
|
+
#
|
954
|
+
private def downcase_first_letter(str)
|
955
|
+
value = str[0].downcase + str[1..-1]
|
956
|
+
value
|
957
|
+
end
|
958
|
+
|
959
|
+
#
|
960
|
+
# Gets a request token from server
|
961
|
+
#
|
962
|
+
private def request_token
|
963
|
+
config = @api_client.config
|
964
|
+
api_version = config.api_version
|
965
|
+
config.api_version = ''
|
966
|
+
request_url = "/oauth2/token"
|
967
|
+
post_data = "grant_type=client_credentials" + "&client_id=" + config.api_key['app_sid'] + "&client_secret=" + config.api_key['api_key']
|
968
|
+
data, status_code, header = @api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object')
|
969
|
+
@api_client.config.access_token = data[:access_token]
|
970
|
+
@api_client.config.api_version = api_version
|
971
|
+
@api_client.config.refresh_token = data[:refresh_token]
|
972
|
+
end
|
973
|
+
|
974
|
+
# requires all files inside a directory from current dir
|
975
|
+
# @param _dir can be relative path like '/lib' or "../lib"
|
976
|
+
private def require_all(_dir)
|
977
|
+
Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), _dir)) + "/*.rb"].each do |file|
|
978
|
+
require file
|
979
|
+
end
|
980
|
+
end
|
981
|
+
end
|
982
|
+
end
|