require "uri" module PureCloud class DownloadsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # OAuth Callback used during code authorization grant flow. # # @param [Hash] opts the optional parameters # @option opts [String] :code # @option opts [String] :state # @return [nil] def get_callback(opts = {}) get_callback_with_http_info(opts) return nil end # OAuth Callback used during code authorization grant flow. # # @param [Hash] opts the optional parameters # @option opts [String] :code # @option opts [String] :state # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def get_callback_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: DownloadsApi#get_callback ..." end # resource path path = "/api/v1/downloads/callback".sub('{format}','json') # query parameters query_params = {} query_params[:'code'] = opts[:'code'] if opts[:'code'] query_params[:'state'] = opts[:'state'] if opts[:'state'] # 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: DownloadsApi#get_callback\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Issues a redirect to a signed secure download URL for specified download # this method will issue a redirect to the url to the content # @param download_id Download ID # @param [Hash] opts the optional parameters # @option opts [String] :content_disposition # @return [UrlResponse] def get_download(download_id, opts = {}) data, status_code, headers = get_download_with_http_info(download_id, opts) return data end # Issues a redirect to a signed secure download URL for specified download # this method will issue a redirect to the url to the content # @param download_id Download ID # @param [Hash] opts the optional parameters # @option opts [String] :content_disposition # @return [Array<(UrlResponse, Fixnum, Hash)>] UrlResponse data, response status code and response headers def get_download_with_http_info(download_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: DownloadsApi#get_download ..." end # verify the required parameter 'download_id' is set fail "Missing the required parameter 'download_id' when calling get_download" if download_id.nil? # resource path path = "/api/v1/downloads/{downloadId}".sub('{format}','json').sub('{' + 'downloadId' + '}', download_id.to_s) # query parameters query_params = {} query_params[:'contentDisposition'] = opts[:'content_disposition'] if opts[:'content_disposition'] # 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 => 'UrlResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: DownloadsApi#get_download\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end