lib/fastly/api/tokens_api.rb in fastly-5.1.1 vs lib/fastly/api/tokens_api.rb in fastly-5.2.0
- old
+ new
@@ -15,9 +15,72 @@
attr_accessor :api_client
def initialize(api_client = ApiClient.default)
@api_client = api_client
end
+ # Get a token
+ # Get a single token by its id.
+ # @option opts [String] :token_id Alphanumeric string identifying a token. (required)
+ # @return [TokenResponse]
+ def get_token(opts = {})
+ data, _status_code, _headers = get_token_with_http_info(opts)
+ data
+ end
+
+ # Get a token
+ # Get a single token by its id.
+ # @option opts [String] :token_id Alphanumeric string identifying a token. (required)
+ # @return [Array<(TokenResponse, Integer, Hash)>] TokenResponse data, response status code and response headers
+ def get_token_with_http_info(opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: TokensApi.get_token ...'
+ end
+ # unbox the parameters from the hash
+ token_id = opts[:'token_id']
+ # verify the required parameter 'token_id' is set
+ if @api_client.config.client_side_validation && token_id.nil?
+ fail ArgumentError, "Missing the required parameter 'token_id' when calling TokensApi.get_token"
+ end
+ # resource path
+ local_var_path = '/tokens/{token_id}'.sub('{' + 'token_id' + '}', CGI.escape(token_id.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'TokenResponse'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['token']
+
+ new_options = opts.merge(
+ :operation => :"TokensApi.get_token",
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: TokensApi#get_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
# Get the current token
# Get a single token based on the access_token used in the request.
# @return [TokenResponse]
def get_token_current(opts = {})
data, _status_code, _headers = get_token_current_with_http_info(opts)