diff --git a/modules/openapi-generator/src/main/resources/r/README.mustache b/modules/openapi-generator/src/main/resources/r/README.mustache index 1da3dffd0cd37cc70e5e05b21f89874470e3d95e..40b284a54ccbe132876b28fcd419748e7041e346 100644 --- a/modules/openapi-generator/src/main/resources/r/README.mustache +++ b/modules/openapi-generator/src/main/resources/r/README.mustache @@ -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}} diff --git a/modules/openapi-generator/src/main/resources/r/api.mustache b/modules/openapi-generator/src/main/resources/r/api.mustache index 55b6a70106682b36796e3aa78ebdf259b0916e33..2d1bf6affd1231c1a59174babb38a2352acfec60 100644 --- a/modules/openapi-generator/src/main/resources/r/api.mustache +++ b/modules/openapi-generator/src/main/resources/r/api.mustache @@ -321,7 +321,10 @@ header_params["Authorization"] <- paste("Basic", base64enc::base64encode(charToRaw(paste(self$api_client$username, self$api_client$password, sep = ":")))) {{/isBasicBasic}} {{#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}} {{/isBasic}} {{#isApiKey}} @@ -339,7 +342,9 @@ {{/isApiKey}} {{#isOAuth}} # 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}} {{/authMethods}} diff --git a/modules/openapi-generator/src/main/resources/r/api_doc.mustache b/modules/openapi-generator/src/main/resources/r/api_doc.mustache index a96041721150bb9479481544174586d89c0907ea..16379784be85a957c7d8fda59912cb340ed0da24 100644 --- a/modules/openapi-generator/src/main/resources/r/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/r/api_doc.mustache @@ -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}} diff --git a/samples/client/petstore/R-httr2/R/pet_api.R b/samples/client/petstore/R-httr2/R/pet_api.R index a5653aa8001a6432b6ed950fbbced468cc38a0fe..6b2bd6fe54275beeea0d3d19dd3c5f32f5d0b5ee 100644 --- a/samples/client/petstore/R-httr2/R/pet_api.R +++ b/samples/client/petstore/R-httr2/R/pet_api.R @@ -770,7 +770,9 @@ PetApi <- R6::R6Class( } # 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 local_var_accepts = list() @@ -869,7 +871,9 @@ PetApi <- R6::R6Class( local_var_url_path <- "/pet/findByStatus" # 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 local_var_accepts = list("application/xml", "application/json") @@ -981,7 +985,9 @@ PetApi <- R6::R6Class( local_var_url_path <- "/pet/findByTags" # 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 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) } - 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 local_var_accepts = list("application/xml", "application/json") @@ -1462,7 +1471,9 @@ PetApi <- R6::R6Class( local_var_url_path <- "/pet" # 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 local_var_accepts = list("application/xml", "application/json") @@ -1580,7 +1591,9 @@ PetApi <- R6::R6Class( } # 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 local_var_accepts = list() @@ -1687,7 +1700,9 @@ PetApi <- R6::R6Class( } # 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 local_var_accepts = list("application/json") diff --git a/samples/client/petstore/R-httr2/README.md b/samples/client/petstore/R-httr2/README.md index 94e6f1a2cd7a24e7a7ebb48408384b46a071c9fc..8c9b2a188f412cbdacace86dc938a96bf582d062 100644 --- a/samples/client/petstore/R-httr2/README.md +++ b/samples/client/petstore/R-httr2/README.md @@ -114,7 +114,7 @@ Class | Method | HTTP request | Description ### BearerToken -- **Type**: HTTP basic authentication +- **Type**: Bearer authentication ### api_key diff --git a/samples/client/petstore/R-httr2/docs/FakeApi.md b/samples/client/petstore/R-httr2/docs/FakeApi.md index cdd8f8d38e7017942473b8996dd9385f5c32e8eb..2d1643663193292dc346921b87f7c63a50a1b1dd 100644 --- a/samples/client/petstore/R-httr2/docs/FakeApi.md +++ b/samples/client/petstore/R-httr2/docs/FakeApi.md @@ -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 diff --git a/samples/client/petstore/R-httr2/docs/PetApi.md b/samples/client/petstore/R-httr2/docs/PetApi.md index 1bbb4f200cd95190f9fb2aa9ad0a5b0797ce177b..2498a03ae7a56a6cf280be74a5506406096329dc 100644 --- a/samples/client/petstore/R-httr2/docs/PetApi.md +++ b/samples/client/petstore/R-httr2/docs/PetApi.md @@ -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 diff --git a/samples/client/petstore/R-httr2/docs/StoreApi.md b/samples/client/petstore/R-httr2/docs/StoreApi.md index be64f9ba72bac8ecac7677e3147c1eac1ff98886..d393fbe337027076b9a7a335a17a85ebb32ed5af 100644 --- a/samples/client/petstore/R-httr2/docs/StoreApi.md +++ b/samples/client/petstore/R-httr2/docs/StoreApi.md @@ -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 diff --git a/samples/client/petstore/R-httr2/docs/UserApi.md b/samples/client/petstore/R-httr2/docs/UserApi.md index 55b9970fab54d625a04ea3a0ea33a2cf6aac36ce..369d723f5141cc67bae2e48f098806d5d1baae6f 100644 --- a/samples/client/petstore/R-httr2/docs/UserApi.md +++ b/samples/client/petstore/R-httr2/docs/UserApi.md @@ -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 diff --git a/samples/client/petstore/R/R/pet_api.R b/samples/client/petstore/R/R/pet_api.R index cd03160159b5dfb4cde1598c32052de10d507553..ecb93b4fe679a4aa17652c1d863956935b61bc3e 100644 --- a/samples/client/petstore/R/R/pet_api.R +++ b/samples/client/petstore/R/R/pet_api.R @@ -770,7 +770,9 @@ PetApi <- R6::R6Class( } # 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 local_var_accepts = list() @@ -869,7 +871,9 @@ PetApi <- R6::R6Class( local_var_url_path <- "/pet/findByStatus" # 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 local_var_accepts = list("application/xml", "application/json") @@ -981,7 +985,9 @@ PetApi <- R6::R6Class( local_var_url_path <- "/pet/findByTags" # 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 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) } - 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 local_var_accepts = list("application/xml", "application/json") @@ -1462,7 +1471,9 @@ PetApi <- R6::R6Class( local_var_url_path <- "/pet" # 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 local_var_accepts = list("application/xml", "application/json") @@ -1580,7 +1591,9 @@ PetApi <- R6::R6Class( } # 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 local_var_accepts = list() @@ -1687,7 +1700,9 @@ PetApi <- R6::R6Class( } # 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 local_var_accepts = list("application/json") diff --git a/samples/client/petstore/R/README.md b/samples/client/petstore/R/README.md index ced7db355d69aea90cbb53b8b330a5c5e8345572..6dbc7c274169d6ec7645c14ea044f59bac2a5810 100644 --- a/samples/client/petstore/R/README.md +++ b/samples/client/petstore/R/README.md @@ -114,7 +114,7 @@ Class | Method | HTTP request | Description ### BearerToken -- **Type**: HTTP basic authentication +- **Type**: Bearer authentication ### api_key diff --git a/samples/client/petstore/R/docs/FakeApi.md b/samples/client/petstore/R/docs/FakeApi.md index 558584fe6970f6db3389987005bdc958017a7a7e..22ab9383e7ddc05385e58985243b2ac1af631ca5 100644 --- a/samples/client/petstore/R/docs/FakeApi.md +++ b/samples/client/petstore/R/docs/FakeApi.md @@ -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 diff --git a/samples/client/petstore/R/docs/PetApi.md b/samples/client/petstore/R/docs/PetApi.md index daf84841e7bd450af4359e767526920adb4f7adf..4c6bae4a7e51177a208968b6e9ef779ea2fe7a0e 100644 --- a/samples/client/petstore/R/docs/PetApi.md +++ b/samples/client/petstore/R/docs/PetApi.md @@ -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 diff --git a/samples/client/petstore/R/docs/StoreApi.md b/samples/client/petstore/R/docs/StoreApi.md index b79108126815d89c0ae7a5d91d5111c3434cdad7..35a21aec9d8a6bf4eaf7b4c12d2871054616ed2b 100644 --- a/samples/client/petstore/R/docs/StoreApi.md +++ b/samples/client/petstore/R/docs/StoreApi.md @@ -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 diff --git a/samples/client/petstore/R/docs/UserApi.md b/samples/client/petstore/R/docs/UserApi.md index a9d8a646d90d25746b0b7ae7f280476e70a4a25d..767c36cb69a1339294ff3f361f7d394b260bf511 100644 --- a/samples/client/petstore/R/docs/UserApi.md +++ b/samples/client/petstore/R/docs/UserApi.md @@ -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