class RainbowSubmarineTest3356::ConversationApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/rainbow-submarine-test-3356/api/conversation_api.rb, line 18
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

get_messages(user_id, opts = {}) click to toggle source

Get the specified app users messages. @param user_id Identifies the user. Can be either the smoochId or the userId. @param [Hash] opts the optional parameters @option opts [String] :before Timestamp of message. The API will return 100 messages before the specified timestamp (excluding any messages with the provided timestamp). @option opts [String] :after Timestamp of message. The API will return 100 messages after the specified timestamp (excluding any messages with the provided timestamp). @return [GetMessagesResponse]

# File lib/rainbow-submarine-test-3356/api/conversation_api.rb, line 29
def get_messages(user_id, opts = {})
  data, _status_code, _headers = get_messages_with_http_info(user_id, opts)
  return data
end
get_messages_with_http_info(user_id, opts = {}) click to toggle source

Get the specified app users messages. @param user_id Identifies the user. Can be either the smoochId or the userId. @param [Hash] opts the optional parameters @option opts [String] :before Timestamp of message. The API will return 100 messages before the specified timestamp (excluding any messages with the provided timestamp). @option opts [String] :after Timestamp of message. The API will return 100 messages after the specified timestamp (excluding any messages with the provided timestamp). @return [Array<(GetMessagesResponse, Fixnum, Hash)>] GetMessagesResponse data, response status code and response headers

# File lib/rainbow-submarine-test-3356/api/conversation_api.rb, line 41
def get_messages_with_http_info(user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ConversationApi.get_messages ..."
  end
  # verify the required parameter 'user_id' is set
  fail ArgumentError, "Missing the required parameter 'user_id' when calling ConversationApi.get_messages" if user_id.nil?
  # resource path
  local_var_path = "/appusers/{userId}/messages".sub('{' + 'userId' + '}', user_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].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 = ['appToken', 'jwt']
  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 => 'GetMessagesResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConversationApi#get_messages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
reset_unread_count(user_id, opts = {}) click to toggle source

Reset the unread count of the conversation to 0. If the conversation has not yet been created for the specified app user 404 will be returned. @param user_id Identifies the user. Can be either the smoochId or the userId. @param [Hash] opts the optional parameters @return [nil]

# File lib/rainbow-submarine-test-3356/api/conversation_api.rb, line 86
def reset_unread_count(user_id, opts = {})
  reset_unread_count_with_http_info(user_id, opts)
  return nil
end
reset_unread_count_with_http_info(user_id, opts = {}) click to toggle source

Reset the unread count of the conversation to 0. If the conversation has not yet been created for the specified app user 404 will be returned. @param user_id Identifies the user. Can be either the smoochId or the userId. @param [Hash] opts the optional parameters @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers

# File lib/rainbow-submarine-test-3356/api/conversation_api.rb, line 96
def reset_unread_count_with_http_info(user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ConversationApi.reset_unread_count ..."
  end
  # verify the required parameter 'user_id' is set
  fail ArgumentError, "Missing the required parameter 'user_id' when calling ConversationApi.reset_unread_count" if user_id.nil?
  # resource path
  local_var_path = "/appusers/{userId}/conversation/read".sub('{' + 'userId' + '}', user_id.to_s)

  # query parameters
  query_params = {}

  # 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 = ['appToken', 'jwt']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConversationApi#reset_unread_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
trigger_typing_activity(user_id, typing_activity_trigger, opts = {}) click to toggle source

Notify Smooch when an app maker starts or stops typing a response. @param user_id Identifies the user. Can be either the smoochId or the userId. @param typing_activity_trigger Supported properties for a triggerTypingActivity request. @param [Hash] opts the optional parameters @return [nil]

# File lib/rainbow-submarine-test-3356/api/conversation_api.rb, line 139
def trigger_typing_activity(user_id, typing_activity_trigger, opts = {})
  trigger_typing_activity_with_http_info(user_id, typing_activity_trigger, opts)
  return nil
end
trigger_typing_activity_with_http_info(user_id, typing_activity_trigger, opts = {}) click to toggle source

Notify Smooch when an app maker starts or stops typing a response. @param user_id Identifies the user. Can be either the smoochId or the userId. @param typing_activity_trigger Supported properties for a triggerTypingActivity request. @param [Hash] opts the optional parameters @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers

# File lib/rainbow-submarine-test-3356/api/conversation_api.rb, line 150
def trigger_typing_activity_with_http_info(user_id, typing_activity_trigger, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ConversationApi.trigger_typing_activity ..."
  end
  # verify the required parameter 'user_id' is set
  fail ArgumentError, "Missing the required parameter 'user_id' when calling ConversationApi.trigger_typing_activity" if user_id.nil?
  # verify the required parameter 'typing_activity_trigger' is set
  fail ArgumentError, "Missing the required parameter 'typing_activity_trigger' when calling ConversationApi.trigger_typing_activity" if typing_activity_trigger.nil?
  # resource path
  local_var_path = "/appusers/{userId}/conversation/activity".sub('{' + 'userId' + '}', user_id.to_s)

  # query parameters
  query_params = {}

  # 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 = @api_client.object_to_http_body(typing_activity_trigger)
  auth_names = ['appToken', 'jwt']
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ConversationApi#trigger_typing_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end