=begin PureCloud Platform API With the PureCloud Platform API, you can control all aspects of your PureCloud environment. With the APIs you can access the system configuration, manage conversations and more. OpenAPI spec version: v2 Contact: DeveloperEvangelists@inin.com Generated by: https://github.com/swagger-api/swagger-codegen.git License: ININ http://www.inin.com Terms of Service: https://developer.mypurecloud.com/tos =end require "uri" module PureCloud class ScriptsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Get the list of scripts # # @param [Hash] opts the optional parameters # @option opts [Integer] :page_size Page size (default to 25) # @option opts [Integer] :page_number Page number (default to 1) # @option opts [String] :expand Expand # @option opts [String] :name Name filter # @option opts [String] :feature Feature filter # @option opts [String] :flow_id Secure flow id filter # @option opts [String] :sort_by SortBy # @option opts [String] :sort_order SortOrder # @return [ScriptEntityListing] def get(opts = {}) data, status_code, headers = get_with_http_info(opts) return data end # Get the list of scripts # # @param [Hash] opts the optional parameters # @option opts [Integer] :page_size Page size # @option opts [Integer] :page_number Page number # @option opts [String] :expand Expand # @option opts [String] :name Name filter # @option opts [String] :feature Feature filter # @option opts [String] :flow_id Secure flow id filter # @option opts [String] :sort_by SortBy # @option opts [String] :sort_order SortOrder # @return [Array<(ScriptEntityListing, Fixnum, Hash)>] ScriptEntityListing data, response status code and response headers def get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ScriptsApi#get ..." end if opts[:'sort_by'] && !['modifiedDate', 'createdDate'].include?(opts[:'sort_by']) fail 'invalid value for "sort_by", must be one of modifiedDate, createdDate' end if opts[:'sort_order'] && !['ascending', 'descending'].include?(opts[:'sort_order']) fail 'invalid value for "sort_order", must be one of ascending, descending' end # resource path local_var_path = "/api/v2/scripts".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'] query_params[:'expand'] = opts[:'expand'] if opts[:'expand'] query_params[:'name'] = opts[:'name'] if opts[:'name'] query_params[:'feature'] = opts[:'feature'] if opts[:'feature'] query_params[:'flowId'] = opts[:'flow_id'] if opts[:'flow_id'] query_params[:'sortBy'] = opts[:'sort_by'] if opts[:'sort_by'] query_params[:'sortOrder'] = opts[:'sort_order'] if opts[:'sort_order'] # 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, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ScriptEntityListing') if @api_client.config.debugging @api_client.config.logger.debug "API called: ScriptsApi#get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get the published scripts. # # @param [Hash] opts the optional parameters # @option opts [Integer] :page_size Page size (default to 25) # @option opts [Integer] :page_number Page number (default to 1) # @option opts [String] :expand Expand # @option opts [String] :name Name filter # @option opts [String] :feature Feature filter # @option opts [String] :flow_id Secure flow id filter # @return [ScriptEntityListing] def get_published(opts = {}) data, status_code, headers = get_published_with_http_info(opts) return data end # Get the published scripts. # # @param [Hash] opts the optional parameters # @option opts [Integer] :page_size Page size # @option opts [Integer] :page_number Page number # @option opts [String] :expand Expand # @option opts [String] :name Name filter # @option opts [String] :feature Feature filter # @option opts [String] :flow_id Secure flow id filter # @return [Array<(ScriptEntityListing, Fixnum, Hash)>] ScriptEntityListing data, response status code and response headers def get_published_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ScriptsApi#get_published ..." end # resource path local_var_path = "/api/v2/scripts/published".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'] query_params[:'expand'] = opts[:'expand'] if opts[:'expand'] query_params[:'name'] = opts[:'name'] if opts[:'name'] query_params[:'feature'] = opts[:'feature'] if opts[:'feature'] query_params[:'flowId'] = opts[:'flow_id'] if opts[:'flow_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, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ScriptEntityListing') if @api_client.config.debugging @api_client.config.logger.debug "API called: ScriptsApi#get_published\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get the published script. # # @param script_id Script ID # @param [Hash] opts the optional parameters # @return [Script] def get_published_script_id(script_id, opts = {}) data, status_code, headers = get_published_script_id_with_http_info(script_id, opts) return data end # Get the published script. # # @param script_id Script ID # @param [Hash] opts the optional parameters # @return [Array<(Script, Fixnum, Hash)>] Script data, response status code and response headers def get_published_script_id_with_http_info(script_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ScriptsApi#get_published_script_id ..." end # verify the required parameter 'script_id' is set fail "Missing the required parameter 'script_id' when calling get_published_script_id" if script_id.nil? # resource path local_var_path = "/api/v2/scripts/published/{scriptId}".sub('{format}','json').sub('{' + 'scriptId' + '}', script_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, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Script') if @api_client.config.debugging @api_client.config.logger.debug "API called: ScriptsApi#get_published_script_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get the list of published pages # # @param script_id Script ID # @param [Hash] opts the optional parameters # @return [Array] def get_published_script_id_pages(script_id, opts = {}) data, status_code, headers = get_published_script_id_pages_with_http_info(script_id, opts) return data end # Get the list of published pages # # @param script_id Script ID # @param [Hash] opts the optional parameters # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def get_published_script_id_pages_with_http_info(script_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ScriptsApi#get_published_script_id_pages ..." end # verify the required parameter 'script_id' is set fail "Missing the required parameter 'script_id' when calling get_published_script_id_pages" if script_id.nil? # resource path local_var_path = "/api/v2/scripts/published/{scriptId}/pages".sub('{format}','json').sub('{' + 'scriptId' + '}', script_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, 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') if @api_client.config.debugging @api_client.config.logger.debug "API called: ScriptsApi#get_published_script_id_pages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get the published page. # # @param script_id Script ID # @param page_id Page ID # @param [Hash] opts the optional parameters # @return [Page] def get_published_script_id_pages_page_id(script_id, page_id, opts = {}) data, status_code, headers = get_published_script_id_pages_page_id_with_http_info(script_id, page_id, opts) return data end # Get the published page. # # @param script_id Script ID # @param page_id Page ID # @param [Hash] opts the optional parameters # @return [Array<(Page, Fixnum, Hash)>] Page data, response status code and response headers def get_published_script_id_pages_page_id_with_http_info(script_id, page_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ScriptsApi#get_published_script_id_pages_page_id ..." end # verify the required parameter 'script_id' is set fail "Missing the required parameter 'script_id' when calling get_published_script_id_pages_page_id" if script_id.nil? # verify the required parameter 'page_id' is set fail "Missing the required parameter 'page_id' when calling get_published_script_id_pages_page_id" if page_id.nil? # resource path local_var_path = "/api/v2/scripts/published/{scriptId}/pages/{pageId}".sub('{format}','json').sub('{' + 'scriptId' + '}', script_id.to_s).sub('{' + 'pageId' + '}', page_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, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Page') if @api_client.config.debugging @api_client.config.logger.debug "API called: ScriptsApi#get_published_script_id_pages_page_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get the published variables # # @param script_id Script ID # @param [Hash] opts the optional parameters # @return [Object] def get_published_script_id_variables(script_id, opts = {}) data, status_code, headers = get_published_script_id_variables_with_http_info(script_id, opts) return data end # Get the published variables # # @param script_id Script ID # @param [Hash] opts the optional parameters # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers def get_published_script_id_variables_with_http_info(script_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ScriptsApi#get_published_script_id_variables ..." end # verify the required parameter 'script_id' is set fail "Missing the required parameter 'script_id' when calling get_published_script_id_variables" if script_id.nil? # resource path local_var_path = "/api/v2/scripts/published/{scriptId}/variables".sub('{format}','json').sub('{' + 'scriptId' + '}', script_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, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Object') if @api_client.config.debugging @api_client.config.logger.debug "API called: ScriptsApi#get_published_script_id_variables\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a script # # @param script_id Script ID # @param [Hash] opts the optional parameters # @return [Script] def get_script_id(script_id, opts = {}) data, status_code, headers = get_script_id_with_http_info(script_id, opts) return data end # Get a script # # @param script_id Script ID # @param [Hash] opts the optional parameters # @return [Array<(Script, Fixnum, Hash)>] Script data, response status code and response headers def get_script_id_with_http_info(script_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ScriptsApi#get_script_id ..." end # verify the required parameter 'script_id' is set fail "Missing the required parameter 'script_id' when calling get_script_id" if script_id.nil? # resource path local_var_path = "/api/v2/scripts/{scriptId}".sub('{format}','json').sub('{' + 'scriptId' + '}', script_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, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Script') if @api_client.config.debugging @api_client.config.logger.debug "API called: ScriptsApi#get_script_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get the list of pages # # @param script_id Script ID # @param [Hash] opts the optional parameters # @return [Array] def get_script_id_pages(script_id, opts = {}) data, status_code, headers = get_script_id_pages_with_http_info(script_id, opts) return data end # Get the list of pages # # @param script_id Script ID # @param [Hash] opts the optional parameters # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def get_script_id_pages_with_http_info(script_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ScriptsApi#get_script_id_pages ..." end # verify the required parameter 'script_id' is set fail "Missing the required parameter 'script_id' when calling get_script_id_pages" if script_id.nil? # resource path local_var_path = "/api/v2/scripts/{scriptId}/pages".sub('{format}','json').sub('{' + 'scriptId' + '}', script_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, 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') if @api_client.config.debugging @api_client.config.logger.debug "API called: ScriptsApi#get_script_id_pages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a page # # @param script_id Script ID # @param page_id Page ID # @param [Hash] opts the optional parameters # @return [Page] def get_script_id_pages_page_id(script_id, page_id, opts = {}) data, status_code, headers = get_script_id_pages_page_id_with_http_info(script_id, page_id, opts) return data end # Get a page # # @param script_id Script ID # @param page_id Page ID # @param [Hash] opts the optional parameters # @return [Array<(Page, Fixnum, Hash)>] Page data, response status code and response headers def get_script_id_pages_page_id_with_http_info(script_id, page_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ScriptsApi#get_script_id_pages_page_id ..." end # verify the required parameter 'script_id' is set fail "Missing the required parameter 'script_id' when calling get_script_id_pages_page_id" if script_id.nil? # verify the required parameter 'page_id' is set fail "Missing the required parameter 'page_id' when calling get_script_id_pages_page_id" if page_id.nil? # resource path local_var_path = "/api/v2/scripts/{scriptId}/pages/{pageId}".sub('{format}','json').sub('{' + 'scriptId' + '}', script_id.to_s).sub('{' + 'pageId' + '}', page_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, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Page') if @api_client.config.debugging @api_client.config.logger.debug "API called: ScriptsApi#get_script_id_pages_page_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end