William Cheng 4635dda518
[R] Add httr2 support (work in progress) (#13005)
* add httr2 support to r client gen

* fix headers

* add accepts, content-types

* update samples

* fix req

* update samples

* various fixes

* add data file test

* fix streaming, add tests
2022-08-01 00:58:19 +08:00

261 lines
6.7 KiB
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/api_client.R
\docType{class}
\name{ApiClient}
\alias{ApiClient}
\title{ApiClient}
\format{
An \code{R6Class} generator object
}
\description{
ApiClient Class
}
\details{
OpenAPI Petstore
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
ApiClient Class
Generic API client for OpenAPI client library builds.
OpenAPI generic API client. This client handles the client-
server communication, and is invariant across implementations. Specifics of
the methods and models for each application are generated from the OpenAPI Generator
templates.
NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Ref: https://openapi-generator.tech
Do not edit the class manually.
}
\section{Public fields}{
\if{html}{\out{<div class="r6-fields">}}
\describe{
\item{\code{base_path}}{Base url}
\item{\code{user_agent}}{Default user agent}
\item{\code{default_headers}}{Default headers}
\item{\code{username}}{Username for HTTP basic authentication}
\item{\code{password}}{Password for HTTP basic authentication}
\item{\code{api_keys}}{API keys}
\item{\code{access_token}}{Access token}
\item{\code{timeout}}{Default timeout in seconds}
\item{\code{retry_status_codes}}{vector of status codes to retry}
\item{\code{max_retry_attempts}}{maximum number of retries for the status codes}
}
\if{html}{\out{</div>}}
}
\section{Methods}{
\subsection{Public methods}{
\itemize{
\item \href{#method-ApiClient-new}{\code{ApiClient$new()}}
\item \href{#method-ApiClient-CallApi}{\code{ApiClient$CallApi()}}
\item \href{#method-ApiClient-Execute}{\code{ApiClient$Execute()}}
\item \href{#method-ApiClient-deserialize}{\code{ApiClient$deserialize()}}
\item \href{#method-ApiClient-deserializeObj}{\code{ApiClient$deserializeObj()}}
\item \href{#method-ApiClient-clone}{\code{ApiClient$clone()}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-ApiClient-new"></a>}}
\if{latex}{\out{\hypertarget{method-ApiClient-new}{}}}
\subsection{Method \code{new()}}{
Initialize a new ApiClient.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{ApiClient$new(
base_path = NULL,
user_agent = NULL,
default_headers = NULL,
username = NULL,
password = NULL,
api_keys = NULL,
access_token = NULL,
timeout = NULL,
retry_status_codes = NULL,
max_retry_attempts = NULL
)}\if{html}{\out{</div>}}
}
\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{base_path}}{Base path.}
\item{\code{user_agent}}{User agent.}
\item{\code{default_headers}}{Default headers.}
\item{\code{username}}{User name.}
\item{\code{password}}{Password.}
\item{\code{api_keys}}{API keys.}
\item{\code{access_token}}{Access token.}
\item{\code{timeout}}{Timeout.}
\item{\code{retry_status_codes}}{Status codes for retry.}
\item{\code{max_retry_attempts}}{Maxmium number of retry.}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-ApiClient-CallApi"></a>}}
\if{latex}{\out{\hypertarget{method-ApiClient-CallApi}{}}}
\subsection{Method \code{CallApi()}}{
Prepare to make an API call with the retry logic.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{ApiClient$CallApi(
url,
method,
query_params,
header_params,
body,
stream_callback = NULL,
...
)}\if{html}{\out{</div>}}
}
\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{url}}{URL.}
\item{\code{method}}{HTTP method.}
\item{\code{query_params}}{The query parameters.}
\item{\code{header_params}}{The header parameters.}
\item{\code{body}}{The HTTP request body.}
\item{\code{...}}{Other optional arguments.}
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
HTTP response
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-ApiClient-Execute"></a>}}
\if{latex}{\out{\hypertarget{method-ApiClient-Execute}{}}}
\subsection{Method \code{Execute()}}{
Make an API call
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{ApiClient$Execute(
url,
method,
query_params,
header_params,
body,
stream_callback = NULL,
...
)}\if{html}{\out{</div>}}
}
\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{url}}{URL.}
\item{\code{method}}{HTTP method.}
\item{\code{query_params}}{The query parameters.}
\item{\code{header_params}}{The header parameters.}
\item{\code{body}}{The HTTP request body.}
\item{\code{stream_callback}}{callback function to process data stream}
\item{\code{...}}{Other optional arguments.}
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
HTTP response
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-ApiClient-deserialize"></a>}}
\if{latex}{\out{\hypertarget{method-ApiClient-deserialize}{}}}
\subsection{Method \code{deserialize()}}{
Deserialize the content of api response to the given type.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{ApiClient$deserialize(resp, return_type, pkg_env)}\if{html}{\out{</div>}}
}
\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{resp}}{Response object.}
\item{\code{return_type}}{R return type.}
\item{\code{pkg_env}}{Package environment.}
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
Deserialized object.
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-ApiClient-deserializeObj"></a>}}
\if{latex}{\out{\hypertarget{method-ApiClient-deserializeObj}{}}}
\subsection{Method \code{deserializeObj()}}{
Deserialize the response from jsonlite object based on the given type
by handling complex and nested types by iterating recursively
Example return_types will be like "array[integer]", "map(Pet)", "array[map(Tag)]", etc.,
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{ApiClient$deserializeObj(obj, return_type, pkg_env)}\if{html}{\out{</div>}}
}
\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{obj}}{Response object.}
\item{\code{return_type}}{R return type.}
\item{\code{pkg_env}}{Package environment.}
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
Deserialized object.
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-ApiClient-clone"></a>}}
\if{latex}{\out{\hypertarget{method-ApiClient-clone}{}}}
\subsection{Method \code{clone()}}{
The objects of this class are cloneable with this method.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{ApiClient$clone(deep = FALSE)}\if{html}{\out{</div>}}
}
\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{deep}}{Whether to make a deep clone.}
}
\if{html}{\out{</div>}}
}
}
}