class TriglavClient::MessagesApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

fetch_messages(offset, opts = {}) click to toggle source

Fetch messages @param offset Offset (Greater than or equal to) ID for Messages to list from @param [Hash] opts the optional parameters @option opts [Integer] :limit Number of limits @option opts [String] :resource_uris URIs of Resource @return [Array<MessageEachResponse>]

# File lib/triglav_client/api/messages_api.rb, line 41
def fetch_messages(offset, opts = {})
  data, _status_code, _headers = fetch_messages_with_http_info(offset, opts)
  return data
end
fetch_messages_with_http_info(offset, opts = {}) click to toggle source

Fetch messages @param offset Offset (Greater than or equal to) ID for Messages to list from @param [Hash] opts the optional parameters @option opts [Integer] :limit Number of limits @option opts [String] :resource_uris URIs of Resource @return [Array<(Array<MessageEachResponse>, Fixnum, Hash)>] Array<MessageEachResponse> data, response status code and response headers

# File lib/triglav_client/api/messages_api.rb, line 53
def fetch_messages_with_http_info(offset, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MessagesApi.fetch_messages ..."
  end
  # verify the required parameter 'offset' is set
  fail ArgumentError, "Missing the required parameter 'offset' when calling MessagesApi.fetch_messages" if offset.nil?
  # resource path
  local_var_path = "/messages".sub('{format}','json')

  # query parameters
  query_params = {}
  query_params[:'offset'] = offset
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'resource_uris'] = opts[:'resource_uris'] if !opts[:'resource_uris'].nil?

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  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 => 'Array<MessageEachResponse>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#fetch_messages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_last_message_id(opts = {}) click to toggle source

Get the current last message id which would be used as a first offset to fetch messages @param [Hash] opts the optional parameters @return [LastMessageIdResponse]

# File lib/triglav_client/api/messages_api.rb, line 102
def get_last_message_id(opts = {})
  data, _status_code, _headers = get_last_message_id_with_http_info(opts)
  return data
end
get_last_message_id_with_http_info(opts = {}) click to toggle source

Get the current last message id which would be used as a first offset to fetch messages @param [Hash] opts the optional parameters @return [Array<(LastMessageIdResponse, Fixnum, Hash)>] LastMessageIdResponse data, response status code and response headers

# File lib/triglav_client/api/messages_api.rb, line 111
def get_last_message_id_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MessagesApi.get_last_message_id ..."
  end
  # resource path
  local_var_path = "/messages/last_id".sub('{format}','json')

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  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 => 'LastMessageIdResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#get_last_message_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
send_messages(messages, opts = {}) click to toggle source

Enqueues new messages @param messages Messages to enqueue @param [Hash] opts the optional parameters @return [BulkinsertResponse]

# File lib/triglav_client/api/messages_api.rb, line 156
def send_messages(messages, opts = {})
  data, _status_code, _headers = send_messages_with_http_info(messages, opts)
  return data
end
send_messages_with_http_info(messages, opts = {}) click to toggle source

Enqueues new messages @param messages Messages to enqueue @param [Hash] opts the optional parameters @return [Array<(BulkinsertResponse, Fixnum, Hash)>] BulkinsertResponse data, response status code and response headers

# File lib/triglav_client/api/messages_api.rb, line 166
def send_messages_with_http_info(messages, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MessagesApi.send_messages ..."
  end
  # verify the required parameter 'messages' is set
  fail ArgumentError, "Missing the required parameter 'messages' when calling MessagesApi.send_messages" if messages.nil?
  # resource path
  local_var_path = "/messages".sub('{format}','json')

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(messages)
  auth_names = ['api_key']
  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 => 'BulkinsertResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagesApi#send_messages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end