=begin #UltraCart Rest API V2 #UltraCart REST API Version 2 The version of the OpenAPI document: 2.0.0 Contact: support@ultracart.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.0.1-SNAPSHOT =end require 'cgi' module UltracartClient class ConversationApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end def self.new_using_api_key(simple_key, verify_ssl = true, debugging = false) api_config = Configuration.new api_config.api_key_prefix['x-ultracart-simple-key'] = simple_key api_config.api_version = '2017-03-01' api_config.verify_ssl = verify_ssl api_client = ApiClient.new(api_config) api_client.config.debugging = debugging UltracartClient::ConversationApi.new(api_client) end # Get agent websocket authorization # Retrieve a JWT to authorize an agent to make a websocket connection. # @param [Hash] opts the optional parameters # @return [ConversationAgentAuthResponse] def get_agent_websocket_authorization(opts = {}) data, _status_code, _headers = get_agent_websocket_authorization_with_http_info(opts) data end # Get agent websocket authorization # Retrieve a JWT to authorize an agent to make a websocket connection. # @param [Hash] opts the optional parameters # @return [Array<(ConversationAgentAuthResponse, Integer, Hash)>] ConversationAgentAuthResponse data, response status code and response headers def get_agent_websocket_authorization_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ConversationApi.get_agent_websocket_authorization ...' end # resource path local_var_path = '/conversation/agent/auth' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ConversationAgentAuthResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ConversationApi.get_agent_websocket_authorization", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ConversationApi#get_agent_websocket_authorization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a conversation # Retrieve a conversation including the participants and messages # @param conversation_uuid [String] # @param [Hash] opts the optional parameters # @return [ConversationResponse] def get_conversation(conversation_uuid, opts = {}) data, _status_code, _headers = get_conversation_with_http_info(conversation_uuid, opts) data end # Retrieve a conversation # Retrieve a conversation including the participants and messages # @param conversation_uuid [String] # @param [Hash] opts the optional parameters # @return [Array<(ConversationResponse, Integer, Hash)>] ConversationResponse data, response status code and response headers def get_conversation_with_http_info(conversation_uuid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ConversationApi.get_conversation ...' end # verify the required parameter 'conversation_uuid' is set if @api_client.config.client_side_validation && conversation_uuid.nil? fail ArgumentError, "Missing the required parameter 'conversation_uuid' when calling ConversationApi.get_conversation" end # resource path local_var_path = '/conversation/conversations/{conversation_uuid}'.sub('{' + 'conversation_uuid' + '}', CGI.escape(conversation_uuid.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ConversationResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ConversationApi.get_conversation", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ConversationApi#get_conversation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a presigned conersation multimedia upload URL # Get a presigned conersation multimedia upload URL # @param extension [String] # @param [Hash] opts the optional parameters # @return [nil] def get_conversation_multimedia_upload_url(extension, opts = {}) get_conversation_multimedia_upload_url_with_http_info(extension, opts) nil end # Get a presigned conersation multimedia upload URL # Get a presigned conersation multimedia upload URL # @param extension [String] # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def get_conversation_multimedia_upload_url_with_http_info(extension, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ConversationApi.get_conversation_multimedia_upload_url ...' end # verify the required parameter 'extension' is set if @api_client.config.client_side_validation && extension.nil? fail ArgumentError, "Missing the required parameter 'extension' when calling ConversationApi.get_conversation_multimedia_upload_url" end # resource path local_var_path = '/conversation/upload_url/{extension}'.sub('{' + 'extension' + '}', CGI.escape(extension.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ConversationApi.get_conversation_multimedia_upload_url", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ConversationApi#get_conversation_multimedia_upload_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a list of conversation summaries newest to oldest # Retrieve a list of conversation summaries that are ordered newest to oldest, include the most recent message and whether its been read. # @param [Hash] opts the optional parameters # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Max 200) (default to 100) # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0) # @return [ConversationsResponse] def get_conversations(opts = {}) data, _status_code, _headers = get_conversations_with_http_info(opts) data end # Retrieve a list of conversation summaries newest to oldest # Retrieve a list of conversation summaries that are ordered newest to oldest, include the most recent message and whether its been read. # @param [Hash] opts the optional parameters # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Max 200) (default to 100) # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0) # @return [Array<(ConversationsResponse, Integer, Hash)>] ConversationsResponse data, response status code and response headers def get_conversations_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ConversationApi.get_conversations ...' end # resource path local_var_path = '/conversation/conversations' # query parameters query_params = opts[:query_params] || {} query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil? query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil? # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ConversationsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ConversationApi.get_conversations", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ConversationApi#get_conversations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Join a conversation # Join a conversation # @param conversation_uuid [String] # @param [Hash] opts the optional parameters # @return [nil] def join_conversation(conversation_uuid, opts = {}) join_conversation_with_http_info(conversation_uuid, opts) nil end # Join a conversation # Join a conversation # @param conversation_uuid [String] # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def join_conversation_with_http_info(conversation_uuid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ConversationApi.join_conversation ...' end # verify the required parameter 'conversation_uuid' is set if @api_client.config.client_side_validation && conversation_uuid.nil? fail ArgumentError, "Missing the required parameter 'conversation_uuid' when calling ConversationApi.join_conversation" end # resource path local_var_path = '/conversation/conversations/{conversation_uuid}/join'.sub('{' + 'conversation_uuid' + '}', CGI.escape(conversation_uuid.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ConversationApi.join_conversation", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ConversationApi#join_conversation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Leave a conversation # Leave a conversation # @param conversation_uuid [String] # @param [Hash] opts the optional parameters # @return [nil] def leave_conversation(conversation_uuid, opts = {}) leave_conversation_with_http_info(conversation_uuid, opts) nil end # Leave a conversation # Leave a conversation # @param conversation_uuid [String] # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def leave_conversation_with_http_info(conversation_uuid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ConversationApi.leave_conversation ...' end # verify the required parameter 'conversation_uuid' is set if @api_client.config.client_side_validation && conversation_uuid.nil? fail ArgumentError, "Missing the required parameter 'conversation_uuid' when calling ConversationApi.leave_conversation" end # resource path local_var_path = '/conversation/conversations/{conversation_uuid}/leave'.sub('{' + 'conversation_uuid' + '}', CGI.escape(conversation_uuid.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # 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[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ConversationApi.leave_conversation", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ConversationApi#leave_conversation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Start a conversation # Start a new conversation # @param start_request [ConversationStartRequest] Start request # @param [Hash] opts the optional parameters # @return [ConversationStartResponse] def start_conversation(start_request, opts = {}) data, _status_code, _headers = start_conversation_with_http_info(start_request, opts) data end # Start a conversation # Start a new conversation # @param start_request [ConversationStartRequest] Start request # @param [Hash] opts the optional parameters # @return [Array<(ConversationStartResponse, Integer, Hash)>] ConversationStartResponse data, response status code and response headers def start_conversation_with_http_info(start_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ConversationApi.start_conversation ...' end # verify the required parameter 'start_request' is set if @api_client.config.client_side_validation && start_request.nil? fail ArgumentError, "Missing the required parameter 'start_request' when calling ConversationApi.start_conversation" end # resource path local_var_path = '/conversation/conversations' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(start_request) # return_type return_type = opts[:debug_return_type] || 'ConversationStartResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey'] new_options = opts.merge( :operation => :"ConversationApi.start_conversation", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ConversationApi#start_conversation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end