require "uri" module PureCloud class PresenceApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Get an Organization's list of Presences # # @param [Hash] opts the optional parameters # @option opts [Integer] :page_number Page number # @option opts [Integer] :page_size Page size # @return [OrganizationPresenceEntityListing] def get_presencedefinitions(opts = {}) data, status_code, headers = get_presencedefinitions_with_http_info(opts) return data end # Get an Organization's list of Presences # # @param [Hash] opts the optional parameters # @option opts [Integer] :page_number Page number # @option opts [Integer] :page_size Page size # @return [Array<(OrganizationPresenceEntityListing, Fixnum, Hash)>] OrganizationPresenceEntityListing data, response status code and response headers def get_presencedefinitions_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PresenceApi#get_presencedefinitions ..." end # resource path path = "/api/v1/presencedefinitions".sub('{format}','json') # query parameters query_params = {} query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number'] query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size'] # 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 => 'OrganizationPresenceEntityListing') if @api_client.config.debugging @api_client.config.logger.debug "API called: PresenceApi#get_presencedefinitions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create an OrganizationPresence # # @param body The OrganizationPresence to create # @param [Hash] opts the optional parameters # @return [OrganizationPresence] def post_presencedefinitions(body, opts = {}) data, status_code, headers = post_presencedefinitions_with_http_info(body, opts) return data end # Create an OrganizationPresence # # @param body The OrganizationPresence to create # @param [Hash] opts the optional parameters # @return [Array<(OrganizationPresence, Fixnum, Hash)>] OrganizationPresence data, response status code and response headers def post_presencedefinitions_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PresenceApi#post_presencedefinitions ..." end # verify the required parameter 'body' is set fail "Missing the required parameter 'body' when calling post_presencedefinitions" if body.nil? # resource path path = "/api/v1/presencedefinitions".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 => 'OrganizationPresence') if @api_client.config.debugging @api_client.config.logger.debug "API called: PresenceApi#post_presencedefinitions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get an OrganizationPresence # # @param presence_id Organization Presence ID # @param [Hash] opts the optional parameters # @return [OrganizationPresence] def get_presencedefinition(presence_id, opts = {}) data, status_code, headers = get_presencedefinition_with_http_info(presence_id, opts) return data end # Get an OrganizationPresence # # @param presence_id Organization Presence ID # @param [Hash] opts the optional parameters # @return [Array<(OrganizationPresence, Fixnum, Hash)>] OrganizationPresence data, response status code and response headers def get_presencedefinition_with_http_info(presence_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PresenceApi#get_presencedefinition ..." end # verify the required parameter 'presence_id' is set fail "Missing the required parameter 'presence_id' when calling get_presencedefinition" if presence_id.nil? # resource path path = "/api/v1/presencedefinitions/{presenceId}".sub('{format}','json').sub('{' + 'presenceId' + '}', presence_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 => 'OrganizationPresence') if @api_client.config.debugging @api_client.config.logger.debug "API called: PresenceApi#get_presencedefinition\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update an OrganizationPresence # # @param presence_id Organization Presence ID # @param body The OrganizationPresence to update # @param [Hash] opts the optional parameters # @return [OrganizationPresence] def put_presencedefinition(presence_id, body, opts = {}) data, status_code, headers = put_presencedefinition_with_http_info(presence_id, body, opts) return data end # Update an OrganizationPresence # # @param presence_id Organization Presence ID # @param body The OrganizationPresence to update # @param [Hash] opts the optional parameters # @return [Array<(OrganizationPresence, Fixnum, Hash)>] OrganizationPresence data, response status code and response headers def put_presencedefinition_with_http_info(presence_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PresenceApi#put_presencedefinition ..." end # verify the required parameter 'presence_id' is set fail "Missing the required parameter 'presence_id' when calling put_presencedefinition" if presence_id.nil? # verify the required parameter 'body' is set fail "Missing the required parameter 'body' when calling put_presencedefinition" if body.nil? # resource path path = "/api/v1/presencedefinitions/{presenceId}".sub('{format}','json').sub('{' + 'presenceId' + '}', presence_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 => 'OrganizationPresence') if @api_client.config.debugging @api_client.config.logger.debug "API called: PresenceApi#put_presencedefinition\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete an OrganizationPresence # # @param presence_id Organization Presence ID # @param [Hash] opts the optional parameters # @return [OrganizationPresence] def delete_presencedefinition(presence_id, opts = {}) data, status_code, headers = delete_presencedefinition_with_http_info(presence_id, opts) return data end # Delete an OrganizationPresence # # @param presence_id Organization Presence ID # @param [Hash] opts the optional parameters # @return [Array<(OrganizationPresence, Fixnum, Hash)>] OrganizationPresence data, response status code and response headers def delete_presencedefinition_with_http_info(presence_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PresenceApi#delete_presencedefinition ..." end # verify the required parameter 'presence_id' is set fail "Missing the required parameter 'presence_id' when calling delete_presencedefinition" if presence_id.nil? # resource path path = "/api/v1/presencedefinitions/{presenceId}".sub('{format}','json').sub('{' + 'presenceId' + '}', presence_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 => 'OrganizationPresence') if @api_client.config.debugging @api_client.config.logger.debug "API called: PresenceApi#delete_presencedefinition\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get an User's list of Presences # # @param user_id User ID # @param [Hash] opts the optional parameters # @option opts [Integer] :page_number Page number # @option opts [Integer] :page_size Page size # @return [UserPresenceEntityListing] def get_user_presences(user_id, opts = {}) data, status_code, headers = get_user_presences_with_http_info(user_id, opts) return data end # Get an User's list of Presences # # @param user_id User ID # @param [Hash] opts the optional parameters # @option opts [Integer] :page_number Page number # @option opts [Integer] :page_size Page size # @return [Array<(UserPresenceEntityListing, Fixnum, Hash)>] UserPresenceEntityListing data, response status code and response headers def get_user_presences_with_http_info(user_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PresenceApi#get_user_presences ..." end # verify the required parameter 'user_id' is set fail "Missing the required parameter 'user_id' when calling get_user_presences" if user_id.nil? # resource path path = "/api/v1/users/{userId}/presences".sub('{format}','json').sub('{' + 'userId' + '}', user_id.to_s) # query parameters query_params = {} query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number'] query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size'] # 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 => 'UserPresenceEntityListing') if @api_client.config.debugging @api_client.config.logger.debug "API called: PresenceApi#get_user_presences\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a UserPresence # # @param user_id User ID # @param source Source # @param [Hash] opts the optional parameters # @return [UserPresence] def get_user_presences_0(user_id, source, opts = {}) data, status_code, headers = get_user_presences_0_with_http_info(user_id, source, opts) return data end # Get a UserPresence # # @param user_id User ID # @param source Source # @param [Hash] opts the optional parameters # @return [Array<(UserPresence, Fixnum, Hash)>] UserPresence data, response status code and response headers def get_user_presences_0_with_http_info(user_id, source, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PresenceApi#get_user_presences_0 ..." end # verify the required parameter 'user_id' is set fail "Missing the required parameter 'user_id' when calling get_user_presences_0" if user_id.nil? # verify the required parameter 'source' is set fail "Missing the required parameter 'source' when calling get_user_presences_0" if source.nil? # resource path path = "/api/v1/users/{userId}/presences/{source}".sub('{format}','json').sub('{' + 'userId' + '}', user_id.to_s).sub('{' + 'source' + '}', source.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 => 'UserPresence') if @api_client.config.debugging @api_client.config.logger.debug "API called: PresenceApi#get_user_presences_0\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a UserPresence # # @param user_id User ID # @param source Source # @param body The updated UserPresence # @param [Hash] opts the optional parameters # @return [UserPresence] def put_user_presences(user_id, source, body, opts = {}) data, status_code, headers = put_user_presences_with_http_info(user_id, source, body, opts) return data end # Update a UserPresence # # @param user_id User ID # @param source Source # @param body The updated UserPresence # @param [Hash] opts the optional parameters # @return [Array<(UserPresence, Fixnum, Hash)>] UserPresence data, response status code and response headers def put_user_presences_with_http_info(user_id, source, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PresenceApi#put_user_presences ..." end # verify the required parameter 'user_id' is set fail "Missing the required parameter 'user_id' when calling put_user_presences" if user_id.nil? # verify the required parameter 'source' is set fail "Missing the required parameter 'source' when calling put_user_presences" if source.nil? # verify the required parameter 'body' is set fail "Missing the required parameter 'body' when calling put_user_presences" if body.nil? # resource path path = "/api/v1/users/{userId}/presences/{source}".sub('{format}','json').sub('{' + 'userId' + '}', user_id.to_s).sub('{' + 'source' + '}', source.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 => 'UserPresence') if @api_client.config.debugging @api_client.config.logger.debug "API called: PresenceApi#put_user_presences\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Patch a UserPresence # # @param user_id User ID # @param source Source # @param body The patched UserPresence # @param [Hash] opts the optional parameters # @return [UserPresence] def patch_user_presences(user_id, source, body, opts = {}) data, status_code, headers = patch_user_presences_with_http_info(user_id, source, body, opts) return data end # Patch a UserPresence # # @param user_id User ID # @param source Source # @param body The patched UserPresence # @param [Hash] opts the optional parameters # @return [Array<(UserPresence, Fixnum, Hash)>] UserPresence data, response status code and response headers def patch_user_presences_with_http_info(user_id, source, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PresenceApi#patch_user_presences ..." end # verify the required parameter 'user_id' is set fail "Missing the required parameter 'user_id' when calling patch_user_presences" if user_id.nil? # verify the required parameter 'source' is set fail "Missing the required parameter 'source' when calling patch_user_presences" if source.nil? # verify the required parameter 'body' is set fail "Missing the required parameter 'body' when calling patch_user_presences" if body.nil? # resource path path = "/api/v1/users/{userId}/presences/{source}".sub('{format}','json').sub('{' + 'userId' + '}', user_id.to_s).sub('{' + 'source' + '}', source.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(:PATCH, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'UserPresence') if @api_client.config.debugging @api_client.config.logger.debug "API called: PresenceApi#patch_user_presences\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a user's Primary UserPresence # # @param user_id User ID # @param [Hash] opts the optional parameters # @return [UserPresence] def get_user_primarypresence(user_id, opts = {}) data, status_code, headers = get_user_primarypresence_with_http_info(user_id, opts) return data end # Get a user's Primary UserPresence # # @param user_id User ID # @param [Hash] opts the optional parameters # @return [Array<(UserPresence, Fixnum, Hash)>] UserPresence data, response status code and response headers def get_user_primarypresence_with_http_info(user_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PresenceApi#get_user_primarypresence ..." end # verify the required parameter 'user_id' is set fail "Missing the required parameter 'user_id' when calling get_user_primarypresence" if user_id.nil? # resource path path = "/api/v1/users/{userId}/primarypresence".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 => 'UserPresence') if @api_client.config.debugging @api_client.config.logger.debug "API called: PresenceApi#get_user_primarypresence\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end