r.libraries.httr2.api_wrapper.mustache Maven / Gradle / Ivy
{{>partial_header}}
#' {{{packageName}}} API Class
#'
#' A single point of access to the {{{packageName}}} API.
#'
#' 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 api_client API client
{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}
{{#-first}}
#' @field {{#lambda.snakecase}}{{classname}}{{/lambda.snakecase}} an instance of {{classname}}
{{/-first}}
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}
{{#useRlangExceptionHandling}}
#' @importFrom rlang abort
{{/useRlangExceptionHandling}}
#' @export
{{#lambda.lowercase}}{{{packageName}}}{{/lambda.lowercase}}_api <- R6::R6Class(
"{{#lambda.lowercase}}{{{packageName}}}{{/lambda.lowercase}}_api",
public = list(
api_client = NULL,
{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}
{{#-first}}
{{#lambda.snakecase}}{{classname}}{{/lambda.snakecase}} = NULL,
{{/-first}}
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}
#' Initialize a new {{{packageName}}} API Class.
#'
#' @description
#' Initialize a new {{{packageName}}} API Class.
#'
#' @param api_client An instance of API client (optional).
#' @export
initialize = function(api_client) {
if (missing(api_client)) {
self$api_client <- ApiClient$new()
} else {
self$api_client <- api_client
}
{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}
{{#-first}}
self${{#lambda.snakecase}}{{classname}}{{/lambda.snakecase}} <- {{{classname}}}$new(self$api_client)
{{/-first}}
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}
}
)
)