require "uri" module PureCloud class GreetingsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Gets an Organization's Greetings # # @param [Hash] opts the optional parameters # @option opts [Integer] :page_size Page size # @option opts [Integer] :page_number Page number # @return [DomainEntityListing] def get_greetings(opts = {}) data, status_code, headers = get_greetings_with_http_info(opts) return data end # Gets an Organization's Greetings # # @param [Hash] opts the optional parameters # @option opts [Integer] :page_size Page size # @option opts [Integer] :page_number Page number # @return [Array<(DomainEntityListing, Fixnum, Hash)>] DomainEntityListing data, response status code and response headers def get_greetings_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: GreetingsApi#get_greetings ..." end # resource path path = "/api/v1/greetings".sub('{format}','json') # query parameters query_params = {} query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size'] query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number'] # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:GET, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'DomainEntityListing') if @api_client.config.debugging @api_client.config.logger.debug "API called: GreetingsApi#get_greetings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a Greeting for an Organization # # @param body The Greeting to create # @param [Hash] opts the optional parameters # @return [DefaultGreetingList] def post_greetings(body, opts = {}) data, status_code, headers = post_greetings_with_http_info(body, opts) return data end # Create a Greeting for an Organization # # @param body The Greeting to create # @param [Hash] opts the optional parameters # @return [Array<(DefaultGreetingList, Fixnum, Hash)>] DefaultGreetingList data, response status code and response headers def post_greetings_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: GreetingsApi#post_greetings ..." end # verify the required parameter 'body' is set fail "Missing the required parameter 'body' when calling post_greetings" if body.nil? # resource path path = "/api/v1/greetings".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:POST, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'DefaultGreetingList') if @api_client.config.debugging @api_client.config.logger.debug "API called: GreetingsApi#post_greetings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get an Organization's DefaultGreetingList # # @param [Hash] opts the optional parameters # @return [DefaultGreetingList] def get_defaults(opts = {}) data, status_code, headers = get_defaults_with_http_info(opts) return data end # Get an Organization's DefaultGreetingList # # @param [Hash] opts the optional parameters # @return [Array<(DefaultGreetingList, Fixnum, Hash)>] DefaultGreetingList data, response status code and response headers def get_defaults_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: GreetingsApi#get_defaults ..." end # resource path path = "/api/v1/greetings/defaults".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:GET, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'DefaultGreetingList') if @api_client.config.debugging @api_client.config.logger.debug "API called: GreetingsApi#get_defaults\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update an Organization's DefaultGreetingList # # @param body The updated defaultGreetingList # @param [Hash] opts the optional parameters # @return [DefaultGreetingList] def put_defaults(body, opts = {}) data, status_code, headers = put_defaults_with_http_info(body, opts) return data end # Update an Organization's DefaultGreetingList # # @param body The updated defaultGreetingList # @param [Hash] opts the optional parameters # @return [Array<(DefaultGreetingList, Fixnum, Hash)>] DefaultGreetingList data, response status code and response headers def put_defaults_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: GreetingsApi#put_defaults ..." end # verify the required parameter 'body' is set fail "Missing the required parameter 'body' when calling put_defaults" if body.nil? # resource path path = "/api/v1/greetings/defaults".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:PUT, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'DefaultGreetingList') if @api_client.config.debugging @api_client.config.logger.debug "API called: GreetingsApi#put_defaults\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a Greeting with the given GreetingId # # @param greeting_id Greeting ID # @param [Hash] opts the optional parameters # @return [Greeting] def get_greeting_id(greeting_id, opts = {}) data, status_code, headers = get_greeting_id_with_http_info(greeting_id, opts) return data end # Get a Greeting with the given GreetingId # # @param greeting_id Greeting ID # @param [Hash] opts the optional parameters # @return [Array<(Greeting, Fixnum, Hash)>] Greeting data, response status code and response headers def get_greeting_id_with_http_info(greeting_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: GreetingsApi#get_greeting_id ..." end # verify the required parameter 'greeting_id' is set fail "Missing the required parameter 'greeting_id' when calling get_greeting_id" if greeting_id.nil? # resource path path = "/api/v1/greetings/{greetingId}".sub('{format}','json').sub('{' + 'greetingId' + '}', greeting_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:GET, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Greeting') if @api_client.config.debugging @api_client.config.logger.debug "API called: GreetingsApi#get_greeting_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Updates the Greeting with the given GreetingId # # @param greeting_id Greeting ID # @param body The updated Greeting # @param [Hash] opts the optional parameters # @return [Greeting] def put_greeting_id(greeting_id, body, opts = {}) data, status_code, headers = put_greeting_id_with_http_info(greeting_id, body, opts) return data end # Updates the Greeting with the given GreetingId # # @param greeting_id Greeting ID # @param body The updated Greeting # @param [Hash] opts the optional parameters # @return [Array<(Greeting, Fixnum, Hash)>] Greeting data, response status code and response headers def put_greeting_id_with_http_info(greeting_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: GreetingsApi#put_greeting_id ..." end # verify the required parameter 'greeting_id' is set fail "Missing the required parameter 'greeting_id' when calling put_greeting_id" if greeting_id.nil? # verify the required parameter 'body' is set fail "Missing the required parameter 'body' when calling put_greeting_id" if body.nil? # resource path path = "/api/v1/greetings/{greetingId}".sub('{format}','json').sub('{' + 'greetingId' + '}', greeting_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:PUT, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Greeting') if @api_client.config.debugging @api_client.config.logger.debug "API called: GreetingsApi#put_greeting_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Deletes a Greeting with the given GreetingId # # @param greeting_id Greeting ID # @param [Hash] opts the optional parameters # @return [Greeting] def delete_greeting_id(greeting_id, opts = {}) data, status_code, headers = delete_greeting_id_with_http_info(greeting_id, opts) return data end # Deletes a Greeting with the given GreetingId # # @param greeting_id Greeting ID # @param [Hash] opts the optional parameters # @return [Array<(Greeting, Fixnum, Hash)>] Greeting data, response status code and response headers def delete_greeting_id_with_http_info(greeting_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: GreetingsApi#delete_greeting_id ..." end # verify the required parameter 'greeting_id' is set fail "Missing the required parameter 'greeting_id' when calling delete_greeting_id" if greeting_id.nil? # resource path path = "/api/v1/greetings/{greetingId}".sub('{format}','json').sub('{' + 'greetingId' + '}', greeting_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:DELETE, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Greeting') if @api_client.config.debugging @api_client.config.logger.debug "API called: GreetingsApi#delete_greeting_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get media playback URI for this greeting # # @param greeting_id Greeting ID # @param [Hash] opts the optional parameters # @option opts [String] :format_id The desired format (WAV, etc.) # @return [GreetingMediaInfo] def get_greeting_id_media(greeting_id, opts = {}) data, status_code, headers = get_greeting_id_media_with_http_info(greeting_id, opts) return data end # Get media playback URI for this greeting # # @param greeting_id Greeting ID # @param [Hash] opts the optional parameters # @option opts [String] :format_id The desired format (WAV, etc.) # @return [Array<(GreetingMediaInfo, Fixnum, Hash)>] GreetingMediaInfo data, response status code and response headers def get_greeting_id_media_with_http_info(greeting_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: GreetingsApi#get_greeting_id_media ..." end # verify the required parameter 'greeting_id' is set fail "Missing the required parameter 'greeting_id' when calling get_greeting_id_media" if greeting_id.nil? if opts[:'format_id'] && !['WAV'].include?(opts[:'format_id']) fail 'invalid value for "format_id", must be one of WAV' end # resource path path = "/api/v1/greetings/{greetingId}/media".sub('{format}','json').sub('{' + 'greetingId' + '}', greeting_id.to_s) # query parameters query_params = {} query_params[:'formatId'] = opts[:'format_id'] if opts[:'format_id'] # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:GET, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GreetingMediaInfo') if @api_client.config.debugging @api_client.config.logger.debug "API called: GreetingsApi#get_greeting_id_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a list of the User's Greetings # # @param user_id User ID # @param [Hash] opts the optional parameters # @option opts [Integer] :page_size Page size # @option opts [Integer] :page_number Page number # @return [DomainEntityListing] def get_user_id_greetings(user_id, opts = {}) data, status_code, headers = get_user_id_greetings_with_http_info(user_id, opts) return data end # Get a list of the User's Greetings # # @param user_id User ID # @param [Hash] opts the optional parameters # @option opts [Integer] :page_size Page size # @option opts [Integer] :page_number Page number # @return [Array<(DomainEntityListing, Fixnum, Hash)>] DomainEntityListing data, response status code and response headers def get_user_id_greetings_with_http_info(user_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: GreetingsApi#get_user_id_greetings ..." end # verify the required parameter 'user_id' is set fail "Missing the required parameter 'user_id' when calling get_user_id_greetings" if user_id.nil? # resource path path = "/api/v1/users/{userId}/greetings".sub('{format}','json').sub('{' + 'userId' + '}', user_id.to_s) # query parameters query_params = {} query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size'] query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number'] # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:GET, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'DomainEntityListing') if @api_client.config.debugging @api_client.config.logger.debug "API called: GreetingsApi#get_user_id_greetings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Creates a Greeting for a User # # @param user_id User ID # @param body The Greeting to create # @param [Hash] opts the optional parameters # @return [Greeting] def post_user_id_greetings(user_id, body, opts = {}) data, status_code, headers = post_user_id_greetings_with_http_info(user_id, body, opts) return data end # Creates a Greeting for a User # # @param user_id User ID # @param body The Greeting to create # @param [Hash] opts the optional parameters # @return [Array<(Greeting, Fixnum, Hash)>] Greeting data, response status code and response headers def post_user_id_greetings_with_http_info(user_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: GreetingsApi#post_user_id_greetings ..." end # verify the required parameter 'user_id' is set fail "Missing the required parameter 'user_id' when calling post_user_id_greetings" if user_id.nil? # verify the required parameter 'body' is set fail "Missing the required parameter 'body' when calling post_user_id_greetings" if body.nil? # resource path path = "/api/v1/users/{userId}/greetings".sub('{format}','json').sub('{' + 'userId' + '}', user_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:POST, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Greeting') if @api_client.config.debugging @api_client.config.logger.debug "API called: GreetingsApi#post_user_id_greetings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Grabs the list of Default Greetings given a User's ID # # @param user_id User ID # @param [Hash] opts the optional parameters # @return [DefaultGreetingList] def get_user_id_greetings_defaults(user_id, opts = {}) data, status_code, headers = get_user_id_greetings_defaults_with_http_info(user_id, opts) return data end # Grabs the list of Default Greetings given a User's ID # # @param user_id User ID # @param [Hash] opts the optional parameters # @return [Array<(DefaultGreetingList, Fixnum, Hash)>] DefaultGreetingList data, response status code and response headers def get_user_id_greetings_defaults_with_http_info(user_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: GreetingsApi#get_user_id_greetings_defaults ..." end # verify the required parameter 'user_id' is set fail "Missing the required parameter 'user_id' when calling get_user_id_greetings_defaults" if user_id.nil? # resource path path = "/api/v1/users/{userId}/greetings/defaults".sub('{format}','json').sub('{' + 'userId' + '}', user_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:GET, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'DefaultGreetingList') if @api_client.config.debugging @api_client.config.logger.debug "API called: GreetingsApi#get_user_id_greetings_defaults\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Updates the DefaultGreetingList of the specified User # # @param user_id User ID # @param body The updated defaultGreetingList # @param [Hash] opts the optional parameters # @return [DefaultGreetingList] def put_user_id_greetings_defaults(user_id, body, opts = {}) data, status_code, headers = put_user_id_greetings_defaults_with_http_info(user_id, body, opts) return data end # Updates the DefaultGreetingList of the specified User # # @param user_id User ID # @param body The updated defaultGreetingList # @param [Hash] opts the optional parameters # @return [Array<(DefaultGreetingList, Fixnum, Hash)>] DefaultGreetingList data, response status code and response headers def put_user_id_greetings_defaults_with_http_info(user_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: GreetingsApi#put_user_id_greetings_defaults ..." end # verify the required parameter 'user_id' is set fail "Missing the required parameter 'user_id' when calling put_user_id_greetings_defaults" if user_id.nil? # verify the required parameter 'body' is set fail "Missing the required parameter 'body' when calling put_user_id_greetings_defaults" if body.nil? # resource path path = "/api/v1/users/{userId}/greetings/defaults".sub('{format}','json').sub('{' + 'userId' + '}', user_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:PUT, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'DefaultGreetingList') if @api_client.config.debugging @api_client.config.logger.debug "API called: GreetingsApi#put_user_id_greetings_defaults\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end