Dynamic API context to be applied in API calls.
Dynamic API context to be applied in API calls.
(auth->opts {:keys [type in param-name]} value)
Process the given auth to an option map that might conatin request options and parameters.
Process the given auth to an option map that might conatin request options and parameters.
(auths->opts auth-names)
Process the given auth names to an option map that might conatin request options and parameters.
Process the given auth names to an option map that might conatin request options and parameters.
(call-api path
method
{:keys [path-params body-param content-types accepts auth-names]
:as opts})
Call an API by making HTTP request and return its response.
Call an API by making HTTP request and return its response.
(check-required-params & params)
Throw exception if any of the given parameters is nil.
Throw exception if any of the given parameters is nil.
(default-to-json-mime mime)
Default to JSON MIME if given / MIME
Default to JSON MIME if given */* MIME
(deserialize {:keys [body] {:keys [content-type]} :headers})
Deserialize the given HTTP response according to the Content-Type header.
Deserialize the given HTTP response according to the Content-Type header.
(form-params->multipart form-params)
Convert the given form parameters map into a vector as clj-http's :multipart option.
Convert the given form parameters map into a vector as clj-http's :multipart option.
(format-date date)
Format the given Date object with the :date-format defined in api-options. NOTE: The UTC time zone is used.
Format the given Date object with the :date-format defined in *api-options*. NOTE: The UTC time zone is used.
(format-datetime date)
(format-datetime date time-zone)
Format the given Date object with the :datetime-format defined in api-options. NOTE: The system's default time zone is used when not provided.
Format the given Date object with the :datetime-format defined in *api-options*. NOTE: The system's default time zone is used when not provided.
(json-mime? mime)
Check if the given MIME is a standard JSON MIME or :json.
Check if the given MIME is a standard JSON MIME or :json.
(json-preferred-mime mimes)
Choose a MIME from the given MIMEs with JSON preferred, i.e. return JSON if included, otherwise return the first one.
Choose a MIME from the given MIMEs with JSON preferred, i.e. return JSON if included, otherwise return the first one.
(make-url path path-params)
Make full URL by adding base URL and filling path parameters.
Make full URL by adding base URL and filling path parameters.
(normalize-array-param xs)
Normalize array paramater according to :collection-format specified in the parameter's meta data. When the parameter contains File, a seq is returned so as to keep File parameters. For :multi collection format, a seq is returned which will be handled properly by clj-http. For other cases, a string is returned.
Normalize array paramater according to :collection-format specified in the parameter's meta data. When the parameter contains File, a seq is returned so as to keep File parameters. For :multi collection format, a seq is returned which will be handled properly by clj-http. For other cases, a string is returned.
(normalize-param param)
Normalize parameter value, handling three cases:
for sequential value, apply normalize-array-param
which handles collection format;
for File value, use current value;
otherwise, apply param->str
.
Normalize parameter value, handling three cases: for sequential value, apply `normalize-array-param` which handles collection format; for File value, use current value; otherwise, apply `param->str`.
(normalize-params params)
Normalize parameters values: remove nils, format to string with param->str
.
Normalize parameters values: remove nils, format to string with `param->str`.
(param->str param)
Format the given parameter value to string.
Format the given parameter value to string.
(parse-date s)
Parse the given string to a Date object with the :date-format defined in api-options. NOTE: The UTC time zone is used.
Parse the given string to a Date object with the :date-format defined in *api-options*. NOTE: The UTC time zone is used.
(parse-datetime s)
(parse-datetime s time-zone)
Parse the given string to a Date object with the :datetime-format defined in api-options. NOTE: The system's default time zone is used when not provided.
Parse the given string to a Date object with the :datetime-format defined in *api-options*. NOTE: The system's default time zone is used when not provided.
(process-auth opts auth-name)
Process the given auth name into options, which is merged into the given opts.
Process the given auth name into options, which is merged into the given opts.
(serialize data content-type)
Serialize the given data according to content-type. Only JSON is supported for now.
Serialize the given data according to content-type. Only JSON is supported for now.
(set-api-context new-context)
Set the api-context globally
Set the *api-context* globally
(with-api-context api-context & body)
A helper macro to wrap api-context with default values.
A helper macro to wrap *api-context* with default values.
(with-collection-format param collection-format)
Attach collection-format to meta data of the given parameter.
Attach collection-format to meta data of the given parameter.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close