forked from loafle/openapi-generator-original
[R][httr2] better support for OAuth authoriziation flows (#13123)
* better oauth support in r client * better comment * update samples * remove commented code * update samples * fix mustache tag
This commit is contained in:
parent
5644e23128
commit
f287dde875
@ -279,7 +279,6 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
supportingFiles.add(new SupportingFile("Rbuildignore.mustache", "", ".Rbuildignore"));
|
||||
supportingFiles.add(new SupportingFile(".travis.yml", "", ".travis.yml"));
|
||||
supportingFiles.add(new SupportingFile("ApiResponse.mustache", File.separator + "R", "api_response.R"));
|
||||
//supportingFiles.add(new SupportingFile("element.mustache", File.separator + "R", "Element.R"));
|
||||
supportingFiles.add(new SupportingFile("api_client.mustache", File.separator + "R", "api_client.R"));
|
||||
supportingFiles.add(new SupportingFile("NAMESPACE.mustache", "", "NAMESPACE"));
|
||||
supportingFiles.add(new SupportingFile("testthat.mustache", File.separator + "tests", "testthat.R"));
|
||||
|
@ -105,7 +105,15 @@ Class | Method | HTTP request | Description
|
||||
{{#isOAuth}}
|
||||
- **Type**: OAuth
|
||||
- **Flow**: {{flow}}
|
||||
{{#authorizationUrl}}
|
||||
- **Authorization URL**: {{authorizationUrl}}
|
||||
{{/authorizationUrl}}
|
||||
{{#tokenUrl}}
|
||||
- **Token URL**: {{tokenUrl}}
|
||||
{{/tokenUrl}}
|
||||
{{#refreshUrl}}
|
||||
- **Refresh URL**: {{refreshUrl}}
|
||||
{{/refreshUrl}}
|
||||
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
||||
{{#scopes}} - {{scope}}: {{description}}
|
||||
{{/scopes}}
|
||||
|
@ -238,6 +238,8 @@
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
{{#requiredParams}}
|
||||
if (missing(`{{paramName}}`)) {
|
||||
@ -435,18 +437,28 @@
|
||||
{{/isKeyInQuery}}
|
||||
{{/isApiKey}}
|
||||
{{#isOAuth}}
|
||||
# OAuth token
|
||||
if (!is.null(self$api_client$access_token)) {
|
||||
header_params["Authorization"] <- paste("Bearer", self$api_client$access_token, sep = " ")
|
||||
# OAuth-related settings
|
||||
if (is.null(self$api_client$oauth_client_id) || is.null(self$api_client$oauth_secret)) {
|
||||
{{#useDefaultExceptionHandling}}
|
||||
stop("oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `{{{operationId}}}`.")
|
||||
{{/useDefaultExceptionHandling}}
|
||||
{{#useRlangExceptionHandling}}
|
||||
rlang::abort(message = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `{{{operationId}}}`.",
|
||||
.subclass = "ApiException",
|
||||
ApiException = ApiException$new(status = 0,
|
||||
reason = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `{{{operationId}}}`."))
|
||||
{{/useRlangExceptionHandling}}
|
||||
}
|
||||
is_oauth <- TRUE
|
||||
oauth_scopes <- "{{#scopes}}{{scope}}{{^-last}} {{/-last}}{{/scopes}}"
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list({{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}})
|
||||
local_var_accepts <- list({{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}})
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list({{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}})
|
||||
local_var_content_types <- list({{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}})
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "{{httpMethod}}",
|
||||
@ -457,6 +469,8 @@
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
{{#vendorExtensions.x-streaming}}
|
||||
stream_callback = stream_callback,
|
||||
{{/vendorExtensions.x-streaming}}
|
||||
|
@ -21,7 +21,20 @@
|
||||
#' @field username Username for HTTP basic authentication
|
||||
#' @field password Password for HTTP basic authentication
|
||||
#' @field api_keys API keys
|
||||
{{#hasOAuthMethods}}
|
||||
#' @field access_token Access token
|
||||
#' @field oauth_client_id OAuth client ID
|
||||
#' @field oauth_secret OAuth secret
|
||||
#' @field oauth_refresh_token OAuth refresh token
|
||||
{{#authMethods}}
|
||||
{{#isOAuth}}
|
||||
#' @field oauth_flow_type OAuth flow type
|
||||
#' @field oauth_authorization_url Authoriziation URL
|
||||
#' @field oauth_token_url Token URL
|
||||
#' @field oauth_pkce Boolean flag to enable PKCE
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
{{/hasOAuthMethods}}
|
||||
#' @field bearer_token Bearer token
|
||||
#' @field timeout Default timeout in seconds
|
||||
#' @field retry_status_codes vector of status codes to retry
|
||||
@ -46,8 +59,29 @@ ApiClient <- R6::R6Class(
|
||||
password = NULL,
|
||||
# API keys
|
||||
api_keys = NULL,
|
||||
{{#hasOAuthMethods}}
|
||||
# Access token
|
||||
access_token = NULL,
|
||||
# OAuth2 client ID
|
||||
oauth_client_id = NULL,
|
||||
# OAuth2 secret
|
||||
oauth_secret = NULL,
|
||||
# OAuth2 refresh token
|
||||
oauth_refresh_token = NULL,
|
||||
# OAuth2
|
||||
{{#authMethods}}
|
||||
{{#isOAuth}}
|
||||
# Flow type
|
||||
oauth_flow_type = "{{flow}}",
|
||||
# Authoriziation URL
|
||||
oauth_authorization_url = "{{authorizationUrl}}",
|
||||
# Token URL
|
||||
oauth_token_url = "{{tokenUrl}}",
|
||||
# Enable PKCE?
|
||||
oauth_pkce = TRUE,
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
{{/hasOAuthMethods}}
|
||||
# Bearer token
|
||||
bearer_token = NULL,
|
||||
# Time Out (seconds)
|
||||
|
@ -21,7 +21,20 @@
|
||||
#' @field username Username for HTTP basic authentication
|
||||
#' @field password Password for HTTP basic authentication
|
||||
#' @field api_keys API keys
|
||||
{{#hasOAuthMethods}}
|
||||
#' @field access_token Access token
|
||||
#' @field oauth_client_id OAuth client ID
|
||||
#' @field oauth_secret OAuth secret
|
||||
#' @field oauth_refresh_token OAuth refresh token
|
||||
{{#authMethods}}
|
||||
{{#isOAuth}}
|
||||
#' @field oauth_flow_type OAuth flow type
|
||||
#' @field oauth_authorization_url Authoriziation URL
|
||||
#' @field oauth_token_url Token URL
|
||||
#' @field oauth_pkce Boolean flag to enable PKCE
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
{{/hasOAuthMethods}}
|
||||
#' @field bearer_token Bearer token
|
||||
#' @field timeout Default timeout in seconds
|
||||
#' @field retry_status_codes vector of status codes to retry
|
||||
@ -46,8 +59,29 @@ ApiClient <- R6::R6Class(
|
||||
password = NULL,
|
||||
# API keys
|
||||
api_keys = NULL,
|
||||
{{#hasOAuthMethods}}
|
||||
# Access token
|
||||
access_token = NULL,
|
||||
# OAuth2 client ID
|
||||
oauth_client_id = NULL,
|
||||
# OAuth2 secret
|
||||
oauth_secret = NULL,
|
||||
# OAuth2 refresh token
|
||||
oauth_refresh_token = NULL,
|
||||
# OAuth2
|
||||
{{#authMethods}}
|
||||
{{#isOAuth}}
|
||||
# Flow type
|
||||
oauth_flow_type = "{{flow}}",
|
||||
# Authoriziation URL
|
||||
oauth_authorization_url = "{{authorizationUrl}}",
|
||||
# Token URL
|
||||
oauth_token_url = "{{tokenUrl}}",
|
||||
# Enable PKCE?
|
||||
oauth_pkce = TRUE,
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
{{/hasOAuthMethods}}
|
||||
# Bearer token
|
||||
bearer_token = NULL,
|
||||
# Time Out (seconds)
|
||||
@ -134,47 +168,33 @@ ApiClient <- R6::R6Class(
|
||||
#' @param query_params The query parameters.
|
||||
#' @param header_params The header parameters.
|
||||
#' @param form_params The form parameters.
|
||||
#' @param file_params The form parameters to upload files
|
||||
#' @param file_params The form parameters to upload files.
|
||||
#' @param accepts The HTTP accpet headers.
|
||||
#' @param content_types The HTTP content-type headers.
|
||||
#' @param body The HTTP request body.
|
||||
#' @param stream_callback Callback function to process the data stream
|
||||
#' @param is_oauth True if the endpoints required OAuth authentication.
|
||||
#' @param oauth_scoeps OAuth scopes.
|
||||
#' @param stream_callback Callback function to process the data stream.
|
||||
#' @param ... Other optional arguments.
|
||||
#' @return HTTP response
|
||||
#' @export
|
||||
CallApi = function(url, method, query_params, header_params, form_params, file_params,
|
||||
accepts, content_types, body, stream_callback = NULL, ...) {
|
||||
CallApi = function(url, method, query_params, header_params, form_params,
|
||||
file_params, accepts, content_types, body,
|
||||
is_oauth = FALSE, oauth_scopes = NULL, stream_callback = NULL, ...) {
|
||||
|
||||
resp <- self$Execute(url, method, query_params, header_params, form_params,
|
||||
file_params, accepts, content_types,
|
||||
body, stream_callback = stream_callback, ...)
|
||||
#status_code <- httr::status_code(resp)
|
||||
# set the URL
|
||||
req <- request(url)
|
||||
|
||||
#if (is.null(self$max_retry_attempts)) {
|
||||
# self$req_retry(max_tries <- max_retry_attempts)
|
||||
#}
|
||||
|
||||
#if (!is.null(self$retry_status_codes)) {
|
||||
|
||||
# for (i in 1 : self$max_retry_attempts) {
|
||||
# if (status_code %in% self$retry_status_codes) {
|
||||
# Sys.sleep((2 ^ i) + stats::runif(n = 1, min = 0, max = 1))
|
||||
# resp <- self$Execute(url, method, query_params, header_params, body, stream_callback = stream_callback, ...)
|
||||
# status_code <- httr::status_code(resp)
|
||||
# } else {
|
||||
# break
|
||||
# }
|
||||
# }
|
||||
#}
|
||||
|
||||
resp
|
||||
resp <- self$Execute(req, method, query_params, header_params, form_params,
|
||||
file_params, accepts, content_types, body, is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes, stream_callback = stream_callback, ...)
|
||||
},
|
||||
#' Make an API call
|
||||
#'
|
||||
#' @description
|
||||
#' Make an API call
|
||||
#'
|
||||
#' @param url URL.
|
||||
#' @param req httr2 request.
|
||||
#' @param method HTTP method.
|
||||
#' @param query_params The query parameters.
|
||||
#' @param header_params The header parameters.
|
||||
@ -183,14 +203,15 @@ ApiClient <- R6::R6Class(
|
||||
#' @param accepts The HTTP accpet headers.
|
||||
#' @param content_types The HTTP content-type headers.
|
||||
#' @param body The HTTP request body.
|
||||
#' @param stream_callback Callback function to process data stream
|
||||
#' @param is_oauth True if the endpoints required OAuth authentication.
|
||||
#' @param oauth_scoeps OAuth scopes.
|
||||
#' @param stream_callback Callback function to process data stream.
|
||||
#' @param ... Other optional arguments.
|
||||
#' @return HTTP response
|
||||
#' @export
|
||||
Execute = function(url, method, query_params, header_params, form_params, file_params,
|
||||
accepts, content_types, body, stream_callback = NULL, ...) {
|
||||
# set the URL
|
||||
req <- request(url)
|
||||
Execute = function(req, method, query_params, header_params, form_params,
|
||||
file_params, accepts, content_types, body,
|
||||
is_oauth = FALSE, oauth_scopes = NULL, stream_callback = NULL, ...) {
|
||||
|
||||
## add headers
|
||||
req <- req %>% req_headers(!!!header_params)
|
||||
@ -253,6 +274,21 @@ ApiClient <- R6::R6Class(
|
||||
# set HTTP verb
|
||||
req <- req %>% req_method(method)
|
||||
|
||||
{{#hasOAuthMethods}}
|
||||
# use oauth authentication if the endpoint requires it
|
||||
if (is_oauth) {
|
||||
client <- oauth_client(
|
||||
id = self$oauth_client_id,
|
||||
secret = obfuscated(self$oauth_secret),
|
||||
token_url = self$oauth_token_url,
|
||||
name = "{{packageName}}-oauth"
|
||||
)
|
||||
req <- req %>% req_oauth_auth_code(client, scope = oauth_scopes,
|
||||
pkce = self$oauth_pkce,
|
||||
auth_url = self$oauth_authoriziation_url)
|
||||
}
|
||||
|
||||
{{/hasOAuthMethods}}
|
||||
# stream data
|
||||
if (typeof(stream_callback) == "closure") {
|
||||
req %>% req_stream(stream_callback)
|
||||
@ -286,12 +322,12 @@ ApiClient <- R6::R6Class(
|
||||
resp_obj <- jsonlite::fromJSON(raw_response)
|
||||
self$deserializeObj(resp_obj, return_type, pkg_env)
|
||||
},
|
||||
#' Deserialize the response from jsonlite object based on the given type
|
||||
#' Deserialize the response from jsonlite object based on the given type.
|
||||
#'
|
||||
#' @description
|
||||
#' Deserialize the response from jsonlite object based on the given type
|
||||
#' 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.,
|
||||
#' Example return_types will be like "array[integer]", "map(Pet)", "array[map(Tag)]", etc.
|
||||
#'
|
||||
#' @param obj Response object.
|
||||
#' @param return_type R return type.
|
||||
@ -345,8 +381,7 @@ ApiClient <- R6::R6Class(
|
||||
}
|
||||
return_obj
|
||||
},
|
||||
#' Return a propery header (for accept or content-type). If JSON-related MIME is found,
|
||||
#' return it. Otherwise, return the first one, if any.
|
||||
#' Return a propery header (for accept or content-type).
|
||||
#'
|
||||
#' @description
|
||||
#' Return a propery header (for accept or content-type). If JSON-related MIME is found,
|
||||
|
@ -200,10 +200,10 @@ paths:
|
||||
responses:
|
||||
'405':
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
#security:
|
||||
# - petstore_auth:
|
||||
# - 'write:pets'
|
||||
# - 'read:pets'
|
||||
requestBody:
|
||||
content:
|
||||
application/x-www-form-urlencoded:
|
||||
|
@ -29,6 +29,13 @@
|
||||
#' @field password Password for HTTP basic authentication
|
||||
#' @field api_keys API keys
|
||||
#' @field access_token Access token
|
||||
#' @field oauth_client_id OAuth client ID
|
||||
#' @field oauth_secret OAuth secret
|
||||
#' @field oauth_refresh_token OAuth refresh token
|
||||
#' @field oauth_flow_type OAuth flow type
|
||||
#' @field oauth_authorization_url Authoriziation URL
|
||||
#' @field oauth_token_url Token URL
|
||||
#' @field oauth_pkce Boolean flag to enable PKCE
|
||||
#' @field bearer_token Bearer token
|
||||
#' @field timeout Default timeout in seconds
|
||||
#' @field retry_status_codes vector of status codes to retry
|
||||
@ -53,6 +60,21 @@ ApiClient <- R6::R6Class(
|
||||
api_keys = NULL,
|
||||
# Access token
|
||||
access_token = NULL,
|
||||
# OAuth2 client ID
|
||||
oauth_client_id = NULL,
|
||||
# OAuth2 secret
|
||||
oauth_secret = NULL,
|
||||
# OAuth2 refresh token
|
||||
oauth_refresh_token = NULL,
|
||||
# OAuth2
|
||||
# Flow type
|
||||
oauth_flow_type = "implicit",
|
||||
# Authoriziation URL
|
||||
oauth_authorization_url = "http://petstore.swagger.io/api/oauth/dialog",
|
||||
# Token URL
|
||||
oauth_token_url = "",
|
||||
# Enable PKCE?
|
||||
oauth_pkce = TRUE,
|
||||
# Bearer token
|
||||
bearer_token = NULL,
|
||||
# Time Out (seconds)
|
||||
@ -139,47 +161,33 @@ ApiClient <- R6::R6Class(
|
||||
#' @param query_params The query parameters.
|
||||
#' @param header_params The header parameters.
|
||||
#' @param form_params The form parameters.
|
||||
#' @param file_params The form parameters to upload files
|
||||
#' @param file_params The form parameters to upload files.
|
||||
#' @param accepts The HTTP accpet headers.
|
||||
#' @param content_types The HTTP content-type headers.
|
||||
#' @param body The HTTP request body.
|
||||
#' @param stream_callback Callback function to process the data stream
|
||||
#' @param is_oauth True if the endpoints required OAuth authentication.
|
||||
#' @param oauth_scoeps OAuth scopes.
|
||||
#' @param stream_callback Callback function to process the data stream.
|
||||
#' @param ... Other optional arguments.
|
||||
#' @return HTTP response
|
||||
#' @export
|
||||
CallApi = function(url, method, query_params, header_params, form_params, file_params,
|
||||
accepts, content_types, body, stream_callback = NULL, ...) {
|
||||
CallApi = function(url, method, query_params, header_params, form_params,
|
||||
file_params, accepts, content_types, body,
|
||||
is_oauth = FALSE, oauth_scopes = NULL, stream_callback = NULL, ...) {
|
||||
|
||||
resp <- self$Execute(url, method, query_params, header_params, form_params,
|
||||
file_params, accepts, content_types,
|
||||
body, stream_callback = stream_callback, ...)
|
||||
#status_code <- httr::status_code(resp)
|
||||
# set the URL
|
||||
req <- request(url)
|
||||
|
||||
#if (is.null(self$max_retry_attempts)) {
|
||||
# self$req_retry(max_tries <- max_retry_attempts)
|
||||
#}
|
||||
|
||||
#if (!is.null(self$retry_status_codes)) {
|
||||
|
||||
# for (i in 1 : self$max_retry_attempts) {
|
||||
# if (status_code %in% self$retry_status_codes) {
|
||||
# Sys.sleep((2 ^ i) + stats::runif(n = 1, min = 0, max = 1))
|
||||
# resp <- self$Execute(url, method, query_params, header_params, body, stream_callback = stream_callback, ...)
|
||||
# status_code <- httr::status_code(resp)
|
||||
# } else {
|
||||
# break
|
||||
# }
|
||||
# }
|
||||
#}
|
||||
|
||||
resp
|
||||
resp <- self$Execute(req, method, query_params, header_params, form_params,
|
||||
file_params, accepts, content_types, body, is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes, stream_callback = stream_callback, ...)
|
||||
},
|
||||
#' Make an API call
|
||||
#'
|
||||
#' @description
|
||||
#' Make an API call
|
||||
#'
|
||||
#' @param url URL.
|
||||
#' @param req httr2 request.
|
||||
#' @param method HTTP method.
|
||||
#' @param query_params The query parameters.
|
||||
#' @param header_params The header parameters.
|
||||
@ -188,14 +196,15 @@ ApiClient <- R6::R6Class(
|
||||
#' @param accepts The HTTP accpet headers.
|
||||
#' @param content_types The HTTP content-type headers.
|
||||
#' @param body The HTTP request body.
|
||||
#' @param stream_callback Callback function to process data stream
|
||||
#' @param is_oauth True if the endpoints required OAuth authentication.
|
||||
#' @param oauth_scoeps OAuth scopes.
|
||||
#' @param stream_callback Callback function to process data stream.
|
||||
#' @param ... Other optional arguments.
|
||||
#' @return HTTP response
|
||||
#' @export
|
||||
Execute = function(url, method, query_params, header_params, form_params, file_params,
|
||||
accepts, content_types, body, stream_callback = NULL, ...) {
|
||||
# set the URL
|
||||
req <- request(url)
|
||||
Execute = function(req, method, query_params, header_params, form_params,
|
||||
file_params, accepts, content_types, body,
|
||||
is_oauth = FALSE, oauth_scopes = NULL, stream_callback = NULL, ...) {
|
||||
|
||||
## add headers
|
||||
req <- req %>% req_headers(!!!header_params)
|
||||
@ -257,6 +266,19 @@ ApiClient <- R6::R6Class(
|
||||
# set HTTP verb
|
||||
req <- req %>% req_method(method)
|
||||
|
||||
# use oauth authentication if the endpoint requires it
|
||||
if (is_oauth) {
|
||||
client <- oauth_client(
|
||||
id = self$oauth_client_id,
|
||||
secret = obfuscated(self$oauth_secret),
|
||||
token_url = self$oauth_token_url,
|
||||
name = "petstore-oauth"
|
||||
)
|
||||
req <- req %>% req_oauth_auth_code(client, scope = oauth_scopes,
|
||||
pkce = self$oauth_pkce,
|
||||
auth_url = self$oauth_authoriziation_url)
|
||||
}
|
||||
|
||||
# stream data
|
||||
if (typeof(stream_callback) == "closure") {
|
||||
req %>% req_stream(stream_callback)
|
||||
@ -290,12 +312,12 @@ ApiClient <- R6::R6Class(
|
||||
resp_obj <- jsonlite::fromJSON(raw_response)
|
||||
self$deserializeObj(resp_obj, return_type, pkg_env)
|
||||
},
|
||||
#' Deserialize the response from jsonlite object based on the given type
|
||||
#' Deserialize the response from jsonlite object based on the given type.
|
||||
#'
|
||||
#' @description
|
||||
#' Deserialize the response from jsonlite object based on the given type
|
||||
#' 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.,
|
||||
#' Example return_types will be like "array[integer]", "map(Pet)", "array[map(Tag)]", etc.
|
||||
#'
|
||||
#' @param obj Response object.
|
||||
#' @param return_type R return type.
|
||||
@ -349,8 +371,7 @@ ApiClient <- R6::R6Class(
|
||||
}
|
||||
return_obj
|
||||
},
|
||||
#' Return a propery header (for accept or content-type). If JSON-related MIME is found,
|
||||
#' return it. Otherwise, return the first one, if any.
|
||||
#' Return a propery header (for accept or content-type).
|
||||
#'
|
||||
#' @description
|
||||
#' Return a propery header (for accept or content-type). If JSON-related MIME is found,
|
||||
|
@ -128,6 +128,8 @@ FakeApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`dummy`)) {
|
||||
rlang::abort(message = "Missing required parameter `dummy`.",
|
||||
@ -145,10 +147,10 @@ FakeApi <- R6::R6Class(
|
||||
local_var_url_path <- "/fake/data_file"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -159,6 +161,8 @@ FakeApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
|
@ -522,9 +522,6 @@
|
||||
#' #Updates a pet in the store with form data
|
||||
#' api.instance <- PetApi$new()
|
||||
#'
|
||||
#' # Configure OAuth2 access token for authorization: petstore_auth
|
||||
#' api.instance$api_client$access_token <- 'TODO_YOUR_ACCESS_TOKEN';
|
||||
#'
|
||||
#'result <- tryCatch(
|
||||
#' api.instance$update_pet_with_form(var.pet_id, name=var.name, status=var.status),
|
||||
#' ApiException = function(ex) ex
|
||||
@ -632,6 +629,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`pet`)) {
|
||||
rlang::abort(message = "Missing required parameter `pet`.",
|
||||
@ -658,10 +657,10 @@ PetApi <- R6::R6Class(
|
||||
header_params["Authorization"] <- paste("Basic", base64enc::base64encode(charToRaw(paste(self$api_client$username, self$api_client$password, sep = ":"))))
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("application/json", "application/xml", "multipart/related")
|
||||
local_var_content_types <- list("application/json", "application/xml", "multipart/related")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "POST",
|
||||
@ -672,6 +671,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -755,6 +756,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`pet_id`)) {
|
||||
rlang::abort(message = "Missing required parameter `pet_id`.",
|
||||
@ -772,16 +775,21 @@ PetApi <- R6::R6Class(
|
||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||
}
|
||||
|
||||
# OAuth token
|
||||
if (!is.null(self$api_client$access_token)) {
|
||||
header_params["Authorization"] <- paste("Bearer", self$api_client$access_token, sep = " ")
|
||||
# OAuth-related settings
|
||||
if (is.null(self$api_client$oauth_client_id) || is.null(self$api_client$oauth_secret)) {
|
||||
rlang::abort(message = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `delete_pet`.",
|
||||
.subclass = "ApiException",
|
||||
ApiException = ApiException$new(status = 0,
|
||||
reason = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `delete_pet`."))
|
||||
}
|
||||
is_oauth <- TRUE
|
||||
oauth_scopes <- "write:pets read:pets"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "DELETE",
|
||||
@ -792,6 +800,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -862,6 +872,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`status`)) {
|
||||
rlang::abort(message = "Missing required parameter `status`.",
|
||||
@ -874,16 +886,21 @@ PetApi <- R6::R6Class(
|
||||
query_params["status"] <- `status`
|
||||
|
||||
local_var_url_path <- "/pet/findByStatus"
|
||||
# OAuth token
|
||||
if (!is.null(self$api_client$access_token)) {
|
||||
header_params["Authorization"] <- paste("Bearer", self$api_client$access_token, sep = " ")
|
||||
# OAuth-related settings
|
||||
if (is.null(self$api_client$oauth_client_id) || is.null(self$api_client$oauth_secret)) {
|
||||
rlang::abort(message = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `find_pets_by_status`.",
|
||||
.subclass = "ApiException",
|
||||
ApiException = ApiException$new(status = 0,
|
||||
reason = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `find_pets_by_status`."))
|
||||
}
|
||||
is_oauth <- TRUE
|
||||
oauth_scopes <- "read:pets"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -894,6 +911,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -977,6 +996,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`tags`)) {
|
||||
rlang::abort(message = "Missing required parameter `tags`.",
|
||||
@ -989,16 +1010,21 @@ PetApi <- R6::R6Class(
|
||||
query_params["tags"] <- `tags`
|
||||
|
||||
local_var_url_path <- "/pet/findByTags"
|
||||
# OAuth token
|
||||
if (!is.null(self$api_client$access_token)) {
|
||||
header_params["Authorization"] <- paste("Bearer", self$api_client$access_token, sep = " ")
|
||||
# OAuth-related settings
|
||||
if (is.null(self$api_client$oauth_client_id) || is.null(self$api_client$oauth_secret)) {
|
||||
rlang::abort(message = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `find_pets_by_tags`.",
|
||||
.subclass = "ApiException",
|
||||
ApiException = ApiException$new(status = 0,
|
||||
reason = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `find_pets_by_tags`."))
|
||||
}
|
||||
is_oauth <- TRUE
|
||||
oauth_scopes <- "read:pets"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -1009,6 +1035,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -1092,6 +1120,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`pet_id`)) {
|
||||
rlang::abort(message = "Missing required parameter `pet_id`.",
|
||||
@ -1112,10 +1142,10 @@ PetApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -1126,6 +1156,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -1215,6 +1247,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`pet_id`)) {
|
||||
rlang::abort(message = "Missing required parameter `pet_id`.",
|
||||
@ -1235,10 +1269,10 @@ PetApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -1249,6 +1283,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
stream_callback = stream_callback,
|
||||
...)
|
||||
|
||||
@ -1343,6 +1379,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`header_test_int`)) {
|
||||
rlang::abort(message = "Missing required parameter `header_test_int`.",
|
||||
@ -1361,10 +1399,10 @@ PetApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -1375,6 +1413,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
stream_callback = stream_callback,
|
||||
...)
|
||||
|
||||
@ -1463,6 +1503,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`pet`)) {
|
||||
rlang::abort(message = "Missing required parameter `pet`.",
|
||||
@ -1479,16 +1521,21 @@ PetApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
local_var_url_path <- "/pet"
|
||||
# OAuth token
|
||||
if (!is.null(self$api_client$access_token)) {
|
||||
header_params["Authorization"] <- paste("Bearer", self$api_client$access_token, sep = " ")
|
||||
# OAuth-related settings
|
||||
if (is.null(self$api_client$oauth_client_id) || is.null(self$api_client$oauth_secret)) {
|
||||
rlang::abort(message = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `update_pet`.",
|
||||
.subclass = "ApiException",
|
||||
ApiException = ApiException$new(status = 0,
|
||||
reason = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `update_pet`."))
|
||||
}
|
||||
is_oauth <- TRUE
|
||||
oauth_scopes <- "write:pets read:pets"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("application/json", "application/xml", "multipart/related")
|
||||
local_var_content_types <- list("application/json", "application/xml", "multipart/related")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "PUT",
|
||||
@ -1499,6 +1546,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -1584,6 +1633,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`pet_id`)) {
|
||||
rlang::abort(message = "Missing required parameter `pet_id`.",
|
||||
@ -1602,16 +1653,12 @@ PetApi <- R6::R6Class(
|
||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||
}
|
||||
|
||||
# OAuth token
|
||||
if (!is.null(self$api_client$access_token)) {
|
||||
header_params["Authorization"] <- paste("Bearer", self$api_client$access_token, sep = " ")
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("application/x-www-form-urlencoded")
|
||||
local_var_content_types <- list("application/x-www-form-urlencoded")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "POST",
|
||||
@ -1622,6 +1669,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -1696,6 +1745,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`pet_id`)) {
|
||||
rlang::abort(message = "Missing required parameter `pet_id`.",
|
||||
@ -1714,16 +1765,21 @@ PetApi <- R6::R6Class(
|
||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||
}
|
||||
|
||||
# OAuth token
|
||||
if (!is.null(self$api_client$access_token)) {
|
||||
header_params["Authorization"] <- paste("Bearer", self$api_client$access_token, sep = " ")
|
||||
# OAuth-related settings
|
||||
if (is.null(self$api_client$oauth_client_id) || is.null(self$api_client$oauth_secret)) {
|
||||
rlang::abort(message = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `upload_file`.",
|
||||
.subclass = "ApiException",
|
||||
ApiException = ApiException$new(status = 0,
|
||||
reason = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `upload_file`."))
|
||||
}
|
||||
is_oauth <- TRUE
|
||||
oauth_scopes <- "write:pets read:pets"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/json")
|
||||
local_var_accepts <- list("application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("multipart/form-data")
|
||||
local_var_content_types <- list("multipart/form-data")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "POST",
|
||||
@ -1734,6 +1790,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
|
@ -276,6 +276,8 @@ StoreApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`order_id`)) {
|
||||
rlang::abort(message = "Missing required parameter `order_id`.",
|
||||
@ -292,10 +294,10 @@ StoreApi <- R6::R6Class(
|
||||
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "DELETE",
|
||||
@ -306,6 +308,8 @@ StoreApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -374,6 +378,8 @@ StoreApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
local_var_url_path <- "/store/inventory"
|
||||
# API key authentication
|
||||
@ -382,10 +388,10 @@ StoreApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/json")
|
||||
local_var_accepts <- list("application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -396,6 +402,8 @@ StoreApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -479,6 +487,8 @@ StoreApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`order_id`)) {
|
||||
rlang::abort(message = "Missing required parameter `order_id`.",
|
||||
@ -507,10 +517,10 @@ StoreApi <- R6::R6Class(
|
||||
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -521,6 +531,8 @@ StoreApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -604,6 +616,8 @@ StoreApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`order`)) {
|
||||
rlang::abort(message = "Missing required parameter `order`.",
|
||||
@ -622,10 +636,10 @@ StoreApi <- R6::R6Class(
|
||||
local_var_url_path <- "/store/order"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("application/json")
|
||||
local_var_content_types <- list("application/json")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "POST",
|
||||
@ -636,6 +650,8 @@ StoreApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
|
@ -462,6 +462,8 @@ UserApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`user`)) {
|
||||
rlang::abort(message = "Missing required parameter `user`.",
|
||||
@ -484,10 +486,10 @@ UserApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("application/json")
|
||||
local_var_content_types <- list("application/json")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "POST",
|
||||
@ -498,6 +500,8 @@ UserApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -566,6 +570,8 @@ UserApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`user`)) {
|
||||
rlang::abort(message = "Missing required parameter `user`.",
|
||||
@ -591,10 +597,10 @@ UserApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("application/json")
|
||||
local_var_content_types <- list("application/json")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "POST",
|
||||
@ -605,6 +611,8 @@ UserApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -673,6 +681,8 @@ UserApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`user`)) {
|
||||
rlang::abort(message = "Missing required parameter `user`.",
|
||||
@ -698,10 +708,10 @@ UserApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("application/json")
|
||||
local_var_content_types <- list("application/json")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "POST",
|
||||
@ -712,6 +722,8 @@ UserApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -780,6 +792,8 @@ UserApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`username`)) {
|
||||
rlang::abort(message = "Missing required parameter `username`.",
|
||||
@ -800,10 +814,10 @@ UserApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "DELETE",
|
||||
@ -814,6 +828,8 @@ UserApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -884,6 +900,8 @@ UserApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`username`)) {
|
||||
rlang::abort(message = "Missing required parameter `username`.",
|
||||
@ -900,10 +918,10 @@ UserApi <- R6::R6Class(
|
||||
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -914,6 +932,8 @@ UserApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -999,6 +1019,8 @@ UserApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`username`)) {
|
||||
rlang::abort(message = "Missing required parameter `username`.",
|
||||
@ -1029,10 +1051,10 @@ UserApi <- R6::R6Class(
|
||||
local_var_url_path <- "/user/login"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -1043,6 +1065,8 @@ UserApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -1122,6 +1146,8 @@ UserApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
local_var_url_path <- "/user/logout"
|
||||
# API key authentication
|
||||
@ -1130,10 +1156,10 @@ UserApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -1144,6 +1170,8 @@ UserApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -1214,6 +1242,8 @@ UserApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`username`)) {
|
||||
rlang::abort(message = "Missing required parameter `username`.",
|
||||
@ -1248,10 +1278,10 @@ UserApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("application/json")
|
||||
local_var_content_types <- list("application/json")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "PUT",
|
||||
@ -1262,6 +1292,8 @@ UserApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
|
@ -534,8 +534,6 @@ var_status <- "status_example" # character | Updated status of the pet (Optional
|
||||
|
||||
#Updates a pet in the store with form data
|
||||
api_instance <- PetApi$new()
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
|
||||
result <- tryCatch(
|
||||
api_instance$update_pet_with_form(var_pet_id, name = var_name, status = var_status),
|
||||
ApiException = function(ex) ex
|
||||
@ -564,7 +562,7 @@ void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
|
@ -112,6 +112,8 @@ test_that("update_pet_with_form", {
|
||||
result <- pet_api$add_pet(update_pet)
|
||||
|
||||
## update pet with form
|
||||
pet_api$api_client$oauth_client_id <- "client_id_aaa"
|
||||
pet_api$api_client$oauth_secret <- "secrete_bbb"
|
||||
update_result <- pet_api$update_pet_with_form(update_pet_id, name = "pet2", status = "sold")
|
||||
|
||||
# get pet
|
||||
|
@ -29,6 +29,13 @@
|
||||
#' @field password Password for HTTP basic authentication
|
||||
#' @field api_keys API keys
|
||||
#' @field access_token Access token
|
||||
#' @field oauth_client_id OAuth client ID
|
||||
#' @field oauth_secret OAuth secret
|
||||
#' @field oauth_refresh_token OAuth refresh token
|
||||
#' @field oauth_flow_type OAuth flow type
|
||||
#' @field oauth_authorization_url Authoriziation URL
|
||||
#' @field oauth_token_url Token URL
|
||||
#' @field oauth_pkce Boolean flag to enable PKCE
|
||||
#' @field bearer_token Bearer token
|
||||
#' @field timeout Default timeout in seconds
|
||||
#' @field retry_status_codes vector of status codes to retry
|
||||
@ -53,6 +60,21 @@ ApiClient <- R6::R6Class(
|
||||
api_keys = NULL,
|
||||
# Access token
|
||||
access_token = NULL,
|
||||
# OAuth2 client ID
|
||||
oauth_client_id = NULL,
|
||||
# OAuth2 secret
|
||||
oauth_secret = NULL,
|
||||
# OAuth2 refresh token
|
||||
oauth_refresh_token = NULL,
|
||||
# OAuth2
|
||||
# Flow type
|
||||
oauth_flow_type = "implicit",
|
||||
# Authoriziation URL
|
||||
oauth_authorization_url = "http://petstore.swagger.io/api/oauth/dialog",
|
||||
# Token URL
|
||||
oauth_token_url = "",
|
||||
# Enable PKCE?
|
||||
oauth_pkce = TRUE,
|
||||
# Bearer token
|
||||
bearer_token = NULL,
|
||||
# Time Out (seconds)
|
||||
|
@ -128,6 +128,8 @@ FakeApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`dummy`)) {
|
||||
rlang::abort(message = "Missing required parameter `dummy`.",
|
||||
@ -145,10 +147,10 @@ FakeApi <- R6::R6Class(
|
||||
local_var_url_path <- "/fake/data_file"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -159,6 +161,8 @@ FakeApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
|
@ -522,9 +522,6 @@
|
||||
#' #Updates a pet in the store with form data
|
||||
#' api.instance <- PetApi$new()
|
||||
#'
|
||||
#' # Configure OAuth2 access token for authorization: petstore_auth
|
||||
#' api.instance$api_client$access_token <- 'TODO_YOUR_ACCESS_TOKEN';
|
||||
#'
|
||||
#'result <- tryCatch(
|
||||
#' api.instance$UpdatePetWithForm(var.pet_id, name=var.name, status=var.status),
|
||||
#' ApiException = function(ex) ex
|
||||
@ -632,6 +629,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`pet`)) {
|
||||
rlang::abort(message = "Missing required parameter `pet`.",
|
||||
@ -658,10 +657,10 @@ PetApi <- R6::R6Class(
|
||||
header_params["Authorization"] <- paste("Basic", base64enc::base64encode(charToRaw(paste(self$api_client$username, self$api_client$password, sep = ":"))))
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("application/json", "application/xml", "multipart/related")
|
||||
local_var_content_types <- list("application/json", "application/xml", "multipart/related")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "POST",
|
||||
@ -672,6 +671,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -755,6 +756,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`pet_id`)) {
|
||||
rlang::abort(message = "Missing required parameter `pet_id`.",
|
||||
@ -772,16 +775,21 @@ PetApi <- R6::R6Class(
|
||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||
}
|
||||
|
||||
# OAuth token
|
||||
if (!is.null(self$api_client$access_token)) {
|
||||
header_params["Authorization"] <- paste("Bearer", self$api_client$access_token, sep = " ")
|
||||
# OAuth-related settings
|
||||
if (is.null(self$api_client$oauth_client_id) || is.null(self$api_client$oauth_secret)) {
|
||||
rlang::abort(message = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `DeletePet`.",
|
||||
.subclass = "ApiException",
|
||||
ApiException = ApiException$new(status = 0,
|
||||
reason = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `DeletePet`."))
|
||||
}
|
||||
is_oauth <- TRUE
|
||||
oauth_scopes <- "write:pets read:pets"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "DELETE",
|
||||
@ -792,6 +800,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -862,6 +872,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`status`)) {
|
||||
rlang::abort(message = "Missing required parameter `status`.",
|
||||
@ -874,16 +886,21 @@ PetApi <- R6::R6Class(
|
||||
query_params["status"] <- `status`
|
||||
|
||||
local_var_url_path <- "/pet/findByStatus"
|
||||
# OAuth token
|
||||
if (!is.null(self$api_client$access_token)) {
|
||||
header_params["Authorization"] <- paste("Bearer", self$api_client$access_token, sep = " ")
|
||||
# OAuth-related settings
|
||||
if (is.null(self$api_client$oauth_client_id) || is.null(self$api_client$oauth_secret)) {
|
||||
rlang::abort(message = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `FindPetsByStatus`.",
|
||||
.subclass = "ApiException",
|
||||
ApiException = ApiException$new(status = 0,
|
||||
reason = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `FindPetsByStatus`."))
|
||||
}
|
||||
is_oauth <- TRUE
|
||||
oauth_scopes <- "read:pets"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -894,6 +911,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -977,6 +996,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`tags`)) {
|
||||
rlang::abort(message = "Missing required parameter `tags`.",
|
||||
@ -989,16 +1010,21 @@ PetApi <- R6::R6Class(
|
||||
query_params["tags"] <- `tags`
|
||||
|
||||
local_var_url_path <- "/pet/findByTags"
|
||||
# OAuth token
|
||||
if (!is.null(self$api_client$access_token)) {
|
||||
header_params["Authorization"] <- paste("Bearer", self$api_client$access_token, sep = " ")
|
||||
# OAuth-related settings
|
||||
if (is.null(self$api_client$oauth_client_id) || is.null(self$api_client$oauth_secret)) {
|
||||
rlang::abort(message = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `FindPetsByTags`.",
|
||||
.subclass = "ApiException",
|
||||
ApiException = ApiException$new(status = 0,
|
||||
reason = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `FindPetsByTags`."))
|
||||
}
|
||||
is_oauth <- TRUE
|
||||
oauth_scopes <- "read:pets"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -1009,6 +1035,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -1092,6 +1120,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`pet_id`)) {
|
||||
rlang::abort(message = "Missing required parameter `pet_id`.",
|
||||
@ -1112,10 +1142,10 @@ PetApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -1126,6 +1156,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -1215,6 +1247,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`pet_id`)) {
|
||||
rlang::abort(message = "Missing required parameter `pet_id`.",
|
||||
@ -1235,10 +1269,10 @@ PetApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -1249,6 +1283,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
stream_callback = stream_callback,
|
||||
...)
|
||||
|
||||
@ -1343,6 +1379,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`header_test_int`)) {
|
||||
rlang::abort(message = "Missing required parameter `header_test_int`.",
|
||||
@ -1361,10 +1399,10 @@ PetApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -1375,6 +1413,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
stream_callback = stream_callback,
|
||||
...)
|
||||
|
||||
@ -1463,6 +1503,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`pet`)) {
|
||||
rlang::abort(message = "Missing required parameter `pet`.",
|
||||
@ -1479,16 +1521,21 @@ PetApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
local_var_url_path <- "/pet"
|
||||
# OAuth token
|
||||
if (!is.null(self$api_client$access_token)) {
|
||||
header_params["Authorization"] <- paste("Bearer", self$api_client$access_token, sep = " ")
|
||||
# OAuth-related settings
|
||||
if (is.null(self$api_client$oauth_client_id) || is.null(self$api_client$oauth_secret)) {
|
||||
rlang::abort(message = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `UpdatePet`.",
|
||||
.subclass = "ApiException",
|
||||
ApiException = ApiException$new(status = 0,
|
||||
reason = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `UpdatePet`."))
|
||||
}
|
||||
is_oauth <- TRUE
|
||||
oauth_scopes <- "write:pets read:pets"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("application/json", "application/xml", "multipart/related")
|
||||
local_var_content_types <- list("application/json", "application/xml", "multipart/related")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "PUT",
|
||||
@ -1499,6 +1546,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -1584,6 +1633,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`pet_id`)) {
|
||||
rlang::abort(message = "Missing required parameter `pet_id`.",
|
||||
@ -1602,16 +1653,12 @@ PetApi <- R6::R6Class(
|
||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||
}
|
||||
|
||||
# OAuth token
|
||||
if (!is.null(self$api_client$access_token)) {
|
||||
header_params["Authorization"] <- paste("Bearer", self$api_client$access_token, sep = " ")
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("application/x-www-form-urlencoded")
|
||||
local_var_content_types <- list("application/x-www-form-urlencoded")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "POST",
|
||||
@ -1622,6 +1669,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -1696,6 +1745,8 @@ PetApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`pet_id`)) {
|
||||
rlang::abort(message = "Missing required parameter `pet_id`.",
|
||||
@ -1714,16 +1765,21 @@ PetApi <- R6::R6Class(
|
||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||
}
|
||||
|
||||
# OAuth token
|
||||
if (!is.null(self$api_client$access_token)) {
|
||||
header_params["Authorization"] <- paste("Bearer", self$api_client$access_token, sep = " ")
|
||||
# OAuth-related settings
|
||||
if (is.null(self$api_client$oauth_client_id) || is.null(self$api_client$oauth_secret)) {
|
||||
rlang::abort(message = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `UploadFile`.",
|
||||
.subclass = "ApiException",
|
||||
ApiException = ApiException$new(status = 0,
|
||||
reason = "oauth_client_id, oauth_secret in `api_client` must be set for authentication in the endpoint `UploadFile`."))
|
||||
}
|
||||
is_oauth <- TRUE
|
||||
oauth_scopes <- "write:pets read:pets"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/json")
|
||||
local_var_accepts <- list("application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("multipart/form-data")
|
||||
local_var_content_types <- list("multipart/form-data")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "POST",
|
||||
@ -1734,6 +1790,8 @@ PetApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
|
@ -276,6 +276,8 @@ StoreApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`order_id`)) {
|
||||
rlang::abort(message = "Missing required parameter `order_id`.",
|
||||
@ -292,10 +294,10 @@ StoreApi <- R6::R6Class(
|
||||
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "DELETE",
|
||||
@ -306,6 +308,8 @@ StoreApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -374,6 +378,8 @@ StoreApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
local_var_url_path <- "/store/inventory"
|
||||
# API key authentication
|
||||
@ -382,10 +388,10 @@ StoreApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/json")
|
||||
local_var_accepts <- list("application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -396,6 +402,8 @@ StoreApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -479,6 +487,8 @@ StoreApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`order_id`)) {
|
||||
rlang::abort(message = "Missing required parameter `order_id`.",
|
||||
@ -507,10 +517,10 @@ StoreApi <- R6::R6Class(
|
||||
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -521,6 +531,8 @@ StoreApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -604,6 +616,8 @@ StoreApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`order`)) {
|
||||
rlang::abort(message = "Missing required parameter `order`.",
|
||||
@ -622,10 +636,10 @@ StoreApi <- R6::R6Class(
|
||||
local_var_url_path <- "/store/order"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("application/json")
|
||||
local_var_content_types <- list("application/json")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "POST",
|
||||
@ -636,6 +650,8 @@ StoreApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
|
@ -462,6 +462,8 @@ UserApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`user`)) {
|
||||
rlang::abort(message = "Missing required parameter `user`.",
|
||||
@ -484,10 +486,10 @@ UserApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("application/json")
|
||||
local_var_content_types <- list("application/json")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "POST",
|
||||
@ -498,6 +500,8 @@ UserApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -566,6 +570,8 @@ UserApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`user`)) {
|
||||
rlang::abort(message = "Missing required parameter `user`.",
|
||||
@ -591,10 +597,10 @@ UserApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("application/json")
|
||||
local_var_content_types <- list("application/json")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "POST",
|
||||
@ -605,6 +611,8 @@ UserApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -673,6 +681,8 @@ UserApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`user`)) {
|
||||
rlang::abort(message = "Missing required parameter `user`.",
|
||||
@ -698,10 +708,10 @@ UserApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("application/json")
|
||||
local_var_content_types <- list("application/json")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "POST",
|
||||
@ -712,6 +722,8 @@ UserApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -780,6 +792,8 @@ UserApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`username`)) {
|
||||
rlang::abort(message = "Missing required parameter `username`.",
|
||||
@ -800,10 +814,10 @@ UserApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "DELETE",
|
||||
@ -814,6 +828,8 @@ UserApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -884,6 +900,8 @@ UserApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`username`)) {
|
||||
rlang::abort(message = "Missing required parameter `username`.",
|
||||
@ -900,10 +918,10 @@ UserApi <- R6::R6Class(
|
||||
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -914,6 +932,8 @@ UserApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -999,6 +1019,8 @@ UserApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`username`)) {
|
||||
rlang::abort(message = "Missing required parameter `username`.",
|
||||
@ -1029,10 +1051,10 @@ UserApi <- R6::R6Class(
|
||||
local_var_url_path <- "/user/login"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list("application/xml", "application/json")
|
||||
local_var_accepts <- list("application/xml", "application/json")
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -1043,6 +1065,8 @@ UserApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -1122,6 +1146,8 @@ UserApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
local_var_url_path <- "/user/logout"
|
||||
# API key authentication
|
||||
@ -1130,10 +1156,10 @@ UserApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list()
|
||||
local_var_content_types <- list()
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "GET",
|
||||
@ -1144,6 +1170,8 @@ UserApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
@ -1214,6 +1242,8 @@ UserApi <- R6::R6Class(
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
if (missing(`username`)) {
|
||||
rlang::abort(message = "Missing required parameter `username`.",
|
||||
@ -1248,10 +1278,10 @@ UserApi <- R6::R6Class(
|
||||
}
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts = list()
|
||||
local_var_accepts <- list()
|
||||
|
||||
# The Content-Type representation header
|
||||
local_var_content_types = list("application/json")
|
||||
local_var_content_types <- list("application/json")
|
||||
|
||||
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||
method = "PUT",
|
||||
@ -1262,6 +1292,8 @@ UserApi <- R6::R6Class(
|
||||
accepts = local_var_accepts,
|
||||
content_types = local_var_content_types,
|
||||
body = local_var_body,
|
||||
is_oauth = is_oauth,
|
||||
oauth_scopes = oauth_scopes,
|
||||
...)
|
||||
|
||||
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||
|
@ -534,8 +534,6 @@ var_status <- "status_example" # character | Updated status of the pet (Optional
|
||||
|
||||
#Updates a pet in the store with form data
|
||||
api_instance <- PetApi$new()
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
|
||||
result <- tryCatch(
|
||||
api_instance$UpdatePetWithForm(var_pet_id, name = var_name, status = var_status),
|
||||
ApiException = function(ex) ex
|
||||
@ -564,7 +562,7 @@ void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
|
@ -22,6 +22,9 @@ test_that("Test toJSONString", {
|
||||
})
|
||||
|
||||
test_that("Test FindPetByStatus", {
|
||||
pet_api$api_client$oauth_client_id <- "client_id_test"
|
||||
pet_api$api_client$oauth_secret <- "secret_test"
|
||||
|
||||
result <- pet_api$FindPetsByStatus("available")
|
||||
expect_equal(result[[1]]$status, "available")
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user