R echo client tests (#17629)

* add r echo api client sample

* add r workflow

* fix

* add env

* set r version

* install curl

* install dep

* fix

* comment out installation
This commit is contained in:
William Cheng 2024-01-18 09:05:35 +08:00 committed by GitHub
parent eab34c9b3f
commit d810d7c534
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
69 changed files with 8498 additions and 0 deletions

42
.github/workflows/samples-r.yaml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Samples R
on:
push:
paths:
- 'samples/client/echo_api/r/**'
pull_request:
paths:
- 'samples/client/echo_api/r/**'
jobs:
build:
name: Build R
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
- 'samples/client/echo_api/r/'
steps:
- uses: actions/checkout@v4
- name: Setup node.js
uses: actions/setup-node@v4
- name: Run echo server
run: |
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
(cd http-echo-server && npm install && npm start &)
- uses: r-lib/actions/setup-r@v2
with:
r-version: 3.6.1
- uses: r-lib/actions/setup-r-dependencies@v2
working-directory: ${{ matrix.sample }}
with:
cache-version: 2
- name: Install curl
run: sudo apt-get install -y r-cran-curl
- name: build and test
working-directory: ${{ matrix.sample }}
run: |
# export _R_CHECK_FORCE_SUGGESTS_=false
/bin/bash build_and_test.bash
shell: bash

View File

@ -0,0 +1,6 @@
generatorName: r
outputDir: samples/client/echo_api/r
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
templateDir: modules/openapi-generator/src/main/resources/r
additionalProperties:
hideGenerationTimestamp: "true"

View File

@ -0,0 +1,20 @@
^.*\.Rproj$ # Designates the directory as an RStudio Project
^\.Rproj\.user$ # Used by RStudio for temporary files
^README\.Rmd$ # An Rmd file used to generate README.md
^LICENSE\.md$ # Full text of the license
^cran-comments\.md$ # Comments for CRAN submission
^data-raw$ # Code used to create data included in the package
^pkgdown$ # Resources used for the package website
^_pkgdown\.yml$ # Configuration info for the package website
^\.github$ # Contributing guidelines, CoC, issue templates, etc.
^\.Rhistory$
^\.gitignore$
^\.openapi-generator-ignore$
^\.travis\.yml$
^\.lintr$
^\.github$
^\.openapi-generator$
^docs$
^git_push\.sh$
^openapi\.Rcheck$
^\.\.Rcheck$

View File

@ -0,0 +1,33 @@
# This file is automatically generated by openapi-generator (https://openapi-generator.tech)
#
# Based on https://github.com/r-lib/actions/tree/v2/examples
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
name: R-CMD-check
jobs:
R-CMD-check:
runs-on: ubuntu-latest
env:
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck, any::roxygen2, any::lintr, local::.
needs: check, roxygen2, lint
- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
- name: Roxygenize
run: |
roxygen2::roxygenize('.', roclets = c('rd', 'collate', 'namespace'))
shell: Rscript {0}
- uses: r-lib/actions/check-r-package@v2

35
samples/client/echo_api/r/.gitignore vendored Normal file
View File

@ -0,0 +1,35 @@
# ref: https://github.com/github/gitignore/blob/master/R.gitignore
# History files
.Rhistory
.Rapp.history
# Session Data files
.RData
# Example code in package build process
*-Ex.R
# Output files from R CMD build
/*.tar.gz
# Output files from R CMD check
/*.Rcheck/
# RStudio files
.Rproj.user/
# produced vignettes
vignettes/*.html
vignettes/*.pdf
# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
.httr-oauth
# knitr and R markdown default cache directories
/*_cache/
/cache/
# Temporary files created by R markdown
*.utf8.md
*.knit.md

View File

@ -0,0 +1,7 @@
linters: linters_with_defaults(
line_length_linter(160),
object_name_linter = NULL,
cyclocomp_linter = NULL
)
exclusions: list(
)

View File

@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@ -0,0 +1,46 @@
.Rbuildignore
.github/workflows/r-client.yaml
.gitignore
.lintr
.travis.yml
DESCRIPTION
NAMESPACE
R/api_client.R
R/api_response.R
R/auth_api.R
R/bird.R
R/body_api.R
R/category.R
R/data_query.R
R/default_value.R
R/form_api.R
R/header_api.R
R/number_properties_only.R
R/path_api.R
R/pet.R
R/query.R
R/query_api.R
R/string_enum_ref.R
R/tag.R
R/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.R
R/test_query_style_form_explode_true_array_string_query_object_parameter.R
README.md
docs/AuthApi.md
docs/Bird.md
docs/BodyApi.md
docs/Category.md
docs/DataQuery.md
docs/DefaultValue.md
docs/FormApi.md
docs/HeaderApi.md
docs/NumberPropertiesOnly.md
docs/PathApi.md
docs/Pet.md
docs/Query.md
docs/QueryApi.md
docs/StringEnumRef.md
docs/Tag.md
docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md
docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md
git_push.sh
tests/testthat.R

View File

@ -0,0 +1 @@
7.3.0-SNAPSHOT

View File

@ -0,0 +1,18 @@
# ref: https://docs.travis-ci.com/user/languages/r/
language: r
cache:
directories:
- /home/travis/R/Library
r_packages:
- jsonlite
- httr
- testthat
# uncomment below to install deps with devtools
#install:
#- R -e 'devtools::install_deps(dep = T)'
script:
- R CMD build .
- R CMD check *tar.gz
- R CMD INSTALL *tar.gz
after_failure:
- cat ${TRAVIS_BUILD_DIR}/namsor.Rcheck/tests/testthat.Rout.fail

View File

@ -0,0 +1,15 @@
Package: openapi
Title: R Package Client for Echo Server API
Version: 1.0.0
Author: person("OpenAPI Generator community", email = "team@openapitools.org", role = c("aut", "cre"))
Maintainer: OpenAPI Generator community <team@openapitools.org>
Description: Echo Server API
URL: https://github.com/GIT_USER_ID/GIT_REPO_ID
BugReports: https://github.com/GIT_USER_ID/GIT_REPO_ID/issues
Depends: R (>= 3.3)
Encoding: UTF-8
License: Apache 2.0
LazyData: true
Suggests: testthat
Imports: jsonlite, httr, R6, base64enc, stringr
RoxygenNote: 7.2.1

View File

@ -0,0 +1,34 @@
# Generated by openapi-generator: https://openapi-generator.tech
# Do not edit by hand
import(R6)
import(jsonlite)
import(httr)
import(base64enc)
import(stringr)
# Core
export(ApiClient)
export(ApiResponse)
# Models
export(Bird)
export(Category)
export(DataQuery)
export(DefaultValue)
export(NumberPropertiesOnly)
export(Pet)
export(Query)
export(StringEnumRef)
export(Tag)
export(TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter)
export(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter)
# APIs
export(AuthApi)
export(BodyApi)
export(FormApi)
export(HeaderApi)
export(PathApi)
export(QueryApi)

View File

@ -0,0 +1,391 @@
#' Echo Server API
#'
#' Echo Server API
#'
#' The version of the OpenAPI document: 0.1.0
#' Contact: team@openapitools.org
#' Generated by: https://openapi-generator.tech
#'
#' ApiClient Class
#'
#' Generic API client for OpenAPI client library builds.
#' OpenAPI generic API client. This client handles the client-
#' server communication, and is invariant across implementations. Specifics of
#' the methods and models for each application are generated from the OpenAPI Generator
#' templates.
#'
#' NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
#' Ref: https://openapi-generator.tech
#' Do not edit the class manually.
#'
#' @docType class
#' @title ApiClient
#' @description ApiClient Class
#' @format An \code{R6Class} generator object
#' @field base_path Base url
#' @field user_agent Default user agent
#' @field default_headers Default headers
#' @field username Username for HTTP basic authentication
#' @field password Password for HTTP basic authentication
#' @field api_keys API keys
#' @field bearer_token Bearer token
#' @field timeout Default timeout in seconds
#' @field retry_status_codes vector of status codes to retry
#' @field max_retry_attempts maximum number of retries for the status codes
#' @importFrom httr add_headers accept timeout content
#' @export
ApiClient <- R6::R6Class(
"ApiClient",
public = list(
# base path of all requests
base_path = "http://localhost:3000",
# user agent in the HTTP request
user_agent = "OpenAPI-Generator/1.0.0/r",
# default headers in the HTTP request
default_headers = NULL,
# username (HTTP basic authentication)
username = NULL,
# password (HTTP basic authentication)
password = NULL,
# API keys
api_keys = NULL,
# Bearer token
bearer_token = NULL,
# Time Out (seconds)
timeout = NULL,
# Vector of status codes to retry
retry_status_codes = NULL,
# Maximum number of retry attempts for the retry status codes
max_retry_attempts = NULL,
#' Initialize a new ApiClient.
#'
#' @description
#' Initialize a new ApiClient.
#'
#' @param base_path Base path.
#' @param user_agent User agent.
#' @param default_headers Default headers.
#' @param username User name.
#' @param password Password.
#' @param api_keys API keys.
#' @param access_token Access token.
#' @param bearer_token Bearer token.
#' @param timeout Timeout.
#' @param retry_status_codes Status codes for retry.
#' @param max_retry_attempts Maxmium number of retry.
#' @export
initialize = function(base_path = NULL, user_agent = NULL,
default_headers = NULL,
username = NULL, password = NULL, api_keys = NULL,
access_token = NULL, bearer_token = NULL, timeout = NULL,
retry_status_codes = NULL, max_retry_attempts = NULL) {
if (!is.null(base_path)) {
self$base_path <- base_path
}
if (!is.null(default_headers)) {
self$default_headers <- default_headers
}
if (!is.null(username)) {
self$username <- username
}
if (!is.null(password)) {
self$password <- password
}
if (!is.null(access_token)) {
self$access_token <- access_token
}
if (!is.null(bearer_token)) {
self$bearer_token <- bearer_token
}
if (!is.null(api_keys)) {
self$api_keys <- api_keys
} else {
self$api_keys <- list()
}
if (!is.null(user_agent)) {
self$`user_agent` <- user_agent
}
if (!is.null(timeout)) {
self$timeout <- timeout
}
if (!is.null(retry_status_codes)) {
self$retry_status_codes <- retry_status_codes
}
if (!is.null(max_retry_attempts)) {
self$max_retry_attempts <- max_retry_attempts
}
},
#' Prepare to make an API call with the retry logic.
#'
#' @description
#' Prepare to make an API call with the retry logic.
#'
#' @param url URL.
#' @param method HTTP method.
#' @param query_params The query parameters.
#' @param header_params The header parameters.
#' @param form_params The form parameters.
#' @param file_params The form parameters for uploading files.
#' @param accepts The list of Accept headers.
#' @param content_types The list of Content-Type headers.
#' @param body The HTTP request body.
#' @param stream_callback Callback function to process the data stream
#' @param ... Other optional arguments.
#' @return HTTP response
#' @export
CallApi = function(url, method, query_params, header_params, form_params,
file_params, accepts, content_types,
body, stream_callback = NULL, ...) {
resp <- self$Execute(url, method, query_params, header_params,
form_params, file_params,
accepts, content_types,
body, stream_callback = stream_callback, ...)
if (is.null(self$max_retry_attempts)) {
self$max_retry_attempts <- 3
}
if (!is.null(self$retry_status_codes)) {
for (i in 1 : self$max_retry_attempts) {
if (resp$status_code %in% self$retry_status_codes) {
Sys.sleep((2 ^ i) + stats::runif(n = 1, min = 0, max = 1))
resp <- self$Execute(url, method, query_params, header_params,
form_params, file_params, accepts, content_types,
body, stream_callback = stream_callback, ...)
} else {
break
}
}
}
resp
},
#' Make an API call
#'
#' @description
#' Make an API call
#'
#' @param url URL.
#' @param method HTTP method.
#' @param query_params The query parameters.
#' @param header_params The header parameters.
#' @param form_params The form parameters.
#' @param file_params The form parameters for uploading files.
#' @param accepts The list of Accept headers
#' @param content_types The list of Content-Type headers
#' @param body The HTTP request body.
#' @param stream_callback Callback function to process data stream
#' @param ... Other optional arguments.
#' @return HTTP response
#' @export
Execute = function(url, method, query_params, header_params,
form_params, file_params,
accepts, content_types,
body, stream_callback = NULL, ...) {
headers <- httr::add_headers(c(header_params, self$default_headers))
http_timeout <- NULL
if (!is.null(self$timeout)) {
http_timeout <- httr::timeout(self$timeout)
}
# set HTTP accept header
accept = self$select_header(accepts)
if (!is.null(accept)) {
headers['Accept'] = accept
}
# set HTTP content-type header
content_type = self$select_header(content_types)
if (!is.null(content_type)) {
headers['Content-Type'] = content_type
}
if (typeof(stream_callback) == "closure") { # stream data
if (method == "GET") {
httr::GET(url, query = query_params, headers, http_timeout,
httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
} else if (method == "POST") {
httr::POST(url, query = query_params, headers, body = body,
httr::content_type("application/json"), http_timeout,
httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
} else if (method == "PUT") {
httr::PUT(url, query = query_params, headers, body = body,
httr::content_type("application/json"), http_timeout,
http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
} else if (method == "PATCH") {
httr::PATCH(url, query = query_params, headers, body = body,
httr::content_type("application/json"), http_timeout,
http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
} else if (method == "HEAD") {
httr::HEAD(url, query = query_params, headers, http_timeout,
http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
} else if (method == "DELETE") {
httr::DELETE(url, query = query_params, headers, http_timeout,
http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
} else {
err_msg <- "Http method must be `GET`, `HEAD`, `OPTIONS`, `POST`, `PATCH`, `PUT` or `DELETE`."
stop(err_msg)
}
} else { # no streaming
if (method == "GET") {
httr_response <- httr::GET(url, query = query_params, headers, http_timeout,
httr::user_agent(self$`user_agent`), ...)
} else if (method == "POST") {
httr_response <- httr::POST(url, query = query_params, headers, body = body,
httr::content_type("application/json"), http_timeout,
httr::user_agent(self$`user_agent`), ...)
} else if (method == "PUT") {
httr_response <- httr::PUT(url, query = query_params, headers, body = body,
httr::content_type("application/json"), http_timeout,
http_timeout, httr::user_agent(self$`user_agent`), ...)
} else if (method == "PATCH") {
httr_response <- httr::PATCH(url, query = query_params, headers, body = body,
httr::content_type("application/json"), http_timeout,
http_timeout, httr::user_agent(self$`user_agent`), ...)
} else if (method == "HEAD") {
httr_response <- httr::HEAD(url, query = query_params, headers, http_timeout,
http_timeout, httr::user_agent(self$`user_agent`), ...)
} else if (method == "DELETE") {
httr_response <- httr::DELETE(url, query = query_params, headers, http_timeout,
http_timeout, httr::user_agent(self$`user_agent`), ...)
} else {
err_msg <- "Http method must be `GET`, `HEAD`, `OPTIONS`, `POST`, `PATCH`, `PUT` or `DELETE`."
stop(err_msg)
}
# return ApiResponse
api_response <- ApiResponse$new()
api_response$status_code <- httr::status_code(httr_response)
api_response$status_code_desc <- httr::http_status(httr_response)$reason
api_response$response <- httr::content(httr_response, "text", encoding = "UTF-8")
api_response$headers <- httr::headers(httr_response)
api_response
}
},
#' Deserialize the content of API response to the given type.
#'
#' @description
#' Deserialize the content of API response to the given type.
#'
#' @param raw_response Raw response.
#' @param return_type R return type.
#' @param pkg_env Package environment.
#' @return Deserialized object.
#' @export
deserialize = function(raw_response, return_type, pkg_env) {
resp_obj <- jsonlite::fromJSON(raw_response)
self$deserializeObj(resp_obj, return_type, pkg_env)
},
#' Deserialize the response from jsonlite object based on the given type
#'
#' @description
#' Deserialize the response from jsonlite object based on the given type
#' by handling complex and nested types by iterating recursively
#' Example return_types will be like "array[integer]", "map(Pet)", "array[map(Tag)]", etc.,
#'
#' @param obj Response object.
#' @param return_type R return type.
#' @param pkg_env Package environment.
#' @return Deserialized object.
#' @export
deserializeObj = function(obj, return_type, pkg_env) {
return_obj <- NULL
primitive_types <- c("character", "numeric", "integer", "logical", "complex")
# To handle the "map" type
if (startsWith(return_type, "map(")) {
inner_return_type <- regmatches(return_type,
regexec(pattern = "map\\((.*)\\)", return_type))[[1]][2]
return_obj <- lapply(names(obj), function(name) {
self$deserializeObj(obj[[name]], inner_return_type, pkg_env)
})
names(return_obj) <- names(obj)
} else if (startsWith(return_type, "array[")) {
# To handle the "array" type
inner_return_type <- regmatches(return_type,
regexec(pattern = "array\\[(.*)\\]", return_type))[[1]][2]
if (c(inner_return_type) %in% primitive_types) {
return_obj <- vector("list", length = length(obj))
if (length(obj) > 0) {
for (row in 1:length(obj)) {
return_obj[[row]] <- self$deserializeObj(obj[row], inner_return_type, pkg_env)
}
}
} else {
if (!is.null(nrow(obj))) {
return_obj <- vector("list", length = nrow(obj))
if (nrow(obj) > 0) {
for (row in 1:nrow(obj)) {
return_obj[[row]] <- self$deserializeObj(obj[row, , drop = FALSE],
inner_return_type, pkg_env)
}
}
}
}
} else if (exists(return_type, pkg_env) && !(c(return_type) %in% primitive_types)) {
# To handle model objects which are not array or map containers. Ex:"Pet"
return_type <- get(return_type, envir = as.environment(pkg_env))
return_obj <- return_type$new()
# check if discriminator is defined
if (!is.null(return_obj$`_discriminator_property_name`)) {
data_type <- return_obj$`_discriminator_property_name`
# use discriminator mapping if provided
if (!is.null(return_obj$`_discriminator_mapping_name`)) {
data_type <- (return_obj$`_discriminator_mapping_name`)[[obj[[data_type]]]]
} else {
# no mapping provided, use the value directly
data_type <- obj[[data_type]]
}
# create an object of the mapped type (e.g. Cat)
return_type <- get(data_type, envir = as.environment(pkg_env))
return_obj <- return_type$new()
}
return_obj$fromJSON(
jsonlite::toJSON(obj, digits = NA, auto_unbox = TRUE)
)
} else {
# To handle primitive type
return_obj <- obj
}
return_obj
},
#' Return a property header (for accept or content-type).
#'
#' @description
#' Return a property header (for accept or content-type). If JSON-related MIME is found,
#' return it. Otherwise, return the first one, if any.
#'
#' @param headers A list of headers
#' @return A header (e.g. 'application/json')
#' @export
select_header = function(headers) {
if (length(headers) == 0) {
return(invisible(NULL))
} else {
for (header in headers) {
if (str_detect(header, "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$")) {
# return JSON-related MIME
return(header)
}
}
# not json mime type, simply return the first one
return(headers[1])
}
}
)
)

View File

@ -0,0 +1,50 @@
#' Echo Server API
#'
#' Echo Server API
#'
#' The version of the OpenAPI document: 0.1.0
#' Contact: team@openapitools.org
#' Generated by: https://openapi-generator.tech
#'
#' @docType class
#' @title ApiResponse
#' @description ApiResponse Class
#' @format An \code{R6Class} generator object
#' @field content The deserialized response body.
#' @field response The raw response from the endpoint.
#' @field status_code The HTTP response status code.
#' @field status_code_desc The brief description of the HTTP response status code.
#' @field headers The HTTP response headers.
#' @export
ApiResponse <- R6::R6Class(
"ApiResponse",
public = list(
content = NULL,
response = NULL,
status_code = NULL,
status_code_desc = NULL,
headers = NULL,
#' Initialize a new ApiResponse class.
#'
#' @description
#' Initialize a new ApiResponse class.
#'
#' @param content The deserialized response body.
#' @param response The raw response from the endpoint.
#' @param status_code The HTTP response status code.
#' @param status_code_desc The brief description of the HTTP response status code.
#' @param headers The HTTP response headers.
#' @export
initialize = function(content = NULL,
response = NULL,
status_code = NULL,
status_code_desc = NULL,
headers = NULL) {
self$content <- content
self$response <- response
self$status_code <- status_code
self$status_code_desc <- status_code_desc
self$headers <- headers
}
)
)

View File

@ -0,0 +1,288 @@
#' Echo Server API
#'
#' Echo Server API
#'
#' The version of the OpenAPI document: 0.1.0
#' Contact: team@openapitools.org
#' Generated by: https://openapi-generator.tech
#'
#' @docType class
#' @title Auth operations
#' @description AuthApi
#' @format An \code{R6Class} generator object
#' @field api_client Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ TestAuthHttpBasic } \emph{ To test HTTP basic authentication }
#' To test HTTP basic authentication
#'
#' \itemize{
#'
#'
#' \item status code : 200 | Successful operation
#'
#' \item return type : character
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ TestAuthHttpBearer } \emph{ To test HTTP bearer authentication }
#' To test HTTP bearer authentication
#'
#' \itemize{
#'
#'
#' \item status code : 200 | Successful operation
#'
#' \item return type : character
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' #################### TestAuthHttpBasic ####################
#'
#' library(openapi)
#'
#' #To test HTTP basic authentication
#' api_instance <- AuthApi$new()
#'
#' # Configure HTTP basic authorization: http_auth
#' api_instance$api_client$username <- Sys.getenv("USERNAME")
#' api_instance$api_client$password <- Sys.getenv("PASSWORD")
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$TestAuthHttpBasic(data_file = "result.txt")
#' result <- api_instance$TestAuthHttpBasic()
#' dput(result)
#'
#'
#' #################### TestAuthHttpBearer ####################
#'
#' library(openapi)
#'
#' #To test HTTP bearer authentication
#' api_instance <- AuthApi$new()
#'
#' # Configure HTTP bearer authorization: http_bearer_auth
#' api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$TestAuthHttpBearer(data_file = "result.txt")
#' result <- api_instance$TestAuthHttpBearer()
#' dput(result)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
AuthApi <- R6::R6Class(
"AuthApi",
public = list(
api_client = NULL,
#' Initialize a new AuthApi.
#'
#' @description
#' Initialize a new AuthApi.
#'
#' @param api_client An instance of API client.
#' @export
initialize = function(api_client) {
if (!missing(api_client)) {
self$api_client <- api_client
} else {
self$api_client <- ApiClient$new()
}
},
#' To test HTTP basic authentication
#'
#' @description
#' To test HTTP basic authentication
#'
#' @param data_file (optional) name of the data file to save the result
#' @param ... Other optional arguments
#' @return character
#' @export
TestAuthHttpBasic = function(data_file = NULL, ...) {
local_var_response <- self$TestAuthHttpBasicWithHttpInfo(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
}
},
#' To test HTTP basic authentication
#'
#' @description
#' To test HTTP basic authentication
#'
#' @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
TestAuthHttpBasicWithHttpInfo = function(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
local_var_url_path <- "/auth/http/basic"
# HTTP basic auth
if (!is.null(self$api_client$username) || !is.null(self$api_client$password)) {
header_params["Authorization"] <- paste("Basic", base64enc::base64encode(charToRaw(paste(self$api_client$username, self$api_client$password, sep = ":"))))
}
# 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 = "POST",
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, "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
}
},
#' To test HTTP bearer authentication
#'
#' @description
#' To test HTTP bearer authentication
#'
#' @param data_file (optional) name of the data file to save the result
#' @param ... Other optional arguments
#' @return character
#' @export
TestAuthHttpBearer = function(data_file = NULL, ...) {
local_var_response <- self$TestAuthHttpBearerWithHttpInfo(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
}
},
#' To test HTTP bearer authentication
#'
#' @description
#' To test HTTP bearer authentication
#'
#' @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
TestAuthHttpBearerWithHttpInfo = function(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
local_var_url_path <- "/auth/http/bearer"
# 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("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 = "POST",
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, "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
}
}
)
)

View File

@ -0,0 +1,188 @@
#' Create a new Bird
#'
#' @description
#' Bird Class
#'
#' @docType class
#' @title Bird
#' @description Bird Class
#' @format An \code{R6Class} generator object
#' @field size character [optional]
#' @field color character [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Bird <- R6::R6Class(
"Bird",
public = list(
`size` = NULL,
`color` = NULL,
#' Initialize a new Bird class.
#'
#' @description
#' Initialize a new Bird class.
#'
#' @param size size
#' @param color color
#' @param ... Other optional arguments.
#' @export
initialize = function(`size` = NULL, `color` = NULL, ...) {
if (!is.null(`size`)) {
if (!(is.character(`size`) && length(`size`) == 1)) {
stop(paste("Error! Invalid data for `size`. Must be a string:", `size`))
}
self$`size` <- `size`
}
if (!is.null(`color`)) {
if (!(is.character(`color`) && length(`color`) == 1)) {
stop(paste("Error! Invalid data for `color`. Must be a string:", `color`))
}
self$`color` <- `color`
}
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return Bird in JSON format
#' @export
toJSON = function() {
BirdObject <- list()
if (!is.null(self$`size`)) {
BirdObject[["size"]] <-
self$`size`
}
if (!is.null(self$`color`)) {
BirdObject[["color"]] <-
self$`color`
}
BirdObject
},
#' Deserialize JSON string into an instance of Bird
#'
#' @description
#' Deserialize JSON string into an instance of Bird
#'
#' @param input_json the JSON input
#' @return the instance of Bird
#' @export
fromJSON = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
if (!is.null(this_object$`size`)) {
self$`size` <- this_object$`size`
}
if (!is.null(this_object$`color`)) {
self$`color` <- this_object$`color`
}
self
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return Bird in JSON format
#' @export
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`size`)) {
sprintf(
'"size":
"%s"
',
self$`size`
)
},
if (!is.null(self$`color`)) {
sprintf(
'"color":
"%s"
',
self$`color`
)
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of Bird
#'
#' @description
#' Deserialize JSON string into an instance of Bird
#'
#' @param input_json the JSON input
#' @return the instance of Bird
#' @export
fromJSONString = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
self$`size` <- this_object$`size`
self$`color` <- this_object$`color`
self
},
#' Validate JSON input with respect to Bird
#'
#' @description
#' Validate JSON input with respect to Bird and throw an exception if invalid
#'
#' @param input the JSON input
#' @export
validateJSON = function(input) {
input_json <- jsonlite::fromJSON(input)
},
#' To string (JSON format)
#'
#' @description
#' To string (JSON format)
#'
#' @return String representation of Bird
#' @export
toString = function() {
self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
},
#' Print the object
#'
#' @description
#' Print the object
#'
#' @export
print = function() {
print(jsonlite::prettify(self$toJSONString()))
invisible(self)
}
),
# Lock the class to prevent modifications to the method or field
lock_class = TRUE
)
## Uncomment below to unlock the class to allow modifications of the method or field
# Bird$unlock()
#
## Below is an example to define the print function
# Bird$set("public", "print", function(...) {
# print(jsonlite::prettify(self$toJSONString()))
# invisible(self)
# })
## Uncomment below to lock the class to prevent modifications to the method or field
# Bird$lock()

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,188 @@
#' Create a new Category
#'
#' @description
#' Category Class
#'
#' @docType class
#' @title Category
#' @description Category Class
#' @format An \code{R6Class} generator object
#' @field id integer [optional]
#' @field name character [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Category <- R6::R6Class(
"Category",
public = list(
`id` = NULL,
`name` = NULL,
#' Initialize a new Category class.
#'
#' @description
#' Initialize a new Category class.
#'
#' @param id id
#' @param name name
#' @param ... Other optional arguments.
#' @export
initialize = function(`id` = NULL, `name` = NULL, ...) {
if (!is.null(`id`)) {
if (!(is.numeric(`id`) && length(`id`) == 1)) {
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
}
self$`id` <- `id`
}
if (!is.null(`name`)) {
if (!(is.character(`name`) && length(`name`) == 1)) {
stop(paste("Error! Invalid data for `name`. Must be a string:", `name`))
}
self$`name` <- `name`
}
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return Category in JSON format
#' @export
toJSON = function() {
CategoryObject <- list()
if (!is.null(self$`id`)) {
CategoryObject[["id"]] <-
self$`id`
}
if (!is.null(self$`name`)) {
CategoryObject[["name"]] <-
self$`name`
}
CategoryObject
},
#' Deserialize JSON string into an instance of Category
#'
#' @description
#' Deserialize JSON string into an instance of Category
#'
#' @param input_json the JSON input
#' @return the instance of Category
#' @export
fromJSON = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
if (!is.null(this_object$`id`)) {
self$`id` <- this_object$`id`
}
if (!is.null(this_object$`name`)) {
self$`name` <- this_object$`name`
}
self
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return Category in JSON format
#' @export
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`id`)) {
sprintf(
'"id":
%d
',
self$`id`
)
},
if (!is.null(self$`name`)) {
sprintf(
'"name":
"%s"
',
self$`name`
)
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of Category
#'
#' @description
#' Deserialize JSON string into an instance of Category
#'
#' @param input_json the JSON input
#' @return the instance of Category
#' @export
fromJSONString = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
self$`id` <- this_object$`id`
self$`name` <- this_object$`name`
self
},
#' Validate JSON input with respect to Category
#'
#' @description
#' Validate JSON input with respect to Category and throw an exception if invalid
#'
#' @param input the JSON input
#' @export
validateJSON = function(input) {
input_json <- jsonlite::fromJSON(input)
},
#' To string (JSON format)
#'
#' @description
#' To string (JSON format)
#'
#' @return String representation of Category
#' @export
toString = function() {
self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
},
#' Print the object
#'
#' @description
#' Print the object
#'
#' @export
print = function() {
print(jsonlite::prettify(self$toJSONString()))
invisible(self)
}
),
# Lock the class to prevent modifications to the method or field
lock_class = TRUE
)
## Uncomment below to unlock the class to allow modifications of the method or field
# Category$unlock()
#
## Below is an example to define the print function
# Category$set("public", "print", function(...) {
# print(jsonlite::prettify(self$toJSONString()))
# invisible(self)
# })
## Uncomment below to lock the class to prevent modifications to the method or field
# Category$lock()

View File

@ -0,0 +1,263 @@
#' Create a new DataQuery
#'
#' @description
#' DataQuery Class
#'
#' @docType class
#' @title DataQuery
#' @description DataQuery Class
#' @format An \code{R6Class} generator object
#' @field id Query integer [optional]
#' @field outcomes list(character) [optional]
#' @field suffix test suffix character [optional]
#' @field text Some text containing white spaces character [optional]
#' @field date A date character [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
DataQuery <- R6::R6Class(
"DataQuery",
inherit = Query,
public = list(
`id` = NULL,
`outcomes` = NULL,
`suffix` = NULL,
`text` = NULL,
`date` = NULL,
#' Initialize a new DataQuery class.
#'
#' @description
#' Initialize a new DataQuery class.
#'
#' @param id Query
#' @param outcomes outcomes. Default to [SUCCESS, FAILURE].
#' @param suffix test suffix
#' @param text Some text containing white spaces
#' @param date A date
#' @param ... Other optional arguments.
#' @export
initialize = function(`id` = NULL, `outcomes` = [SUCCESS, FAILURE], `suffix` = NULL, `text` = NULL, `date` = NULL, ...) {
if (!is.null(`id`)) {
if (!(is.numeric(`id`) && length(`id`) == 1)) {
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
}
self$`id` <- `id`
}
if (!is.null(`outcomes`)) {
stopifnot(is.vector(`outcomes`), length(`outcomes`) != 0)
sapply(`outcomes`, function(x) stopifnot(is.character(x)))
self$`outcomes` <- `outcomes`
}
if (!is.null(`suffix`)) {
if (!(is.character(`suffix`) && length(`suffix`) == 1)) {
stop(paste("Error! Invalid data for `suffix`. Must be a string:", `suffix`))
}
self$`suffix` <- `suffix`
}
if (!is.null(`text`)) {
if (!(is.character(`text`) && length(`text`) == 1)) {
stop(paste("Error! Invalid data for `text`. Must be a string:", `text`))
}
self$`text` <- `text`
}
if (!is.null(`date`)) {
if (!is.character(`date`)) {
stop(paste("Error! Invalid data for `date`. Must be a string:", `date`))
}
self$`date` <- `date`
}
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return DataQuery in JSON format
#' @export
toJSON = function() {
DataQueryObject <- list()
if (!is.null(self$`id`)) {
DataQueryObject[["id"]] <-
self$`id`
}
if (!is.null(self$`outcomes`)) {
DataQueryObject[["outcomes"]] <-
self$`outcomes`
}
if (!is.null(self$`suffix`)) {
DataQueryObject[["suffix"]] <-
self$`suffix`
}
if (!is.null(self$`text`)) {
DataQueryObject[["text"]] <-
self$`text`
}
if (!is.null(self$`date`)) {
DataQueryObject[["date"]] <-
self$`date`
}
DataQueryObject
},
#' Deserialize JSON string into an instance of DataQuery
#'
#' @description
#' Deserialize JSON string into an instance of DataQuery
#'
#' @param input_json the JSON input
#' @return the instance of DataQuery
#' @export
fromJSON = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
if (!is.null(this_object$`id`)) {
self$`id` <- this_object$`id`
}
if (!is.null(this_object$`outcomes`)) {
self$`outcomes` <- ApiClient$new()$deserializeObj(this_object$`outcomes`, "array[character]", loadNamespace("openapi"))
}
if (!is.null(this_object$`suffix`)) {
self$`suffix` <- this_object$`suffix`
}
if (!is.null(this_object$`text`)) {
self$`text` <- this_object$`text`
}
if (!is.null(this_object$`date`)) {
self$`date` <- this_object$`date`
}
self
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return DataQuery in JSON format
#' @export
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`id`)) {
sprintf(
'"id":
%d
',
self$`id`
)
},
if (!is.null(self$`outcomes`)) {
sprintf(
'"outcomes":
[%s]
',
paste(unlist(lapply(self$`outcomes`, function(x) paste0('"', x, '"'))), collapse = ",")
)
},
if (!is.null(self$`suffix`)) {
sprintf(
'"suffix":
"%s"
',
self$`suffix`
)
},
if (!is.null(self$`text`)) {
sprintf(
'"text":
"%s"
',
self$`text`
)
},
if (!is.null(self$`date`)) {
sprintf(
'"date":
"%s"
',
self$`date`
)
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of DataQuery
#'
#' @description
#' Deserialize JSON string into an instance of DataQuery
#'
#' @param input_json the JSON input
#' @return the instance of DataQuery
#' @export
fromJSONString = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
self$`id` <- this_object$`id`
self$`outcomes` <- ApiClient$new()$deserializeObj(this_object$`outcomes`, "array[character]", loadNamespace("openapi"))
self$`suffix` <- this_object$`suffix`
self$`text` <- this_object$`text`
self$`date` <- this_object$`date`
self
},
#' Validate JSON input with respect to DataQuery
#'
#' @description
#' Validate JSON input with respect to DataQuery and throw an exception if invalid
#'
#' @param input the JSON input
#' @export
validateJSON = function(input) {
input_json <- jsonlite::fromJSON(input)
},
#' To string (JSON format)
#'
#' @description
#' To string (JSON format)
#'
#' @return String representation of DataQuery
#' @export
toString = function() {
self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
},
#' Print the object
#'
#' @description
#' Print the object
#'
#' @export
print = function() {
print(jsonlite::prettify(self$toJSONString()))
invisible(self)
}
),
# Lock the class to prevent modifications to the method or field
lock_class = TRUE
)
## Uncomment below to unlock the class to allow modifications of the method or field
# DataQuery$unlock()
#
## Below is an example to define the print function
# DataQuery$set("public", "print", function(...) {
# print(jsonlite::prettify(self$toJSONString()))
# invisible(self)
# })
## Uncomment below to lock the class to prevent modifications to the method or field
# DataQuery$lock()

View File

@ -0,0 +1,331 @@
#' Create a new DefaultValue
#'
#' @description
#' to test the default value of properties
#'
#' @docType class
#' @title DefaultValue
#' @description DefaultValue Class
#' @format An \code{R6Class} generator object
#' @field array_string_enum_ref_default list(\link{StringEnumRef}) [optional]
#' @field array_string_enum_default list(character) [optional]
#' @field array_string_default list(character) [optional]
#' @field array_integer_default list(integer) [optional]
#' @field array_string list(character) [optional]
#' @field array_string_nullable list(character) [optional]
#' @field array_string_extension_nullable list(character) [optional]
#' @field string_nullable character [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
DefaultValue <- R6::R6Class(
"DefaultValue",
public = list(
`array_string_enum_ref_default` = NULL,
`array_string_enum_default` = NULL,
`array_string_default` = NULL,
`array_integer_default` = NULL,
`array_string` = NULL,
`array_string_nullable` = NULL,
`array_string_extension_nullable` = NULL,
`string_nullable` = NULL,
#' Initialize a new DefaultValue class.
#'
#' @description
#' Initialize a new DefaultValue class.
#'
#' @param array_string_enum_ref_default array_string_enum_ref_default. Default to ["success","failure"].
#' @param array_string_enum_default array_string_enum_default. Default to ["success","failure"].
#' @param array_string_default array_string_default. Default to ["failure","skipped"].
#' @param array_integer_default array_integer_default. Default to [1,3].
#' @param array_string array_string
#' @param array_string_nullable array_string_nullable
#' @param array_string_extension_nullable array_string_extension_nullable
#' @param string_nullable string_nullable
#' @param ... Other optional arguments.
#' @export
initialize = function(`array_string_enum_ref_default` = ["success","failure"], `array_string_enum_default` = ["success","failure"], `array_string_default` = ["failure","skipped"], `array_integer_default` = [1,3], `array_string` = NULL, `array_string_nullable` = NULL, `array_string_extension_nullable` = NULL, `string_nullable` = NULL, ...) {
if (!is.null(`array_string_enum_ref_default`)) {
stopifnot(is.vector(`array_string_enum_ref_default`), length(`array_string_enum_ref_default`) != 0)
sapply(`array_string_enum_ref_default`, function(x) stopifnot(R6::is.R6(x)))
self$`array_string_enum_ref_default` <- `array_string_enum_ref_default`
}
if (!is.null(`array_string_enum_default`)) {
stopifnot(is.vector(`array_string_enum_default`), length(`array_string_enum_default`) != 0)
sapply(`array_string_enum_default`, function(x) stopifnot(is.character(x)))
self$`array_string_enum_default` <- `array_string_enum_default`
}
if (!is.null(`array_string_default`)) {
stopifnot(is.vector(`array_string_default`), length(`array_string_default`) != 0)
sapply(`array_string_default`, function(x) stopifnot(is.character(x)))
self$`array_string_default` <- `array_string_default`
}
if (!is.null(`array_integer_default`)) {
stopifnot(is.vector(`array_integer_default`), length(`array_integer_default`) != 0)
sapply(`array_integer_default`, function(x) stopifnot(is.character(x)))
self$`array_integer_default` <- `array_integer_default`
}
if (!is.null(`array_string`)) {
stopifnot(is.vector(`array_string`), length(`array_string`) != 0)
sapply(`array_string`, function(x) stopifnot(is.character(x)))
self$`array_string` <- `array_string`
}
if (!is.null(`array_string_nullable`)) {
stopifnot(is.vector(`array_string_nullable`), length(`array_string_nullable`) != 0)
sapply(`array_string_nullable`, function(x) stopifnot(is.character(x)))
self$`array_string_nullable` <- `array_string_nullable`
}
if (!is.null(`array_string_extension_nullable`)) {
stopifnot(is.vector(`array_string_extension_nullable`), length(`array_string_extension_nullable`) != 0)
sapply(`array_string_extension_nullable`, function(x) stopifnot(is.character(x)))
self$`array_string_extension_nullable` <- `array_string_extension_nullable`
}
if (!is.null(`string_nullable`)) {
if (!(is.character(`string_nullable`) && length(`string_nullable`) == 1)) {
stop(paste("Error! Invalid data for `string_nullable`. Must be a string:", `string_nullable`))
}
self$`string_nullable` <- `string_nullable`
}
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return DefaultValue in JSON format
#' @export
toJSON = function() {
DefaultValueObject <- list()
if (!is.null(self$`array_string_enum_ref_default`)) {
DefaultValueObject[["array_string_enum_ref_default"]] <-
lapply(self$`array_string_enum_ref_default`, function(x) x$toJSON())
}
if (!is.null(self$`array_string_enum_default`)) {
DefaultValueObject[["array_string_enum_default"]] <-
self$`array_string_enum_default`
}
if (!is.null(self$`array_string_default`)) {
DefaultValueObject[["array_string_default"]] <-
self$`array_string_default`
}
if (!is.null(self$`array_integer_default`)) {
DefaultValueObject[["array_integer_default"]] <-
self$`array_integer_default`
}
if (!is.null(self$`array_string`)) {
DefaultValueObject[["array_string"]] <-
self$`array_string`
}
if (!is.null(self$`array_string_nullable`)) {
DefaultValueObject[["array_string_nullable"]] <-
self$`array_string_nullable`
}
if (!is.null(self$`array_string_extension_nullable`)) {
DefaultValueObject[["array_string_extension_nullable"]] <-
self$`array_string_extension_nullable`
}
if (!is.null(self$`string_nullable`)) {
DefaultValueObject[["string_nullable"]] <-
self$`string_nullable`
}
DefaultValueObject
},
#' Deserialize JSON string into an instance of DefaultValue
#'
#' @description
#' Deserialize JSON string into an instance of DefaultValue
#'
#' @param input_json the JSON input
#' @return the instance of DefaultValue
#' @export
fromJSON = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
if (!is.null(this_object$`array_string_enum_ref_default`)) {
self$`array_string_enum_ref_default` <- ApiClient$new()$deserializeObj(this_object$`array_string_enum_ref_default`, "array[StringEnumRef]", loadNamespace("openapi"))
}
if (!is.null(this_object$`array_string_enum_default`)) {
self$`array_string_enum_default` <- ApiClient$new()$deserializeObj(this_object$`array_string_enum_default`, "array[character]", loadNamespace("openapi"))
}
if (!is.null(this_object$`array_string_default`)) {
self$`array_string_default` <- ApiClient$new()$deserializeObj(this_object$`array_string_default`, "array[character]", loadNamespace("openapi"))
}
if (!is.null(this_object$`array_integer_default`)) {
self$`array_integer_default` <- ApiClient$new()$deserializeObj(this_object$`array_integer_default`, "array[integer]", loadNamespace("openapi"))
}
if (!is.null(this_object$`array_string`)) {
self$`array_string` <- ApiClient$new()$deserializeObj(this_object$`array_string`, "array[character]", loadNamespace("openapi"))
}
if (!is.null(this_object$`array_string_nullable`)) {
self$`array_string_nullable` <- ApiClient$new()$deserializeObj(this_object$`array_string_nullable`, "array[character]", loadNamespace("openapi"))
}
if (!is.null(this_object$`array_string_extension_nullable`)) {
self$`array_string_extension_nullable` <- ApiClient$new()$deserializeObj(this_object$`array_string_extension_nullable`, "array[character]", loadNamespace("openapi"))
}
if (!is.null(this_object$`string_nullable`)) {
self$`string_nullable` <- this_object$`string_nullable`
}
self
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return DefaultValue in JSON format
#' @export
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`array_string_enum_ref_default`)) {
sprintf(
'"array_string_enum_ref_default":
[%s]
',
paste(sapply(self$`array_string_enum_ref_default`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",")
)
},
if (!is.null(self$`array_string_enum_default`)) {
sprintf(
'"array_string_enum_default":
[%s]
',
paste(unlist(lapply(self$`array_string_enum_default`, function(x) paste0('"', x, '"'))), collapse = ",")
)
},
if (!is.null(self$`array_string_default`)) {
sprintf(
'"array_string_default":
[%s]
',
paste(unlist(lapply(self$`array_string_default`, function(x) paste0('"', x, '"'))), collapse = ",")
)
},
if (!is.null(self$`array_integer_default`)) {
sprintf(
'"array_integer_default":
[%s]
',
paste(unlist(lapply(self$`array_integer_default`, function(x) paste0('"', x, '"'))), collapse = ",")
)
},
if (!is.null(self$`array_string`)) {
sprintf(
'"array_string":
[%s]
',
paste(unlist(lapply(self$`array_string`, function(x) paste0('"', x, '"'))), collapse = ",")
)
},
if (!is.null(self$`array_string_nullable`)) {
sprintf(
'"array_string_nullable":
[%s]
',
paste(unlist(lapply(self$`array_string_nullable`, function(x) paste0('"', x, '"'))), collapse = ",")
)
},
if (!is.null(self$`array_string_extension_nullable`)) {
sprintf(
'"array_string_extension_nullable":
[%s]
',
paste(unlist(lapply(self$`array_string_extension_nullable`, function(x) paste0('"', x, '"'))), collapse = ",")
)
},
if (!is.null(self$`string_nullable`)) {
sprintf(
'"string_nullable":
"%s"
',
self$`string_nullable`
)
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of DefaultValue
#'
#' @description
#' Deserialize JSON string into an instance of DefaultValue
#'
#' @param input_json the JSON input
#' @return the instance of DefaultValue
#' @export
fromJSONString = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
self$`array_string_enum_ref_default` <- ApiClient$new()$deserializeObj(this_object$`array_string_enum_ref_default`, "array[StringEnumRef]", loadNamespace("openapi"))
self$`array_string_enum_default` <- ApiClient$new()$deserializeObj(this_object$`array_string_enum_default`, "array[character]", loadNamespace("openapi"))
self$`array_string_default` <- ApiClient$new()$deserializeObj(this_object$`array_string_default`, "array[character]", loadNamespace("openapi"))
self$`array_integer_default` <- ApiClient$new()$deserializeObj(this_object$`array_integer_default`, "array[integer]", loadNamespace("openapi"))
self$`array_string` <- ApiClient$new()$deserializeObj(this_object$`array_string`, "array[character]", loadNamespace("openapi"))
self$`array_string_nullable` <- ApiClient$new()$deserializeObj(this_object$`array_string_nullable`, "array[character]", loadNamespace("openapi"))
self$`array_string_extension_nullable` <- ApiClient$new()$deserializeObj(this_object$`array_string_extension_nullable`, "array[character]", loadNamespace("openapi"))
self$`string_nullable` <- this_object$`string_nullable`
self
},
#' Validate JSON input with respect to DefaultValue
#'
#' @description
#' Validate JSON input with respect to DefaultValue and throw an exception if invalid
#'
#' @param input the JSON input
#' @export
validateJSON = function(input) {
input_json <- jsonlite::fromJSON(input)
},
#' To string (JSON format)
#'
#' @description
#' To string (JSON format)
#'
#' @return String representation of DefaultValue
#' @export
toString = function() {
self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
},
#' Print the object
#'
#' @description
#' Print the object
#'
#' @export
print = function() {
print(jsonlite::prettify(self$toJSONString()))
invisible(self)
}
),
# Lock the class to prevent modifications to the method or field
lock_class = TRUE
)
## Uncomment below to unlock the class to allow modifications of the method or field
# DefaultValue$unlock()
#
## Below is an example to define the print function
# DefaultValue$set("public", "print", function(...) {
# print(jsonlite::prettify(self$toJSONString()))
# invisible(self)
# })
## Uncomment below to lock the class to prevent modifications to the method or field
# DefaultValue$lock()

View File

@ -0,0 +1,327 @@
#' Echo Server API
#'
#' Echo Server API
#'
#' The version of the OpenAPI document: 0.1.0
#' Contact: team@openapitools.org
#' Generated by: https://openapi-generator.tech
#'
#' @docType class
#' @title Form operations
#' @description FormApi
#' @format An \code{R6Class} generator object
#' @field api_client Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ TestFormIntegerBooleanString } \emph{ Test form parameter(s) }
#' Test form parameter(s)
#'
#' \itemize{
#' \item \emph{ @param } integer_form integer
#' \item \emph{ @param } boolean_form character
#' \item \emph{ @param } string_form character
#'
#'
#' \item status code : 200 | Successful operation
#'
#' \item return type : character
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ TestFormOneof } \emph{ Test form parameter(s) for oneOf schema }
#' Test form parameter(s) for oneOf schema
#'
#' \itemize{
#' \item \emph{ @param } form1 character
#' \item \emph{ @param } form2 integer
#' \item \emph{ @param } form3 character
#' \item \emph{ @param } form4 character
#' \item \emph{ @param } id integer
#' \item \emph{ @param } name character
#'
#'
#' \item status code : 200 | Successful operation
#'
#' \item return type : character
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' #################### TestFormIntegerBooleanString ####################
#'
#' library(openapi)
#' var_integer_form <- 56 # integer | (Optional)
#' var_boolean_form <- "boolean_form_example" # character | (Optional)
#' var_string_form <- "string_form_example" # character | (Optional)
#'
#' #Test form parameter(s)
#' api_instance <- FormApi$new()
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$TestFormIntegerBooleanString(integer_form = var_integer_form, boolean_form = var_boolean_form, string_form = var_string_formdata_file = "result.txt")
#' result <- api_instance$TestFormIntegerBooleanString(integer_form = var_integer_form, boolean_form = var_boolean_form, string_form = var_string_form)
#' dput(result)
#'
#'
#' #################### TestFormOneof ####################
#'
#' library(openapi)
#' var_form1 <- "form1_example" # character | (Optional)
#' var_form2 <- 56 # integer | (Optional)
#' var_form3 <- "form3_example" # character | (Optional)
#' var_form4 <- "form4_example" # character | (Optional)
#' var_id <- 56 # integer | (Optional)
#' var_name <- "name_example" # character | (Optional)
#'
#' #Test form parameter(s) for oneOf schema
#' api_instance <- FormApi$new()
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$TestFormOneof(form1 = var_form1, form2 = var_form2, form3 = var_form3, form4 = var_form4, id = var_id, name = var_namedata_file = "result.txt")
#' result <- api_instance$TestFormOneof(form1 = var_form1, form2 = var_form2, form3 = var_form3, form4 = var_form4, id = var_id, name = var_name)
#' dput(result)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
FormApi <- R6::R6Class(
"FormApi",
public = list(
api_client = NULL,
#' Initialize a new FormApi.
#'
#' @description
#' Initialize a new FormApi.
#'
#' @param api_client An instance of API client.
#' @export
initialize = function(api_client) {
if (!missing(api_client)) {
self$api_client <- api_client
} else {
self$api_client <- ApiClient$new()
}
},
#' Test form parameter(s)
#'
#' @description
#' Test form parameter(s)
#'
#' @param integer_form (optional) No description
#' @param boolean_form (optional) No description
#' @param string_form (optional) No description
#' @param data_file (optional) name of the data file to save the result
#' @param ... Other optional arguments
#' @return character
#' @export
TestFormIntegerBooleanString = function(integer_form = NULL, boolean_form = NULL, string_form = NULL, data_file = NULL, ...) {
local_var_response <- self$TestFormIntegerBooleanStringWithHttpInfo(integer_form, boolean_form, string_form, 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 form parameter(s)
#'
#' @description
#' Test form parameter(s)
#'
#' @param integer_form (optional) No description
#' @param boolean_form (optional) No description
#' @param string_form (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
TestFormIntegerBooleanStringWithHttpInfo = function(integer_form = NULL, boolean_form = NULL, string_form = 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
form_params["integer_form"] <- `integer_form`
form_params["boolean_form"] <- `boolean_form`
form_params["string_form"] <- `string_form`
local_var_url_path <- "/form/integer/boolean/string"
# The Accept request HTTP header
local_var_accepts <- list("text/plain")
# The Content-Type representation header
local_var_content_types <- list("application/x-www-form-urlencoded")
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
method = "POST",
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, "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 form parameter(s) for oneOf schema
#'
#' @description
#' Test form parameter(s) for oneOf schema
#'
#' @param form1 (optional) No description
#' @param form2 (optional) No description
#' @param form3 (optional) No description
#' @param form4 (optional) No description
#' @param id (optional) No description
#' @param name (optional) No description
#' @param data_file (optional) name of the data file to save the result
#' @param ... Other optional arguments
#' @return character
#' @export
TestFormOneof = function(form1 = NULL, form2 = NULL, form3 = NULL, form4 = NULL, id = NULL, name = NULL, data_file = NULL, ...) {
local_var_response <- self$TestFormOneofWithHttpInfo(form1, form2, form3, form4, id, name, 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 form parameter(s) for oneOf schema
#'
#' @description
#' Test form parameter(s) for oneOf schema
#'
#' @param form1 (optional) No description
#' @param form2 (optional) No description
#' @param form3 (optional) No description
#' @param form4 (optional) No description
#' @param id (optional) No description
#' @param name (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
TestFormOneofWithHttpInfo = function(form1 = NULL, form2 = NULL, form3 = NULL, form4 = NULL, id = NULL, name = 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
form_params["form1"] <- `form1`
form_params["form2"] <- `form2`
form_params["form3"] <- `form3`
form_params["form4"] <- `form4`
form_params["id"] <- `id`
form_params["name"] <- `name`
local_var_url_path <- "/form/oneof"
# The Accept request HTTP header
local_var_accepts <- list("text/plain")
# The Content-Type representation header
local_var_content_types <- list("application/x-www-form-urlencoded")
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
method = "POST",
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, "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
}
}
)
)

View File

@ -0,0 +1,194 @@
#' Echo Server API
#'
#' Echo Server API
#'
#' The version of the OpenAPI document: 0.1.0
#' Contact: team@openapitools.org
#' Generated by: https://openapi-generator.tech
#'
#' @docType class
#' @title Header operations
#' @description HeaderApi
#' @format An \code{R6Class} generator object
#' @field api_client Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ TestHeaderIntegerBooleanStringEnums } \emph{ Test header parameter(s) }
#' Test header parameter(s)
#'
#' \itemize{
#' \item \emph{ @param } integer_header integer
#' \item \emph{ @param } boolean_header character
#' \item \emph{ @param } string_header character
#' \item \emph{ @param } enum_nonref_string_header Enum < [success, failure, unclassified] >
#' \item \emph{ @param } enum_ref_string_header \link{StringEnumRef}
#'
#'
#' \item status code : 200 | Successful operation
#'
#' \item return type : character
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' #################### TestHeaderIntegerBooleanStringEnums ####################
#'
#' library(openapi)
#' var_integer_header <- 56 # integer | (Optional)
#' var_boolean_header <- "boolean_header_example" # character | (Optional)
#' var_string_header <- "string_header_example" # character | (Optional)
#' var_enum_nonref_string_header <- "enum_nonref_string_header_example" # character | (Optional)
#' var_enum_ref_string_header <- StringEnumRef$new() # StringEnumRef | (Optional)
#'
#' #Test header parameter(s)
#' api_instance <- HeaderApi$new()
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$TestHeaderIntegerBooleanStringEnums(integer_header = var_integer_header, boolean_header = var_boolean_header, string_header = var_string_header, enum_nonref_string_header = var_enum_nonref_string_header, enum_ref_string_header = var_enum_ref_string_headerdata_file = "result.txt")
#' result <- api_instance$TestHeaderIntegerBooleanStringEnums(integer_header = var_integer_header, boolean_header = var_boolean_header, string_header = var_string_header, enum_nonref_string_header = var_enum_nonref_string_header, enum_ref_string_header = var_enum_ref_string_header)
#' dput(result)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
HeaderApi <- R6::R6Class(
"HeaderApi",
public = list(
api_client = NULL,
#' Initialize a new HeaderApi.
#'
#' @description
#' Initialize a new HeaderApi.
#'
#' @param api_client An instance of API client.
#' @export
initialize = function(api_client) {
if (!missing(api_client)) {
self$api_client <- api_client
} else {
self$api_client <- ApiClient$new()
}
},
#' Test header parameter(s)
#'
#' @description
#' Test header parameter(s)
#'
#' @param integer_header (optional) No description
#' @param boolean_header (optional) No description
#' @param string_header (optional) No description
#' @param enum_nonref_string_header (optional) No description
#' @param enum_ref_string_header (optional) No description
#' @param data_file (optional) name of the data file to save the result
#' @param ... Other optional arguments
#' @return character
#' @export
TestHeaderIntegerBooleanStringEnums = function(integer_header = NULL, boolean_header = NULL, string_header = NULL, enum_nonref_string_header = NULL, enum_ref_string_header = NULL, data_file = NULL, ...) {
local_var_response <- self$TestHeaderIntegerBooleanStringEnumsWithHttpInfo(integer_header, boolean_header, string_header, enum_nonref_string_header, enum_ref_string_header, 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 header parameter(s)
#'
#' @description
#' Test header parameter(s)
#'
#' @param integer_header (optional) No description
#' @param boolean_header (optional) No description
#' @param string_header (optional) No description
#' @param enum_nonref_string_header (optional) No description
#' @param enum_ref_string_header (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
TestHeaderIntegerBooleanStringEnumsWithHttpInfo = function(integer_header = NULL, boolean_header = NULL, string_header = NULL, enum_nonref_string_header = NULL, enum_ref_string_header = 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
header_params["integer_header"] <- `integer_header`
header_params["boolean_header"] <- `boolean_header`
header_params["string_header"] <- `string_header`
header_params["enum_nonref_string_header"] <- `enum_nonref_string_header`
header_params["enum_ref_string_header"] <- `enum_ref_string_header`
local_var_url_path <- "/header/integer/boolean/string/enums"
# 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, "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
}
}
)
)

View File

@ -0,0 +1,224 @@
#' Create a new NumberPropertiesOnly
#'
#' @description
#' NumberPropertiesOnly Class
#'
#' @docType class
#' @title NumberPropertiesOnly
#' @description NumberPropertiesOnly Class
#' @format An \code{R6Class} generator object
#' @field number numeric [optional]
#' @field float numeric [optional]
#' @field double numeric [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
NumberPropertiesOnly <- R6::R6Class(
"NumberPropertiesOnly",
public = list(
`number` = NULL,
`float` = NULL,
`double` = NULL,
#' Initialize a new NumberPropertiesOnly class.
#'
#' @description
#' Initialize a new NumberPropertiesOnly class.
#'
#' @param number number
#' @param float float
#' @param double double
#' @param ... Other optional arguments.
#' @export
initialize = function(`number` = NULL, `float` = NULL, `double` = NULL, ...) {
if (!is.null(`number`)) {
self$`number` <- `number`
}
if (!is.null(`float`)) {
if (!(is.numeric(`float`) && length(`float`) == 1)) {
stop(paste("Error! Invalid data for `float`. Must be a number:", `float`))
}
self$`float` <- `float`
}
if (!is.null(`double`)) {
if (!(is.numeric(`double`) && length(`double`) == 1)) {
stop(paste("Error! Invalid data for `double`. Must be a number:", `double`))
}
self$`double` <- `double`
}
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return NumberPropertiesOnly in JSON format
#' @export
toJSON = function() {
NumberPropertiesOnlyObject <- list()
if (!is.null(self$`number`)) {
NumberPropertiesOnlyObject[["number"]] <-
self$`number`
}
if (!is.null(self$`float`)) {
NumberPropertiesOnlyObject[["float"]] <-
self$`float`
}
if (!is.null(self$`double`)) {
NumberPropertiesOnlyObject[["double"]] <-
self$`double`
}
NumberPropertiesOnlyObject
},
#' Deserialize JSON string into an instance of NumberPropertiesOnly
#'
#' @description
#' Deserialize JSON string into an instance of NumberPropertiesOnly
#'
#' @param input_json the JSON input
#' @return the instance of NumberPropertiesOnly
#' @export
fromJSON = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
if (!is.null(this_object$`number`)) {
self$`number` <- this_object$`number`
}
if (!is.null(this_object$`float`)) {
self$`float` <- this_object$`float`
}
if (!is.null(this_object$`double`)) {
self$`double` <- this_object$`double`
}
self
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return NumberPropertiesOnly in JSON format
#' @export
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`number`)) {
sprintf(
'"number":
%d
',
self$`number`
)
},
if (!is.null(self$`float`)) {
sprintf(
'"float":
%d
',
self$`float`
)
},
if (!is.null(self$`double`)) {
sprintf(
'"double":
%d
',
self$`double`
)
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of NumberPropertiesOnly
#'
#' @description
#' Deserialize JSON string into an instance of NumberPropertiesOnly
#'
#' @param input_json the JSON input
#' @return the instance of NumberPropertiesOnly
#' @export
fromJSONString = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
self$`number` <- this_object$`number`
self$`float` <- this_object$`float`
self$`double` <- this_object$`double`
self
},
#' Validate JSON input with respect to NumberPropertiesOnly
#'
#' @description
#' Validate JSON input with respect to NumberPropertiesOnly and throw an exception if invalid
#'
#' @param input the JSON input
#' @export
validateJSON = function(input) {
input_json <- jsonlite::fromJSON(input)
},
#' To string (JSON format)
#'
#' @description
#' To string (JSON format)
#'
#' @return String representation of NumberPropertiesOnly
#' @export
toString = function() {
self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
if (self$`double` > 50.2) {
return(FALSE)
}
if (self$`double` < 0.8) {
return(FALSE)
}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
if (self$`double` > 50.2) {
invalid_fields["double"] <- "Invalid value for `double`, must be smaller than or equal to 50.2."
}
if (self$`double` < 0.8) {
invalid_fields["double"] <- "Invalid value for `double`, must be bigger than or equal to 0.8."
}
invalid_fields
},
#' Print the object
#'
#' @description
#' Print the object
#'
#' @export
print = function() {
print(jsonlite::prettify(self$toJSONString()))
invisible(self)
}
),
# Lock the class to prevent modifications to the method or field
lock_class = TRUE
)
## Uncomment below to unlock the class to allow modifications of the method or field
# NumberPropertiesOnly$unlock()
#
## Below is an example to define the print function
# NumberPropertiesOnly$set("public", "print", function(...) {
# print(jsonlite::prettify(self$toJSONString()))
# invisible(self)
# })
## Uncomment below to lock the class to prevent modifications to the method or field
# NumberPropertiesOnly$lock()

View File

@ -0,0 +1,211 @@
#' Echo Server API
#'
#' Echo Server API
#'
#' The version of the OpenAPI document: 0.1.0
#' Contact: team@openapitools.org
#' Generated by: https://openapi-generator.tech
#'
#' @docType class
#' @title Path operations
#' @description PathApi
#' @format An \code{R6Class} generator object
#' @field api_client Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath } \emph{ Test path parameter(s) }
#' Test path parameter(s)
#'
#' \itemize{
#' \item \emph{ @param } path_string character
#' \item \emph{ @param } path_integer integer
#' \item \emph{ @param } enum_nonref_string_path Enum < [success, failure, unclassified] >
#' \item \emph{ @param } enum_ref_string_path \link{StringEnumRef}
#'
#'
#' \item status code : 200 | Successful operation
#'
#' \item return type : character
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' #################### TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath ####################
#'
#' library(openapi)
#' var_path_string <- "path_string_example" # character |
#' var_path_integer <- 56 # integer |
#' var_enum_nonref_string_path <- "enum_nonref_string_path_example" # character |
#' var_enum_ref_string_path <- StringEnumRef$new() # StringEnumRef |
#'
#' #Test path parameter(s)
#' api_instance <- PathApi$new()
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(var_path_string, var_path_integer, var_enum_nonref_string_path, var_enum_ref_string_pathdata_file = "result.txt")
#' result <- api_instance$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(var_path_string, var_path_integer, var_enum_nonref_string_path, var_enum_ref_string_path)
#' dput(result)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
PathApi <- R6::R6Class(
"PathApi",
public = list(
api_client = NULL,
#' Initialize a new PathApi.
#'
#' @description
#' Initialize a new PathApi.
#'
#' @param api_client An instance of API client.
#' @export
initialize = function(api_client) {
if (!missing(api_client)) {
self$api_client <- api_client
} else {
self$api_client <- ApiClient$new()
}
},
#' Test path parameter(s)
#'
#' @description
#' Test path parameter(s)
#'
#' @param path_string
#' @param path_integer
#' @param enum_nonref_string_path
#' @param enum_ref_string_path
#' @param data_file (optional) name of the data file to save the result
#' @param ... Other optional arguments
#' @return character
#' @export
TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath = function(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path, data_file = NULL, ...) {
local_var_response <- self$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path, 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 path parameter(s)
#'
#' @description
#' Test path parameter(s)
#'
#' @param path_string
#' @param path_integer
#' @param enum_nonref_string_path
#' @param enum_ref_string_path
#' @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
TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo = function(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path, 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
if (missing(`path_string`)) {
stop("Missing required parameter `path_string`.")
}
if (missing(`path_integer`)) {
stop("Missing required parameter `path_integer`.")
}
if (missing(`enum_nonref_string_path`)) {
stop("Missing required parameter `enum_nonref_string_path`.")
}
if (missing(`enum_ref_string_path`)) {
stop("Missing required parameter `enum_ref_string_path`.")
}
local_var_url_path <- "/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}"
if (!missing(`path_string`)) {
local_var_url_path <- gsub("\\{path_string\\}", URLencode(as.character(`path_string`), reserved = TRUE), local_var_url_path)
}
if (!missing(`path_integer`)) {
local_var_url_path <- gsub("\\{path_integer\\}", URLencode(as.character(`path_integer`), reserved = TRUE), local_var_url_path)
}
if (!missing(`enum_nonref_string_path`)) {
local_var_url_path <- gsub("\\{enum_nonref_string_path\\}", URLencode(as.character(`enum_nonref_string_path`), reserved = TRUE), local_var_url_path)
}
if (!missing(`enum_ref_string_path`)) {
local_var_url_path <- gsub("\\{enum_ref_string_path\\}", URLencode(as.character(`enum_ref_string_path`), reserved = TRUE), local_var_url_path)
}
# 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, "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
}
}
)
)

View File

@ -0,0 +1,330 @@
#' Create a new Pet
#'
#' @description
#' Pet Class
#'
#' @docType class
#' @title Pet
#' @description Pet Class
#' @format An \code{R6Class} generator object
#' @field id integer [optional]
#' @field name character
#' @field category \link{Category} [optional]
#' @field photoUrls list(character)
#' @field tags list(\link{Tag}) [optional]
#' @field status pet status in the store character [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Pet <- R6::R6Class(
"Pet",
public = list(
`id` = NULL,
`name` = NULL,
`category` = NULL,
`photoUrls` = NULL,
`tags` = NULL,
`status` = NULL,
#' Initialize a new Pet class.
#'
#' @description
#' Initialize a new Pet class.
#'
#' @param name name
#' @param photoUrls photoUrls
#' @param id id
#' @param category category
#' @param tags tags
#' @param status pet status in the store
#' @param ... Other optional arguments.
#' @export
initialize = function(`name`, `photoUrls`, `id` = NULL, `category` = NULL, `tags` = NULL, `status` = NULL, ...) {
if (!missing(`name`)) {
if (!(is.character(`name`) && length(`name`) == 1)) {
stop(paste("Error! Invalid data for `name`. Must be a string:", `name`))
}
self$`name` <- `name`
}
if (!missing(`photoUrls`)) {
stopifnot(is.vector(`photoUrls`), length(`photoUrls`) != 0)
sapply(`photoUrls`, function(x) stopifnot(is.character(x)))
self$`photoUrls` <- `photoUrls`
}
if (!is.null(`id`)) {
if (!(is.numeric(`id`) && length(`id`) == 1)) {
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
}
self$`id` <- `id`
}
if (!is.null(`category`)) {
stopifnot(R6::is.R6(`category`))
self$`category` <- `category`
}
if (!is.null(`tags`)) {
stopifnot(is.vector(`tags`), length(`tags`) != 0)
sapply(`tags`, function(x) stopifnot(R6::is.R6(x)))
self$`tags` <- `tags`
}
if (!is.null(`status`)) {
if (!(`status` %in% c("available", "pending", "sold"))) {
stop(paste("Error! \"", `status`, "\" cannot be assigned to `status`. Must be \"available\", \"pending\", \"sold\".", sep = ""))
}
if (!(is.character(`status`) && length(`status`) == 1)) {
stop(paste("Error! Invalid data for `status`. Must be a string:", `status`))
}
self$`status` <- `status`
}
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return Pet in JSON format
#' @export
toJSON = function() {
PetObject <- list()
if (!is.null(self$`id`)) {
PetObject[["id"]] <-
self$`id`
}
if (!is.null(self$`name`)) {
PetObject[["name"]] <-
self$`name`
}
if (!is.null(self$`category`)) {
PetObject[["category"]] <-
self$`category`$toJSON()
}
if (!is.null(self$`photoUrls`)) {
PetObject[["photoUrls"]] <-
self$`photoUrls`
}
if (!is.null(self$`tags`)) {
PetObject[["tags"]] <-
lapply(self$`tags`, function(x) x$toJSON())
}
if (!is.null(self$`status`)) {
PetObject[["status"]] <-
self$`status`
}
PetObject
},
#' Deserialize JSON string into an instance of Pet
#'
#' @description
#' Deserialize JSON string into an instance of Pet
#'
#' @param input_json the JSON input
#' @return the instance of Pet
#' @export
fromJSON = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
if (!is.null(this_object$`id`)) {
self$`id` <- this_object$`id`
}
if (!is.null(this_object$`name`)) {
self$`name` <- this_object$`name`
}
if (!is.null(this_object$`category`)) {
`category_object` <- Category$new()
`category_object`$fromJSON(jsonlite::toJSON(this_object$`category`, auto_unbox = TRUE, digits = NA))
self$`category` <- `category_object`
}
if (!is.null(this_object$`photoUrls`)) {
self$`photoUrls` <- ApiClient$new()$deserializeObj(this_object$`photoUrls`, "array[character]", loadNamespace("openapi"))
}
if (!is.null(this_object$`tags`)) {
self$`tags` <- ApiClient$new()$deserializeObj(this_object$`tags`, "array[Tag]", loadNamespace("openapi"))
}
if (!is.null(this_object$`status`)) {
if (!is.null(this_object$`status`) && !(this_object$`status` %in% c("available", "pending", "sold"))) {
stop(paste("Error! \"", this_object$`status`, "\" cannot be assigned to `status`. Must be \"available\", \"pending\", \"sold\".", sep = ""))
}
self$`status` <- this_object$`status`
}
self
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return Pet in JSON format
#' @export
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`id`)) {
sprintf(
'"id":
%d
',
self$`id`
)
},
if (!is.null(self$`name`)) {
sprintf(
'"name":
"%s"
',
self$`name`
)
},
if (!is.null(self$`category`)) {
sprintf(
'"category":
%s
',
jsonlite::toJSON(self$`category`$toJSON(), auto_unbox = TRUE, digits = NA)
)
},
if (!is.null(self$`photoUrls`)) {
sprintf(
'"photoUrls":
[%s]
',
paste(unlist(lapply(self$`photoUrls`, function(x) paste0('"', x, '"'))), collapse = ",")
)
},
if (!is.null(self$`tags`)) {
sprintf(
'"tags":
[%s]
',
paste(sapply(self$`tags`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",")
)
},
if (!is.null(self$`status`)) {
sprintf(
'"status":
"%s"
',
self$`status`
)
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of Pet
#'
#' @description
#' Deserialize JSON string into an instance of Pet
#'
#' @param input_json the JSON input
#' @return the instance of Pet
#' @export
fromJSONString = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
self$`id` <- this_object$`id`
self$`name` <- this_object$`name`
self$`category` <- Category$new()$fromJSON(jsonlite::toJSON(this_object$`category`, auto_unbox = TRUE, digits = NA))
self$`photoUrls` <- ApiClient$new()$deserializeObj(this_object$`photoUrls`, "array[character]", loadNamespace("openapi"))
self$`tags` <- ApiClient$new()$deserializeObj(this_object$`tags`, "array[Tag]", loadNamespace("openapi"))
if (!is.null(this_object$`status`) && !(this_object$`status` %in% c("available", "pending", "sold"))) {
stop(paste("Error! \"", this_object$`status`, "\" cannot be assigned to `status`. Must be \"available\", \"pending\", \"sold\".", sep = ""))
}
self$`status` <- this_object$`status`
self
},
#' Validate JSON input with respect to Pet
#'
#' @description
#' Validate JSON input with respect to Pet and throw an exception if invalid
#'
#' @param input the JSON input
#' @export
validateJSON = function(input) {
input_json <- jsonlite::fromJSON(input)
# check the required field `name`
if (!is.null(input_json$`name`)) {
if (!(is.character(input_json$`name`) && length(input_json$`name`) == 1)) {
stop(paste("Error! Invalid data for `name`. Must be a string:", input_json$`name`))
}
} else {
stop(paste("The JSON input `", input, "` is invalid for Pet: the required field `name` is missing."))
}
# check the required field `photoUrls`
if (!is.null(input_json$`photoUrls`)) {
stopifnot(is.vector(input_json$`photoUrls`), length(input_json$`photoUrls`) != 0)
tmp <- sapply(input_json$`photoUrls`, function(x) stopifnot(is.character(x)))
} else {
stop(paste("The JSON input `", input, "` is invalid for Pet: the required field `photoUrls` is missing."))
}
},
#' To string (JSON format)
#'
#' @description
#' To string (JSON format)
#'
#' @return String representation of Pet
#' @export
toString = function() {
self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
# check if the required `name` is null
if (is.null(self$`name`)) {
return(FALSE)
}
# check if the required `photoUrls` is null
if (is.null(self$`photoUrls`)) {
return(FALSE)
}
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
# check if the required `name` is null
if (is.null(self$`name`)) {
invalid_fields["name"] <- "Non-nullable required field `name` cannot be null."
}
# check if the required `photoUrls` is null
if (is.null(self$`photoUrls`)) {
invalid_fields["photoUrls"] <- "Non-nullable required field `photoUrls` cannot be null."
}
invalid_fields
},
#' Print the object
#'
#' @description
#' Print the object
#'
#' @export
print = function() {
print(jsonlite::prettify(self$toJSONString()))
invisible(self)
}
),
# Lock the class to prevent modifications to the method or field
lock_class = TRUE
)
## Uncomment below to unlock the class to allow modifications of the method or field
# Pet$unlock()
#
## Below is an example to define the print function
# Pet$set("public", "print", function(...) {
# print(jsonlite::prettify(self$toJSONString()))
# invisible(self)
# })
## Uncomment below to lock the class to prevent modifications to the method or field
# Pet$lock()

View File

@ -0,0 +1,187 @@
#' Create a new Query
#'
#' @description
#' Query Class
#'
#' @docType class
#' @title Query
#' @description Query Class
#' @format An \code{R6Class} generator object
#' @field id Query integer [optional]
#' @field outcomes list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Query <- R6::R6Class(
"Query",
public = list(
`id` = NULL,
`outcomes` = NULL,
#' Initialize a new Query class.
#'
#' @description
#' Initialize a new Query class.
#'
#' @param id Query
#' @param outcomes outcomes. Default to ["SUCCESS","FAILURE"].
#' @param ... Other optional arguments.
#' @export
initialize = function(`id` = NULL, `outcomes` = ["SUCCESS","FAILURE"], ...) {
if (!is.null(`id`)) {
if (!(is.numeric(`id`) && length(`id`) == 1)) {
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
}
self$`id` <- `id`
}
if (!is.null(`outcomes`)) {
stopifnot(is.vector(`outcomes`), length(`outcomes`) != 0)
sapply(`outcomes`, function(x) stopifnot(is.character(x)))
self$`outcomes` <- `outcomes`
}
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return Query in JSON format
#' @export
toJSON = function() {
QueryObject <- list()
if (!is.null(self$`id`)) {
QueryObject[["id"]] <-
self$`id`
}
if (!is.null(self$`outcomes`)) {
QueryObject[["outcomes"]] <-
self$`outcomes`
}
QueryObject
},
#' Deserialize JSON string into an instance of Query
#'
#' @description
#' Deserialize JSON string into an instance of Query
#'
#' @param input_json the JSON input
#' @return the instance of Query
#' @export
fromJSON = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
if (!is.null(this_object$`id`)) {
self$`id` <- this_object$`id`
}
if (!is.null(this_object$`outcomes`)) {
self$`outcomes` <- ApiClient$new()$deserializeObj(this_object$`outcomes`, "array[character]", loadNamespace("openapi"))
}
self
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return Query in JSON format
#' @export
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`id`)) {
sprintf(
'"id":
%d
',
self$`id`
)
},
if (!is.null(self$`outcomes`)) {
sprintf(
'"outcomes":
[%s]
',
paste(unlist(lapply(self$`outcomes`, function(x) paste0('"', x, '"'))), collapse = ",")
)
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of Query
#'
#' @description
#' Deserialize JSON string into an instance of Query
#'
#' @param input_json the JSON input
#' @return the instance of Query
#' @export
fromJSONString = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
self$`id` <- this_object$`id`
self$`outcomes` <- ApiClient$new()$deserializeObj(this_object$`outcomes`, "array[character]", loadNamespace("openapi"))
self
},
#' Validate JSON input with respect to Query
#'
#' @description
#' Validate JSON input with respect to Query and throw an exception if invalid
#'
#' @param input the JSON input
#' @export
validateJSON = function(input) {
input_json <- jsonlite::fromJSON(input)
},
#' To string (JSON format)
#'
#' @description
#' To string (JSON format)
#'
#' @return String representation of Query
#' @export
toString = function() {
self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
},
#' Print the object
#'
#' @description
#' Print the object
#'
#' @export
print = function() {
print(jsonlite::prettify(self$toJSONString()))
invisible(self)
}
),
# Lock the class to prevent modifications to the method or field
lock_class = TRUE
)
## Uncomment below to unlock the class to allow modifications of the method or field
# Query$unlock()
#
## Below is an example to define the print function
# Query$set("public", "print", function(...) {
# print(jsonlite::prettify(self$toJSONString()))
# invisible(self)
# })
## Uncomment below to lock the class to prevent modifications to the method or field
# Query$lock()

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,88 @@
#' @docType class
#' @title StringEnumRef
#' @description StringEnumRef Class
#' @format An \code{R6Class} generator object
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
StringEnumRef <- R6::R6Class(
"StringEnumRef",
public = list(
#' Initialize a new StringEnumRef class.
#'
#' @description
#' Initialize a new StringEnumRef class.
#'
#' @param ... Optional arguments.
#' @export
initialize = function(...) {
local.optional.var <- list(...)
val <- unlist(local.optional.var)
enumvec <- .parse_StringEnumRef()
stopifnot(length(val) == 1L)
if (!val %in% enumvec)
stop("Use one of the valid values: ",
paste0(enumvec, collapse = ", "))
private$value <- val
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return StringEnumRef in JSON format
#' @export
toJSON = function() {
jsonlite::toJSON(private$value, auto_unbox = TRUE)
},
#' Deserialize JSON string into an instance of StringEnumRef
#'
#' @description
#' Deserialize JSON string into an instance of StringEnumRef
#'
#' @param input_json the JSON input
#' @return the instance of StringEnumRef
#' @export
fromJSON = function(input_json) {
private$value <- jsonlite::fromJSON(input_json,
simplifyVector = FALSE)
self
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return StringEnumRef in JSON format
#' @export
toJSONString = function() {
as.character(jsonlite::toJSON(private$value,
auto_unbox = TRUE))
},
#' Deserialize JSON string into an instance of StringEnumRef
#'
#' @description
#' Deserialize JSON string into an instance of StringEnumRef
#'
#' @param input_json the JSON input
#' @return the instance of StringEnumRef
#' @export
fromJSONString = function(input_json) {
private$value <- jsonlite::fromJSON(input_json,
simplifyVector = FALSE)
self
}
),
private = list(
value = NULL
)
)
# add to utils.R
.parse_StringEnumRef <- function(vals) {
res <- gsub("^\\[|\\]$", "", "[success, failure, unclassified]")
unlist(strsplit(res, ", "))
}

View File

@ -0,0 +1,188 @@
#' Create a new Tag
#'
#' @description
#' Tag Class
#'
#' @docType class
#' @title Tag
#' @description Tag Class
#' @format An \code{R6Class} generator object
#' @field id integer [optional]
#' @field name character [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Tag <- R6::R6Class(
"Tag",
public = list(
`id` = NULL,
`name` = NULL,
#' Initialize a new Tag class.
#'
#' @description
#' Initialize a new Tag class.
#'
#' @param id id
#' @param name name
#' @param ... Other optional arguments.
#' @export
initialize = function(`id` = NULL, `name` = NULL, ...) {
if (!is.null(`id`)) {
if (!(is.numeric(`id`) && length(`id`) == 1)) {
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
}
self$`id` <- `id`
}
if (!is.null(`name`)) {
if (!(is.character(`name`) && length(`name`) == 1)) {
stop(paste("Error! Invalid data for `name`. Must be a string:", `name`))
}
self$`name` <- `name`
}
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return Tag in JSON format
#' @export
toJSON = function() {
TagObject <- list()
if (!is.null(self$`id`)) {
TagObject[["id"]] <-
self$`id`
}
if (!is.null(self$`name`)) {
TagObject[["name"]] <-
self$`name`
}
TagObject
},
#' Deserialize JSON string into an instance of Tag
#'
#' @description
#' Deserialize JSON string into an instance of Tag
#'
#' @param input_json the JSON input
#' @return the instance of Tag
#' @export
fromJSON = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
if (!is.null(this_object$`id`)) {
self$`id` <- this_object$`id`
}
if (!is.null(this_object$`name`)) {
self$`name` <- this_object$`name`
}
self
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return Tag in JSON format
#' @export
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`id`)) {
sprintf(
'"id":
%d
',
self$`id`
)
},
if (!is.null(self$`name`)) {
sprintf(
'"name":
"%s"
',
self$`name`
)
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of Tag
#'
#' @description
#' Deserialize JSON string into an instance of Tag
#'
#' @param input_json the JSON input
#' @return the instance of Tag
#' @export
fromJSONString = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
self$`id` <- this_object$`id`
self$`name` <- this_object$`name`
self
},
#' Validate JSON input with respect to Tag
#'
#' @description
#' Validate JSON input with respect to Tag and throw an exception if invalid
#'
#' @param input the JSON input
#' @export
validateJSON = function(input) {
input_json <- jsonlite::fromJSON(input)
},
#' To string (JSON format)
#'
#' @description
#' To string (JSON format)
#'
#' @return String representation of Tag
#' @export
toString = function() {
self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
},
#' Print the object
#'
#' @description
#' Print the object
#'
#' @export
print = function() {
print(jsonlite::prettify(self$toJSONString()))
invisible(self)
}
),
# Lock the class to prevent modifications to the method or field
lock_class = TRUE
)
## Uncomment below to unlock the class to allow modifications of the method or field
# Tag$unlock()
#
## Below is an example to define the print function
# Tag$set("public", "print", function(...) {
# print(jsonlite::prettify(self$toJSONString()))
# invisible(self)
# })
## Uncomment below to lock the class to prevent modifications to the method or field
# Tag$lock()

View File

@ -0,0 +1,238 @@
#' Create a new TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
#'
#' @description
#' TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter Class
#'
#' @docType class
#' @title TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
#' @description TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter Class
#' @format An \code{R6Class} generator object
#' @field size character [optional]
#' @field color character [optional]
#' @field id integer [optional]
#' @field name character [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter <- R6::R6Class(
"TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter",
public = list(
`size` = NULL,
`color` = NULL,
`id` = NULL,
`name` = NULL,
#' Initialize a new TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter class.
#'
#' @description
#' Initialize a new TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter class.
#'
#' @param size size
#' @param color color
#' @param id id
#' @param name name
#' @param ... Other optional arguments.
#' @export
initialize = function(`size` = NULL, `color` = NULL, `id` = NULL, `name` = NULL, ...) {
if (!is.null(`size`)) {
if (!(is.character(`size`) && length(`size`) == 1)) {
stop(paste("Error! Invalid data for `size`. Must be a string:", `size`))
}
self$`size` <- `size`
}
if (!is.null(`color`)) {
if (!(is.character(`color`) && length(`color`) == 1)) {
stop(paste("Error! Invalid data for `color`. Must be a string:", `color`))
}
self$`color` <- `color`
}
if (!is.null(`id`)) {
if (!(is.numeric(`id`) && length(`id`) == 1)) {
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
}
self$`id` <- `id`
}
if (!is.null(`name`)) {
if (!(is.character(`name`) && length(`name`) == 1)) {
stop(paste("Error! Invalid data for `name`. Must be a string:", `name`))
}
self$`name` <- `name`
}
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter in JSON format
#' @export
toJSON = function() {
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject <- list()
if (!is.null(self$`size`)) {
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject[["size"]] <-
self$`size`
}
if (!is.null(self$`color`)) {
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject[["color"]] <-
self$`color`
}
if (!is.null(self$`id`)) {
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject[["id"]] <-
self$`id`
}
if (!is.null(self$`name`)) {
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject[["name"]] <-
self$`name`
}
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject
},
#' Deserialize JSON string into an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
#'
#' @description
#' Deserialize JSON string into an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
#'
#' @param input_json the JSON input
#' @return the instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
#' @export
fromJSON = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
if (!is.null(this_object$`size`)) {
self$`size` <- this_object$`size`
}
if (!is.null(this_object$`color`)) {
self$`color` <- this_object$`color`
}
if (!is.null(this_object$`id`)) {
self$`id` <- this_object$`id`
}
if (!is.null(this_object$`name`)) {
self$`name` <- this_object$`name`
}
self
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter in JSON format
#' @export
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`size`)) {
sprintf(
'"size":
"%s"
',
self$`size`
)
},
if (!is.null(self$`color`)) {
sprintf(
'"color":
"%s"
',
self$`color`
)
},
if (!is.null(self$`id`)) {
sprintf(
'"id":
%d
',
self$`id`
)
},
if (!is.null(self$`name`)) {
sprintf(
'"name":
"%s"
',
self$`name`
)
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
#'
#' @description
#' Deserialize JSON string into an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
#'
#' @param input_json the JSON input
#' @return the instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
#' @export
fromJSONString = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
self$`size` <- this_object$`size`
self$`color` <- this_object$`color`
self$`id` <- this_object$`id`
self$`name` <- this_object$`name`
self
},
#' Validate JSON input with respect to TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
#'
#' @description
#' Validate JSON input with respect to TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter and throw an exception if invalid
#'
#' @param input the JSON input
#' @export
validateJSON = function(input) {
input_json <- jsonlite::fromJSON(input)
},
#' To string (JSON format)
#'
#' @description
#' To string (JSON format)
#'
#' @return String representation of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
#' @export
toString = function() {
self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
},
#' Print the object
#'
#' @description
#' Print the object
#'
#' @export
print = function() {
print(jsonlite::prettify(self$toJSONString()))
invisible(self)
}
),
# Lock the class to prevent modifications to the method or field
lock_class = TRUE
)
## Uncomment below to unlock the class to allow modifications of the method or field
# TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter$unlock()
#
## Below is an example to define the print function
# TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter$set("public", "print", function(...) {
# print(jsonlite::prettify(self$toJSONString()))
# invisible(self)
# })
## Uncomment below to lock the class to prevent modifications to the method or field
# TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter$lock()

View File

@ -0,0 +1,162 @@
#' Create a new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
#'
#' @description
#' TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter Class
#'
#' @docType class
#' @title TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
#' @description TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter Class
#' @format An \code{R6Class} generator object
#' @field values list(character) [optional]
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter <- R6::R6Class(
"TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter",
public = list(
`values` = NULL,
#' Initialize a new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter class.
#'
#' @description
#' Initialize a new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter class.
#'
#' @param values values
#' @param ... Other optional arguments.
#' @export
initialize = function(`values` = NULL, ...) {
if (!is.null(`values`)) {
stopifnot(is.vector(`values`), length(`values`) != 0)
sapply(`values`, function(x) stopifnot(is.character(x)))
self$`values` <- `values`
}
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter in JSON format
#' @export
toJSON = function() {
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterObject <- list()
if (!is.null(self$`values`)) {
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterObject[["values"]] <-
self$`values`
}
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterObject
},
#' Deserialize JSON string into an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
#'
#' @description
#' Deserialize JSON string into an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
#'
#' @param input_json the JSON input
#' @return the instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
#' @export
fromJSON = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
if (!is.null(this_object$`values`)) {
self$`values` <- ApiClient$new()$deserializeObj(this_object$`values`, "array[character]", loadNamespace("openapi"))
}
self
},
#' To JSON string
#'
#' @description
#' To JSON String
#'
#' @return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter in JSON format
#' @export
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`values`)) {
sprintf(
'"values":
[%s]
',
paste(unlist(lapply(self$`values`, function(x) paste0('"', x, '"'))), collapse = ",")
)
}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
},
#' Deserialize JSON string into an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
#'
#' @description
#' Deserialize JSON string into an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
#'
#' @param input_json the JSON input
#' @return the instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
#' @export
fromJSONString = function(input_json) {
this_object <- jsonlite::fromJSON(input_json)
self$`values` <- ApiClient$new()$deserializeObj(this_object$`values`, "array[character]", loadNamespace("openapi"))
self
},
#' Validate JSON input with respect to TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
#'
#' @description
#' Validate JSON input with respect to TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter and throw an exception if invalid
#'
#' @param input the JSON input
#' @export
validateJSON = function(input) {
input_json <- jsonlite::fromJSON(input)
},
#' To string (JSON format)
#'
#' @description
#' To string (JSON format)
#'
#' @return String representation of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
#' @export
toString = function() {
self$toJSONString()
},
#' Return true if the values in all fields are valid.
#'
#' @description
#' Return true if the values in all fields are valid.
#'
#' @return true if the values in all fields are valid.
#' @export
isValid = function() {
TRUE
},
#' Return a list of invalid fields (if any).
#'
#' @description
#' Return a list of invalid fields (if any).
#'
#' @return A list of invalid fields (if any).
#' @export
getInvalidFields = function() {
invalid_fields <- list()
invalid_fields
},
#' Print the object
#'
#' @description
#' Print the object
#'
#' @export
print = function() {
print(jsonlite::prettify(self$toJSONString()))
invisible(self)
}
),
# Lock the class to prevent modifications to the method or field
lock_class = TRUE
)
## Uncomment below to unlock the class to allow modifications of the method or field
# TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter$unlock()
#
## Below is an example to define the print function
# TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter$set("public", "print", function(...) {
# print(jsonlite::prettify(self$toJSONString()))
# invisible(self)
# })
## Uncomment below to lock the class to prevent modifications to the method or field
# TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter$lock()

View File

@ -0,0 +1,130 @@
# R API client for openapi
Echo Server API
## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI spec](https://openapis.org) from a remote server, you can easily generate an API client.
- API version: 0.1.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.RClientCodegen
## Installation
### Prerequisites
Install the dependencies
```R
install.packages("jsonlite")
install.packages("httr")
install.packages("base64enc")
```
### Build the package
```sh
git clone https://github.com/GIT_USER_ID/GIT_REPO_ID
cd GIT_REPO_ID
R CMD build .
R CMD check openapi_1.0.0.tar.gz --no-manual
R CMD INSTALL --preclean openapi_1.0.0.tar.gz
```
### Install the package
```R
install.packages("openapi")
```
To install directly from Github, use `devtools`:
```R
install.packages("devtools")
library(devtools)
install_github("GIT_USER_ID/GIT_REPO_ID")
```
To install the package from a local file:
```R
install.packages("openapi_1.0.0.tar.gz", repos = NULL, type = "source")
```
### Usage
```R
library(openapi)
```
### Reformat code
To reformat code using [styler](https://styler.r-lib.org/index.html), please run the following in the R console:
```R
install.packages("remotes")
remotes::install_github("r-lib/styler@v1.7.0.9003")
library("styler")
style_dir()
```
## Documentation for API Endpoints
All URIs are relative to *http://localhost:3000*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AuthApi* | [**TestAuthHttpBasic**](docs/AuthApi.md#TestAuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication
*AuthApi* | [**TestAuthHttpBearer**](docs/AuthApi.md#TestAuthHttpBearer) | **POST** /auth/http/bearer | To test HTTP bearer authentication
*BodyApi* | [**TestBinaryGif**](docs/BodyApi.md#TestBinaryGif) | **POST** /binary/gif | Test binary (gif) response body
*BodyApi* | [**TestBodyApplicationOctetstreamBinary**](docs/BodyApi.md#TestBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
*BodyApi* | [**TestBodyMultipartFormdataArrayOfBinary**](docs/BodyApi.md#TestBodyMultipartFormdataArrayOfBinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
*BodyApi* | [**TestBodyMultipartFormdataSingleBinary**](docs/BodyApi.md#TestBodyMultipartFormdataSingleBinary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime
*BodyApi* | [**TestEchoBodyAllOfPet**](docs/BodyApi.md#TestEchoBodyAllOfPet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
*BodyApi* | [**TestEchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#TestEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
*BodyApi* | [**TestEchoBodyPet**](docs/BodyApi.md#TestEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s)
*BodyApi* | [**TestEchoBodyPetResponseString**](docs/BodyApi.md#TestEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body
*BodyApi* | [**TestEchoBodyTagResponseString**](docs/BodyApi.md#TestEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
*FormApi* | [**TestFormIntegerBooleanString**](docs/FormApi.md#TestFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s)
*FormApi* | [**TestFormOneof**](docs/FormApi.md#TestFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema
*HeaderApi* | [**TestHeaderIntegerBooleanStringEnums**](docs/HeaderApi.md#TestHeaderIntegerBooleanStringEnums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s)
*PathApi* | [**TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](docs/PathApi.md#TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s)
*QueryApi* | [**TestEnumRefString**](docs/QueryApi.md#TestEnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s)
*QueryApi* | [**TestQueryDatetimeDateString**](docs/QueryApi.md#TestQueryDatetimeDateString) | **GET** /query/datetime/date/string | Test query parameter(s)
*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* | [**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)
## Documentation for Models
- [Bird](docs/Bird.md)
- [Category](docs/Category.md)
- [DataQuery](docs/DataQuery.md)
- [DefaultValue](docs/DefaultValue.md)
- [NumberPropertiesOnly](docs/NumberPropertiesOnly.md)
- [Pet](docs/Pet.md)
- [Query](docs/Query.md)
- [StringEnumRef](docs/StringEnumRef.md)
- [Tag](docs/Tag.md)
- [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md)
- [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md)
## Documentation for Authorization
Authentication schemes defined for the API:
### http_auth
- **Type**: HTTP basic authentication
### http_bearer_auth
- **Type**: Bearer authentication
## Author
team@openapitools.org

View File

@ -0,0 +1,26 @@
#!/bin/bash
set -e
REPO=https://cloud.r-project.org
export R_LIBS_USER=$HOME/R
echo "R lib directory: $R_LIBS_USER"
mkdir $R_LIBS_USER || true
#Rscript -e "install.packages('jsonlite', repos='$REPO', lib='$R_LIBS_USER')"
#Rscript -e "install.packages('httr', repos='$REPO', lib='$R_LIBS_USER')"
#Rscript -e "install.packages('testthat', repos='$REPO', lib='$R_LIBS_USER')"
#Rscript -e "install.packages('R6', repos='$REPO', lib='$R_LIBS_USER')"
#Rscript -e "install.packages('base64enc', repos='$REPO', lib='$R_LIBS_USER')"
#Rscript -e "install.packages('rlang', repos='$REPO', lib='$R_LIBS_USER')"
#Rscript -e "install.packages('rjson', repos='$REPO', lib='$R_LIBS_USER')"
#Rscript -e "install.packages('devtools', repos='$REPO', lib='$R_LIBS_USER')"
#Rscript -e "install.packages('stringr', repos='$REPO', lib='$R_LIBS_USER')"
#Rscript -e "install.packages('lifecycle', repos='$REPO', lib='$R_LIBS_USER')"
#
R CMD build .
R CMD check *tar.gz --no-manual
R CMD install --preclean *tar.gz

View File

@ -0,0 +1,99 @@
# AuthApi
All URIs are relative to *http://localhost:3000*
Method | HTTP request | Description
------------- | ------------- | -------------
[**TestAuthHttpBasic**](AuthApi.md#TestAuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication
[**TestAuthHttpBearer**](AuthApi.md#TestAuthHttpBearer) | **POST** /auth/http/bearer | To test HTTP bearer authentication
# **TestAuthHttpBasic**
> character TestAuthHttpBasic()
To test HTTP basic authentication
To test HTTP basic authentication
### Example
```R
library(openapi)
# To test HTTP basic authentication
#
api_instance <- AuthApi$new()
# Configure HTTP basic authorization: http_auth
api_instance$api_client$username <- Sys.getenv("USERNAME")
api_instance$api_client$password <- Sys.getenv("PASSWORD")
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestAuthHttpBasic(data_file = "result.txt")
result <- api_instance$TestAuthHttpBasic()
dput(result)
```
### Parameters
This endpoint does not need any parameter.
### Return type
**character**
### Authorization
[http_auth](../README.md#http_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
# **TestAuthHttpBearer**
> character TestAuthHttpBearer()
To test HTTP bearer authentication
To test HTTP bearer authentication
### Example
```R
library(openapi)
# To test HTTP bearer authentication
#
api_instance <- AuthApi$new()
# Configure HTTP bearer authorization: http_bearer_auth
api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestAuthHttpBearer(data_file = "result.txt")
result <- api_instance$TestAuthHttpBearer()
dput(result)
```
### Parameters
This endpoint does not need any parameter.
### Return type
**character**
### Authorization
[http_bearer_auth](../README.md#http_bearer_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |

View File

@ -0,0 +1,10 @@
# openapi::Bird
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**size** | **character** | | [optional]
**color** | **character** | | [optional]

View File

@ -0,0 +1,435 @@
# BodyApi
All URIs are relative to *http://localhost:3000*
Method | HTTP request | Description
------------- | ------------- | -------------
[**TestBinaryGif**](BodyApi.md#TestBinaryGif) | **POST** /binary/gif | Test binary (gif) response body
[**TestBodyApplicationOctetstreamBinary**](BodyApi.md#TestBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
[**TestBodyMultipartFormdataArrayOfBinary**](BodyApi.md#TestBodyMultipartFormdataArrayOfBinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
[**TestBodyMultipartFormdataSingleBinary**](BodyApi.md#TestBodyMultipartFormdataSingleBinary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime
[**TestEchoBodyAllOfPet**](BodyApi.md#TestEchoBodyAllOfPet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
[**TestEchoBodyFreeFormObjectResponseString**](BodyApi.md#TestEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
[**TestEchoBodyPet**](BodyApi.md#TestEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s)
[**TestEchoBodyPetResponseString**](BodyApi.md#TestEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body
[**TestEchoBodyTagResponseString**](BodyApi.md#TestEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
# **TestBinaryGif**
> data.frame TestBinaryGif()
Test binary (gif) response body
Test binary (gif) response body
### Example
```R
library(openapi)
# Test binary (gif) response body
#
api_instance <- BodyApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestBinaryGif(data_file = "result.txt")
result <- api_instance$TestBinaryGif()
dput(result)
```
### Parameters
This endpoint does not need any parameter.
### Return type
**data.frame**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: image/gif
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
# **TestBodyApplicationOctetstreamBinary**
> character TestBodyApplicationOctetstreamBinary(body = var.body)
Test body parameter(s)
Test body parameter(s)
### Example
```R
library(openapi)
# Test body parameter(s)
#
# prepare function argument(s)
var_body <- File.new('/path/to/file') # data.frame | (Optional)
api_instance <- BodyApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestBodyApplicationOctetstreamBinary(body = var_bodydata_file = "result.txt")
result <- api_instance$TestBodyApplicationOctetstreamBinary(body = var_body)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **data.frame**| | [optional]
### Return type
**character**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/octet-stream
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
# **TestBodyMultipartFormdataArrayOfBinary**
> character TestBodyMultipartFormdataArrayOfBinary(files)
Test array of binary in multipart mime
Test array of binary in multipart mime
### Example
```R
library(openapi)
# Test array of binary in multipart mime
#
# prepare function argument(s)
var_files <- c(123) # array[data.frame] |
api_instance <- BodyApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestBodyMultipartFormdataArrayOfBinary(var_filesdata_file = "result.txt")
result <- api_instance$TestBodyMultipartFormdataArrayOfBinary(var_files)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**files** | list( **data.frame** )| |
### Return type
**character**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
# **TestBodyMultipartFormdataSingleBinary**
> character TestBodyMultipartFormdataSingleBinary(my_file = var.my_file)
Test single binary in multipart mime
Test single binary in multipart mime
### Example
```R
library(openapi)
# Test single binary in multipart mime
#
# prepare function argument(s)
var_my_file <- File.new('/path/to/file') # data.frame | (Optional)
api_instance <- BodyApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestBodyMultipartFormdataSingleBinary(my_file = var_my_filedata_file = "result.txt")
result <- api_instance$TestBodyMultipartFormdataSingleBinary(my_file = var_my_file)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**my_file** | **data.frame**| | [optional]
### Return type
**character**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
# **TestEchoBodyAllOfPet**
> Pet TestEchoBodyAllOfPet(pet = var.pet)
Test body parameter(s)
Test body parameter(s)
### Example
```R
library(openapi)
# Test body parameter(s)
#
# prepare function argument(s)
var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store (Optional)
api_instance <- BodyApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestEchoBodyAllOfPet(pet = var_petdata_file = "result.txt")
result <- api_instance$TestEchoBodyAllOfPet(pet = var_pet)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
### Return type
[**Pet**](Pet.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
# **TestEchoBodyFreeFormObjectResponseString**
> character TestEchoBodyFreeFormObjectResponseString(body = var.body)
Test free form object
Test free form object
### Example
```R
library(openapi)
# Test free form object
#
# prepare function argument(s)
var_body <- c(key = TODO) # object | Free form object (Optional)
api_instance <- BodyApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestEchoBodyFreeFormObjectResponseString(body = var_bodydata_file = "result.txt")
result <- api_instance$TestEchoBodyFreeFormObjectResponseString(body = var_body)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **object**| Free form object | [optional]
### Return type
**character**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
# **TestEchoBodyPet**
> Pet TestEchoBodyPet(pet = var.pet)
Test body parameter(s)
Test body parameter(s)
### Example
```R
library(openapi)
# Test body parameter(s)
#
# prepare function argument(s)
var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store (Optional)
api_instance <- BodyApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestEchoBodyPet(pet = var_petdata_file = "result.txt")
result <- api_instance$TestEchoBodyPet(pet = var_pet)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
### Return type
[**Pet**](Pet.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
# **TestEchoBodyPetResponseString**
> character TestEchoBodyPetResponseString(pet = var.pet)
Test empty response body
Test empty response body
### Example
```R
library(openapi)
# Test empty response body
#
# prepare function argument(s)
var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store (Optional)
api_instance <- BodyApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestEchoBodyPetResponseString(pet = var_petdata_file = "result.txt")
result <- api_instance$TestEchoBodyPetResponseString(pet = var_pet)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
### Return type
**character**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
# **TestEchoBodyTagResponseString**
> character TestEchoBodyTagResponseString(tag = var.tag)
Test empty json (request body)
Test empty json (request body)
### Example
```R
library(openapi)
# Test empty json (request body)
#
# prepare function argument(s)
var_tag <- Tag$new(123, "name_example") # Tag | Tag object (Optional)
api_instance <- BodyApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestEchoBodyTagResponseString(tag = var_tagdata_file = "result.txt")
result <- api_instance$TestEchoBodyTagResponseString(tag = var_tag)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**tag** | [**Tag**](Tag.md)| Tag object | [optional]
### Return type
**character**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |

View File

@ -0,0 +1,10 @@
# openapi::Category
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **integer** | | [optional]
**name** | **character** | | [optional]

View File

@ -0,0 +1,13 @@
# openapi::DataQuery
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **integer** | Query | [optional]
**outcomes** | **array[character]** | | [optional] [default to [SUCCESS, FAILURE]] [Enum: ]
**suffix** | **character** | test suffix | [optional]
**text** | **character** | Some text containing white spaces | [optional]
**date** | **character** | A date | [optional]

View File

@ -0,0 +1,17 @@
# openapi::DefaultValue
to test the default value of properties
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**array_string_enum_ref_default** | [**array[StringEnumRef]**](StringEnumRef.md) | | [optional] [default to [&quot;success&quot;,&quot;failure&quot;]]
**array_string_enum_default** | **array[character]** | | [optional] [default to [&quot;success&quot;,&quot;failure&quot;]] [Enum: ]
**array_string_default** | **array[character]** | | [optional] [default to [&quot;failure&quot;,&quot;skipped&quot;]]
**array_integer_default** | **array[integer]** | | [optional] [default to [1,3]]
**array_string** | **array[character]** | | [optional]
**array_string_nullable** | **array[character]** | | [optional]
**array_string_extension_nullable** | **array[character]** | | [optional]
**string_nullable** | **character** | | [optional]

View File

@ -0,0 +1,118 @@
# FormApi
All URIs are relative to *http://localhost:3000*
Method | HTTP request | Description
------------- | ------------- | -------------
[**TestFormIntegerBooleanString**](FormApi.md#TestFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s)
[**TestFormOneof**](FormApi.md#TestFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema
# **TestFormIntegerBooleanString**
> character TestFormIntegerBooleanString(integer_form = var.integer_form, boolean_form = var.boolean_form, string_form = var.string_form)
Test form parameter(s)
Test form parameter(s)
### Example
```R
library(openapi)
# Test form parameter(s)
#
# prepare function argument(s)
var_integer_form <- 56 # integer | (Optional)
var_boolean_form <- "boolean_form_example" # character | (Optional)
var_string_form <- "string_form_example" # character | (Optional)
api_instance <- FormApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestFormIntegerBooleanString(integer_form = var_integer_form, boolean_form = var_boolean_form, string_form = var_string_formdata_file = "result.txt")
result <- api_instance$TestFormIntegerBooleanString(integer_form = var_integer_form, boolean_form = var_boolean_form, string_form = var_string_form)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**integer_form** | **integer**| | [optional]
**boolean_form** | **character**| | [optional]
**string_form** | **character**| | [optional]
### Return type
**character**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
# **TestFormOneof**
> character TestFormOneof(form1 = var.form1, form2 = var.form2, form3 = var.form3, form4 = var.form4, id = var.id, name = var.name)
Test form parameter(s) for oneOf schema
Test form parameter(s) for oneOf schema
### Example
```R
library(openapi)
# Test form parameter(s) for oneOf schema
#
# prepare function argument(s)
var_form1 <- "form1_example" # character | (Optional)
var_form2 <- 56 # integer | (Optional)
var_form3 <- "form3_example" # character | (Optional)
var_form4 <- "form4_example" # character | (Optional)
var_id <- 56 # integer | (Optional)
var_name <- "name_example" # character | (Optional)
api_instance <- FormApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestFormOneof(form1 = var_form1, form2 = var_form2, form3 = var_form3, form4 = var_form4, id = var_id, name = var_namedata_file = "result.txt")
result <- api_instance$TestFormOneof(form1 = var_form1, form2 = var_form2, form3 = var_form3, form4 = var_form4, id = var_id, name = var_name)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**form1** | **character**| | [optional]
**form2** | **integer**| | [optional]
**form3** | **character**| | [optional]
**form4** | **character**| | [optional]
**id** | **integer**| | [optional]
**name** | **character**| | [optional]
### Return type
**character**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |

View File

@ -0,0 +1,64 @@
# HeaderApi
All URIs are relative to *http://localhost:3000*
Method | HTTP request | Description
------------- | ------------- | -------------
[**TestHeaderIntegerBooleanStringEnums**](HeaderApi.md#TestHeaderIntegerBooleanStringEnums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s)
# **TestHeaderIntegerBooleanStringEnums**
> character TestHeaderIntegerBooleanStringEnums(integer_header = var.integer_header, boolean_header = var.boolean_header, string_header = var.string_header, enum_nonref_string_header = var.enum_nonref_string_header, enum_ref_string_header = var.enum_ref_string_header)
Test header parameter(s)
Test header parameter(s)
### Example
```R
library(openapi)
# Test header parameter(s)
#
# prepare function argument(s)
var_integer_header <- 56 # integer | (Optional)
var_boolean_header <- "boolean_header_example" # character | (Optional)
var_string_header <- "string_header_example" # character | (Optional)
var_enum_nonref_string_header <- "enum_nonref_string_header_example" # character | (Optional)
var_enum_ref_string_header <- StringEnumRef$new() # StringEnumRef | (Optional)
api_instance <- HeaderApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestHeaderIntegerBooleanStringEnums(integer_header = var_integer_header, boolean_header = var_boolean_header, string_header = var_string_header, enum_nonref_string_header = var_enum_nonref_string_header, enum_ref_string_header = var_enum_ref_string_headerdata_file = "result.txt")
result <- api_instance$TestHeaderIntegerBooleanStringEnums(integer_header = var_integer_header, boolean_header = var_boolean_header, string_header = var_string_header, enum_nonref_string_header = var_enum_nonref_string_header, enum_ref_string_header = var_enum_ref_string_header)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**integer_header** | **integer**| | [optional]
**boolean_header** | **character**| | [optional]
**string_header** | **character**| | [optional]
**enum_nonref_string_header** | Enum [success, failure, unclassified] | | [optional]
**enum_ref_string_header** | [**StringEnumRef**](.md)| | [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 | - |

View File

@ -0,0 +1,11 @@
# openapi::NumberPropertiesOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**number** | **numeric** | | [optional]
**float** | **numeric** | | [optional]
**double** | **numeric** | | [optional] [Max: 50.2] [Min: 0.8]

View File

@ -0,0 +1,62 @@
# PathApi
All URIs are relative to *http://localhost:3000*
Method | HTTP request | Description
------------- | ------------- | -------------
[**TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](PathApi.md#TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s)
# **TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**
> character TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path)
Test path parameter(s)
Test path parameter(s)
### Example
```R
library(openapi)
# Test path parameter(s)
#
# prepare function argument(s)
var_path_string <- "path_string_example" # character |
var_path_integer <- 56 # integer |
var_enum_nonref_string_path <- "enum_nonref_string_path_example" # character |
var_enum_ref_string_path <- StringEnumRef$new() # StringEnumRef |
api_instance <- PathApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(var_path_string, var_path_integer, var_enum_nonref_string_path, var_enum_ref_string_pathdata_file = "result.txt")
result <- api_instance$TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(var_path_string, var_path_integer, var_enum_nonref_string_path, var_enum_ref_string_path)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**path_string** | **character**| |
**path_integer** | **integer**| |
**enum_nonref_string_path** | Enum [success, failure, unclassified] | |
**enum_ref_string_path** | [**StringEnumRef**](.md)| |
### 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 | - |

View File

@ -0,0 +1,14 @@
# openapi::Pet
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **integer** | | [optional]
**name** | **character** | |
**category** | [**Category**](Category.md) | | [optional]
**photoUrls** | **array[character]** | |
**tags** | [**array[Tag]**](Tag.md) | | [optional]
**status** | **character** | pet status in the store | [optional] [Enum: [available, pending, sold]]

View File

@ -0,0 +1,10 @@
# openapi::Query
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **integer** | Query | [optional]
**outcomes** | **array[character]** | | [optional] [default to [&quot;SUCCESS&quot;,&quot;FAILURE&quot;]] [Enum: ]

View File

@ -0,0 +1,402 @@
# QueryApi
All URIs are relative to *http://localhost:3000*
Method | HTTP request | Description
------------- | ------------- | -------------
[**TestEnumRefString**](QueryApi.md#TestEnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s)
[**TestQueryDatetimeDateString**](QueryApi.md#TestQueryDatetimeDateString) | **GET** /query/datetime/date/string | Test query parameter(s)
[**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)
[**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)
# **TestEnumRefString**
> character TestEnumRefString(enum_nonref_string_query = var.enum_nonref_string_query, enum_ref_string_query = var.enum_ref_string_query)
Test query parameter(s)
Test query parameter(s)
### Example
```R
library(openapi)
# Test query parameter(s)
#
# prepare function argument(s)
var_enum_nonref_string_query <- "enum_nonref_string_query_example" # character | (Optional)
var_enum_ref_string_query <- StringEnumRef$new() # StringEnumRef | (Optional)
api_instance <- QueryApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestEnumRefString(enum_nonref_string_query = var_enum_nonref_string_query, enum_ref_string_query = var_enum_ref_string_querydata_file = "result.txt")
result <- api_instance$TestEnumRefString(enum_nonref_string_query = var_enum_nonref_string_query, enum_ref_string_query = var_enum_ref_string_query)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**enum_nonref_string_query** | Enum [success, failure, unclassified] | | [optional]
**enum_ref_string_query** | [**StringEnumRef**](.md)| | [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 | - |
# **TestQueryDatetimeDateString**
> character TestQueryDatetimeDateString(datetime_query = var.datetime_query, date_query = var.date_query, string_query = var.string_query)
Test query parameter(s)
Test query parameter(s)
### Example
```R
library(openapi)
# Test query parameter(s)
#
# prepare function argument(s)
var_datetime_query <- "datetime_query_example" # character | (Optional)
var_date_query <- "date_query_example" # character | (Optional)
var_string_query <- "string_query_example" # 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$TestQueryDatetimeDateString(datetime_query = var_datetime_query, date_query = var_date_query, string_query = var_string_querydata_file = "result.txt")
result <- api_instance$TestQueryDatetimeDateString(datetime_query = var_datetime_query, date_query = var_date_query, string_query = var_string_query)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**datetime_query** | **character**| | [optional]
**date_query** | **character**| | [optional]
**string_query** | **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 | - |
# **TestQueryIntegerBooleanString**
> character TestQueryIntegerBooleanString(integer_query = var.integer_query, boolean_query = var.boolean_query, string_query = var.string_query)
Test query parameter(s)
Test query parameter(s)
### Example
```R
library(openapi)
# Test query parameter(s)
#
# prepare function argument(s)
var_integer_query <- 56 # integer | (Optional)
var_boolean_query <- "boolean_query_example" # character | (Optional)
var_string_query <- "string_query_example" # 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$TestQueryIntegerBooleanString(integer_query = var_integer_query, boolean_query = var_boolean_query, string_query = var_string_querydata_file = "result.txt")
result <- api_instance$TestQueryIntegerBooleanString(integer_query = var_integer_query, boolean_query = var_boolean_query, string_query = var_string_query)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**integer_query** | **integer**| | [optional]
**boolean_query** | **character**| | [optional]
**string_query** | **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 | - |
# **TestQueryStyleDeepObjectExplodeTrueObject**
> character TestQueryStyleDeepObjectExplodeTrueObject(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 <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | (Optional)
api_instance <- QueryApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestQueryStyleDeepObjectExplodeTrueObject(query_object = var_query_objectdata_file = "result.txt")
result <- api_instance$TestQueryStyleDeepObjectExplodeTrueObject(query_object = var_query_object)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**query_object** | [**Pet**](.md)| | [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 | - |
# **TestQueryStyleDeepObjectExplodeTrueObjectAllOf**
> character TestQueryStyleDeepObjectExplodeTrueObjectAllOf(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 <- test_query_style_deepObject_explode_true_object_allOf_query_object_parameter$new("size_example", "color_example", 123, "name_example") # TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter | (Optional)
api_instance <- QueryApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestQueryStyleDeepObjectExplodeTrueObjectAllOf(query_object = var_query_objectdata_file = "result.txt")
result <- api_instance$TestQueryStyleDeepObjectExplodeTrueObjectAllOf(query_object = var_query_object)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**query_object** | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter**](.md)| | [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)
Test query parameter(s)
Test query parameter(s)
### Example
```R
library(openapi)
# Test query parameter(s)
#
# prepare function argument(s)
var_query_object <- test_query_style_form_explode_true_array_string_query_object_parameter$new(c("values_example")) # TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter | (Optional)
api_instance <- QueryApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestQueryStyleFormExplodeTrueArrayString(query_object = var_query_objectdata_file = "result.txt")
result <- api_instance$TestQueryStyleFormExplodeTrueArrayString(query_object = var_query_object)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**query_object** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](.md)| | [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 | - |
# **TestQueryStyleFormExplodeTrueObject**
> character TestQueryStyleFormExplodeTrueObject(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 <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | (Optional)
api_instance <- QueryApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestQueryStyleFormExplodeTrueObject(query_object = var_query_objectdata_file = "result.txt")
result <- api_instance$TestQueryStyleFormExplodeTrueObject(query_object = var_query_object)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**query_object** | [**Pet**](.md)| | [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 | - |
# **TestQueryStyleFormExplodeTrueObjectAllOf**
> character TestQueryStyleFormExplodeTrueObjectAllOf(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 <- DataQuery$new(123, c("SUCCESS"), "suffix_example", "text_example", "date_example") # DataQuery | (Optional)
api_instance <- QueryApi$new()
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$TestQueryStyleFormExplodeTrueObjectAllOf(query_object = var_query_objectdata_file = "result.txt")
result <- api_instance$TestQueryStyleFormExplodeTrueObjectAllOf(query_object = var_query_object)
dput(result)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**query_object** | [**DataQuery**](.md)| | [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 | - |

View File

@ -0,0 +1,8 @@
# openapi::StringEnumRef
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

View File

@ -0,0 +1,10 @@
# openapi::Tag
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **integer** | | [optional]
**name** | **character** | | [optional]

View File

@ -0,0 +1,12 @@
# openapi::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**size** | **character** | | [optional]
**color** | **character** | | [optional]
**id** | **integer** | | [optional]
**name** | **character** | | [optional]

View File

@ -0,0 +1,9 @@
# openapi::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**values** | **array[character]** | | [optional]

View File

@ -0,0 +1,57 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=$(git remote)
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -0,0 +1,4 @@
library(testthat)
library(openapi)
test_check("openapi")

View File

@ -0,0 +1,28 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test AuthApi")
api_instance <- AuthApi$new()
test_that("TestAuthHttpBasic", {
# tests for TestAuthHttpBasic
# base path: http://localhost:3000
# To test HTTP basic authentication
# To test HTTP basic authentication
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestAuthHttpBearer", {
# tests for TestAuthHttpBearer
# base path: http://localhost:3000
# To test HTTP bearer authentication
# To test HTTP bearer authentication
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})

View File

@ -0,0 +1,20 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test Bird")
model_instance <- Bird$new()
test_that("size", {
# tests for the property `size` (character)
# uncomment below to test the property
#expect_equal(model.instance$`size`, "EXPECTED_RESULT")
})
test_that("color", {
# tests for the property `color` (character)
# uncomment below to test the property
#expect_equal(model.instance$`color`, "EXPECTED_RESULT")
})

View File

@ -0,0 +1,113 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test BodyApi")
api_instance <- BodyApi$new()
test_that("TestBinaryGif", {
# tests for TestBinaryGif
# base path: http://localhost:3000
# Test binary (gif) response body
# Test binary (gif) response body
# @return [data.frame]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestBodyApplicationOctetstreamBinary", {
# tests for TestBodyApplicationOctetstreamBinary
# base path: http://localhost:3000
# Test body parameter(s)
# Test body parameter(s)
# @param body data.frame (optional)
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestBodyMultipartFormdataArrayOfBinary", {
# tests for TestBodyMultipartFormdataArrayOfBinary
# base path: http://localhost:3000
# Test array of binary in multipart mime
# Test array of binary in multipart mime
# @param files array[data.frame]
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestBodyMultipartFormdataSingleBinary", {
# tests for TestBodyMultipartFormdataSingleBinary
# base path: http://localhost:3000
# Test single binary in multipart mime
# Test single binary in multipart mime
# @param my_file data.frame (optional)
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestEchoBodyAllOfPet", {
# tests for TestEchoBodyAllOfPet
# base path: http://localhost:3000
# Test body parameter(s)
# Test body parameter(s)
# @param pet Pet Pet object that needs to be added to the store (optional)
# @return [Pet]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestEchoBodyFreeFormObjectResponseString", {
# tests for TestEchoBodyFreeFormObjectResponseString
# base path: http://localhost:3000
# Test free form object
# Test free form object
# @param body object Free form object (optional)
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestEchoBodyPet", {
# tests for TestEchoBodyPet
# base path: http://localhost:3000
# Test body parameter(s)
# Test body parameter(s)
# @param pet Pet Pet object that needs to be added to the store (optional)
# @return [Pet]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestEchoBodyPetResponseString", {
# tests for TestEchoBodyPetResponseString
# base path: http://localhost:3000
# Test empty response body
# Test empty response body
# @param pet Pet Pet object that needs to be added to the store (optional)
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestEchoBodyTagResponseString", {
# tests for TestEchoBodyTagResponseString
# base path: http://localhost:3000
# Test empty json (request body)
# Test empty json (request body)
# @param tag Tag Tag object (optional)
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})

View File

@ -0,0 +1,20 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test Category")
model_instance <- Category$new()
test_that("id", {
# tests for the property `id` (integer)
# uncomment below to test the property
#expect_equal(model.instance$`id`, "EXPECTED_RESULT")
})
test_that("name", {
# tests for the property `name` (character)
# uncomment below to test the property
#expect_equal(model.instance$`name`, "EXPECTED_RESULT")
})

View File

@ -0,0 +1,45 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test DataQuery")
model_instance <- DataQuery$new()
test_that("id", {
# tests for the property `id` (integer)
# Query
# uncomment below to test the property
#expect_equal(model.instance$`id`, "EXPECTED_RESULT")
})
test_that("outcomes", {
# tests for the property `outcomes` (array[character])
# uncomment below to test the property
#expect_equal(model.instance$`outcomes`, "EXPECTED_RESULT")
})
test_that("suffix", {
# tests for the property `suffix` (character)
# test suffix
# uncomment below to test the property
#expect_equal(model.instance$`suffix`, "EXPECTED_RESULT")
})
test_that("text", {
# tests for the property `text` (character)
# Some text containing white spaces
# uncomment below to test the property
#expect_equal(model.instance$`text`, "EXPECTED_RESULT")
})
test_that("date", {
# tests for the property `date` (character)
# A date
# uncomment below to test the property
#expect_equal(model.instance$`date`, "EXPECTED_RESULT")
})

View File

@ -0,0 +1,62 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test DefaultValue")
model_instance <- DefaultValue$new()
test_that("array_string_enum_ref_default", {
# tests for the property `array_string_enum_ref_default` (array[StringEnumRef])
# uncomment below to test the property
#expect_equal(model.instance$`array_string_enum_ref_default`, "EXPECTED_RESULT")
})
test_that("array_string_enum_default", {
# tests for the property `array_string_enum_default` (array[character])
# uncomment below to test the property
#expect_equal(model.instance$`array_string_enum_default`, "EXPECTED_RESULT")
})
test_that("array_string_default", {
# tests for the property `array_string_default` (array[character])
# uncomment below to test the property
#expect_equal(model.instance$`array_string_default`, "EXPECTED_RESULT")
})
test_that("array_integer_default", {
# tests for the property `array_integer_default` (array[integer])
# uncomment below to test the property
#expect_equal(model.instance$`array_integer_default`, "EXPECTED_RESULT")
})
test_that("array_string", {
# tests for the property `array_string` (array[character])
# uncomment below to test the property
#expect_equal(model.instance$`array_string`, "EXPECTED_RESULT")
})
test_that("array_string_nullable", {
# tests for the property `array_string_nullable` (array[character])
# uncomment below to test the property
#expect_equal(model.instance$`array_string_nullable`, "EXPECTED_RESULT")
})
test_that("array_string_extension_nullable", {
# tests for the property `array_string_extension_nullable` (array[character])
# uncomment below to test the property
#expect_equal(model.instance$`array_string_extension_nullable`, "EXPECTED_RESULT")
})
test_that("string_nullable", {
# tests for the property `string_nullable` (character)
# uncomment below to test the property
#expect_equal(model.instance$`string_nullable`, "EXPECTED_RESULT")
})

View File

@ -0,0 +1,37 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test FormApi")
api_instance <- FormApi$new()
test_that("TestFormIntegerBooleanString", {
# tests for TestFormIntegerBooleanString
# base path: http://localhost:3000
# Test form parameter(s)
# Test form parameter(s)
# @param integer_form integer (optional)
# @param boolean_form character (optional)
# @param string_form character (optional)
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestFormOneof", {
# tests for TestFormOneof
# base path: http://localhost:3000
# Test form parameter(s) for oneOf schema
# Test form parameter(s) for oneOf schema
# @param form1 character (optional)
# @param form2 integer (optional)
# @param form3 character (optional)
# @param form4 character (optional)
# @param id integer (optional)
# @param name character (optional)
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})

View File

@ -0,0 +1,22 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test HeaderApi")
api_instance <- HeaderApi$new()
test_that("TestHeaderIntegerBooleanStringEnums", {
# tests for TestHeaderIntegerBooleanStringEnums
# base path: http://localhost:3000
# Test header parameter(s)
# Test header parameter(s)
# @param integer_header integer (optional)
# @param boolean_header character (optional)
# @param string_header character (optional)
# @param enum_nonref_string_header character (optional)
# @param enum_ref_string_header StringEnumRef (optional)
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})

View File

@ -0,0 +1,27 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test NumberPropertiesOnly")
model_instance <- NumberPropertiesOnly$new()
test_that("number", {
# tests for the property `number` (numeric)
# uncomment below to test the property
#expect_equal(model.instance$`number`, "EXPECTED_RESULT")
})
test_that("float", {
# tests for the property `float` (numeric)
# uncomment below to test the property
#expect_equal(model.instance$`float`, "EXPECTED_RESULT")
})
test_that("double", {
# tests for the property `double` (numeric)
# uncomment below to test the property
#expect_equal(model.instance$`double`, "EXPECTED_RESULT")
})

View File

@ -0,0 +1,21 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test PathApi")
api_instance <- PathApi$new()
test_that("TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath", {
# tests for TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath
# base path: http://localhost:3000
# Test path parameter(s)
# Test path parameter(s)
# @param path_string character
# @param path_integer integer
# @param enum_nonref_string_path character
# @param enum_ref_string_path StringEnumRef
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})

View File

@ -0,0 +1,49 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test Pet")
model_instance <- Pet$new()
test_that("id", {
# tests for the property `id` (integer)
# uncomment below to test the property
#expect_equal(model.instance$`id`, "EXPECTED_RESULT")
})
test_that("name", {
# tests for the property `name` (character)
# uncomment below to test the property
#expect_equal(model.instance$`name`, "EXPECTED_RESULT")
})
test_that("category", {
# tests for the property `category` (Category)
# uncomment below to test the property
#expect_equal(model.instance$`category`, "EXPECTED_RESULT")
})
test_that("photoUrls", {
# tests for the property `photoUrls` (array[character])
# uncomment below to test the property
#expect_equal(model.instance$`photoUrls`, "EXPECTED_RESULT")
})
test_that("tags", {
# tests for the property `tags` (array[Tag])
# uncomment below to test the property
#expect_equal(model.instance$`tags`, "EXPECTED_RESULT")
})
test_that("status", {
# tests for the property `status` (character)
# pet status in the store
# uncomment below to test the property
#expect_equal(model.instance$`status`, "EXPECTED_RESULT")
})

View File

@ -0,0 +1,21 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test Query")
model_instance <- Query$new()
test_that("id", {
# tests for the property `id` (integer)
# Query
# uncomment below to test the property
#expect_equal(model.instance$`id`, "EXPECTED_RESULT")
})
test_that("outcomes", {
# tests for the property `outcomes` (array[character])
# uncomment below to test the property
#expect_equal(model.instance$`outcomes`, "EXPECTED_RESULT")
})

View File

@ -0,0 +1,107 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test QueryApi")
api_instance <- QueryApi$new()
test_that("TestEnumRefString", {
# tests for TestEnumRefString
# base path: http://localhost:3000
# Test query parameter(s)
# Test query parameter(s)
# @param enum_nonref_string_query character (optional)
# @param enum_ref_string_query StringEnumRef (optional)
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestQueryDatetimeDateString", {
# tests for TestQueryDatetimeDateString
# base path: http://localhost:3000
# Test query parameter(s)
# Test query parameter(s)
# @param datetime_query character (optional)
# @param date_query character (optional)
# @param string_query character (optional)
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestQueryIntegerBooleanString", {
# tests for TestQueryIntegerBooleanString
# base path: http://localhost:3000
# Test query parameter(s)
# Test query parameter(s)
# @param integer_query integer (optional)
# @param boolean_query character (optional)
# @param string_query character (optional)
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestQueryStyleDeepObjectExplodeTrueObject", {
# tests for TestQueryStyleDeepObjectExplodeTrueObject
# base path: http://localhost:3000
# Test query parameter(s)
# Test query parameter(s)
# @param query_object Pet (optional)
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestQueryStyleDeepObjectExplodeTrueObjectAllOf", {
# tests for TestQueryStyleDeepObjectExplodeTrueObjectAllOf
# base path: http://localhost:3000
# Test query parameter(s)
# Test query parameter(s)
# @param query_object TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter (optional)
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestQueryStyleFormExplodeTrueArrayString", {
# tests for TestQueryStyleFormExplodeTrueArrayString
# base path: http://localhost:3000
# Test query parameter(s)
# Test query parameter(s)
# @param query_object TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter (optional)
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestQueryStyleFormExplodeTrueObject", {
# tests for TestQueryStyleFormExplodeTrueObject
# base path: http://localhost:3000
# Test query parameter(s)
# Test query parameter(s)
# @param query_object Pet (optional)
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})
test_that("TestQueryStyleFormExplodeTrueObjectAllOf", {
# tests for TestQueryStyleFormExplodeTrueObjectAllOf
# base path: http://localhost:3000
# Test query parameter(s)
# Test query parameter(s)
# @param query_object DataQuery (optional)
# @return [character]
# uncomment below to test the operation
#expect_equal(result, "EXPECTED_RESULT")
})

View File

@ -0,0 +1,4 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test StringEnumRef")

View File

@ -0,0 +1,20 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test Tag")
model_instance <- Tag$new()
test_that("id", {
# tests for the property `id` (integer)
# uncomment below to test the property
#expect_equal(model.instance$`id`, "EXPECTED_RESULT")
})
test_that("name", {
# tests for the property `name` (character)
# uncomment below to test the property
#expect_equal(model.instance$`name`, "EXPECTED_RESULT")
})

View File

@ -0,0 +1,34 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter")
model_instance <- TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter$new()
test_that("size", {
# tests for the property `size` (character)
# uncomment below to test the property
#expect_equal(model.instance$`size`, "EXPECTED_RESULT")
})
test_that("color", {
# tests for the property `color` (character)
# uncomment below to test the property
#expect_equal(model.instance$`color`, "EXPECTED_RESULT")
})
test_that("id", {
# tests for the property `id` (integer)
# uncomment below to test the property
#expect_equal(model.instance$`id`, "EXPECTED_RESULT")
})
test_that("name", {
# tests for the property `name` (character)
# uncomment below to test the property
#expect_equal(model.instance$`name`, "EXPECTED_RESULT")
})

View File

@ -0,0 +1,13 @@
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter")
model_instance <- TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter$new()
test_that("values", {
# tests for the property `values` (array[character])
# uncomment below to test the property
#expect_equal(model.instance$`values`, "EXPECTED_RESULT")
})