=begin #Subskribe API #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: 1.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.41 =end require 'uri' module SubskribeDevClient class AuthenticationApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Add a saml integration # Adds a saml integration # @param [Hash] opts the optional parameters # @option opts [AuthSamlIntegrationJson] :body saml representing the integration # @return [nil] def add_saml_integration(opts = {}) add_saml_integration_with_http_info(opts) nil end # Add a saml integration # Adds a saml integration # @param [Hash] opts the optional parameters # @option opts [AuthSamlIntegrationJson] :body saml representing the integration # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def add_saml_integration_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthenticationApi.add_saml_integration ...' end # resource path local_var_path = '/auth/saml' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_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: AuthenticationApi#add_saml_integration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a new api key # Create a new api key with the specified parameters. The new key is returned # @param [Hash] opts the optional parameters # @option opts [String] :role Role-based permissions to be associated with the key. Specify this OR userId. # @option opts [Integer] :expiry Time of expiry in seconds since Epoch (GMT) # @option opts [String] :user_id User to associate key with. Specify this OR role. # @option opts [String] :entity_id Scope of entities that the key has access to. Either specify a single entity or all entities (i.e. *). # @return [String] def create_api_key(opts = {}) data, _status_code, _headers = create_api_key_with_http_info(opts) data end # Create a new api key # Create a new api key with the specified parameters. The new key is returned # @param [Hash] opts the optional parameters # @option opts [String] :role Role-based permissions to be associated with the key. Specify this OR userId. # @option opts [Integer] :expiry Time of expiry in seconds since Epoch (GMT) # @option opts [String] :user_id User to associate key with. Specify this OR role. # @option opts [String] :entity_id Scope of entities that the key has access to. Either specify a single entity or all entities (i.e. *). # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers def create_api_key_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthenticationApi.create_api_key ...' end if @api_client.config.client_side_validation && opts[:'role'] && !['ADMIN', 'FINANCE', 'SALES', 'DEAL_DESK', 'BILLING_CLERK', 'REVENUE_CLERK', 'READ_ONLY', 'EXECUTIVE', 'CRM', 'IMPORT'].include?(opts[:'role']) fail ArgumentError, 'invalid value for "role", must be one of ADMIN, FINANCE, SALES, DEAL_DESK, BILLING_CLERK, REVENUE_CLERK, READ_ONLY, EXECUTIVE, CRM, IMPORT' end # resource path local_var_path = '/apikey' # query parameters query_params = {} query_params[:'role'] = opts[:'role'] if !opts[:'role'].nil? query_params[:'expiry'] = opts[:'expiry'] if !opts[:'expiry'].nil? query_params[:'userId'] = opts[:'user_id'] if !opts[:'user_id'].nil? query_params[:'entityId'] = opts[:'entity_id'] if !opts[:'entity_id'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_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: AuthenticationApi#create_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieves all API keys # Retrieves a list of (maximum 500 items) all API keys (including expired and deactivated keys) # @param [Hash] opts the optional parameters # @return [nil] def get_all_api_keys(opts = {}) get_all_api_keys_with_http_info(opts) nil end # Retrieves all API keys # Retrieves a list of (maximum 500 items) all API keys (including expired and deactivated keys) # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def get_all_api_keys_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthenticationApi.get_all_api_keys ...' end # resource path local_var_path = '/apikey' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationApi#get_all_api_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve an API key by id # Retrieve an api key referenced by its id # @param id # @param [Hash] opts the optional parameters # @return [nil] def get_api_key_by_id(id, opts = {}) get_api_key_by_id_with_http_info(id, opts) nil end # Retrieve an API key by id # Retrieve an api key referenced by its id # @param id # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def get_api_key_by_id_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthenticationApi.get_api_key_by_id ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling AuthenticationApi.get_api_key_by_id" end # resource path local_var_path = '/apikey/{id}'.sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationApi#get_api_key_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # revoke all keys # Revokes all keys for your tenant # @param [Hash] opts the optional parameters # @return [nil] def revoke_api_key(opts = {}) revoke_api_key_with_http_info(opts) nil end # revoke all keys # Revokes all keys for your tenant # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def revoke_api_key_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthenticationApi.revoke_api_key ...' end # resource path local_var_path = '/apikey/revoke' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_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: AuthenticationApi#revoke_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # revoke an API key by id # Revoke an api key referenced by its id # @param id # @param [Hash] opts the optional parameters # @return [nil] def revoke_api_key_by_id(id, opts = {}) revoke_api_key_by_id_with_http_info(id, opts) nil end # revoke an API key by id # Revoke an api key referenced by its id # @param id # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def revoke_api_key_by_id_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthenticationApi.revoke_api_key_by_id ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling AuthenticationApi.revoke_api_key_by_id" end # resource path local_var_path = '/apikey/revoke/{id}'.sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_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: AuthenticationApi#revoke_api_key_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end