aspose_html_cloud 19.5.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.
@@ -0,0 +1,859 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin
3
+ --------------------------------------------------------------------------------------------------------------------
4
+ <copyright company="Aspose" file="storage_api.rb">
5
+ </copyright>
6
+ Copyright (c) 2019 Aspose.HTML for Cloud
7
+ <summary>
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
25
+ </summary>
26
+ --------------------------------------------------------------------------------------------------------------------
27
+ =end
28
+
29
+ require "uri"
30
+
31
+ module AsposeHtml
32
+ class StorageApi
33
+ attr_accessor :api_client
34
+
35
+ def initialize(args)
36
+ @api_client = AsposeHtml::ApiClient.default(args)
37
+ end
38
+
39
+ ################################################################################
40
+ # Storage Api
41
+ ################################################################################
42
+
43
+ # Get disc usage
44
+ # @param [Hash] opts the optional parameters
45
+ # @option opts [String] :storage_name Storage name
46
+ # @return [DiscUsage]
47
+ def get_disc_usage(opts = {})
48
+ data, _status_code, _headers = get_disc_usage_with_http_info(opts)
49
+ data
50
+ end
51
+
52
+ # Get disc usage
53
+ # @param [Hash] opts the optional parameters
54
+ # @option opts [String] :storage_name Storage name
55
+ # @return [Array<(DiscUsage, Fixnum, Hash)>] DiscUsage data, response status code and response headers
56
+ def get_disc_usage_with_http_info(opts = {})
57
+ if @api_client.config.debug
58
+ @api_client.config.logger.debug 'Calling API: StorageApi.get_disc_usage ...'
59
+ end
60
+ # resource path
61
+ local_var_path = '/html/storage/disc'
62
+
63
+ # query parameters
64
+ query_params = {}
65
+ query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].nil?
66
+
67
+ # header parameters
68
+ header_params = {}
69
+ # HTTP header 'Accept' (if needed)
70
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
71
+ # HTTP header 'Content-Type'
72
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
73
+
74
+ # form parameters
75
+ form_params = {}
76
+
77
+ # http body (model)
78
+ post_body = nil
79
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
80
+ :header_params => header_params,
81
+ :query_params => query_params,
82
+ :form_params => form_params,
83
+ :body => post_body,
84
+ :return_type => 'DiscUsage')
85
+ if @api_client.config.debug
86
+ @api_client.config.logger.debug "API called: StorageApi#get_disc_usage\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
87
+ end
88
+ return data, status_code, headers
89
+ end
90
+
91
+ # Get file versions
92
+ # @param path File path e.g. &#39;/file.ext&#39;
93
+ # @param [Hash] opts the optional parameters
94
+ # @option opts [String] :storage_name Storage name
95
+ # @return [FileVersions]
96
+ def get_file_versions(path, opts = {})
97
+ data, _status_code, _headers = get_file_versions_with_http_info(path, opts)
98
+ data
99
+ end
100
+
101
+ # Get file versions
102
+ # @param path File path e.g. &#39;/file.ext&#39;
103
+ # @param [Hash] opts the optional parameters
104
+ # @option opts [String] :storage_name Storage name
105
+ # @return [Array<(FileVersions, Fixnum, Hash)>] FileVersions data, response status code and response headers
106
+ def get_file_versions_with_http_info(path, opts = {})
107
+ if @api_client.config.debug
108
+ @api_client.config.logger.debug 'Calling API: StorageApi.get_file_versions ...'
109
+ end
110
+ # verify the required parameter 'path' is set
111
+ if @api_client.config.client_side_validation && path.nil?
112
+ fail ArgumentError, "Missing the required parameter 'path' when calling StorageApi.get_file_versions"
113
+ end
114
+ # resource path
115
+ local_var_path = '/html/storage/version/{path}'.sub('{' + 'path' + '}', path.to_s)
116
+
117
+ # query parameters
118
+ query_params = {}
119
+ query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].nil?
120
+
121
+ # header parameters
122
+ header_params = {}
123
+ # HTTP header 'Accept' (if needed)
124
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
125
+ # HTTP header 'Content-Type'
126
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
127
+
128
+ # form parameters
129
+ form_params = {}
130
+
131
+ # http body (model)
132
+ post_body = nil
133
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
134
+ :header_params => header_params,
135
+ :query_params => query_params,
136
+ :form_params => form_params,
137
+ :body => post_body,
138
+ :return_type => 'FileVersions')
139
+ if @api_client.config.debug
140
+ @api_client.config.logger.debug "API called: StorageApi#get_file_versions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
141
+ end
142
+ return data, status_code, headers
143
+ end
144
+
145
+ # Check if file or folder exists
146
+ # @param path File or folder path e.g. &#39;/file.ext&#39; or &#39;/folder&#39;
147
+ # @param [Hash] opts the optional parameters
148
+ # @option opts [String] :storage_name Storage name
149
+ # @option opts [String] :version_id File version ID
150
+ # @return [ObjectExist]
151
+ def object_exists(path, opts = {})
152
+ data, _status_code, _headers = object_exists_with_http_info(path, opts)
153
+ data
154
+ end
155
+
156
+ # Check if file or folder exists
157
+ # @param path File or folder path e.g. &#39;/file.ext&#39; or &#39;/folder&#39;
158
+ # @param [Hash] opts the optional parameters
159
+ # @option opts [String] :storage_name Storage name
160
+ # @option opts [String] :version_id File version ID
161
+ # @return [Array<(ObjectExist, Fixnum, Hash)>] ObjectExist data, response status code and response headers
162
+ def object_exists_with_http_info(path, opts = {})
163
+ if @api_client.config.debug
164
+ @api_client.config.logger.debug 'Calling API: StorageApi.object_exists ...'
165
+ end
166
+ # verify the required parameter 'path' is set
167
+ if @api_client.config.client_side_validation && path.nil?
168
+ fail ArgumentError, "Missing the required parameter 'path' when calling StorageApi.object_exists"
169
+ end
170
+ # resource path
171
+ local_var_path = '/html/storage/exist/{path}'.sub('{' + 'path' + '}', path.to_s)
172
+
173
+ # query parameters
174
+ query_params = {}
175
+ query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].nil?
176
+ query_params[:'versionId'] = opts[:'version_id'] if !opts[:'version_id'].nil?
177
+
178
+ # header parameters
179
+ header_params = {}
180
+ # HTTP header 'Accept' (if needed)
181
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
182
+ # HTTP header 'Content-Type'
183
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
184
+
185
+ # form parameters
186
+ form_params = {}
187
+
188
+ # http body (model)
189
+ post_body = nil
190
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
191
+ :header_params => header_params,
192
+ :query_params => query_params,
193
+ :form_params => form_params,
194
+ :body => post_body,
195
+ :return_type => 'ObjectExist')
196
+ if @api_client.config.debug
197
+ @api_client.config.logger.debug "API called: StorageApi#object_exists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
198
+ end
199
+ return data, status_code, headers
200
+ end
201
+
202
+ # Check if storage exists
203
+ # @param storage_name Storage name
204
+ # @param [Hash] opts the optional parameters
205
+ # @return [StorageExist]
206
+ def storage_exists(storage_name, opts = {})
207
+ data, _status_code, _headers = storage_exists_with_http_info(storage_name, opts)
208
+ data
209
+ end
210
+
211
+ # Check if storage exists
212
+ # @param storage_name Storage name
213
+ # @param [Hash] opts the optional parameters
214
+ # @return [Array<(StorageExist, Fixnum, Hash)>] StorageExist data, response status code and response headers
215
+ def storage_exists_with_http_info(storage_name, opts = {})
216
+ if @api_client.config.debug
217
+ @api_client.config.logger.debug 'Calling API: StorageApi.storage_exists ...'
218
+ end
219
+ # verify the required parameter 'storage_name' is set
220
+ if @api_client.config.client_side_validation && storage_name.nil?
221
+ fail ArgumentError, "Missing the required parameter 'storage_name' when calling StorageApi.storage_exists"
222
+ end
223
+ # resource path
224
+ local_var_path = '/html/storage/{storageName}/exist'.sub('{' + 'storageName' + '}', storage_name.to_s)
225
+
226
+ # query parameters
227
+ query_params = {}
228
+
229
+ # header parameters
230
+ header_params = {}
231
+ # HTTP header 'Accept' (if needed)
232
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
233
+ # HTTP header 'Content-Type'
234
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
235
+
236
+ # form parameters
237
+ form_params = {}
238
+
239
+ # http body (model)
240
+ post_body = nil
241
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
242
+ :header_params => header_params,
243
+ :query_params => query_params,
244
+ :form_params => form_params,
245
+ :body => post_body,
246
+ :return_type => 'StorageExist')
247
+ if @api_client.config.debug
248
+ @api_client.config.logger.debug "API called: StorageApi#storage_exists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
249
+ end
250
+ return data, status_code, headers
251
+ end
252
+
253
+ ################################################################################
254
+ # File Api
255
+ ################################################################################
256
+
257
+ # Copy file
258
+ # @param src_path Source file path e.g. &#39;/folder/file.ext&#39;
259
+ # @param dest_path Destination file path
260
+ # @param [Hash] opts the optional parameters
261
+ # @option opts [String] :src_storage_name Source storage name
262
+ # @option opts [String] :dest_storage_name Destination storage name
263
+ # @option opts [String] :version_id File version ID to copy
264
+ # @return [nil]
265
+ def copy_file(src_path, dest_path, opts = {})
266
+ copy_file_with_http_info(src_path, dest_path, opts)
267
+ nil
268
+ end
269
+
270
+ # Copy file
271
+ # @param src_path Source file path e.g. &#39;/folder/file.ext&#39;
272
+ # @param dest_path Destination file path
273
+ # @param [Hash] opts the optional parameters
274
+ # @option opts [String] :src_storage_name Source storage name
275
+ # @option opts [String] :dest_storage_name Destination storage name
276
+ # @option opts [String] :version_id File version ID to copy
277
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
278
+ def copy_file_with_http_info(src_path, dest_path, opts = {})
279
+ if @api_client.config.debug
280
+ @api_client.config.logger.debug 'Calling API: StorageApi.copy_file ...'
281
+ end
282
+ # verify the required parameter 'src_path' is set
283
+ if @api_client.config.client_side_validation && src_path.nil?
284
+ fail ArgumentError, "Missing the required parameter 'src_path' when calling StorageApi.copy_file"
285
+ end
286
+ # verify the required parameter 'dest_path' is set
287
+ if @api_client.config.client_side_validation && dest_path.nil?
288
+ fail ArgumentError, "Missing the required parameter 'dest_path' when calling StorageApi.copy_file"
289
+ end
290
+ # resource path
291
+ local_var_path = '/html/storage/file/copy/{srcPath}'.sub('{' + 'srcPath' + '}', src_path.to_s)
292
+
293
+ # query parameters
294
+ query_params = {}
295
+ query_params[:'destPath'] = dest_path
296
+ query_params[:'srcStorageName'] = opts[:'src_storage_name'] if !opts[:'src_storage_name'].nil?
297
+ query_params[:'destStorageName'] = opts[:'dest_storage_name'] if !opts[:'dest_storage_name'].nil?
298
+ query_params[:'versionId'] = opts[:'version_id'] if !opts[:'version_id'].nil?
299
+
300
+ # header parameters
301
+ header_params = {}
302
+ # HTTP header 'Accept' (if needed)
303
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
304
+ # HTTP header 'Content-Type'
305
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
306
+
307
+ # form parameters
308
+ form_params = {}
309
+
310
+ # http body (model)
311
+ post_body = nil
312
+
313
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
314
+ :header_params => header_params,
315
+ :query_params => query_params,
316
+ :form_params => form_params,
317
+ :body => post_body)
318
+ if @api_client.config.debug
319
+ @api_client.config.logger.debug "API called: StorageApi#copy_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
320
+ end
321
+ return data, status_code, headers
322
+ end
323
+
324
+ # Delete file
325
+ # @param path File path e.g. &#39;/folder/file.ext&#39;
326
+ # @param [Hash] opts the optional parameters
327
+ # @option opts [String] :storage_name Storage name
328
+ # @option opts [String] :version_id File version ID to delete
329
+ # @return [nil]
330
+ def delete_file(path, opts = {})
331
+ delete_file_with_http_info(path, opts)
332
+ nil
333
+ end
334
+
335
+ # Delete file
336
+ # @param path File path e.g. &#39;/folder/file.ext&#39;
337
+ # @param [Hash] opts the optional parameters
338
+ # @option opts [String] :storage_name Storage name
339
+ # @option opts [String] :version_id File version ID to delete
340
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
341
+ def delete_file_with_http_info(path, opts = {})
342
+ if @api_client.config.debug
343
+ @api_client.config.logger.debug 'Calling API: StorageApi.delete_file ...'
344
+ end
345
+ # verify the required parameter 'path' is set
346
+ if @api_client.config.client_side_validation && path.nil?
347
+ fail ArgumentError, "Missing the required parameter 'path' when calling StorageApi.delete_file"
348
+ end
349
+ # resource path
350
+ local_var_path = '/html/storage/file/{path}'.sub('{' + 'path' + '}', path.to_s)
351
+
352
+ # query parameters
353
+ query_params = {}
354
+ query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].nil?
355
+ query_params[:'versionId'] = opts[:'version_id'] if !opts[:'version_id'].nil?
356
+
357
+ # header parameters
358
+ header_params = {}
359
+ # HTTP header 'Accept' (if needed)
360
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
361
+ # HTTP header 'Content-Type'
362
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
363
+
364
+ # form parameters
365
+ form_params = {}
366
+
367
+ # http body (model)
368
+ post_body = nil
369
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
370
+ :header_params => header_params,
371
+ :query_params => query_params,
372
+ :form_params => form_params,
373
+ :body => post_body)
374
+ if @api_client.config.debug
375
+ @api_client.config.logger.debug "API called: StorageApi#delete_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
376
+ end
377
+ return data, status_code, headers
378
+ end
379
+
380
+ # Download file
381
+ # @param path File path e.g. &#39;/folder/file.ext&#39;
382
+ # @param [Hash] opts the optional parameters
383
+ # @option opts [String] :storage_name Storage name
384
+ # @option opts [String] :version_id File version ID to download
385
+ # @return [File]
386
+ def download_file(path, opts = {})
387
+ data, _status_code, _headers = download_file_with_http_info(path, opts)
388
+ data
389
+ end
390
+
391
+ # Download file
392
+ # @param path File path e.g. &#39;/folder/file.ext&#39;
393
+ # @param [Hash] opts the optional parameters
394
+ # @option opts [String] :storage_name Storage name
395
+ # @option opts [String] :version_id File version ID to download
396
+ # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
397
+ def download_file_with_http_info(path, opts = {})
398
+ if @api_client.config.debug
399
+ @api_client.config.logger.debug 'Calling API: StorageApi.download_file ...'
400
+ end
401
+ # verify the required parameter 'path' is set
402
+ if @api_client.config.client_side_validation && path.nil?
403
+ fail ArgumentError, "Missing the required parameter 'path' when calling StorageApi.download_file"
404
+ end
405
+ # resource path
406
+ local_var_path = '/html/storage/file/{path}'.sub('{' + 'path' + '}', path.to_s)
407
+
408
+ # query parameters
409
+ query_params = {}
410
+ query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].nil?
411
+ query_params[:'versionId'] = opts[:'version_id'] if !opts[:'version_id'].nil?
412
+
413
+ # header parameters
414
+ header_params = {}
415
+ # HTTP header 'Accept' (if needed)
416
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
417
+ # HTTP header 'Content-Type'
418
+ header_params['Content-Type'] = @api_client.select_header_content_type(
419
+ ['application/octet-stream'])
420
+
421
+ # form parameters
422
+ form_params = {}
423
+
424
+ # http body (model)
425
+ post_body = nil
426
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
427
+ :header_params => header_params,
428
+ :query_params => query_params,
429
+ :form_params => form_params,
430
+ :body => post_body,
431
+ :return_type => 'File')
432
+ if @api_client.config.debug
433
+ @api_client.config.logger.debug "API called: StorageApi#download_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
434
+ end
435
+ return data, status_code, headers
436
+ end
437
+
438
+ # Move file
439
+ # @param src_path Source file path e.g. &#39;/src.ext&#39;
440
+ # @param dest_path Destination file path e.g. &#39;/dest.ext&#39;
441
+ # @param [Hash] opts the optional parameters
442
+ # @option opts [String] :src_storage_name Source storage name
443
+ # @option opts [String] :dest_storage_name Destination storage name
444
+ # @option opts [String] :version_id File version ID to move
445
+ # @return [nil]
446
+ def move_file(src_path, dest_path, opts = {})
447
+ move_file_with_http_info(src_path, dest_path, opts)
448
+ nil
449
+ end
450
+
451
+ # Move file
452
+ # @param src_path Source file path e.g. &#39;/src.ext&#39;
453
+ # @param dest_path Destination file path e.g. &#39;/dest.ext&#39;
454
+ # @param [Hash] opts the optional parameters
455
+ # @option opts [String] :src_storage_name Source storage name
456
+ # @option opts [String] :dest_storage_name Destination storage name
457
+ # @option opts [String] :version_id File version ID to move
458
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
459
+ def move_file_with_http_info(src_path, dest_path, opts = {})
460
+ if @api_client.config.debug
461
+ @api_client.config.logger.debug 'Calling API: StorageApi.move_file ...'
462
+ end
463
+ # verify the required parameter 'src_path' is set
464
+ if @api_client.config.client_side_validation && src_path.nil?
465
+ fail ArgumentError, "Missing the required parameter 'src_path' when calling StorageApi.move_file"
466
+ end
467
+ # verify the required parameter 'dest_path' is set
468
+ if @api_client.config.client_side_validation && dest_path.nil?
469
+ fail ArgumentError, "Missing the required parameter 'dest_path' when calling StorageApi.move_file"
470
+ end
471
+ # resource path
472
+ local_var_path = '/html/storage/file/move/{srcPath}'.sub('{' + 'srcPath' + '}', src_path.to_s)
473
+
474
+ # query parameters
475
+ query_params = {}
476
+ query_params[:'destPath'] = dest_path
477
+ query_params[:'srcStorageName'] = opts[:'src_storage_name'] if !opts[:'src_storage_name'].nil?
478
+ query_params[:'destStorageName'] = opts[:'dest_storage_name'] if !opts[:'dest_storage_name'].nil?
479
+ query_params[:'versionId'] = opts[:'version_id'] if !opts[:'version_id'].nil?
480
+
481
+ # header parameters
482
+ header_params = {}
483
+ # HTTP header 'Accept' (if needed)
484
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
485
+ # HTTP header 'Content-Type'
486
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
487
+
488
+ # form parameters
489
+ form_params = {}
490
+
491
+ # http body (model)
492
+ post_body = nil
493
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
494
+ :header_params => header_params,
495
+ :query_params => query_params,
496
+ :form_params => form_params,
497
+ :body => post_body)
498
+ if @api_client.config.debug
499
+ @api_client.config.logger.debug "API called: StorageApi#move_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
500
+ end
501
+ return data, status_code, headers
502
+ end
503
+
504
+ # Upload file
505
+ # @param path Path where to upload including filename and extension e.g. /file.ext or /Folder 1/file.ext If the content is multipart and path does not contains the file name it tries to get them from filename parameter from Content-Disposition header.
506
+ # @param file File to upload
507
+ # @param [Hash] opts the optional parameters
508
+ # @option opts [String] :storage_name Storage name
509
+ # @return [FilesUploadResult]
510
+ def upload_file(path, file, opts = {})
511
+ data, _status_code, _headers = upload_file_with_http_info(path, file, opts)
512
+ data
513
+ end
514
+
515
+ # Upload file
516
+ # @param path Path where to upload including filename and extension e.g. /file.ext or /Folder 1/file.ext If the content is multipart and path does not contains the file name it tries to get them from filename parameter from Content-Disposition header.
517
+ # @param file File to upload
518
+ # @param [Hash] opts the optional parameters
519
+ # @option opts [String] :storage_name Storage name
520
+ # @return [Array<(FilesUploadResult, Fixnum, Hash)>] FilesUploadResult data, response status code and response headers
521
+ def upload_file_with_http_info(path, file, opts = {})
522
+ if @api_client.config.debug
523
+ @api_client.config.logger.debug 'Calling API: StorageApi.upload_file ...'
524
+ end
525
+ # verify the required parameter 'path' is set
526
+ if @api_client.config.client_side_validation && path.nil?
527
+ fail ArgumentError, "Missing the required parameter 'path' when calling StorageApi.upload_file"
528
+ end
529
+ # verify the required parameter 'file' is set
530
+ if @api_client.config.client_side_validation && file.nil?
531
+ fail ArgumentError, "Missing the required parameter 'file' when calling StorageApi.upload_file"
532
+ end
533
+ # resource path
534
+ local_var_path = '/html/storage/file/{path}'.sub('{' + 'path' + '}', path.to_s)
535
+
536
+ # query parameters
537
+ query_params = {}
538
+ query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].nil?
539
+
540
+ # header parameters
541
+ header_params = {}
542
+ # HTTP header 'Accept' (if needed)
543
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
544
+ # HTTP header 'Content-Type'
545
+ header_params['Content-Type'] = @api_client.select_header_content_type(
546
+ ['application/octet-stream'])
547
+
548
+ # form parameters
549
+ form_params = {}
550
+
551
+ # http body (model)
552
+ post_body = ::File.open(file,"rb").read
553
+
554
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
555
+ :header_params => header_params,
556
+ :query_params => query_params,
557
+ :form_params => form_params,
558
+ :body => post_body,
559
+ :return_type => 'FilesUploadResult')
560
+ if @api_client.config.debug
561
+ @api_client.config.logger.debug "API called: StorageApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
562
+ end
563
+ return data, status_code, headers
564
+ end
565
+
566
+ ################################################################################
567
+ # Folder Api
568
+ ################################################################################
569
+
570
+ # Copy folder
571
+ # @param src_path Source folder path e.g. &#39;/src&#39;
572
+ # @param dest_path Destination folder path e.g. &#39;/dst&#39;
573
+ # @param [Hash] opts the optional parameters
574
+ # @option opts [String] :src_storage_name Source storage name
575
+ # @option opts [String] :dest_storage_name Destination storage name
576
+ # @return [nil]
577
+ def copy_folder(src_path, dest_path, opts = {})
578
+ copy_folder_with_http_info(src_path, dest_path, opts)
579
+ nil
580
+ end
581
+
582
+ # Copy folder
583
+ # @param src_path Source folder path e.g. &#39;/src&#39;
584
+ # @param dest_path Destination folder path e.g. &#39;/dst&#39;
585
+ # @param [Hash] opts the optional parameters
586
+ # @option opts [String] :src_storage_name Source storage name
587
+ # @option opts [String] :dest_storage_name Destination storage name
588
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
589
+ def copy_folder_with_http_info(src_path, dest_path, opts = {})
590
+ if @api_client.config.debug
591
+ @api_client.config.logger.debug 'Calling API: StorageApi.copy_folder ...'
592
+ end
593
+ # verify the required parameter 'src_path' is set
594
+ if @api_client.config.client_side_validation && src_path.nil?
595
+ fail ArgumentError, "Missing the required parameter 'src_path' when calling StorageApi.copy_folder"
596
+ end
597
+ # verify the required parameter 'dest_path' is set
598
+ if @api_client.config.client_side_validation && dest_path.nil?
599
+ fail ArgumentError, "Missing the required parameter 'dest_path' when calling StorageApi.copy_folder"
600
+ end
601
+ # resource path
602
+ local_var_path = '/html/storage/folder/copy/{srcPath}'.sub('{' + 'srcPath' + '}', src_path.to_s)
603
+
604
+ # query parameters
605
+ query_params = {}
606
+ query_params[:'destPath'] = dest_path
607
+ query_params[:'srcStorageName'] = opts[:'src_storage_name'] if !opts[:'src_storage_name'].nil?
608
+ query_params[:'destStorageName'] = opts[:'dest_storage_name'] if !opts[:'dest_storage_name'].nil?
609
+
610
+ # header parameters
611
+ header_params = {}
612
+ # HTTP header 'Accept' (if needed)
613
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
614
+ # HTTP header 'Content-Type'
615
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
616
+
617
+ # form parameters
618
+ form_params = {}
619
+
620
+ # http body (model)
621
+ post_body = nil
622
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
623
+ :header_params => header_params,
624
+ :query_params => query_params,
625
+ :form_params => form_params,
626
+ :body => post_body)
627
+ if @api_client.config.debug
628
+ @api_client.config.logger.debug "API called: StorageApi#copy_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
629
+ end
630
+ return data, status_code, headers
631
+ end
632
+
633
+ # Create the folder
634
+ # @param path Folder path to create e.g. &#39;folder_1/folder_2/&#39;
635
+ # @param [Hash] opts the optional parameters
636
+ # @option opts [String] :storage_name Storage name
637
+ # @return [nil]
638
+ def create_folder(path, opts = {})
639
+ create_folder_with_http_info(path, opts)
640
+ nil
641
+ end
642
+
643
+ # Create the folder
644
+ # @param path Folder path to create e.g. &#39;folder_1/folder_2/&#39;
645
+ # @param [Hash] opts the optional parameters
646
+ # @option opts [String] :storage_name Storage name
647
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
648
+ def create_folder_with_http_info(path, opts = {})
649
+ if @api_client.config.debug
650
+ @api_client.config.logger.debug 'Calling API: StorageApi.create_folder ...'
651
+ end
652
+ # verify the required parameter 'path' is set
653
+ if @api_client.config.client_side_validation && path.nil?
654
+ fail ArgumentError, "Missing the required parameter 'path' when calling StorageApi.create_folder"
655
+ end
656
+ # resource path
657
+ local_var_path = '/html/storage/folder/{path}'.sub('{' + 'path' + '}', path.to_s)
658
+
659
+ # query parameters
660
+ query_params = {}
661
+ query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].nil?
662
+
663
+ # header parameters
664
+ header_params = {}
665
+ # HTTP header 'Accept' (if needed)
666
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
667
+ # HTTP header 'Content-Type'
668
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
669
+
670
+ # form parameters
671
+ form_params = {}
672
+
673
+ # http body (model)
674
+ post_body = nil
675
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
676
+ :header_params => header_params,
677
+ :query_params => query_params,
678
+ :form_params => form_params,
679
+ :body => post_body)
680
+ if @api_client.config.debug
681
+ @api_client.config.logger.debug "API called: StorageApi#create_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
682
+ end
683
+ return data, status_code, headers
684
+ end
685
+
686
+ # Delete folder
687
+ # @param path Folder path e.g. &#39;/folder&#39;
688
+ # @param [Hash] opts the optional parameters
689
+ # @option opts [String] :storage_name Storage name
690
+ # @option opts [BOOLEAN] :recursive Enable to delete folders, subfolders and files (default to false)
691
+ # @return [nil]
692
+ def delete_folder(path, opts = {})
693
+ delete_folder_with_http_info(path, opts)
694
+ nil
695
+ end
696
+
697
+ # Delete folder
698
+ # @param path Folder path e.g. &#39;/folder&#39;
699
+ # @param [Hash] opts the optional parameters
700
+ # @option opts [String] :storage_name Storage name
701
+ # @option opts [BOOLEAN] :recursive Enable to delete folders, subfolders and files
702
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
703
+ def delete_folder_with_http_info(path, opts = {})
704
+ if @api_client.config.debug
705
+ @api_client.config.logger.debug 'Calling API: StorageApi.delete_folder ...'
706
+ end
707
+ # verify the required parameter 'path' is set
708
+ if @api_client.config.client_side_validation && path.nil?
709
+ fail ArgumentError, "Missing the required parameter 'path' when calling StorageApi.delete_folder"
710
+ end
711
+ # resource path
712
+ local_var_path = '/html/storage/folder/{path}'.sub('{' + 'path' + '}', path.to_s)
713
+
714
+ # query parameters
715
+ query_params = {}
716
+ query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].nil?
717
+ query_params[:'recursive'] = opts[:'recursive'] if !opts[:'recursive'].nil?
718
+
719
+ # header parameters
720
+ header_params = {}
721
+ # HTTP header 'Accept' (if needed)
722
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
723
+ # HTTP header 'Content-Type'
724
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
725
+
726
+ # form parameters
727
+ form_params = {}
728
+
729
+ # http body (model)
730
+ post_body = nil
731
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
732
+ :header_params => header_params,
733
+ :query_params => query_params,
734
+ :form_params => form_params,
735
+ :body => post_body)
736
+ if @api_client.config.debug
737
+ @api_client.config.logger.debug "API called: StorageApi#delete_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
738
+ end
739
+ return data, status_code, headers
740
+ end
741
+
742
+ # Get all files and folders within a folder
743
+ # @param path Folder path e.g. &#39;/folder&#39;
744
+ # @param [Hash] opts the optional parameters
745
+ # @option opts [String] :storage_name Storage name
746
+ # @return [FilesList]
747
+ def get_files_list(path, opts = {})
748
+ data, _status_code, _headers = get_files_list_with_http_info(path, opts)
749
+ data
750
+ end
751
+
752
+ # Get all files and folders within a folder
753
+ # @param path Folder path e.g. &#39;/folder&#39;
754
+ # @param [Hash] opts the optional parameters
755
+ # @option opts [String] :storage_name Storage name
756
+ # @return [Array<(FilesList, Fixnum, Hash)>] FilesList data, response status code and response headers
757
+ def get_files_list_with_http_info(path, opts = {})
758
+ if @api_client.config.debug
759
+ @api_client.config.logger.debug 'Calling API: StorageApi.get_files_list ...'
760
+ end
761
+ # verify the required parameter 'path' is set
762
+ if @api_client.config.client_side_validation && path.nil?
763
+ fail ArgumentError, "Missing the required parameter 'path' when calling StorageApi.get_files_list"
764
+ end
765
+ # resource path
766
+ local_var_path = '/html/storage/folder/{path}'.sub('{' + 'path' + '}', path.to_s)
767
+
768
+ # query parameters
769
+ query_params = {}
770
+ query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].nil?
771
+
772
+ # header parameters
773
+ header_params = {}
774
+ # HTTP header 'Accept' (if needed)
775
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
776
+ # HTTP header 'Content-Type'
777
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
778
+
779
+ # form parameters
780
+ form_params = {}
781
+
782
+ # http body (model)
783
+ post_body = nil
784
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
785
+ :header_params => header_params,
786
+ :query_params => query_params,
787
+ :form_params => form_params,
788
+ :body => post_body,
789
+ :return_type => 'FilesList')
790
+ if @api_client.config.debug
791
+ @api_client.config.logger.debug "API called: StorageApi#get_files_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
792
+ end
793
+ return data, status_code, headers
794
+ end
795
+
796
+ # Move folder
797
+ # @param src_path Folder path to move e.g. &#39;/folder&#39;
798
+ # @param dest_path Destination folder path to move to e.g &#39;/dst&#39;
799
+ # @param [Hash] opts the optional parameters
800
+ # @option opts [String] :src_storage_name Source storage name
801
+ # @option opts [String] :dest_storage_name Destination storage name
802
+ # @return [nil]
803
+ def move_folder(src_path, dest_path, opts = {})
804
+ move_folder_with_http_info(src_path, dest_path, opts)
805
+ nil
806
+ end
807
+
808
+ # Move folder
809
+ # @param src_path Folder path to move e.g. &#39;/folder&#39;
810
+ # @param dest_path Destination folder path to move to e.g &#39;/dst&#39;
811
+ # @param [Hash] opts the optional parameters
812
+ # @option opts [String] :src_storage_name Source storage name
813
+ # @option opts [String] :dest_storage_name Destination storage name
814
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
815
+ def move_folder_with_http_info(src_path, dest_path, opts = {})
816
+ if @api_client.config.debug
817
+ @api_client.config.logger.debug 'Calling API: StorageApi.move_folder ...'
818
+ end
819
+ # verify the required parameter 'src_path' is set
820
+ if @api_client.config.client_side_validation && src_path.nil?
821
+ fail ArgumentError, "Missing the required parameter 'src_path' when calling StorageApi.move_folder"
822
+ end
823
+ # verify the required parameter 'dest_path' is set
824
+ if @api_client.config.client_side_validation && dest_path.nil?
825
+ fail ArgumentError, "Missing the required parameter 'dest_path' when calling StorageApi.move_folder"
826
+ end
827
+ # resource path
828
+ local_var_path = '/html/storage/folder/move/{srcPath}'.sub('{' + 'srcPath' + '}', src_path.to_s)
829
+
830
+ # query parameters
831
+ query_params = {}
832
+ query_params[:'destPath'] = dest_path
833
+ query_params[:'srcStorageName'] = opts[:'src_storage_name'] if !opts[:'src_storage_name'].nil?
834
+ query_params[:'destStorageName'] = opts[:'dest_storage_name'] if !opts[:'dest_storage_name'].nil?
835
+
836
+ # header parameters
837
+ header_params = {}
838
+ # HTTP header 'Accept' (if needed)
839
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
840
+ # HTTP header 'Content-Type'
841
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
842
+
843
+ # form parameters
844
+ form_params = {}
845
+
846
+ # http body (model)
847
+ post_body = nil
848
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
849
+ :header_params => header_params,
850
+ :query_params => query_params,
851
+ :form_params => form_params,
852
+ :body => post_body)
853
+ if @api_client.config.debug
854
+ @api_client.config.logger.debug "API called: StorageApi#move_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
855
+ end
856
+ return data, status_code, headers
857
+ end
858
+ end
859
+ end