=begin #SignRequest API #API for SignRequest.com OpenAPI spec version: v1 Contact: tech-support@signrequest.com Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.3.1 =end require "uri" module SignRequestClient class ApiTokensApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Create an API token # You can create an API token in the [team api settings page](/#/teams). It is also possible to get or create a token using the REST api with your login credentials. # @param data # @param [Hash] opts the optional parameters # @return [AuthToken] def api_tokens_create(data, opts = {}) data, _status_code, _headers = api_tokens_create_with_http_info(data, opts) return data end # Create an API token # You can create an API token in the [team api settings page](/#/teams). It is also possible to get or create a token using the REST api with your login credentials. # @param data # @param [Hash] opts the optional parameters # @return [Array<(AuthToken, Fixnum, Hash)>] AuthToken data, response status code and response headers def api_tokens_create_with_http_info(data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ApiTokensApi.api_tokens_create ..." end # verify the required parameter 'data' is set if @api_client.config.client_side_validation && data.nil? fail ArgumentError, "Missing the required parameter 'data' when calling ApiTokensApi.api_tokens_create" end # resource path local_var_path = "/api-tokens/" # 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(data) auth_names = ['Token'] 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 => 'AuthToken') if @api_client.config.debugging @api_client.config.logger.debug "API called: ApiTokensApi#api_tokens_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete an API token # # @param key A unique value identifying this api token. # @param [Hash] opts the optional parameters # @return [nil] def api_tokens_delete(key, opts = {}) api_tokens_delete_with_http_info(key, opts) return nil end # Delete an API token # # @param key A unique value identifying this api token. # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def api_tokens_delete_with_http_info(key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ApiTokensApi.api_tokens_delete ..." end # verify the required parameter 'key' is set if @api_client.config.client_side_validation && key.nil? fail ArgumentError, "Missing the required parameter 'key' when calling ApiTokensApi.api_tokens_delete" end # resource path local_var_path = "/api-tokens/{key}/".sub('{' + 'key' + '}', key.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 = ['Token'] 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: ApiTokensApi#api_tokens_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a list of API tokens # # @param [Hash] opts the optional parameters # @option opts [Integer] :page A page number within the paginated result set. # @option opts [Integer] :limit Number of results to return per page. # @return [InlineResponse200] def api_tokens_list(opts = {}) data, _status_code, _headers = api_tokens_list_with_http_info(opts) return data end # Retrieve a list of API tokens # # @param [Hash] opts the optional parameters # @option opts [Integer] :page A page number within the paginated result set. # @option opts [Integer] :limit Number of results to return per page. # @return [Array<(InlineResponse200, Fixnum, Hash)>] InlineResponse200 data, response status code and response headers def api_tokens_list_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ApiTokensApi.api_tokens_list ..." end # resource path local_var_path = "/api-tokens/" # query parameters query_params = {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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 = ['Token'] 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 => 'InlineResponse200') if @api_client.config.debugging @api_client.config.logger.debug "API called: ApiTokensApi#api_tokens_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve an API token # # @param key A unique value identifying this api token. # @param [Hash] opts the optional parameters # @return [AuthToken] def api_tokens_read(key, opts = {}) data, _status_code, _headers = api_tokens_read_with_http_info(key, opts) return data end # Retrieve an API token # # @param key A unique value identifying this api token. # @param [Hash] opts the optional parameters # @return [Array<(AuthToken, Fixnum, Hash)>] AuthToken data, response status code and response headers def api_tokens_read_with_http_info(key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ApiTokensApi.api_tokens_read ..." end # verify the required parameter 'key' is set if @api_client.config.client_side_validation && key.nil? fail ArgumentError, "Missing the required parameter 'key' when calling ApiTokensApi.api_tokens_read" end # resource path local_var_path = "/api-tokens/{key}/".sub('{' + 'key' + '}', key.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 = ['Token'] 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 => 'AuthToken') if @api_client.config.debugging @api_client.config.logger.debug "API called: ApiTokensApi#api_tokens_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end