[R] fix auto-generated doc, add checks for bearer/access token (#13112)

* update readme to show bearer auth

* fix doc

* fix doc
This commit is contained in:
William Cheng 2022-08-06 16:32:18 +08:00 committed by GitHub
parent 247574aa0c
commit f5900c7015
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 328 additions and 360 deletions

View File

@ -83,13 +83,27 @@ Class | Method | HTTP request | Description
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
{{#authMethods}}### {{name}}
{{#isApiKey}}- **Type**: API key
{{#isApiKey}}
- **Type**: API key
- **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication
{{#isBasic}}
{{#isHttpSignature}}
- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isBasicBasic}}
- **Type**: HTTP basic authentication
{{/isBasicBasic}}
{{#isBasicBearer}}
- **Type**: Bearer authentication
{{#bearerFormat}}
- **Bearer Format**: {{{.}}}
{{/bearerFormat}}
{{/isBasicBearer}}
{{/isBasic}}
{{#isOAuth}}- **Type**: OAuth
{{#isOAuth}}
- **Type**: OAuth
- **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}

View File

@ -321,7 +321,10 @@
header_params["Authorization"] <- paste("Basic", base64enc::base64encode(charToRaw(paste(self$api_client$username, self$api_client$password, sep = ":"))))
{{/isBasicBasic}}
{{#isBasicBearer}}
# Bearer token
if (!is.null(self$api_client$bearer_token)) {
header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ")
}
{{/isBasicBearer}}
{{/isBasic}}
{{#isApiKey}}
@ -339,7 +342,9 @@
{{/isApiKey}}
{{#isOAuth}}
# OAuth token
if (!is.null(self$api_client$access_token)) {
header_params["Authorization"] <- paste("Bearer", self$api_client$access_token, sep = " ")
}
{{/isOAuth}}
{{/authMethods}}

View File

@ -22,7 +22,7 @@ Method | HTTP request | Description
library({{{packageName}}})
{{#allParams}}
var_{{{paramName}}} <- {{{vendorExtensions.x-r-example}}} # {{{dataType}}} | {{{description}}}
var_{{{paramName}}} <- {{{vendorExtensions.x-r-example}}} # {{{dataType}}} | {{{description}}}{{^required}} (Optional){{/required}}
{{/allParams}}
{{#summary}}
@ -34,21 +34,21 @@ api_instance <- {{{classname}}}$new()
{{#isBasic}}
{{#isBasicBasic}}
# Configure HTTP basic authorization: {{{name}}}
api_instance$api_client$username <- 'TODO_YOUR_USERNAME';
api_instance$api_client$password <- 'TODO_YOUR_PASSWORD';
api_instance$api_client$username <- Sys.getenv("USERNAME")
api_instance$api_client$password <- Sys.getenv("PASSWORD")
{{/isBasicBasic}}
{{#isBasicBearer}}
# Configure HTTP bearer authorization: {{{name}}}
api.instance$api_client$bearer_token <- 'TODO_YOUR_BEARER_TOKEN';
api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
{{/isBasicBearer}}
{{/isBasic}}
{{#isApiKey}}
# Configure API key authorization: {{{name}}}
api_instance$api_client$api_keys['{{{keyParamName}}}'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["{{{keyParamName}}}"] <- Sys.getenv("API_KEY")
{{/isApiKey}}
{{#isOAuth}}
# Configure OAuth2 access token for authorization: {{{name}}}
api_instance$api_client$access_token <- 'TODO_YOUR_ACCESS_TOKEN';
api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
{{/isOAuth}}
{{/authMethods}}
{{/hasAuthMethods}}
@ -68,21 +68,22 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `{{{operationId}}}`:")
dput(result$ApiException$toString())
{{#errorObjectType}}
# error object
dput(result$ApiException$error_object)
{{/errorObjectType}}
} else {
{{#returnType}}
}{{#returnType}} else {
# deserialized response object
dput(result$content)
{{/returnType}}
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
{{/returnType}}
{{^returnType}}
# This endpoint doesn't return data
{{/returnType}}
{{/useRlangExceptionHandling}}
{{/returnExceptionOnFailure}}
{{^useRlangExceptionHandling}}

View File

@ -770,7 +770,9 @@ PetApi <- R6::R6Class(
}
# 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()
@ -869,7 +871,9 @@ PetApi <- R6::R6Class(
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 = " ")
}
# The Accept request HTTP header
local_var_accepts = list("application/xml", "application/json")
@ -981,7 +985,9 @@ PetApi <- R6::R6Class(
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 = " ")
}
# The Accept request HTTP header
local_var_accepts = list("application/xml", "application/json")
@ -1094,7 +1100,10 @@ PetApi <- R6::R6Class(
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
}
# Bearer token
if (!is.null(self$api_client$bearer_token)) {
header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ")
}
# The Accept request HTTP header
local_var_accepts = list("application/xml", "application/json")
@ -1462,7 +1471,9 @@ 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 = " ")
}
# The Accept request HTTP header
local_var_accepts = list("application/xml", "application/json")
@ -1580,7 +1591,9 @@ PetApi <- R6::R6Class(
}
# 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()
@ -1687,7 +1700,9 @@ PetApi <- R6::R6Class(
}
# 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("application/json")

View File

@ -114,7 +114,7 @@ Class | Method | HTTP request | Description
### BearerToken
- **Type**: HTTP basic authentication
- **Type**: Bearer authentication
### api_key

View File

@ -19,7 +19,7 @@ test data_file to ensure it's escaped correctly
library(petstore)
var_dummy <- "dummy_example" # character | dummy required parameter
var_var_data_file <- "var_data_file_example" # character | header data file
var_var_data_file <- "var_data_file_example" # character | header data file (Optional)
#test data_file to ensure it's escaped correctly
api_instance <- FakeApi$new()
@ -31,17 +31,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `fake_data_file`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters

View File

@ -32,8 +32,8 @@ var_pet <- Pet$new("name_example", list("photoUrls_example"), 123, Category$new(
#Add a new pet to the store
api_instance <- PetApi$new()
# Configure HTTP basic authorization: http_auth
api_instance$api_client$username <- 'TODO_YOUR_USERNAME';
api_instance$api_client$password <- 'TODO_YOUR_PASSWORD';
api_instance$api_client$username <- Sys.getenv("USERNAME")
api_instance$api_client$password <- Sys.getenv("PASSWORD")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$add_pet(var_pet, data_file = "result.txt"),
@ -42,17 +42,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `add_pet`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -92,27 +91,24 @@ Deletes a pet
library(petstore)
var_pet_id <- 56 # integer | Pet id to delete
var_api_key <- "api_key_example" # character |
var_api_key <- "api_key_example" # character | (Optional)
#Deletes a pet
api_instance <- PetApi$new()
# Configure OAuth2 access token for authorization: petstore_auth
api_instance$api_client$access_token <- 'TODO_YOUR_ACCESS_TOKEN';
api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
result <- tryCatch(
api_instance$delete_pet(var_pet_id, api_key = var_api_key),
ApiException = function(ex) ex
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `delete_pet`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters
@ -156,7 +152,7 @@ var_status <- list("available") # array[character] | Status values that need to
#Finds Pets by status
api_instance <- PetApi$new()
# Configure OAuth2 access token for authorization: petstore_auth
api_instance$api_client$access_token <- 'TODO_YOUR_ACCESS_TOKEN';
api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$find_pets_by_status(var_status, data_file = "result.txt"),
@ -165,17 +161,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `find_pets_by_status`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -219,7 +214,7 @@ var_tags <- list("inner_example") # array[character] | Tags to filter by
#Finds Pets by tags
api_instance <- PetApi$new()
# Configure OAuth2 access token for authorization: petstore_auth
api_instance$api_client$access_token <- 'TODO_YOUR_ACCESS_TOKEN';
api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$find_pets_by_tags(var_tags, data_file = "result.txt"),
@ -228,17 +223,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `find_pets_by_tags`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -282,7 +276,7 @@ var_pet_id <- 56 # integer | ID of pet to return
#Find pet by ID
api_instance <- PetApi$new()
# Configure HTTP bearer authorization: BearerToken
api.instance$api_client$bearer_token <- 'TODO_YOUR_BEARER_TOKEN';
api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$get_pet_by_id(var_pet_id, data_file = "result.txt"),
@ -291,17 +285,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `get_pet_by_id`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -346,7 +339,7 @@ var_pet_id <- 56 # integer | ID of pet to return
#Find pet by ID (streaming)
api_instance <- PetApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$get_pet_by_id_streaming(var_pet_id, data_file = "result.txt"),
@ -357,17 +350,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `get_pet_by_id_streaming`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -412,7 +404,7 @@ var_header_test_int <- 56 # integer | header test int
#Header test
api_instance <- PetApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$test_header(var_header_test_int, data_file = "result.txt"),
@ -423,17 +415,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `test_header`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -478,7 +469,7 @@ var_pet <- Pet$new("name_example", list("photoUrls_example"), 123, Category$new(
#Update an existing pet
api_instance <- PetApi$new()
# Configure OAuth2 access token for authorization: petstore_auth
api_instance$api_client$access_token <- 'TODO_YOUR_ACCESS_TOKEN';
api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$update_pet(var_pet, data_file = "result.txt"),
@ -487,17 +478,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `update_pet`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -539,28 +529,25 @@ Updates a pet in the store with form data
library(petstore)
var_pet_id <- 56 # integer | ID of pet that needs to be updated
var_name <- "name_example" # character | Updated name of the pet
var_status <- "status_example" # character | Updated status of the pet
var_name <- "name_example" # character | Updated name of the pet (Optional)
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 <- 'TODO_YOUR_ACCESS_TOKEN';
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
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `update_pet_with_form`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters
@ -601,13 +588,13 @@ uploads an image
library(petstore)
var_pet_id <- 56 # integer | ID of pet to update
var_additional_metadata <- "additional_metadata_example" # character | Additional data to pass to server
var_file <- File.new('/path/to/file') # data.frame | file to upload
var_additional_metadata <- "additional_metadata_example" # character | Additional data to pass to server (Optional)
var_file <- File.new('/path/to/file') # data.frame | file to upload (Optional)
#uploads an image
api_instance <- PetApi$new()
# Configure OAuth2 access token for authorization: petstore_auth
api_instance$api_client$access_token <- 'TODO_YOUR_ACCESS_TOKEN';
api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$upload_file(var_pet_id, additional_metadata = var_additional_metadata, file = var_file, data_file = "result.txt"),
@ -616,17 +603,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `upload_file`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters

View File

@ -31,15 +31,12 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `delete_order`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters
@ -82,7 +79,7 @@ library(petstore)
#Returns pet inventories by status
api_instance <- StoreApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$get_inventory(data_file = "result.txt"),
@ -91,17 +88,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `get_inventory`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -148,17 +144,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `get_order_by_id`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -210,17 +205,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `place_order`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters

View File

@ -30,22 +30,19 @@ var_user <- User$new(123, "username_example", "firstName_example", "lastName_exa
#Create user
api_instance <- UserApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
api_instance$create_user(var_user),
ApiException = function(ex) ex
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `create_user`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters
@ -88,22 +85,19 @@ var_user <- list(User$new(123, "username_example", "firstName_example", "lastNam
#Creates list of users with given input array
api_instance <- UserApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
api_instance$create_users_with_array_input(var_user),
ApiException = function(ex) ex
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `create_users_with_array_input`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters
@ -146,22 +140,19 @@ var_user <- list(User$new(123, "username_example", "firstName_example", "lastNam
#Creates list of users with given input array
api_instance <- UserApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
api_instance$create_users_with_list_input(var_user),
ApiException = function(ex) ex
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `create_users_with_list_input`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters
@ -204,22 +195,19 @@ var_username <- "username_example" # character | The name that needs to be delet
#Delete user
api_instance <- UserApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
api_instance$delete_user(var_username),
ApiException = function(ex) ex
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `delete_user`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters
@ -270,17 +258,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `get_user_by_name`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -333,17 +320,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `login_user`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -387,22 +373,19 @@ library(petstore)
#Logs out current logged in user session
api_instance <- UserApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
api_instance$logout_user(),
ApiException = function(ex) ex
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `logout_user`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters
@ -443,22 +426,19 @@ var_user <- User$new(123, "username_example", "firstName_example", "lastName_exa
#Updated user
api_instance <- UserApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
api_instance$update_user(var_username, var_user),
ApiException = function(ex) ex
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `update_user`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters

View File

@ -770,7 +770,9 @@ PetApi <- R6::R6Class(
}
# 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()
@ -869,7 +871,9 @@ PetApi <- R6::R6Class(
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 = " ")
}
# The Accept request HTTP header
local_var_accepts = list("application/xml", "application/json")
@ -981,7 +985,9 @@ PetApi <- R6::R6Class(
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 = " ")
}
# The Accept request HTTP header
local_var_accepts = list("application/xml", "application/json")
@ -1094,7 +1100,10 @@ PetApi <- R6::R6Class(
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
}
# Bearer token
if (!is.null(self$api_client$bearer_token)) {
header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ")
}
# The Accept request HTTP header
local_var_accepts = list("application/xml", "application/json")
@ -1462,7 +1471,9 @@ 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 = " ")
}
# The Accept request HTTP header
local_var_accepts = list("application/xml", "application/json")
@ -1580,7 +1591,9 @@ PetApi <- R6::R6Class(
}
# 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()
@ -1687,7 +1700,9 @@ PetApi <- R6::R6Class(
}
# 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("application/json")

View File

@ -114,7 +114,7 @@ Class | Method | HTTP request | Description
### BearerToken
- **Type**: HTTP basic authentication
- **Type**: Bearer authentication
### api_key

View File

@ -19,7 +19,7 @@ test data_file to ensure it's escaped correctly
library(petstore)
var_dummy <- "dummy_example" # character | dummy required parameter
var_var_data_file <- "var_data_file_example" # character | header data file
var_var_data_file <- "var_data_file_example" # character | header data file (Optional)
#test data_file to ensure it's escaped correctly
api_instance <- FakeApi$new()
@ -31,17 +31,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `FakeDataFile`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters

View File

@ -32,8 +32,8 @@ var_pet <- Pet$new("name_example", list("photoUrls_example"), 123, Category$new(
#Add a new pet to the store
api_instance <- PetApi$new()
# Configure HTTP basic authorization: http_auth
api_instance$api_client$username <- 'TODO_YOUR_USERNAME';
api_instance$api_client$password <- 'TODO_YOUR_PASSWORD';
api_instance$api_client$username <- Sys.getenv("USERNAME")
api_instance$api_client$password <- Sys.getenv("PASSWORD")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$AddPet(var_pet, data_file = "result.txt"),
@ -42,17 +42,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `AddPet`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -92,27 +91,24 @@ Deletes a pet
library(petstore)
var_pet_id <- 56 # integer | Pet id to delete
var_api_key <- "api_key_example" # character |
var_api_key <- "api_key_example" # character | (Optional)
#Deletes a pet
api_instance <- PetApi$new()
# Configure OAuth2 access token for authorization: petstore_auth
api_instance$api_client$access_token <- 'TODO_YOUR_ACCESS_TOKEN';
api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
result <- tryCatch(
api_instance$DeletePet(var_pet_id, api_key = var_api_key),
ApiException = function(ex) ex
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `DeletePet`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters
@ -156,7 +152,7 @@ var_status <- list("available") # array[character] | Status values that need to
#Finds Pets by status
api_instance <- PetApi$new()
# Configure OAuth2 access token for authorization: petstore_auth
api_instance$api_client$access_token <- 'TODO_YOUR_ACCESS_TOKEN';
api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$FindPetsByStatus(var_status, data_file = "result.txt"),
@ -165,17 +161,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `FindPetsByStatus`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -219,7 +214,7 @@ var_tags <- list("inner_example") # array[character] | Tags to filter by
#Finds Pets by tags
api_instance <- PetApi$new()
# Configure OAuth2 access token for authorization: petstore_auth
api_instance$api_client$access_token <- 'TODO_YOUR_ACCESS_TOKEN';
api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$FindPetsByTags(var_tags, data_file = "result.txt"),
@ -228,17 +223,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `FindPetsByTags`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -282,7 +276,7 @@ var_pet_id <- 56 # integer | ID of pet to return
#Find pet by ID
api_instance <- PetApi$new()
# Configure HTTP bearer authorization: BearerToken
api.instance$api_client$bearer_token <- 'TODO_YOUR_BEARER_TOKEN';
api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$GetPetById(var_pet_id, data_file = "result.txt"),
@ -291,17 +285,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `GetPetById`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -346,7 +339,7 @@ var_pet_id <- 56 # integer | ID of pet to return
#Find pet by ID (streaming)
api_instance <- PetApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$GetPetByIdStreaming(var_pet_id, data_file = "result.txt"),
@ -357,17 +350,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `GetPetByIdStreaming`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -412,7 +404,7 @@ var_header_test_int <- 56 # integer | header test int
#Header test
api_instance <- PetApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$TestHeader(var_header_test_int, data_file = "result.txt"),
@ -423,17 +415,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `TestHeader`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -478,7 +469,7 @@ var_pet <- Pet$new("name_example", list("photoUrls_example"), 123, Category$new(
#Update an existing pet
api_instance <- PetApi$new()
# Configure OAuth2 access token for authorization: petstore_auth
api_instance$api_client$access_token <- 'TODO_YOUR_ACCESS_TOKEN';
api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$UpdatePet(var_pet, data_file = "result.txt"),
@ -487,17 +478,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `UpdatePet`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -539,28 +529,25 @@ Updates a pet in the store with form data
library(petstore)
var_pet_id <- 56 # integer | ID of pet that needs to be updated
var_name <- "name_example" # character | Updated name of the pet
var_status <- "status_example" # character | Updated status of the pet
var_name <- "name_example" # character | Updated name of the pet (Optional)
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 <- 'TODO_YOUR_ACCESS_TOKEN';
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
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `UpdatePetWithForm`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters
@ -601,13 +588,13 @@ uploads an image
library(petstore)
var_pet_id <- 56 # integer | ID of pet to update
var_additional_metadata <- "additional_metadata_example" # character | Additional data to pass to server
var_file <- File.new('/path/to/file') # data.frame | file to upload
var_additional_metadata <- "additional_metadata_example" # character | Additional data to pass to server (Optional)
var_file <- File.new('/path/to/file') # data.frame | file to upload (Optional)
#uploads an image
api_instance <- PetApi$new()
# Configure OAuth2 access token for authorization: petstore_auth
api_instance$api_client$access_token <- 'TODO_YOUR_ACCESS_TOKEN';
api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$UploadFile(var_pet_id, additional_metadata = var_additional_metadata, file = var_file, data_file = "result.txt"),
@ -616,17 +603,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `UploadFile`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters

View File

@ -31,15 +31,12 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `DeleteOrder`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters
@ -82,7 +79,7 @@ library(petstore)
#Returns pet inventories by status
api_instance <- StoreApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# api_instance$GetInventory(data_file = "result.txt"),
@ -91,17 +88,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `GetInventory`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -148,17 +144,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `GetOrderById`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -210,17 +205,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `PlaceOrder`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters

View File

@ -30,22 +30,19 @@ var_user <- User$new(123, "username_example", "firstName_example", "lastName_exa
#Create user
api_instance <- UserApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
api_instance$CreateUser(var_user),
ApiException = function(ex) ex
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `CreateUser`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters
@ -88,22 +85,19 @@ var_user <- list(User$new(123, "username_example", "firstName_example", "lastNam
#Creates list of users with given input array
api_instance <- UserApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
api_instance$CreateUsersWithArrayInput(var_user),
ApiException = function(ex) ex
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `CreateUsersWithArrayInput`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters
@ -146,22 +140,19 @@ var_user <- list(User$new(123, "username_example", "firstName_example", "lastNam
#Creates list of users with given input array
api_instance <- UserApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
api_instance$CreateUsersWithListInput(var_user),
ApiException = function(ex) ex
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `CreateUsersWithListInput`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters
@ -204,22 +195,19 @@ var_username <- "username_example" # character | The name that needs to be delet
#Delete user
api_instance <- UserApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
api_instance$DeleteUser(var_username),
ApiException = function(ex) ex
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `DeleteUser`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters
@ -270,17 +258,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `GetUserByName`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -333,17 +320,16 @@ result <- tryCatch(
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `LoginUser`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# deserialized response object
dput(result$content)
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
print("The response is ...")
dput(result$toString())
}
```
### Parameters
@ -387,22 +373,19 @@ library(petstore)
#Logs out current logged in user session
api_instance <- UserApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
api_instance$LogoutUser(),
ApiException = function(ex) ex
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `LogoutUser`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters
@ -443,22 +426,19 @@ var_user <- User$new(123, "username_example", "firstName_example", "lastName_exa
#Updated user
api_instance <- UserApi$new()
# Configure API key authorization: api_key
api_instance$api_client$api_keys['api_key'] <- 'TODO_YOUR_API_KEY';
api_instance$api_client$api_keys["api_key"] <- Sys.getenv("API_KEY")
result <- tryCatch(
api_instance$UpdateUser(var_username, var_user),
ApiException = function(ex) ex
)
# In case of error, print the error object
if (!is.null(result$ApiException)) {
dput(result$ApiException)
print("Exception occurs when calling `UpdateUser`:")
dput(result$ApiException$toString())
# error object
dput(result$ApiException$error_object)
} else {
# response headers
dput(result$response$headers)
# response status code
dput(result$response$status_code)
}
# This endpoint doesn't return data
```
### Parameters