All Downloads are FREE. Search and download functionalities are using the official Maven repository.

r.api_doc.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
# {{classname}}{{#description}}
{{.}}{{/description}}

All URIs are relative to *{{basePath}}*

Method | HTTP request | Description
------------- | ------------- | -------------
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}}
{{/operation}}{{/operations}}

{{#operations}}
{{#operation}}
# **{{operationId}}**
> {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-first}}{{#requiredParams.0}}, {{/requiredParams.0}}{{/-first}}{{{paramName}}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{^defaultValue}} = var.{{{paramName}}}{{/defaultValue}}{{^-last}}, {{/-last}}{{/optionalParams}})

{{{summary}}}{{#notes}}

{{{.}}}{{/notes}}

### Example
```R
library({{{packageName}}})

{{#summary}}
# {{{.}}}
#
{{/summary}}
{{#allParams}}
{{#-first}}
# prepare function argument(s)
{{/-first}}
var_{{{paramName}}} <- {{{vendorExtensions.x-r-example}}} # {{{dataType}}} | {{{description}}}{{^required}} (Optional){{/required}}
{{/allParams}}

{{#generateWrapper}}
api_instance <- {{#lambda.lowercase}}{{{packageName}}}{{/lambda.lowercase}}_api$new()
{{/generateWrapper}}
{{^generateWrapper}}
api_instance <- {{{classname}}}$new()
{{/generateWrapper}}
{{#hasAuthMethods}}
{{#authMethods}}
{{#isBasic}}
{{#isBasicBasic}}
# Configure HTTP basic authorization: {{{name}}}
{{^-first}}# {{/-first}}api_instance$api_client$username <- Sys.getenv("USERNAME")
{{^-first}}# {{/-first}}api_instance$api_client$password <- Sys.getenv("PASSWORD")
{{/isBasicBasic}}
{{#isBasicBearer}}
# Configure HTTP bearer authorization: {{{name}}}
{{^-first}}# {{/-first}}api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
{{/isBasicBearer}}
{{/isBasic}}
{{#isApiKey}}
# Configure API key authorization: {{{name}}}
{{^-first}}# {{/-first}}api_instance$api_client$api_keys["{{{keyParamName}}}"] <- Sys.getenv("API_KEY")
{{/isApiKey}}
{{#isOAuth}}
# Configure OAuth2 access token for authorization: {{{name}}}
{{^-first}}# {{/-first}}api_instance$api_client$access_token <- Sys.getenv("ACCESS_TOKEN")
{{/isOAuth}}
{{/authMethods}}
{{/hasAuthMethods}}
{{#returnExceptionOnFailure}}
{{#useRlangExceptionHandling}}
result <- tryCatch(
             {{#returnType}}
             # to save the result into a file, simply add the optional `data_file` parameter, e.g.
             # api_instance{{#generateWrapper}}${{#lambda.snakecase}}{{{classname}}}{{/lambda.snakecase}}{{/generateWrapper}}${{{operationId}}}({{#requiredParams}}var_{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-first}}{{#requiredParams.0}}, {{/requiredParams.0}}{{/-first}}{{{paramName}}} = var_{{{paramName}}}{{^-last}}, {{/-last}}{{/optionalParams}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}data_file = "result.txt"),
             {{#vendorExtensions.x-streaming}}
             # this endpoint supports data streaming via a callback function using the optional `stream_callback` parameter, e.g.
             # api_instance{{#generateWrapper}}${{#lambda.snakecase}}{{{classname}}}{{/lambda.snakecase}}{{/generateWrapper}}${{{operationId}}}({{#requiredParams}}var_{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-first}}{{#requiredParams.0}}, {{/requiredParams.0}}{{/-first}}{{{paramName}}} = var_{{{paramName}}}{{^-last}}, {{/-last}}{{/optionalParams}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}stream_callback = function(x){ print(length(x)) }),
             {{/vendorExtensions.x-streaming}}
             {{/returnType}}
             api_instance{{#generateWrapper}}${{#lambda.snakecase}}{{{classname}}}{{/lambda.snakecase}}{{/generateWrapper}}${{{operationId}}}({{#requiredParams}}var_{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-first}}{{#requiredParams.0}}, {{/requiredParams.0}}{{/-first}}{{{paramName}}} = var_{{{paramName}}}{{^-last}}, {{/-last}}{{/optionalParams}}),
             ApiException = function(ex) ex
          )
# In case of error, print the error object
if (!is.null(result$ApiException)) {
  print("Exception occurs when calling `{{{operationId}}}`:")
  dput(result$ApiException$toString())
  {{#errorObjectType}}
  # error object
  dput(result$ApiException$error_object$toJSONString())
  {{/errorObjectType}}
}{{#returnType}} else {
  # deserialized response object
  print("The response is ...")
  dput(result$toString())
}
{{/returnType}}

{{^returnType}}
# This endpoint doesn't return data
{{/returnType}}
{{/useRlangExceptionHandling}}
{{/returnExceptionOnFailure}}
{{^useRlangExceptionHandling}}
{{#returnType}}
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance${{{operationId}}}({{#requiredParams}}var_{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-first}}{{#requiredParams.0}}, {{/requiredParams.0}}{{/-first}}{{{paramName}}} = var_{{{paramName}}}{{^-last}}, {{/-last}}{{/optionalParams}}data_file = "result.txt")
{{/returnType}}
{{#vendorExtensions.x-streaming}}
# this endpoint supports data streaming via a callback function using the optional `stream_callback` parameter, e.g.
# api_instance${{{operationId}}}({{#requiredParams}}var_{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-first}}{{#requiredParams.0}}, {{/requiredParams.0}}{{/-first}}{{{paramName}}} = var_{{{paramName}}}{{^-last}}, {{/-last}}{{/optionalParams}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}stream_callback = function(x){ print(length(x)) })
{{/vendorExtensions.x-streaming}}
{{#returnType}}result <- {{/returnType}}api_instance{{#generateWrapper}}${{#lambda.snakecase}}{{{classname}}}{{/lambda.snakecase}}{{/generateWrapper}}${{{operationId}}}({{#requiredParams}}var_{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-first}}{{#requiredParams.0}}, {{/requiredParams.0}}{{/-first}}{{{paramName}}} = var_{{{paramName}}}{{^-last}}, {{/-last}}{{/optionalParams}})
{{#returnType}}
dput(result)
{{/returnType}}
{{/useRlangExceptionHandling}}
```

### Parameters
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
{{#allParams}} **{{paramName}}** | {{#isEnum}}Enum {{#allowableValues}}{{values}}{{/allowableValues}} {{/isEnum}}{{^isEnum}}{{#isContainer}}{{#isArray}}{{#items}}{{#isPrimitiveType}}list( **{{dataType}}** ){{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}list( [**{{dataType}}**]({{baseType}}.md) ){{/isFile}}{{/isPrimitiveType}}{{/items}}{{/isArray}}{{#isMap}}{{#isPrimitiveType}}named list( **{{dataType}}** ){{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}named list( [**{{dataType}}**]({{baseType}}.md) ){{/isFile}}{{/isPrimitiveType}}{{/isMap}}{{/isContainer}}{{^isContainer}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}{{/isContainer}}{{/isEnum}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{.}}]{{/defaultValue}}
{{/allParams}}

### Return type

{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}}

### Authorization

{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}}

### HTTP request headers

 - **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
 - **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}}

{{#responses.0}}
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
{{#responses}}
| **{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}} 
{{/headers}}{{^headers.0}} - {{/headers.0}} | {{/responses}} {{/responses.0}} {{/operation}} {{/operations}}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy