[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}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
{{#authMethods}}### {{name}} {{#authMethods}}### {{name}}
{{#isApiKey}}- **Type**: API key {{#isApiKey}}
- **Type**: API key
- **API key parameter name**: {{keyParamName}} - **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}} {{/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}} {{/isBasic}}
{{#isOAuth}}- **Type**: OAuth {{#isOAuth}}
- **Type**: OAuth
- **Flow**: {{flow}} - **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}} - **Authorization URL**: {{authorizationUrl}}
- **Scopes**: {{^scopes}}N/A{{/scopes}} - **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 = ":")))) header_params["Authorization"] <- paste("Basic", base64enc::base64encode(charToRaw(paste(self$api_client$username, self$api_client$password, sep = ":"))))
{{/isBasicBasic}} {{/isBasicBasic}}
{{#isBasicBearer}} {{#isBasicBearer}}
header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ") # Bearer token
if (!is.null(self$api_client$bearer_token)) {
header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ")
}
{{/isBasicBearer}} {{/isBasicBearer}}
{{/isBasic}} {{/isBasic}}
{{#isApiKey}} {{#isApiKey}}
@ -339,7 +342,9 @@
{{/isApiKey}} {{/isApiKey}}
{{#isOAuth}} {{#isOAuth}}
# OAuth token # OAuth token
header_params["Authorization"] <- paste("Bearer", self$api_client$access_token, sep = " ") if (!is.null(self$api_client$access_token)) {
header_params["Authorization"] <- paste("Bearer", self$api_client$access_token, sep = " ")
}
{{/isOAuth}} {{/isOAuth}}
{{/authMethods}} {{/authMethods}}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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