mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-10 23:42:44 +00:00
Add tests for query parameters (array of integer/string) (#17686)
* add tests for query parameters in python client * update other samples * update samples
This commit is contained in:
@@ -99,6 +99,38 @@
|
||||
#' }
|
||||
#' }
|
||||
#'
|
||||
#' \strong{ TestQueryStyleFormExplodeFalseArrayInteger } \emph{ Test query parameter(s) }
|
||||
#' Test query parameter(s)
|
||||
#'
|
||||
#' \itemize{
|
||||
#' \item \emph{ @param } query_object list( integer )
|
||||
#'
|
||||
#'
|
||||
#' \item status code : 200 | Successful operation
|
||||
#'
|
||||
#' \item return type : character
|
||||
#' \item response headers :
|
||||
#'
|
||||
#' \tabular{ll}{
|
||||
#' }
|
||||
#' }
|
||||
#'
|
||||
#' \strong{ TestQueryStyleFormExplodeFalseArrayString } \emph{ Test query parameter(s) }
|
||||
#' Test query parameter(s)
|
||||
#'
|
||||
#' \itemize{
|
||||
#' \item \emph{ @param } query_object list( character )
|
||||
#'
|
||||
#'
|
||||
#' \item status code : 200 | Successful operation
|
||||
#'
|
||||
#' \item return type : character
|
||||
#' \item response headers :
|
||||
#'
|
||||
#' \tabular{ll}{
|
||||
#' }
|
||||
#' }
|
||||
#'
|
||||
#' \strong{ TestQueryStyleFormExplodeTrueArrayString } \emph{ Test query parameter(s) }
|
||||
#' Test query parameter(s)
|
||||
#'
|
||||
@@ -227,6 +259,34 @@
|
||||
#' dput(result)
|
||||
#'
|
||||
#'
|
||||
#' #################### TestQueryStyleFormExplodeFalseArrayInteger ####################
|
||||
#'
|
||||
#' library(openapi)
|
||||
#' var_query_object <- c(123) # array[integer] | (Optional)
|
||||
#'
|
||||
#' #Test query parameter(s)
|
||||
#' api_instance <- QueryApi$new()
|
||||
#'
|
||||
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
|
||||
#' # result <- api_instance$TestQueryStyleFormExplodeFalseArrayInteger(query_object = var_query_objectdata_file = "result.txt")
|
||||
#' result <- api_instance$TestQueryStyleFormExplodeFalseArrayInteger(query_object = var_query_object)
|
||||
#' dput(result)
|
||||
#'
|
||||
#'
|
||||
#' #################### TestQueryStyleFormExplodeFalseArrayString ####################
|
||||
#'
|
||||
#' library(openapi)
|
||||
#' var_query_object <- c("inner_example") # array[character] | (Optional)
|
||||
#'
|
||||
#' #Test query parameter(s)
|
||||
#' api_instance <- QueryApi$new()
|
||||
#'
|
||||
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
|
||||
#' # result <- api_instance$TestQueryStyleFormExplodeFalseArrayString(query_object = var_query_objectdata_file = "result.txt")
|
||||
#' result <- api_instance$TestQueryStyleFormExplodeFalseArrayString(query_object = var_query_object)
|
||||
#' dput(result)
|
||||
#'
|
||||
#'
|
||||
#' #################### TestQueryStyleFormExplodeTrueArrayString ####################
|
||||
#'
|
||||
#' library(openapi)
|
||||
@@ -784,6 +844,190 @@ QueryApi <- R6::R6Class(
|
||||
#' @param ... Other optional arguments
|
||||
#' @return character
|
||||
#' @export
|
||||
TestQueryStyleFormExplodeFalseArrayInteger = function(query_object = NULL, data_file = NULL, ...) {
|
||||
local_var_response <- self$TestQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(query_object, data_file = data_file, ...)
|
||||
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 query parameter(s)
|
||||
#'
|
||||
#' @description
|
||||
#' Test query parameter(s)
|
||||
#'
|
||||
#' @param query_object (optional) No description
|
||||
#' @param data_file (optional) name of the data file to save the result
|
||||
#' @param ... Other optional arguments
|
||||
#' @return API response (character) with additional information such as HTTP status code, headers
|
||||
#' @export
|
||||
TestQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo = function(query_object = NULL, data_file = NULL, ...) {
|
||||
args <- list(...)
|
||||
query_params <- list()
|
||||
header_params <- c()
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
|
||||
# no explore
|
||||
query_params[["query_object"]] <- I(paste(lapply(`query_object`, URLencode, reserved = TRUE), collapse = ","))
|
||||
|
||||
local_var_url_path <- "/query/style_form/explode_false/array_integer"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts <- list("text/plain")
|
||||
|
||||
# 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) {
|
||||
# save response in a file
|
||||
if (!is.null(data_file)) {
|
||||
write(local_var_resp$response, data_file)
|
||||
}
|
||||
|
||||
deserialized_resp_obj <- tryCatch(
|
||||
self$api_client$deserialize(local_var_resp$response_as_text(), "character", loadNamespace("openapi")),
|
||||
error = function(e) {
|
||||
stop("Failed to deserialize response")
|
||||
}
|
||||
)
|
||||
local_var_resp$content <- deserialized_resp_obj
|
||||
local_var_resp
|
||||
} else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
|
||||
ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp)
|
||||
} else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
|
||||
ApiResponse$new("API client error", local_var_resp)
|
||||
} else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
|
||||
if (is.null(local_var_resp$response) || local_var_resp$response == "") {
|
||||
local_var_resp$response <- "API server error"
|
||||
}
|
||||
local_var_resp
|
||||
}
|
||||
},
|
||||
#' Test query parameter(s)
|
||||
#'
|
||||
#' @description
|
||||
#' Test query parameter(s)
|
||||
#'
|
||||
#' @param query_object (optional) No description
|
||||
#' @param data_file (optional) name of the data file to save the result
|
||||
#' @param ... Other optional arguments
|
||||
#' @return character
|
||||
#' @export
|
||||
TestQueryStyleFormExplodeFalseArrayString = function(query_object = NULL, data_file = NULL, ...) {
|
||||
local_var_response <- self$TestQueryStyleFormExplodeFalseArrayStringWithHttpInfo(query_object, data_file = data_file, ...)
|
||||
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 query parameter(s)
|
||||
#'
|
||||
#' @description
|
||||
#' Test query parameter(s)
|
||||
#'
|
||||
#' @param query_object (optional) No description
|
||||
#' @param data_file (optional) name of the data file to save the result
|
||||
#' @param ... Other optional arguments
|
||||
#' @return API response (character) with additional information such as HTTP status code, headers
|
||||
#' @export
|
||||
TestQueryStyleFormExplodeFalseArrayStringWithHttpInfo = function(query_object = NULL, data_file = NULL, ...) {
|
||||
args <- list(...)
|
||||
query_params <- list()
|
||||
header_params <- c()
|
||||
form_params <- list()
|
||||
file_params <- list()
|
||||
local_var_body <- NULL
|
||||
oauth_scopes <- NULL
|
||||
is_oauth <- FALSE
|
||||
|
||||
|
||||
# no explore
|
||||
query_params[["query_object"]] <- I(paste(lapply(`query_object`, URLencode, reserved = TRUE), collapse = ","))
|
||||
|
||||
local_var_url_path <- "/query/style_form/explode_false/array_string"
|
||||
|
||||
# The Accept request HTTP header
|
||||
local_var_accepts <- list("text/plain")
|
||||
|
||||
# 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) {
|
||||
# save response in a file
|
||||
if (!is.null(data_file)) {
|
||||
write(local_var_resp$response, data_file)
|
||||
}
|
||||
|
||||
deserialized_resp_obj <- tryCatch(
|
||||
self$api_client$deserialize(local_var_resp$response_as_text(), "character", loadNamespace("openapi")),
|
||||
error = function(e) {
|
||||
stop("Failed to deserialize response")
|
||||
}
|
||||
)
|
||||
local_var_resp$content <- deserialized_resp_obj
|
||||
local_var_resp
|
||||
} else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
|
||||
ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp)
|
||||
} else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
|
||||
ApiResponse$new("API client error", local_var_resp)
|
||||
} else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
|
||||
if (is.null(local_var_resp$response) || local_var_resp$response == "") {
|
||||
local_var_resp$response <- "API server error"
|
||||
}
|
||||
local_var_resp
|
||||
}
|
||||
},
|
||||
#' Test query parameter(s)
|
||||
#'
|
||||
#' @description
|
||||
#' Test query parameter(s)
|
||||
#'
|
||||
#' @param query_object (optional) No description
|
||||
#' @param data_file (optional) name of the data file to save the result
|
||||
#' @param ... Other optional arguments
|
||||
#' @return character
|
||||
#' @export
|
||||
TestQueryStyleFormExplodeTrueArrayString = function(query_object = NULL, data_file = NULL, ...) {
|
||||
local_var_response <- self$TestQueryStyleFormExplodeTrueArrayStringWithHttpInfo(query_object, data_file = data_file, ...)
|
||||
if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) {
|
||||
|
||||
@@ -92,6 +92,8 @@ Class | Method | HTTP request | Description
|
||||
*QueryApi* | [**TestQueryIntegerBooleanString**](docs/QueryApi.md#TestQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s)
|
||||
*QueryApi* | [**TestQueryStyleDeepObjectExplodeTrueObject**](docs/QueryApi.md#TestQueryStyleDeepObjectExplodeTrueObject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s)
|
||||
*QueryApi* | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOf**](docs/QueryApi.md#TestQueryStyleDeepObjectExplodeTrueObjectAllOf) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s)
|
||||
*QueryApi* | [**TestQueryStyleFormExplodeFalseArrayInteger**](docs/QueryApi.md#TestQueryStyleFormExplodeFalseArrayInteger) | **GET** /query/style_form/explode_false/array_integer | Test query parameter(s)
|
||||
*QueryApi* | [**TestQueryStyleFormExplodeFalseArrayString**](docs/QueryApi.md#TestQueryStyleFormExplodeFalseArrayString) | **GET** /query/style_form/explode_false/array_string | Test query parameter(s)
|
||||
*QueryApi* | [**TestQueryStyleFormExplodeTrueArrayString**](docs/QueryApi.md#TestQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
|
||||
*QueryApi* | [**TestQueryStyleFormExplodeTrueObject**](docs/QueryApi.md#TestQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s)
|
||||
*QueryApi* | [**TestQueryStyleFormExplodeTrueObjectAllOf**](docs/QueryApi.md#TestQueryStyleFormExplodeTrueObjectAllOf) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s)
|
||||
|
||||
@@ -9,6 +9,8 @@ Method | HTTP request | Description
|
||||
[**TestQueryIntegerBooleanString**](QueryApi.md#TestQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s)
|
||||
[**TestQueryStyleDeepObjectExplodeTrueObject**](QueryApi.md#TestQueryStyleDeepObjectExplodeTrueObject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s)
|
||||
[**TestQueryStyleDeepObjectExplodeTrueObjectAllOf**](QueryApi.md#TestQueryStyleDeepObjectExplodeTrueObjectAllOf) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s)
|
||||
[**TestQueryStyleFormExplodeFalseArrayInteger**](QueryApi.md#TestQueryStyleFormExplodeFalseArrayInteger) | **GET** /query/style_form/explode_false/array_integer | Test query parameter(s)
|
||||
[**TestQueryStyleFormExplodeFalseArrayString**](QueryApi.md#TestQueryStyleFormExplodeFalseArrayString) | **GET** /query/style_form/explode_false/array_string | Test query parameter(s)
|
||||
[**TestQueryStyleFormExplodeTrueArrayString**](QueryApi.md#TestQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
|
||||
[**TestQueryStyleFormExplodeTrueObject**](QueryApi.md#TestQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s)
|
||||
[**TestQueryStyleFormExplodeTrueObjectAllOf**](QueryApi.md#TestQueryStyleFormExplodeTrueObjectAllOf) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s)
|
||||
@@ -259,6 +261,100 @@ No authorization required
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
# **TestQueryStyleFormExplodeFalseArrayInteger**
|
||||
> character TestQueryStyleFormExplodeFalseArrayInteger(query_object = var.query_object)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### Example
|
||||
```R
|
||||
library(openapi)
|
||||
|
||||
# Test query parameter(s)
|
||||
#
|
||||
# prepare function argument(s)
|
||||
var_query_object <- c(123) # array[integer] | (Optional)
|
||||
|
||||
api_instance <- QueryApi$new()
|
||||
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
|
||||
# result <- api_instance$TestQueryStyleFormExplodeFalseArrayInteger(query_object = var_query_objectdata_file = "result.txt")
|
||||
result <- api_instance$TestQueryStyleFormExplodeFalseArrayInteger(query_object = var_query_object)
|
||||
dput(result)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**query_object** | list( **integer** )| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**character**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
# **TestQueryStyleFormExplodeFalseArrayString**
|
||||
> character TestQueryStyleFormExplodeFalseArrayString(query_object = var.query_object)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### Example
|
||||
```R
|
||||
library(openapi)
|
||||
|
||||
# Test query parameter(s)
|
||||
#
|
||||
# prepare function argument(s)
|
||||
var_query_object <- c("inner_example") # array[character] | (Optional)
|
||||
|
||||
api_instance <- QueryApi$new()
|
||||
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
|
||||
# result <- api_instance$TestQueryStyleFormExplodeFalseArrayString(query_object = var_query_objectdata_file = "result.txt")
|
||||
result <- api_instance$TestQueryStyleFormExplodeFalseArrayString(query_object = var_query_object)
|
||||
dput(result)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**query_object** | list( **character** )| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**character**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
# **TestQueryStyleFormExplodeTrueArrayString**
|
||||
> character TestQueryStyleFormExplodeTrueArrayString(query_object = var.query_object)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user