forked from loafle/openapi-generator-original
[R] Add array support to path parameters (#13450)
* add array support to path parameters (r client) * update samples
This commit is contained in:
parent
d48209e297
commit
517816d72b
@ -542,7 +542,14 @@
|
|||||||
{{#hasPathParams}}
|
{{#hasPathParams}}
|
||||||
{{#pathParams}}
|
{{#pathParams}}
|
||||||
if (!missing(`{{paramName}}`)) {
|
if (!missing(`{{paramName}}`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "{{baseName}}", "\\}"), URLencode(as.character(`{{paramName}}`), reserved = TRUE), local_var_url_path)
|
{{=< >=}}
|
||||||
|
<#isArray>
|
||||||
|
local_var_url_path <- gsub("\\{<baseName>\\}", paste(URLencode(as.character(`<paramName>`), reserved = TRUE), collapse= ",", sep=""), local_var_url_path)
|
||||||
|
</isArray>
|
||||||
|
<^isArray>
|
||||||
|
local_var_url_path <- gsub("\\{<baseName>\\}", URLencode(as.character(`<paramName>`), reserved = TRUE), local_var_url_path)
|
||||||
|
</isArray>
|
||||||
|
<={{ }}=>
|
||||||
}
|
}
|
||||||
|
|
||||||
{{/pathParams}}
|
{{/pathParams}}
|
||||||
|
@ -629,6 +629,25 @@ paths:
|
|||||||
description: User not found
|
description: User not found
|
||||||
security:
|
security:
|
||||||
- api_key: []
|
- api_key: []
|
||||||
|
/fake/path_array/{path_array}/testing:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- fake
|
||||||
|
summary: test array parameter in path
|
||||||
|
description: ''
|
||||||
|
operationId: fake_path_array
|
||||||
|
parameters:
|
||||||
|
- name: path_array
|
||||||
|
in: path
|
||||||
|
description: dummy path parameter
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successful operation
|
||||||
/fake/regular_expression:
|
/fake/regular_expression:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
@ -32,6 +32,23 @@
|
|||||||
#' }
|
#' }
|
||||||
#' }
|
#' }
|
||||||
#'
|
#'
|
||||||
|
#' \strong{ fake_path_array } \emph{ test array parameter in path }
|
||||||
|
#'
|
||||||
|
#'
|
||||||
|
#' \itemize{
|
||||||
|
#' \item \emph{ @param } path_array list( character )
|
||||||
|
#'
|
||||||
|
#' \item On encountering errors, an error of subclass ApiException will be thrown.
|
||||||
|
#'
|
||||||
|
#' \item status code : 200 | successful operation
|
||||||
|
#'
|
||||||
|
#'
|
||||||
|
#' \item response headers :
|
||||||
|
#'
|
||||||
|
#' \tabular{ll}{
|
||||||
|
#' }
|
||||||
|
#' }
|
||||||
|
#'
|
||||||
#' \strong{ fake_regular_expression } \emph{ test regular expression to ensure no exception }
|
#' \strong{ fake_regular_expression } \emph{ test regular expression to ensure no exception }
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
@ -106,6 +123,31 @@
|
|||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
|
#' #################### fake_path_array ####################
|
||||||
|
#'
|
||||||
|
#' library(petstore)
|
||||||
|
#' var_path_array <- ["path_array_example"] # array[character] | dummy path parameter
|
||||||
|
#'
|
||||||
|
#' #test array parameter in path
|
||||||
|
#' api_instance <- petstore_api$new()
|
||||||
|
#'
|
||||||
|
#' result <- tryCatch(
|
||||||
|
#'
|
||||||
|
#' api_instance$fake_api$fake_path_array(var_path_array),
|
||||||
|
#' ApiException = function(ex) ex
|
||||||
|
#' )
|
||||||
|
#' # In case of error, print the error object
|
||||||
|
#' if (!is.null(result$ApiException)) {
|
||||||
|
#' print("Exception occurs when calling `fake_path_array`:")
|
||||||
|
#' dput(result$ApiException$toString())
|
||||||
|
#'
|
||||||
|
#' # error object
|
||||||
|
#' dput(result$ApiException$error_object$toJSONString())
|
||||||
|
#'
|
||||||
|
#' }#'
|
||||||
|
#' # This endpoint doesn't return data
|
||||||
|
#'
|
||||||
|
#'
|
||||||
#' #################### fake_regular_expression ####################
|
#' #################### fake_regular_expression ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
@ -300,6 +342,108 @@ FakeApi <- R6::R6Class(
|
|||||||
ApiException = ApiException$new(http_response = local_var_resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
#' test array parameter in path
|
||||||
|
#'
|
||||||
|
#' @description
|
||||||
|
#' test array parameter in path
|
||||||
|
#'
|
||||||
|
#' @param path_array dummy path parameter
|
||||||
|
#' @param ... Other optional arguments
|
||||||
|
#' @return void
|
||||||
|
#' @export
|
||||||
|
fake_path_array = function(path_array, ...) {
|
||||||
|
local_var_response <- self$fake_path_array_with_http_info(path_array, ...)
|
||||||
|
if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) {
|
||||||
|
local_var_response$content
|
||||||
|
} else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) {
|
||||||
|
local_var_response
|
||||||
|
} else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) {
|
||||||
|
local_var_response
|
||||||
|
} else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) {
|
||||||
|
local_var_response
|
||||||
|
}
|
||||||
|
},
|
||||||
|
#' test array parameter in path
|
||||||
|
#'
|
||||||
|
#' @description
|
||||||
|
#' test array parameter in path
|
||||||
|
#'
|
||||||
|
#' @param path_array dummy path parameter
|
||||||
|
#' @param ... Other optional arguments
|
||||||
|
#' @return API response (void) with additional information such as HTTP status code, headers
|
||||||
|
#' @export
|
||||||
|
fake_path_array_with_http_info = function(path_array, ...) {
|
||||||
|
args <- list(...)
|
||||||
|
query_params <- list()
|
||||||
|
header_params <- c()
|
||||||
|
form_params <- list()
|
||||||
|
file_params <- list()
|
||||||
|
local_var_body <- NULL
|
||||||
|
oauth_scopes <- NULL
|
||||||
|
is_oauth <- FALSE
|
||||||
|
|
||||||
|
if (missing(`path_array`)) {
|
||||||
|
rlang::abort(message = "Missing required parameter `path_array`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `path_array`."))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
local_var_url_path <- "/fake/path_array/{path_array}/testing"
|
||||||
|
if (!missing(`path_array`)) {
|
||||||
|
local_var_url_path <- gsub("\\{path_array\\}", paste(URLencode(as.character(`path_array`), reserved = TRUE), collapse= ",", sep=""), local_var_url_path)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# The Accept request HTTP header
|
||||||
|
local_var_accepts <- list()
|
||||||
|
|
||||||
|
# The Content-Type representation header
|
||||||
|
local_var_content_types <- list()
|
||||||
|
|
||||||
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
|
method = "GET",
|
||||||
|
query_params = query_params,
|
||||||
|
header_params = header_params,
|
||||||
|
form_params = form_params,
|
||||||
|
file_params = file_params,
|
||||||
|
accepts = local_var_accepts,
|
||||||
|
content_types = local_var_content_types,
|
||||||
|
body = local_var_body,
|
||||||
|
is_oauth = is_oauth,
|
||||||
|
oauth_scopes = oauth_scopes,
|
||||||
|
...)
|
||||||
|
|
||||||
|
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||||
|
local_var_resp$content <- NULL
|
||||||
|
local_var_resp
|
||||||
|
} else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
|
||||||
|
local_var_error_msg <- local_var_resp$response
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- paste("Server returned ", local_var_resp$status_code, " response status code.")
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
|
||||||
|
local_var_error_msg <- local_var_resp$response
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
|
||||||
|
local_var_error_msg <- local_var_resp$response
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
}
|
||||||
|
},
|
||||||
#' test regular expression to ensure no exception
|
#' test regular expression to ensure no exception
|
||||||
#'
|
#'
|
||||||
#' @description
|
#' @description
|
||||||
|
@ -836,7 +836,7 @@ PetApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/pet/{petId}"
|
local_var_url_path <- "/pet/{petId}"
|
||||||
if (!missing(`pet_id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{petId\\}", URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# OAuth-related settings
|
# OAuth-related settings
|
||||||
@ -1187,7 +1187,7 @@ PetApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/pet/{petId}"
|
local_var_url_path <- "/pet/{petId}"
|
||||||
if (!missing(`pet_id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{petId\\}", URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Bearer token
|
# Bearer token
|
||||||
@ -1314,7 +1314,7 @@ PetApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/pet/{petId}?streaming"
|
local_var_url_path <- "/pet/{petId}?streaming"
|
||||||
if (!missing(`pet_id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{petId\\}", URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# API key authentication
|
# API key authentication
|
||||||
@ -1698,7 +1698,7 @@ PetApi <- R6::R6Class(
|
|||||||
form_params["status"] <- `status`
|
form_params["status"] <- `status`
|
||||||
local_var_url_path <- "/pet/{petId}"
|
local_var_url_path <- "/pet/{petId}"
|
||||||
if (!missing(`pet_id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{petId\\}", URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1810,7 +1810,7 @@ PetApi <- R6::R6Class(
|
|||||||
file_params["file"] <- curl::form_file(`file`)
|
file_params["file"] <- curl::form_file(`file`)
|
||||||
local_var_url_path <- "/pet/{petId}/uploadImage"
|
local_var_url_path <- "/pet/{petId}/uploadImage"
|
||||||
if (!missing(`pet_id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{petId\\}", URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# OAuth-related settings
|
# OAuth-related settings
|
||||||
|
@ -314,7 +314,7 @@ StoreApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/store/order/{orderId}"
|
local_var_url_path <- "/store/order/{orderId}"
|
||||||
if (!missing(`order_id`)) {
|
if (!missing(`order_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "orderId", "\\}"), URLencode(as.character(`order_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{orderId\\}", URLencode(as.character(`order_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -537,7 +537,7 @@ StoreApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/store/order/{orderId}"
|
local_var_url_path <- "/store/order/{orderId}"
|
||||||
if (!missing(`order_id`)) {
|
if (!missing(`order_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "orderId", "\\}"), URLencode(as.character(`order_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{orderId\\}", URLencode(as.character(`order_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -832,7 +832,7 @@ UserApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/user/{username}"
|
local_var_url_path <- "/user/{username}"
|
||||||
if (!missing(`username`)) {
|
if (!missing(`username`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{username\\}", URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# API key authentication
|
# API key authentication
|
||||||
@ -940,7 +940,7 @@ UserApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/user/{username}"
|
local_var_url_path <- "/user/{username}"
|
||||||
if (!missing(`username`)) {
|
if (!missing(`username`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{username\\}", URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1296,7 +1296,7 @@ UserApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/user/{username}"
|
local_var_url_path <- "/user/{username}"
|
||||||
if (!missing(`username`)) {
|
if (!missing(`username`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{username\\}", URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# API key authentication
|
# API key authentication
|
||||||
|
@ -62,6 +62,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
|||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
*FakeApi* | [**fake_data_file**](docs/FakeApi.md#fake_data_file) | **GET** /fake/data_file | test data_file to ensure it's escaped correctly
|
*FakeApi* | [**fake_data_file**](docs/FakeApi.md#fake_data_file) | **GET** /fake/data_file | test data_file to ensure it's escaped correctly
|
||||||
|
*FakeApi* | [**fake_path_array**](docs/FakeApi.md#fake_path_array) | **GET** /fake/path_array/{path_array}/testing | test array parameter in path
|
||||||
*FakeApi* | [**fake_regular_expression**](docs/FakeApi.md#fake_regular_expression) | **GET** /fake/regular_expression | test regular expression to ensure no exception
|
*FakeApi* | [**fake_regular_expression**](docs/FakeApi.md#fake_regular_expression) | **GET** /fake/regular_expression | test regular expression to ensure no exception
|
||||||
*FakeApi* | [**fake_set_query**](docs/FakeApi.md#fake_set_query) | **GET** /fake/set_query_parameter | test set query parameter
|
*FakeApi* | [**fake_set_query**](docs/FakeApi.md#fake_set_query) | **GET** /fake/set_query_parameter | test set query parameter
|
||||||
*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
||||||
|
@ -5,6 +5,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
|||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
[**fake_data_file**](FakeApi.md#fake_data_file) | **GET** /fake/data_file | test data_file to ensure it's escaped correctly
|
[**fake_data_file**](FakeApi.md#fake_data_file) | **GET** /fake/data_file | test data_file to ensure it's escaped correctly
|
||||||
|
[**fake_path_array**](FakeApi.md#fake_path_array) | **GET** /fake/path_array/{path_array}/testing | test array parameter in path
|
||||||
[**fake_regular_expression**](FakeApi.md#fake_regular_expression) | **GET** /fake/regular_expression | test regular expression to ensure no exception
|
[**fake_regular_expression**](FakeApi.md#fake_regular_expression) | **GET** /fake/regular_expression | test regular expression to ensure no exception
|
||||||
[**fake_set_query**](FakeApi.md#fake_set_query) | **GET** /fake/set_query_parameter | test set query parameter
|
[**fake_set_query**](FakeApi.md#fake_set_query) | **GET** /fake/set_query_parameter | test set query parameter
|
||||||
|
|
||||||
@ -72,6 +73,61 @@ No authorization required
|
|||||||
|-------------|-------------|------------------|
|
|-------------|-------------|------------------|
|
||||||
| **200** | successful operation | - |
|
| **200** | successful operation | - |
|
||||||
|
|
||||||
|
# **fake_path_array**
|
||||||
|
> fake_path_array(path_array)
|
||||||
|
|
||||||
|
test array parameter in path
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```R
|
||||||
|
library(petstore)
|
||||||
|
|
||||||
|
# test array parameter in path
|
||||||
|
#
|
||||||
|
# prepare function argument(s)
|
||||||
|
var_path_array <- list("inner_example") # array[character] | dummy path parameter
|
||||||
|
|
||||||
|
api_instance <- petstore_api$new()
|
||||||
|
result <- tryCatch(
|
||||||
|
api_instance$fake_api$fake_path_array(var_path_array),
|
||||||
|
ApiException = function(ex) ex
|
||||||
|
)
|
||||||
|
# In case of error, print the error object
|
||||||
|
if (!is.null(result$ApiException)) {
|
||||||
|
print("Exception occurs when calling `fake_path_array`:")
|
||||||
|
dput(result$ApiException$toString())
|
||||||
|
# error object
|
||||||
|
dput(result$ApiException$error_object$toJSONString())
|
||||||
|
}
|
||||||
|
# This endpoint doesn't return data
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**path_array** | list( **character** )| dummy path parameter |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
void (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
|
||||||
# **fake_regular_expression**
|
# **fake_regular_expression**
|
||||||
> fake_regular_expression(reg_exp_test)
|
> fake_regular_expression(reg_exp_test)
|
||||||
|
|
||||||
|
@ -234,6 +234,14 @@ test_that("GetPetById with data_file", {
|
|||||||
expect_equal(response$name, "name_test")
|
expect_equal(response$name, "name_test")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test_that("array test in path parameters", {
|
||||||
|
fake_api <- FakeApi$new()
|
||||||
|
# array input for path parameter
|
||||||
|
#array_dummy <- list(1, 2, 2, 3)
|
||||||
|
array_dummy <- list("hello world", "1&2")
|
||||||
|
expect_error(fake_api$fake_path_array(array_dummy), "")
|
||||||
|
})
|
||||||
|
|
||||||
test_that("set validation test", {
|
test_that("set validation test", {
|
||||||
fake_api <- FakeApi$new()
|
fake_api <- FakeApi$new()
|
||||||
# array input invalid (not unique)
|
# array input invalid (not unique)
|
||||||
|
@ -32,6 +32,23 @@
|
|||||||
#' }
|
#' }
|
||||||
#' }
|
#' }
|
||||||
#'
|
#'
|
||||||
|
#' \strong{ fake_path_array } \emph{ test array parameter in path }
|
||||||
|
#'
|
||||||
|
#'
|
||||||
|
#' \itemize{
|
||||||
|
#' \item \emph{ @param } path_array list( character )
|
||||||
|
#'
|
||||||
|
#' \item On encountering errors, an error of subclass ApiException will be thrown.
|
||||||
|
#'
|
||||||
|
#' \item status code : 200 | successful operation
|
||||||
|
#'
|
||||||
|
#'
|
||||||
|
#' \item response headers :
|
||||||
|
#'
|
||||||
|
#' \tabular{ll}{
|
||||||
|
#' }
|
||||||
|
#' }
|
||||||
|
#'
|
||||||
#' \strong{ fake_regular_expression } \emph{ test regular expression to ensure no exception }
|
#' \strong{ fake_regular_expression } \emph{ test regular expression to ensure no exception }
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
@ -106,6 +123,31 @@
|
|||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
|
#' #################### fake_path_array ####################
|
||||||
|
#'
|
||||||
|
#' library(petstore)
|
||||||
|
#' var_path_array <- ["path_array_example"] # array[character] | dummy path parameter
|
||||||
|
#'
|
||||||
|
#' #test array parameter in path
|
||||||
|
#' api_instance <- FakeApi$new()
|
||||||
|
#'
|
||||||
|
#' result <- tryCatch(
|
||||||
|
#'
|
||||||
|
#' api_instance$fake_path_array(var_path_array),
|
||||||
|
#' ApiException = function(ex) ex
|
||||||
|
#' )
|
||||||
|
#' # In case of error, print the error object
|
||||||
|
#' if (!is.null(result$ApiException)) {
|
||||||
|
#' print("Exception occurs when calling `fake_path_array`:")
|
||||||
|
#' dput(result$ApiException$toString())
|
||||||
|
#'
|
||||||
|
#' # error object
|
||||||
|
#' dput(result$ApiException$error_object$toJSONString())
|
||||||
|
#'
|
||||||
|
#' }#'
|
||||||
|
#' # This endpoint doesn't return data
|
||||||
|
#'
|
||||||
|
#'
|
||||||
#' #################### fake_regular_expression ####################
|
#' #################### fake_regular_expression ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
@ -300,6 +342,108 @@ FakeApi <- R6::R6Class(
|
|||||||
ApiException = ApiException$new(http_response = local_var_resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
#' test array parameter in path
|
||||||
|
#'
|
||||||
|
#' @description
|
||||||
|
#' test array parameter in path
|
||||||
|
#'
|
||||||
|
#' @param path_array dummy path parameter
|
||||||
|
#' @param ... Other optional arguments
|
||||||
|
#' @return void
|
||||||
|
#' @export
|
||||||
|
fake_path_array = function(path_array, ...) {
|
||||||
|
local_var_response <- self$fake_path_array_with_http_info(path_array, ...)
|
||||||
|
if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) {
|
||||||
|
local_var_response$content
|
||||||
|
} else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) {
|
||||||
|
local_var_response
|
||||||
|
} else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) {
|
||||||
|
local_var_response
|
||||||
|
} else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) {
|
||||||
|
local_var_response
|
||||||
|
}
|
||||||
|
},
|
||||||
|
#' test array parameter in path
|
||||||
|
#'
|
||||||
|
#' @description
|
||||||
|
#' test array parameter in path
|
||||||
|
#'
|
||||||
|
#' @param path_array dummy path parameter
|
||||||
|
#' @param ... Other optional arguments
|
||||||
|
#' @return API response (void) with additional information such as HTTP status code, headers
|
||||||
|
#' @export
|
||||||
|
fake_path_array_with_http_info = function(path_array, ...) {
|
||||||
|
args <- list(...)
|
||||||
|
query_params <- list()
|
||||||
|
header_params <- c()
|
||||||
|
form_params <- list()
|
||||||
|
file_params <- list()
|
||||||
|
local_var_body <- NULL
|
||||||
|
oauth_scopes <- NULL
|
||||||
|
is_oauth <- FALSE
|
||||||
|
|
||||||
|
if (missing(`path_array`)) {
|
||||||
|
rlang::abort(message = "Missing required parameter `path_array`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `path_array`."))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
local_var_url_path <- "/fake/path_array/{path_array}/testing"
|
||||||
|
if (!missing(`path_array`)) {
|
||||||
|
local_var_url_path <- gsub("\\{path_array\\}", paste(URLencode(as.character(`path_array`), reserved = TRUE), collapse= ",", sep=""), local_var_url_path)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# The Accept request HTTP header
|
||||||
|
local_var_accepts <- list()
|
||||||
|
|
||||||
|
# The Content-Type representation header
|
||||||
|
local_var_content_types <- list()
|
||||||
|
|
||||||
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
|
method = "GET",
|
||||||
|
query_params = query_params,
|
||||||
|
header_params = header_params,
|
||||||
|
form_params = form_params,
|
||||||
|
file_params = file_params,
|
||||||
|
accepts = local_var_accepts,
|
||||||
|
content_types = local_var_content_types,
|
||||||
|
body = local_var_body,
|
||||||
|
is_oauth = is_oauth,
|
||||||
|
oauth_scopes = oauth_scopes,
|
||||||
|
...)
|
||||||
|
|
||||||
|
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||||
|
local_var_resp$content <- NULL
|
||||||
|
local_var_resp
|
||||||
|
} else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
|
||||||
|
local_var_error_msg <- local_var_resp$response
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- paste("Server returned ", local_var_resp$status_code, " response status code.")
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
|
||||||
|
local_var_error_msg <- local_var_resp$response
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
|
||||||
|
local_var_error_msg <- local_var_resp$response
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
}
|
||||||
|
},
|
||||||
#' test regular expression to ensure no exception
|
#' test regular expression to ensure no exception
|
||||||
#'
|
#'
|
||||||
#' @description
|
#' @description
|
||||||
|
@ -836,7 +836,7 @@ PetApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/pet/{petId}"
|
local_var_url_path <- "/pet/{petId}"
|
||||||
if (!missing(`pet_id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{petId\\}", URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# OAuth-related settings
|
# OAuth-related settings
|
||||||
@ -1187,7 +1187,7 @@ PetApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/pet/{petId}"
|
local_var_url_path <- "/pet/{petId}"
|
||||||
if (!missing(`pet_id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{petId\\}", URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Bearer token
|
# Bearer token
|
||||||
@ -1314,7 +1314,7 @@ PetApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/pet/{petId}?streaming"
|
local_var_url_path <- "/pet/{petId}?streaming"
|
||||||
if (!missing(`pet_id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{petId\\}", URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# API key authentication
|
# API key authentication
|
||||||
@ -1698,7 +1698,7 @@ PetApi <- R6::R6Class(
|
|||||||
form_params["status"] <- `status`
|
form_params["status"] <- `status`
|
||||||
local_var_url_path <- "/pet/{petId}"
|
local_var_url_path <- "/pet/{petId}"
|
||||||
if (!missing(`pet_id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{petId\\}", URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1810,7 +1810,7 @@ PetApi <- R6::R6Class(
|
|||||||
file_params["file"] <- curl::form_file(`file`)
|
file_params["file"] <- curl::form_file(`file`)
|
||||||
local_var_url_path <- "/pet/{petId}/uploadImage"
|
local_var_url_path <- "/pet/{petId}/uploadImage"
|
||||||
if (!missing(`pet_id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{petId\\}", URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# OAuth-related settings
|
# OAuth-related settings
|
||||||
|
@ -314,7 +314,7 @@ StoreApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/store/order/{orderId}"
|
local_var_url_path <- "/store/order/{orderId}"
|
||||||
if (!missing(`order_id`)) {
|
if (!missing(`order_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "orderId", "\\}"), URLencode(as.character(`order_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{orderId\\}", URLencode(as.character(`order_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -537,7 +537,7 @@ StoreApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/store/order/{orderId}"
|
local_var_url_path <- "/store/order/{orderId}"
|
||||||
if (!missing(`order_id`)) {
|
if (!missing(`order_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "orderId", "\\}"), URLencode(as.character(`order_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{orderId\\}", URLencode(as.character(`order_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -832,7 +832,7 @@ UserApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/user/{username}"
|
local_var_url_path <- "/user/{username}"
|
||||||
if (!missing(`username`)) {
|
if (!missing(`username`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{username\\}", URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# API key authentication
|
# API key authentication
|
||||||
@ -940,7 +940,7 @@ UserApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/user/{username}"
|
local_var_url_path <- "/user/{username}"
|
||||||
if (!missing(`username`)) {
|
if (!missing(`username`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{username\\}", URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1296,7 +1296,7 @@ UserApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/user/{username}"
|
local_var_url_path <- "/user/{username}"
|
||||||
if (!missing(`username`)) {
|
if (!missing(`username`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{username\\}", URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# API key authentication
|
# API key authentication
|
||||||
|
@ -62,6 +62,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
|||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
*FakeApi* | [**fake_data_file**](docs/FakeApi.md#fake_data_file) | **GET** /fake/data_file | test data_file to ensure it's escaped correctly
|
*FakeApi* | [**fake_data_file**](docs/FakeApi.md#fake_data_file) | **GET** /fake/data_file | test data_file to ensure it's escaped correctly
|
||||||
|
*FakeApi* | [**fake_path_array**](docs/FakeApi.md#fake_path_array) | **GET** /fake/path_array/{path_array}/testing | test array parameter in path
|
||||||
*FakeApi* | [**fake_regular_expression**](docs/FakeApi.md#fake_regular_expression) | **GET** /fake/regular_expression | test regular expression to ensure no exception
|
*FakeApi* | [**fake_regular_expression**](docs/FakeApi.md#fake_regular_expression) | **GET** /fake/regular_expression | test regular expression to ensure no exception
|
||||||
*FakeApi* | [**fake_set_query**](docs/FakeApi.md#fake_set_query) | **GET** /fake/set_query_parameter | test set query parameter
|
*FakeApi* | [**fake_set_query**](docs/FakeApi.md#fake_set_query) | **GET** /fake/set_query_parameter | test set query parameter
|
||||||
*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
||||||
|
@ -5,6 +5,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
|||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
[**fake_data_file**](FakeApi.md#fake_data_file) | **GET** /fake/data_file | test data_file to ensure it's escaped correctly
|
[**fake_data_file**](FakeApi.md#fake_data_file) | **GET** /fake/data_file | test data_file to ensure it's escaped correctly
|
||||||
|
[**fake_path_array**](FakeApi.md#fake_path_array) | **GET** /fake/path_array/{path_array}/testing | test array parameter in path
|
||||||
[**fake_regular_expression**](FakeApi.md#fake_regular_expression) | **GET** /fake/regular_expression | test regular expression to ensure no exception
|
[**fake_regular_expression**](FakeApi.md#fake_regular_expression) | **GET** /fake/regular_expression | test regular expression to ensure no exception
|
||||||
[**fake_set_query**](FakeApi.md#fake_set_query) | **GET** /fake/set_query_parameter | test set query parameter
|
[**fake_set_query**](FakeApi.md#fake_set_query) | **GET** /fake/set_query_parameter | test set query parameter
|
||||||
|
|
||||||
@ -72,6 +73,61 @@ No authorization required
|
|||||||
|-------------|-------------|------------------|
|
|-------------|-------------|------------------|
|
||||||
| **200** | successful operation | - |
|
| **200** | successful operation | - |
|
||||||
|
|
||||||
|
# **fake_path_array**
|
||||||
|
> fake_path_array(path_array)
|
||||||
|
|
||||||
|
test array parameter in path
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```R
|
||||||
|
library(petstore)
|
||||||
|
|
||||||
|
# test array parameter in path
|
||||||
|
#
|
||||||
|
# prepare function argument(s)
|
||||||
|
var_path_array <- list("inner_example") # array[character] | dummy path parameter
|
||||||
|
|
||||||
|
api_instance <- FakeApi$new()
|
||||||
|
result <- tryCatch(
|
||||||
|
api_instance$fake_path_array(var_path_array),
|
||||||
|
ApiException = function(ex) ex
|
||||||
|
)
|
||||||
|
# In case of error, print the error object
|
||||||
|
if (!is.null(result$ApiException)) {
|
||||||
|
print("Exception occurs when calling `fake_path_array`:")
|
||||||
|
dput(result$ApiException$toString())
|
||||||
|
# error object
|
||||||
|
dput(result$ApiException$error_object$toJSONString())
|
||||||
|
}
|
||||||
|
# This endpoint doesn't return data
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**path_array** | list( **character** )| dummy path parameter |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
void (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
|
||||||
# **fake_regular_expression**
|
# **fake_regular_expression**
|
||||||
> fake_regular_expression(reg_exp_test)
|
> fake_regular_expression(reg_exp_test)
|
||||||
|
|
||||||
|
@ -32,6 +32,23 @@
|
|||||||
#' }
|
#' }
|
||||||
#' }
|
#' }
|
||||||
#'
|
#'
|
||||||
|
#' \strong{ FakePathArray } \emph{ test array parameter in path }
|
||||||
|
#'
|
||||||
|
#'
|
||||||
|
#' \itemize{
|
||||||
|
#' \item \emph{ @param } path_array list( character )
|
||||||
|
#'
|
||||||
|
#' \item On encountering errors, an error of subclass ApiException will be thrown.
|
||||||
|
#'
|
||||||
|
#' \item status code : 200 | successful operation
|
||||||
|
#'
|
||||||
|
#'
|
||||||
|
#' \item response headers :
|
||||||
|
#'
|
||||||
|
#' \tabular{ll}{
|
||||||
|
#' }
|
||||||
|
#' }
|
||||||
|
#'
|
||||||
#' \strong{ FakeRegularExpression } \emph{ test regular expression to ensure no exception }
|
#' \strong{ FakeRegularExpression } \emph{ test regular expression to ensure no exception }
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
@ -106,6 +123,31 @@
|
|||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
|
#' #################### FakePathArray ####################
|
||||||
|
#'
|
||||||
|
#' library(petstore)
|
||||||
|
#' var_path_array <- ["path_array_example"] # array[character] | dummy path parameter
|
||||||
|
#'
|
||||||
|
#' #test array parameter in path
|
||||||
|
#' api_instance <- FakeApi$new()
|
||||||
|
#'
|
||||||
|
#' result <- tryCatch(
|
||||||
|
#'
|
||||||
|
#' api_instance$FakePathArray(var_path_array),
|
||||||
|
#' ApiException = function(ex) ex
|
||||||
|
#' )
|
||||||
|
#' # In case of error, print the error object
|
||||||
|
#' if (!is.null(result$ApiException)) {
|
||||||
|
#' print("Exception occurs when calling `FakePathArray`:")
|
||||||
|
#' dput(result$ApiException$toString())
|
||||||
|
#'
|
||||||
|
#' # error object
|
||||||
|
#' dput(result$ApiException$error_object$toJSONString())
|
||||||
|
#'
|
||||||
|
#' }#'
|
||||||
|
#' # This endpoint doesn't return data
|
||||||
|
#'
|
||||||
|
#'
|
||||||
#' #################### FakeRegularExpression ####################
|
#' #################### FakeRegularExpression ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
@ -300,6 +342,108 @@ FakeApi <- R6::R6Class(
|
|||||||
ApiException = ApiException$new(http_response = local_var_resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
#' test array parameter in path
|
||||||
|
#'
|
||||||
|
#' @description
|
||||||
|
#' test array parameter in path
|
||||||
|
#'
|
||||||
|
#' @param path_array dummy path parameter
|
||||||
|
#' @param ... Other optional arguments
|
||||||
|
#' @return void
|
||||||
|
#' @export
|
||||||
|
FakePathArray = function(path_array, ...) {
|
||||||
|
local_var_response <- self$FakePathArrayWithHttpInfo(path_array, ...)
|
||||||
|
if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) {
|
||||||
|
local_var_response$content
|
||||||
|
} else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) {
|
||||||
|
local_var_response
|
||||||
|
} else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) {
|
||||||
|
local_var_response
|
||||||
|
} else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) {
|
||||||
|
local_var_response
|
||||||
|
}
|
||||||
|
},
|
||||||
|
#' test array parameter in path
|
||||||
|
#'
|
||||||
|
#' @description
|
||||||
|
#' test array parameter in path
|
||||||
|
#'
|
||||||
|
#' @param path_array dummy path parameter
|
||||||
|
#' @param ... Other optional arguments
|
||||||
|
#' @return API response (void) with additional information such as HTTP status code, headers
|
||||||
|
#' @export
|
||||||
|
FakePathArrayWithHttpInfo = function(path_array, ...) {
|
||||||
|
args <- list(...)
|
||||||
|
query_params <- list()
|
||||||
|
header_params <- c()
|
||||||
|
form_params <- list()
|
||||||
|
file_params <- list()
|
||||||
|
local_var_body <- NULL
|
||||||
|
oauth_scopes <- NULL
|
||||||
|
is_oauth <- FALSE
|
||||||
|
|
||||||
|
if (missing(`path_array`)) {
|
||||||
|
rlang::abort(message = "Missing required parameter `path_array`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `path_array`."))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
local_var_url_path <- "/fake/path_array/{path_array}/testing"
|
||||||
|
if (!missing(`path_array`)) {
|
||||||
|
local_var_url_path <- gsub("\\{path_array\\}", paste(URLencode(as.character(`path_array`), reserved = TRUE), collapse= ",", sep=""), local_var_url_path)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# The Accept request HTTP header
|
||||||
|
local_var_accepts <- list()
|
||||||
|
|
||||||
|
# The Content-Type representation header
|
||||||
|
local_var_content_types <- list()
|
||||||
|
|
||||||
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
|
method = "GET",
|
||||||
|
query_params = query_params,
|
||||||
|
header_params = header_params,
|
||||||
|
form_params = form_params,
|
||||||
|
file_params = file_params,
|
||||||
|
accepts = local_var_accepts,
|
||||||
|
content_types = local_var_content_types,
|
||||||
|
body = local_var_body,
|
||||||
|
is_oauth = is_oauth,
|
||||||
|
oauth_scopes = oauth_scopes,
|
||||||
|
...)
|
||||||
|
|
||||||
|
if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
|
||||||
|
local_var_resp$content <- NULL
|
||||||
|
local_var_resp
|
||||||
|
} else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
|
||||||
|
local_var_error_msg <- local_var_resp$response
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- paste("Server returned ", local_var_resp$status_code, " response status code.")
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
|
||||||
|
local_var_error_msg <- local_var_resp$response
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
|
||||||
|
local_var_error_msg <- local_var_resp$response
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
}
|
||||||
|
},
|
||||||
#' test regular expression to ensure no exception
|
#' test regular expression to ensure no exception
|
||||||
#'
|
#'
|
||||||
#' @description
|
#' @description
|
||||||
|
@ -836,7 +836,7 @@ PetApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/pet/{petId}"
|
local_var_url_path <- "/pet/{petId}"
|
||||||
if (!missing(`pet_id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{petId\\}", URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# OAuth-related settings
|
# OAuth-related settings
|
||||||
@ -1187,7 +1187,7 @@ PetApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/pet/{petId}"
|
local_var_url_path <- "/pet/{petId}"
|
||||||
if (!missing(`pet_id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{petId\\}", URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Bearer token
|
# Bearer token
|
||||||
@ -1314,7 +1314,7 @@ PetApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/pet/{petId}?streaming"
|
local_var_url_path <- "/pet/{petId}?streaming"
|
||||||
if (!missing(`pet_id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{petId\\}", URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# API key authentication
|
# API key authentication
|
||||||
@ -1698,7 +1698,7 @@ PetApi <- R6::R6Class(
|
|||||||
form_params["status"] <- `status`
|
form_params["status"] <- `status`
|
||||||
local_var_url_path <- "/pet/{petId}"
|
local_var_url_path <- "/pet/{petId}"
|
||||||
if (!missing(`pet_id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{petId\\}", URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1810,7 +1810,7 @@ PetApi <- R6::R6Class(
|
|||||||
file_params["file"] <- httr::upload_file(`file`)
|
file_params["file"] <- httr::upload_file(`file`)
|
||||||
local_var_url_path <- "/pet/{petId}/uploadImage"
|
local_var_url_path <- "/pet/{petId}/uploadImage"
|
||||||
if (!missing(`pet_id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{petId\\}", URLencode(as.character(`pet_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# OAuth-related settings
|
# OAuth-related settings
|
||||||
|
@ -314,7 +314,7 @@ StoreApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/store/order/{orderId}"
|
local_var_url_path <- "/store/order/{orderId}"
|
||||||
if (!missing(`order_id`)) {
|
if (!missing(`order_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "orderId", "\\}"), URLencode(as.character(`order_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{orderId\\}", URLencode(as.character(`order_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -537,7 +537,7 @@ StoreApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/store/order/{orderId}"
|
local_var_url_path <- "/store/order/{orderId}"
|
||||||
if (!missing(`order_id`)) {
|
if (!missing(`order_id`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "orderId", "\\}"), URLencode(as.character(`order_id`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{orderId\\}", URLencode(as.character(`order_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -832,7 +832,7 @@ UserApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/user/{username}"
|
local_var_url_path <- "/user/{username}"
|
||||||
if (!missing(`username`)) {
|
if (!missing(`username`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{username\\}", URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# API key authentication
|
# API key authentication
|
||||||
@ -940,7 +940,7 @@ UserApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/user/{username}"
|
local_var_url_path <- "/user/{username}"
|
||||||
if (!missing(`username`)) {
|
if (!missing(`username`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{username\\}", URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1296,7 +1296,7 @@ UserApi <- R6::R6Class(
|
|||||||
|
|
||||||
local_var_url_path <- "/user/{username}"
|
local_var_url_path <- "/user/{username}"
|
||||||
if (!missing(`username`)) {
|
if (!missing(`username`)) {
|
||||||
local_var_url_path <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
local_var_url_path <- gsub("\\{username\\}", URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# API key authentication
|
# API key authentication
|
||||||
|
@ -62,6 +62,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
|||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
*FakeApi* | [**FakeDataFile**](docs/FakeApi.md#FakeDataFile) | **GET** /fake/data_file | test data_file to ensure it's escaped correctly
|
*FakeApi* | [**FakeDataFile**](docs/FakeApi.md#FakeDataFile) | **GET** /fake/data_file | test data_file to ensure it's escaped correctly
|
||||||
|
*FakeApi* | [**FakePathArray**](docs/FakeApi.md#FakePathArray) | **GET** /fake/path_array/{path_array}/testing | test array parameter in path
|
||||||
*FakeApi* | [**FakeRegularExpression**](docs/FakeApi.md#FakeRegularExpression) | **GET** /fake/regular_expression | test regular expression to ensure no exception
|
*FakeApi* | [**FakeRegularExpression**](docs/FakeApi.md#FakeRegularExpression) | **GET** /fake/regular_expression | test regular expression to ensure no exception
|
||||||
*FakeApi* | [**FakeSetQuery**](docs/FakeApi.md#FakeSetQuery) | **GET** /fake/set_query_parameter | test set query parameter
|
*FakeApi* | [**FakeSetQuery**](docs/FakeApi.md#FakeSetQuery) | **GET** /fake/set_query_parameter | test set query parameter
|
||||||
*PetApi* | [**AddPet**](docs/PetApi.md#AddPet) | **POST** /pet | Add a new pet to the store
|
*PetApi* | [**AddPet**](docs/PetApi.md#AddPet) | **POST** /pet | Add a new pet to the store
|
||||||
|
@ -5,6 +5,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
|||||||
Method | HTTP request | Description
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
[**FakeDataFile**](FakeApi.md#FakeDataFile) | **GET** /fake/data_file | test data_file to ensure it's escaped correctly
|
[**FakeDataFile**](FakeApi.md#FakeDataFile) | **GET** /fake/data_file | test data_file to ensure it's escaped correctly
|
||||||
|
[**FakePathArray**](FakeApi.md#FakePathArray) | **GET** /fake/path_array/{path_array}/testing | test array parameter in path
|
||||||
[**FakeRegularExpression**](FakeApi.md#FakeRegularExpression) | **GET** /fake/regular_expression | test regular expression to ensure no exception
|
[**FakeRegularExpression**](FakeApi.md#FakeRegularExpression) | **GET** /fake/regular_expression | test regular expression to ensure no exception
|
||||||
[**FakeSetQuery**](FakeApi.md#FakeSetQuery) | **GET** /fake/set_query_parameter | test set query parameter
|
[**FakeSetQuery**](FakeApi.md#FakeSetQuery) | **GET** /fake/set_query_parameter | test set query parameter
|
||||||
|
|
||||||
@ -72,6 +73,61 @@ No authorization required
|
|||||||
|-------------|-------------|------------------|
|
|-------------|-------------|------------------|
|
||||||
| **200** | successful operation | - |
|
| **200** | successful operation | - |
|
||||||
|
|
||||||
|
# **FakePathArray**
|
||||||
|
> FakePathArray(path_array)
|
||||||
|
|
||||||
|
test array parameter in path
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```R
|
||||||
|
library(petstore)
|
||||||
|
|
||||||
|
# test array parameter in path
|
||||||
|
#
|
||||||
|
# prepare function argument(s)
|
||||||
|
var_path_array <- list("inner_example") # array[character] | dummy path parameter
|
||||||
|
|
||||||
|
api_instance <- FakeApi$new()
|
||||||
|
result <- tryCatch(
|
||||||
|
api_instance$FakePathArray(var_path_array),
|
||||||
|
ApiException = function(ex) ex
|
||||||
|
)
|
||||||
|
# In case of error, print the error object
|
||||||
|
if (!is.null(result$ApiException)) {
|
||||||
|
print("Exception occurs when calling `FakePathArray`:")
|
||||||
|
dput(result$ApiException$toString())
|
||||||
|
# error object
|
||||||
|
dput(result$ApiException$error_object$toJSONString())
|
||||||
|
}
|
||||||
|
# This endpoint doesn't return data
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**path_array** | list( **character** )| dummy path parameter |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
void (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
|
||||||
# **FakeRegularExpression**
|
# **FakeRegularExpression**
|
||||||
> FakeRegularExpression(reg_exp_test)
|
> FakeRegularExpression(reg_exp_test)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user