Class: Notifo::MediaApi

Inherits:
Object
  • Object
show all
Defined in:
lib/notifo/api/media_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MediaApi

Returns a new instance of MediaApi.



16
17
18
# File 'lib/notifo/api/media_api.rb', line 16

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/notifo/api/media_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#media_delete(app_id, file_name, opts = {}) ⇒ nil

Delete a media.

Parameters:

  • app_id

    The app id where the media belongs to.

  • file_name

    The file name of the media.

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

    the optional parameters

Returns:

  • (nil)


24
25
26
27
# File 'lib/notifo/api/media_api.rb', line 24

def media_delete(app_id, file_name, opts = {})
  media_delete_with_http_info(app_id, file_name, opts)
  nil
end

#media_delete_with_http_info(app_id, file_name, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a media.

Parameters:

  • app_id

    The app id where the media belongs to.

  • file_name

    The file name of the media.

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

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



34
35
36
37
38
39
40
41
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
# File 'lib/notifo/api/media_api.rb', line 34

def media_delete_with_http_info(app_id, file_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.media_delete ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling MediaApi.media_delete"
  end
  # verify the required parameter 'file_name' is set
  if @api_client.config.client_side_validation && file_name.nil?
    fail ArgumentError, "Missing the required parameter 'file_name' when calling MediaApi.media_delete"
  end
  # resource path
  local_var_path = '/api/apps/{appId}/media/{fileName}'.sub('{' + 'appId' + '}', app_id.to_s).sub('{' + 'fileName' + '}', file_name.to_s)

  # query parameters
  query_params = opts[:query_params] || {}

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

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] 

  auth_names = opts[: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 => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#media_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#media_download(app_id, file_name, opts = {}) ⇒ String

Download a media object.

Parameters:

  • app_id

    The app id where the media belongs to.

  • file_name

    The name of the media to download.

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

    the optional parameters

Options Hash (opts):

  • :cache (Integer)

    The cache duration.

  • :download (Integer)

    Set it to 1 to create a download response.

  • :width (Integer)

    The target width when an image.

  • :height (Integer)

    The target height when an image.

  • :quality (Integer)

    The target quality when an image.

  • :preset (String)

    A preset dimension.

  • :mode (ResizeMode)

    The resize mode.

  • :focus_x (Float)

    The x position of the focues point.

  • :focus_y (Float)

    The y position of the focues point.

  • :force (BOOLEAN)

    True to resize it and clear the cache.

Returns:

  • (String)


94
95
96
97
# File 'lib/notifo/api/media_api.rb', line 94

def media_download(app_id, file_name, opts = {})
  data, _status_code, _headers = media_download_with_http_info(app_id, file_name, opts)
  data
end

#media_download2(app_id, file_name, opts = {}) ⇒ String

Download a media object.

Parameters:

  • app_id

    The app id where the media belongs to.

  • file_name

    The name of the media to download.

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

    the optional parameters

Options Hash (opts):

  • :cache (Integer)

    The cache duration.

  • :download (Integer)

    Set it to 1 to create a download response.

  • :width (Integer)

    The target width when an image.

  • :height (Integer)

    The target height when an image.

  • :quality (Integer)

    The target quality when an image.

  • :preset (String)

    A preset dimension.

  • :mode (ResizeMode)

    The resize mode.

  • :focus_x (Float)

    The x position of the focues point.

  • :focus_y (Float)

    The y position of the focues point.

  • :force (BOOLEAN)

    True to resize it and clear the cache.

Returns:

  • (String)


184
185
186
187
# File 'lib/notifo/api/media_api.rb', line 184

def media_download2(app_id, file_name, opts = {})
  data, _status_code, _headers = media_download2_with_http_info(app_id, file_name, opts)
  data
end

#media_download2_with_http_info(app_id, file_name, opts = {}) ⇒ Array<(String, Integer, Hash)>

Download a media object.

Parameters:

  • app_id

    The app id where the media belongs to.

  • file_name

    The name of the media to download.

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

    the optional parameters

Options Hash (opts):

  • :cache (Integer)

    The cache duration.

  • :download (Integer)

    Set it to 1 to create a download response.

  • :width (Integer)

    The target width when an image.

  • :height (Integer)

    The target height when an image.

  • :quality (Integer)

    The target quality when an image.

  • :preset (String)

    A preset dimension.

  • :mode (ResizeMode)

    The resize mode.

  • :focus_x (Float)

    The x position of the focues point.

  • :focus_y (Float)

    The y position of the focues point.

  • :force (BOOLEAN)

    True to resize it and clear the cache.

Returns:

  • (Array<(String, Integer, Hash)>)

    String data, response status code and response headers



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/notifo/api/media_api.rb', line 204

def media_download2_with_http_info(app_id, file_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.media_download2 ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling MediaApi.media_download2"
  end
  # verify the required parameter 'file_name' is set
  if @api_client.config.client_side_validation && file_name.nil?
    fail ArgumentError, "Missing the required parameter 'file_name' when calling MediaApi.media_download2"
  end
  # resource path
  local_var_path = '/api/assets/{appId}/{fileName}'.sub('{' + 'appId' + '}', app_id.to_s).sub('{' + 'fileName' + '}', file_name.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'cache'] = opts[:'cache'] if !opts[:'cache'].nil?
  query_params[:'download'] = opts[:'download'] if !opts[:'download'].nil?
  query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
  query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
  query_params[:'quality'] = opts[:'quality'] if !opts[:'quality'].nil?
  query_params[:'preset'] = opts[:'preset'] if !opts[:'preset'].nil?
  query_params[:'mode'] = opts[:'mode'] if !opts[:'mode'].nil?
  query_params[:'focusX'] = opts[:'focus_x'] if !opts[:'focus_x'].nil?
  query_params[:'focusY'] = opts[:'focus_y'] if !opts[:'focus_y'].nil?
  query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream', 'application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'String' 

  auth_names = opts[: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 => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#media_download2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#media_download_with_http_info(app_id, file_name, opts = {}) ⇒ Array<(String, Integer, Hash)>

Download a media object.

Parameters:

  • app_id

    The app id where the media belongs to.

  • file_name

    The name of the media to download.

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

    the optional parameters

Options Hash (opts):

  • :cache (Integer)

    The cache duration.

  • :download (Integer)

    Set it to 1 to create a download response.

  • :width (Integer)

    The target width when an image.

  • :height (Integer)

    The target height when an image.

  • :quality (Integer)

    The target quality when an image.

  • :preset (String)

    A preset dimension.

  • :mode (ResizeMode)

    The resize mode.

  • :focus_x (Float)

    The x position of the focues point.

  • :focus_y (Float)

    The y position of the focues point.

  • :force (BOOLEAN)

    True to resize it and clear the cache.

Returns:

  • (Array<(String, Integer, Hash)>)

    String data, response status code and response headers



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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/notifo/api/media_api.rb', line 114

def media_download_with_http_info(app_id, file_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.media_download ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling MediaApi.media_download"
  end
  # verify the required parameter 'file_name' is set
  if @api_client.config.client_side_validation && file_name.nil?
    fail ArgumentError, "Missing the required parameter 'file_name' when calling MediaApi.media_download"
  end
  # resource path
  local_var_path = '/api/apps/{appId}/media/{fileName}'.sub('{' + 'appId' + '}', app_id.to_s).sub('{' + 'fileName' + '}', file_name.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'cache'] = opts[:'cache'] if !opts[:'cache'].nil?
  query_params[:'download'] = opts[:'download'] if !opts[:'download'].nil?
  query_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
  query_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
  query_params[:'quality'] = opts[:'quality'] if !opts[:'quality'].nil?
  query_params[:'preset'] = opts[:'preset'] if !opts[:'preset'].nil?
  query_params[:'mode'] = opts[:'mode'] if !opts[:'mode'].nil?
  query_params[:'focusX'] = opts[:'focus_x'] if !opts[:'focus_x'].nil?
  query_params[:'focusY'] = opts[:'focus_y'] if !opts[:'focus_y'].nil?
  query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream', 'application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'String' 

  auth_names = opts[: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 => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#media_download\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#media_get_medias(app_id, opts = {}) ⇒ ListResponseDtoOfMediaDto

Query media items.

Parameters:

  • app_id

    The app where the media belongs to.

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

    the optional parameters

Options Hash (opts):

  • :query (String)

    The optional query to search for items.

  • :take (Integer)

    The number of items to return.

  • :skip (Integer)

    The number of items to skip.

Returns:



266
267
268
269
# File 'lib/notifo/api/media_api.rb', line 266

def media_get_medias(app_id, opts = {})
  data, _status_code, _headers = media_get_medias_with_http_info(app_id, opts)
  data
end

#media_get_medias_with_http_info(app_id, opts = {}) ⇒ Array<(ListResponseDtoOfMediaDto, Integer, Hash)>

Query media items.

Parameters:

  • app_id

    The app where the media belongs to.

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

    the optional parameters

Options Hash (opts):

  • :query (String)

    The optional query to search for items.

  • :take (Integer)

    The number of items to return.

  • :skip (Integer)

    The number of items to skip.

Returns:

  • (Array<(ListResponseDtoOfMediaDto, Integer, Hash)>)

    ListResponseDtoOfMediaDto data, response status code and response headers



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/notifo/api/media_api.rb', line 278

def media_get_medias_with_http_info(app_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.media_get_medias ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling MediaApi.media_get_medias"
  end
  # resource path
  local_var_path = '/api/apps/{appId}/media'.sub('{' + 'appId' + '}', app_id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?
  query_params[:'take'] = opts[:'take'] if !opts[:'take'].nil?
  query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?

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

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'ListResponseDtoOfMediaDto' 

  auth_names = opts[: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 => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#media_get_medias\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#media_upload(app_id, opts = {}) ⇒ nil

Upload a media object.

Parameters:

  • app_id

    The app id where the media belongs to.

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

    the optional parameters

Options Hash (opts):

  • :file (String)

Returns:

  • (nil)


327
328
329
330
# File 'lib/notifo/api/media_api.rb', line 327

def media_upload(app_id, opts = {})
  media_upload_with_http_info(app_id, opts)
  nil
end

#media_upload_with_http_info(app_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Upload a media object.

Parameters:

  • app_id

    The app id where the media belongs to.

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

    the optional parameters

Options Hash (opts):

  • :file (String)

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/notifo/api/media_api.rb', line 337

def media_upload_with_http_info(app_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.media_upload ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling MediaApi.media_upload"
  end
  # resource path
  local_var_path = '/api/apps/{appId}/media'.sub('{' + 'appId' + '}', app_id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[: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 = opts[:form_params] || {}
  form_params['file'] = opts[:'file'] if !opts[:'file'].nil?

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] 

  auth_names = opts[: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 => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#media_upload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end