Class: GroupDocsPlatformCloud::FileApi

Inherits:
Object
  • Object
show all
Defined in:
lib/groupdocs_platform_cloud/api/file_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FileApi

Returns a new instance of FileApi.



19
20
21
# File 'lib/groupdocs_platform_cloud/api/file_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/groupdocs_platform_cloud/api/file_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#file_delete_file(path, opts = {}) ⇒ RemoveFileResponse

Remove a specific file. Parameters: path - file path e.g. /file.ext, versionID - file’s version, storage - user’s storage name.

Parameters:

  • path
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :version_id (String)
  • :storage (String)

Returns:



30
31
32
33
# File 'lib/groupdocs_platform_cloud/api/file_api.rb', line 30

def file_delete_file(path, opts = {})
  data, _status_code, _headers = file_delete_file_with_http_info(path, opts)
  return data
end

#file_delete_file_with_http_info(path, opts = {}) ⇒ Array<(RemoveFileResponse, Fixnum, Hash)>

Remove a specific file. Parameters: path - file path e.g. /file.ext, versionID - file&#39;s version, storage - user&#39;s storage name.

Parameters:

  • path
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :version_id (String)
  • :storage (String)

Returns:

  • (Array<(RemoveFileResponse, Fixnum, Hash)>)

    RemoveFileResponse data, response status code and response headers



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/groupdocs_platform_cloud/api/file_api.rb', line 42

def file_delete_file_with_http_info(path, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: FileApi.file_delete_file ..."
  end
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    fail ArgumentError, "Missing the required parameter 'path' when calling FileApi.file_delete_file"
  end
  # resource path
  local_var_path = "/storage/file/{path}".sub('{' + 'path' + '}', path.to_s)

  # query parameters
  query_params = {}
  query_params[:'versionId'] = opts[:'version_id'] if !opts[:'version_id'].nil?
  query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'RemoveFileResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileApi#file_delete_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#file_get_download(path, opts = {}) ⇒ File

Download a specific file. Parameters: path - file path e.g. /file.ext, versionID - file’s version, storage - user’s storage name.

Parameters:

  • path
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :version_id (String)
  • :storage (String)

Returns:



91
92
93
94
# File 'lib/groupdocs_platform_cloud/api/file_api.rb', line 91

def file_get_download(path, opts = {})
  data, _status_code, _headers = file_get_download_with_http_info(path, opts)
  return data
end

#file_get_download_with_http_info(path, opts = {}) ⇒ Array<(File, Fixnum, Hash)>

Download a specific file. Parameters: path - file path e.g. /file.ext, versionID - file&#39;s version, storage - user&#39;s storage name.

Parameters:

  • path
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :version_id (String)
  • :storage (String)

Returns:

  • (Array<(File, Fixnum, Hash)>)

    File data, response status code and response headers



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/groupdocs_platform_cloud/api/file_api.rb', line 103

def file_get_download_with_http_info(path, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: FileApi.file_get_download ..."
  end
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    fail ArgumentError, "Missing the required parameter 'path' when calling FileApi.file_get_download"
  end
  # resource path
  local_var_path = "/storage/file/{path}".sub('{' + 'path' + '}', path.to_s)

  # query parameters
  query_params = {}
  query_params[:'versionId'] = opts[:'version_id'] if !opts[:'version_id'].nil?
  query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'File')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileApi#file_get_download\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#file_post_move_file(path, dest, opts = {}) ⇒ MoveFileResponse

Move a specific file.

Parameters:

  • path

    source file path e.g. /file.ext

  • dest
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :version_id (String)

    source file&#39;s version,

  • :storage (String)

    user&#39;s source storage name

  • :dest_storage (String)

    user&#39;s destination storage name

Returns:



154
155
156
157
# File 'lib/groupdocs_platform_cloud/api/file_api.rb', line 154

def file_post_move_file(path, dest, opts = {})
  data, _status_code, _headers = file_post_move_file_with_http_info(path, dest, opts)
  return data
end

#file_post_move_file_with_http_info(path, dest, opts = {}) ⇒ Array<(MoveFileResponse, Fixnum, Hash)>

Move a specific file.

Parameters:

  • path

    source file path e.g. /file.ext

  • dest
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :version_id (String)

    source file&#39;s version,

  • :storage (String)

    user&#39;s source storage name

  • :dest_storage (String)

    user&#39;s destination storage name

Returns:

  • (Array<(MoveFileResponse, Fixnum, Hash)>)

    MoveFileResponse data, response status code and response headers



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/groupdocs_platform_cloud/api/file_api.rb', line 168

def file_post_move_file_with_http_info(path, dest, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: FileApi.file_post_move_file ..."
  end
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    fail ArgumentError, "Missing the required parameter 'path' when calling FileApi.file_post_move_file"
  end
  # verify the required parameter 'dest' is set
  if @api_client.config.client_side_validation && dest.nil?
    fail ArgumentError, "Missing the required parameter 'dest' when calling FileApi.file_post_move_file"
  end
  # resource path
  local_var_path = "/storage/file/{path}".sub('{' + 'path' + '}', path.to_s)

  # query parameters
  query_params = {}
  query_params[:'dest'] = dest
  query_params[:'versionId'] = opts[:'version_id'] if !opts[:'version_id'].nil?
  query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?
  query_params[:'destStorage'] = opts[:'dest_storage'] if !opts[:'dest_storage'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'MoveFileResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileApi#file_post_move_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#file_put_create(path, file, opts = {}) ⇒ SaaSposeResponse

Upload a specific file. Parameters: path - source file path e.g. /file.ext, versionID - source file’s version, storage - user’s source storage name, newdest - destination file path, destStorage - user’s destination storage name.

Parameters:

  • path
  • file

    file to upload

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :version_id (String)
  • :storage (String)

Returns:



222
223
224
225
# File 'lib/groupdocs_platform_cloud/api/file_api.rb', line 222

def file_put_create(path, file, opts = {})
  data, _status_code, _headers = file_put_create_with_http_info(path, file, opts)
  return data
end

#file_put_create_with_http_info(path, file, opts = {}) ⇒ Array<(SaaSposeResponse, Fixnum, Hash)>

Upload a specific file. Parameters: path - source file path e.g. /file.ext, versionID - source file&#39;s version, storage - user&#39;s source storage name, newdest - destination file path, destStorage - user&#39;s destination storage name.

Parameters:

  • path
  • file

    file to upload

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :version_id (String)
  • :storage (String)

Returns:

  • (Array<(SaaSposeResponse, Fixnum, Hash)>)

    SaaSposeResponse data, response status code and response headers



235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/groupdocs_platform_cloud/api/file_api.rb', line 235

def file_put_create_with_http_info(path, file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: FileApi.file_put_create ..."
  end
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    fail ArgumentError, "Missing the required parameter 'path' when calling FileApi.file_put_create"
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling FileApi.file_put_create"
  end
  # resource path
  local_var_path = "/storage/file/{path}".sub('{' + 'path' + '}', path.to_s)

  # query parameters
  query_params = {}
  query_params[:'versionId'] = opts[:'version_id'] if !opts[:'version_id'].nil?
  query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params["file"] = file

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'SaaSposeResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileApi#file_put_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end