class GoogleCloudStorage::ApiClient

Defined in:

google_cloud_storage/api_client.cr

Constant Summary

COLLECTION_FORMAT_MULTI = "multi"
COLLECTION_FORMAT_SEPARATOR_MAP = {"csv" => ",", "ssv" => " ", "tsv" => "\t", "pipes" => "|", COLLECTION_FORMAT_MULTI => COLLECTION_FORMAT_MULTI}
DEFAULT_MIME_TYPE = "application/octet-stream"
JSON_MIME_REGEX = /Application\/.*json(?!p)(;.*)?/i
UNKNOWN_COLLECTION_FORMAT_SEPARATOR = "unknown"

Constructors

Instance Method Summary

Constructor Detail

def self.default : ApiClient #

[View source]
def self.new(config : GoogleCloudStorage::Configuration = Configuration.default, default_url_encoder : ::Crest::ParamsEncoder.class = Crest::ZeroEnumeratedFlatParamsEncoder, default_headers : Hash(String, String) = Hash(String, String).new, default_cookies : Hash(String, String) = Hash(String, String).new) #

Initializes the ApiClient @option config [Configuration] Configuration for initializing the object, default to Configuration.default


[View source]

Instance Method Detail

def build_api_request(http_method : Symbol, path : String, operation : String | Nil = nil, post_body : IO | String | Nil = nil, auth_names : Array(String) = Array(String).new, header_params : Hash(String, String) = Hash(String, String).new, cookie_params : Hash(String, String) = Hash(String, String).new, query_params : Hash(String, String | Array(String) | JSON::Any) = Hash(String, String | Array(String) | JSON::Any).new, form_params : Array(Tuple(String, Crest::ParamsValue)) | Nil = nil) : Crest::Request #

Build an API request with given options.

@return Crest::Request the data deserialized from response body (could be nil), response status code and response headers.


[View source]
def build_collection_param(params : Array, collection_format : String) : Array(String) #

Build parameter value according to the given collection format. @param [String] collection_format one of csv, ssv, tsv, pipes and multi


[View source]
def build_collection_param_tuples(name : String, params : Array, collection_format : String) : Array(Tuple(String, Crest::ParamsValue)) #

Build tuples of parameters according to the given collection format. @param [String] collection_format one of csv, ssv, tsv, pipes and multi


[View source]
def build_form_data(form_params : Array(Tuple(String, Crest::ParamsValue)), header_params : Hash(String, String)) : String #

Build form data from form params @param [Array(Tuple(String, Crest::ParamsValue))] form_params


[View source]
def build_header_param(params : Array) : String #

Build HTTP header value for array HTTP header values are always comma separated @param [Array] params


[View source]
def build_multipart_form_data(form_params : Array(Tuple(String, Crest::ParamsValue)), header_params : Hash(String, String)) : String #

Build multipart form data from form params @param [Array(Tuple(String, Crest::ParamsValue))] form_params


[View source]
def build_request_url(path : String, operation : String | Nil) : String #

[View source]
def build_url_encoded_form_data(form_params : Array(Tuple(String, Crest::ParamsValue))) : String #

Build url encoded form data from form params @param [Array(Tuple(String, Crest::ParamsValue))] form_params


[View source]
def config : Configuration #

The Configuration object holding settings to be used in the API client.


[View source]
def config=(config : Configuration) #

The Configuration object holding settings to be used in the API client.


[View source]
def default_cookies : Hash(String, String) #

Defines the cookies to be used in HTTP requests of all API calls by default.

@return [Hash]


[View source]
def default_cookies=(default_cookies : Hash(String, String)) #

Defines the cookies to be used in HTTP requests of all API calls by default.

@return [Hash]


[View source]
def default_headers : Hash(String, String) #

Defines the headers to be used in HTTP requests of all API calls by default.

@return [Hash]


[View source]
def default_headers=(default_headers : Hash(String, String)) #

Defines the headers to be used in HTTP requests of all API calls by default.

@return [Hash]


[View source]
def default_url_encoder : Crest::ParamsEncoder.class #

The encoder class used to encode request body


[View source]
def default_url_encoder=(default_url_encoder : Crest::ParamsEncoder.class) #

The encoder class used to encode request body


[View source]
def encode(body : Hash | Array | OpenApi::Json | JSON::Any, content_type : String | Nil = nil, url_encoder : Crest::ParamsEncoder.class | Nil = nil) : String #

[View source]
def execute_api_request(request : Crest::Request) : Tuple(String, Int32, Hash(String, Array(String) | String)) #

[View source]
def json_mime?(mime : String) : Bool #

Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; charset=UTF8 APPLICATION/JSON / @param [String] mime MIME @return [Boolean] True if the MIME is application/json


[View source]
def select_header_accept(accepts : Array(String)) : String #

Return Accept header based on an array of accepts provided. @param [Array] accepts array for Accept @return [String] the Accept header (e.g. application/json)


[View source]
def select_header_content_type(content_types : Array(String)) : String #

Return Content-Type header based on an array of content types provided. @param [Array] content_types array for Content-Type @return [String] the Content-Type header (e.g. application/json)


[View source]
def update_params_for_auth!(header_params : Hash(String, String), cookie_params : Hash(String, String), query_params : Hash(String, String | Array(String) | JSON::Any), auth_names : Array(String)) : Nil #

Update header and query params based on authentication settings.

@param [Hash] header_params Header parameters @param [Hash] query_params Query parameters @param [String] auth_names Authentication scheme name


[View source]
def user_agent : String | Nil #

User Agent


[View source]
def user_agent=(user_agent : String | Nil) : Nil #

Sets user agent in HTTP header

@param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)


[View source]