require "uri" module PureCloud class NotificationsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Get available notification topics. # # @param [Hash] opts the optional parameters # @return [TopicEntityListing] def get_availabletopics(opts = {}) data, status_code, headers = get_availabletopics_with_http_info(opts) return data end # Get available notification topics. # # @param [Hash] opts the optional parameters # @return [Array<(TopicEntityListing, Fixnum, Hash)>] TopicEntityListing data, response status code and response headers def get_availabletopics_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: NotificationsApi#get_availabletopics ..." end # resource path path = "/api/v1/notifications/availabletopics".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 => 'TopicEntityListing') if @api_client.config.debugging @api_client.config.logger.debug "API called: NotificationsApi#get_availabletopics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # The list of existing channels # # @param [Hash] opts the optional parameters # @return [ChannelEntityListing] def get_channels(opts = {}) data, status_code, headers = get_channels_with_http_info(opts) return data end # The list of existing channels # # @param [Hash] opts the optional parameters # @return [Array<(ChannelEntityListing, Fixnum, Hash)>] ChannelEntityListing data, response status code and response headers def get_channels_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: NotificationsApi#get_channels ..." end # resource path path = "/api/v1/notifications/channels".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 => 'ChannelEntityListing') if @api_client.config.debugging @api_client.config.logger.debug "API called: NotificationsApi#get_channels\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a new channel # There is a limit of 10 channels. Creating an 11th channel will remove the channel with oldest last used date. # @param [Hash] opts the optional parameters # @return [Channel] def create_channels(opts = {}) data, status_code, headers = create_channels_with_http_info(opts) return data end # Create a new channel # There is a limit of 10 channels. Creating an 11th channel will remove the channel with oldest last used date. # @param [Hash] opts the optional parameters # @return [Array<(Channel, Fixnum, Hash)>] Channel data, response status code and response headers def create_channels_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: NotificationsApi#create_channels ..." end # resource path path = "/api/v1/notifications/channels".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(:POST, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Channel') if @api_client.config.debugging @api_client.config.logger.debug "API called: NotificationsApi#create_channels\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # The list of all subscriptions for this channel # # @param channel_id Channel ID # @param [Hash] opts the optional parameters # @return [TopicEntityListing] def get_channel_subscriptions(channel_id, opts = {}) data, status_code, headers = get_channel_subscriptions_with_http_info(channel_id, opts) return data end # The list of all subscriptions for this channel # # @param channel_id Channel ID # @param [Hash] opts the optional parameters # @return [Array<(TopicEntityListing, Fixnum, Hash)>] TopicEntityListing data, response status code and response headers def get_channel_subscriptions_with_http_info(channel_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: NotificationsApi#get_channel_subscriptions ..." end # verify the required parameter 'channel_id' is set fail "Missing the required parameter 'channel_id' when calling get_channel_subscriptions" if channel_id.nil? # resource path path = "/api/v1/notifications/channels/{channelId}/subscriptions".sub('{format}','json').sub('{' + 'channelId' + '}', channel_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 => 'TopicEntityListing') if @api_client.config.debugging @api_client.config.logger.debug "API called: NotificationsApi#get_channel_subscriptions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Replace the current list of subscriptions with a new list. # # @param channel_id Channel ID # @param [Hash] opts the optional parameters # @option opts [Array] :body Topic # @return [TopicEntityListing] def update_channel_subscriptions(channel_id, opts = {}) data, status_code, headers = update_channel_subscriptions_with_http_info(channel_id, opts) return data end # Replace the current list of subscriptions with a new list. # # @param channel_id Channel ID # @param [Hash] opts the optional parameters # @option opts [Array] :body Topic # @return [Array<(TopicEntityListing, Fixnum, Hash)>] TopicEntityListing data, response status code and response headers def update_channel_subscriptions_with_http_info(channel_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: NotificationsApi#update_channel_subscriptions ..." end # verify the required parameter 'channel_id' is set fail "Missing the required parameter 'channel_id' when calling update_channel_subscriptions" if channel_id.nil? # resource path path = "/api/v1/notifications/channels/{channelId}/subscriptions".sub('{format}','json').sub('{' + 'channelId' + '}', channel_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(opts[:'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 => 'TopicEntityListing') if @api_client.config.debugging @api_client.config.logger.debug "API called: NotificationsApi#update_channel_subscriptions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Add a list of subscriptions to the existing list of subscriptions # # @param channel_id Channel ID # @param [Hash] opts the optional parameters # @option opts [Array] :body Topic # @return [TopicEntityListing] def create_channel_subscriptions(channel_id, opts = {}) data, status_code, headers = create_channel_subscriptions_with_http_info(channel_id, opts) return data end # Add a list of subscriptions to the existing list of subscriptions # # @param channel_id Channel ID # @param [Hash] opts the optional parameters # @option opts [Array] :body Topic # @return [Array<(TopicEntityListing, Fixnum, Hash)>] TopicEntityListing data, response status code and response headers def create_channel_subscriptions_with_http_info(channel_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: NotificationsApi#create_channel_subscriptions ..." end # verify the required parameter 'channel_id' is set fail "Missing the required parameter 'channel_id' when calling create_channel_subscriptions" if channel_id.nil? # resource path path = "/api/v1/notifications/channels/{channelId}/subscriptions".sub('{format}','json').sub('{' + 'channelId' + '}', channel_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(opts[:'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 => 'TopicEntityListing') if @api_client.config.debugging @api_client.config.logger.debug "API called: NotificationsApi#create_channel_subscriptions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Remove all subscriptions # # @param channel_id Channel ID # @param [Hash] opts the optional parameters # @return [String] def delete_channel_subscriptions(channel_id, opts = {}) data, status_code, headers = delete_channel_subscriptions_with_http_info(channel_id, opts) return data end # Remove all subscriptions # # @param channel_id Channel ID # @param [Hash] opts the optional parameters # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers def delete_channel_subscriptions_with_http_info(channel_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: NotificationsApi#delete_channel_subscriptions ..." end # verify the required parameter 'channel_id' is set fail "Missing the required parameter 'channel_id' when calling delete_channel_subscriptions" if channel_id.nil? # resource path path = "/api/v1/notifications/channels/{channelId}/subscriptions".sub('{format}','json').sub('{' + 'channelId' + '}', channel_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 => 'String') if @api_client.config.debugging @api_client.config.logger.debug "API called: NotificationsApi#delete_channel_subscriptions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end