class Notifo::MediaApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/notifo/api/media_api.rb, line 16
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

media_delete(app_id, file_name, opts = {}) click to toggle source

Delete a media. @param app_id The app id where the media belongs to. @param file_name The file name of the media. @param [Hash] opts the optional parameters @return [nil]

# 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 = {}) click to toggle source

Delete a media. @param app_id The app id where the media belongs to. @param file_name The file name of the media. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# 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 = {}) click to toggle source

Download a media object. @param app_id The app id where the media belongs to. @param file_name The name of the media to download. @param [Hash] opts the optional parameters @option opts [Integer] :cache The cache duration. @option opts [Integer] :download Set it to 1 to create a download response. @option opts [Integer] :width The target width when an image. @option opts [Integer] :height The target height when an image. @option opts [Integer] :quality The target quality when an image. @option opts [String] :preset A preset dimension. @option opts [ResizeMode] :mode The resize mode. @option opts [Float] :focus_x The x position of the focues point. @option opts [Float] :focus_y The y position of the focues point. @option opts [BOOLEAN] :force True to resize it and clear the cache. @return [String]

# 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 = {}) click to toggle source

Download a media object. @param app_id The app id where the media belongs to. @param file_name The name of the media to download. @param [Hash] opts the optional parameters @option opts [Integer] :cache The cache duration. @option opts [Integer] :download Set it to 1 to create a download response. @option opts [Integer] :width The target width when an image. @option opts [Integer] :height The target height when an image. @option opts [Integer] :quality The target quality when an image. @option opts [String] :preset A preset dimension. @option opts [ResizeMode] :mode The resize mode. @option opts [Float] :focus_x The x position of the focues point. @option opts [Float] :focus_y The y position of the focues point. @option opts [BOOLEAN] :force True to resize it and clear the cache. @return [String]

# 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 = {}) click to toggle source

Download a media object. @param app_id The app id where the media belongs to. @param file_name The name of the media to download. @param [Hash] opts the optional parameters @option opts [Integer] :cache The cache duration. @option opts [Integer] :download Set it to 1 to create a download response. @option opts [Integer] :width The target width when an image. @option opts [Integer] :height The target height when an image. @option opts [Integer] :quality The target quality when an image. @option opts [String] :preset A preset dimension. @option opts [ResizeMode] :mode The resize mode. @option opts [Float] :focus_x The x position of the focues point. @option opts [Float] :focus_y The y position of the focues point. @option opts [BOOLEAN] :force True to resize it and clear the cache. @return [Array<(String, Integer, Hash)>] String data, response status code and response headers

# 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 = {}) click to toggle source

Download a media object. @param app_id The app id where the media belongs to. @param file_name The name of the media to download. @param [Hash] opts the optional parameters @option opts [Integer] :cache The cache duration. @option opts [Integer] :download Set it to 1 to create a download response. @option opts [Integer] :width The target width when an image. @option opts [Integer] :height The target height when an image. @option opts [Integer] :quality The target quality when an image. @option opts [String] :preset A preset dimension. @option opts [ResizeMode] :mode The resize mode. @option opts [Float] :focus_x The x position of the focues point. @option opts [Float] :focus_y The y position of the focues point. @option opts [BOOLEAN] :force True to resize it and clear the cache. @return [Array<(String, Integer, Hash)>] String data, response status code and response headers

# 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 = {}) click to toggle source

Query media items. @param app_id The app where the media belongs to. @param [Hash] opts the optional parameters @option opts [String] :query The optional query to search for items. @option opts [Integer] :take The number of items to return. @option opts [Integer] :skip The number of items to skip. @return [ListResponseDtoOfMediaDto]

# 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 = {}) click to toggle source

Query media items. @param app_id The app where the media belongs to. @param [Hash] opts the optional parameters @option opts [String] :query The optional query to search for items. @option opts [Integer] :take The number of items to return. @option opts [Integer] :skip The number of items to skip. @return [Array<(ListResponseDtoOfMediaDto, Integer, Hash)>] ListResponseDtoOfMediaDto data, response status code and response headers

# 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 = {}) click to toggle source

Upload a media object. @param app_id The app id where the media belongs to. @param [Hash] opts the optional parameters @option opts [String] :file @return [nil]

# 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 = {}) click to toggle source

Upload a media object. @param app_id The app id where the media belongs to. @param [Hash] opts the optional parameters @option opts [String] :file @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# 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