templates/api_doc.mustache in dropbox-sign-1.5.0 vs templates/api_doc.mustache in dropbox-sign-1.6.0

- old
+ new

@@ -6,36 +6,118 @@ | Method | HTTP request | Description | | ------ | ------------ | ----------- | {{#operations}} {{#operation}} +{{^useCustomTemplateCode}} +| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} | +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} | [`{{operationId}}`]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** `{{path}}` | {{summary}} | +{{/useCustomTemplateCode}} {{/operation}} {{/operations}} {{#operations}} {{#operation}} +{{^useCustomTemplateCode}} +## {{operationId}} + +> {{#returnType}}{{#returnTypeIsPrimitive}}{{returnType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}<{{{returnType}}}>{{/returnTypeIsPrimitive}} {{/returnType}}{{operationId}}{{#hasParams}}({{^vendorExtensions.x-group-parameters}}{{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}opts{{/vendorExtensions.x-group-parameters}}){{/hasParams}} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} ## `{{operationId}}` > `{{#returnType}}{{#returnTypeIsPrimitive}}{{returnType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}<{{{returnType}}}>{{/returnTypeIsPrimitive}} {{/returnType}}{{operationId}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}` +{{/useCustomTemplateCode}} {{{summary}}}{{#notes}} {{{.}}}{{/notes}} ### Examples ```ruby +{{^useCustomTemplateCode}} +require 'time' +require '{{{gemName}}}' +{{#hasAuthMethods}} +# setup authorization +{{{moduleName}}}.configure do |config|{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + # Configure HTTP basic authorization: {{{name}}} + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD'{{/isBasicBasic}}{{#isBasicBearer}} + # Configure Bearer authorization{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}: {{{name}}} + config.access_token = 'YOUR_BEARER_TOKEN'{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + # Configure API key authorization: {{{name}}} + config.api_key['{{{name}}}'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['{{{name}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}} + # Configure OAuth2 access token for authorization: {{{name}}} + config.access_token = 'YOUR ACCESS TOKEN'{{/isOAuth}} +{{/authMethods}}end +{{/hasAuthMethods}} + +api_instance = {{{moduleName}}}::{{{classname}}}.new +{{^vendorExtensions.x-group-parameters}} +{{#requiredParams}} +{{{paramName}}} = {{{vendorExtensions.x-ruby-example}}} # {{{dataType}}} | {{{description}}} +{{/requiredParams}} +{{#optionalParams}} +{{#-first}} +opts = { +{{/-first}} + {{{paramName}}}: {{{vendorExtensions.x-ruby-example}}}{{^-last}},{{/-last}} # {{{dataType}}} | {{{description}}} +{{#-last}} +} +{{/-last}} +{{/optionalParams}} +{{/vendorExtensions.x-group-parameters}} +{{#vendorExtensions.x-group-parameters}} +{{#hasParams}} +opts = { +{{#requiredParams}} + {{{paramName}}}: {{{vendorExtensions.x-ruby-example}}}, # {{{dataType}}} | {{{description}}} (required) +{{/requiredParams}} +{{#optionalParams}} + {{{paramName}}}: {{{vendorExtensions.x-ruby-example}}}, # {{{dataType}}} | {{{description}}} +{{/optionalParams}} +} +{{/hasParams}} +{{/vendorExtensions.x-group-parameters}} + +begin + {{#summary}}# {{{.}}}{{/summary}} + {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{^vendorExtensions.x-group-parameters}}{{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}opts{{/vendorExtensions.x-group-parameters}}){{/hasParams}} + {{#returnType}} + p result + {{/returnType}} +rescue {{{moduleName}}}::ApiError => e + puts "Error when calling {{classname}}->{{{operationId}}}: #{e}" +end +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} REPLACE_ME_WITH_EXAMPLE_FOR__{{{operationId}}}_Ruby_CODE +{{/useCustomTemplateCode}} ``` +{{^useCustomTemplateCode}} +#### Using the {{operationId}}_with_http_info variant +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} #### Using the `{{operationId}}_with_http_info` variant +{{/useCustomTemplateCode}} This returns an Array which contains the response data{{^returnType}} (`nil` in this case){{/returnType}}, status code and headers. +{{^useCustomTemplateCode}} +> <Array({{#returnType}}{{#returnTypeIsPrimitive}}{{returnType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}<{{{returnType}}}>{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil{{/returnType}}, Integer, Hash)> {{operationId}}_with_http_info{{#hasParams}}({{^vendorExtensions.x-group-parameters}}{{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}opts{{/vendorExtensions.x-group-parameters}}){{/hasParams}} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} > `<Array({{#returnType}}{{#returnTypeIsPrimitive}}{{returnType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}<{{{returnType}}}>{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil{{/returnType}}, Integer, Hash)> {{operationId}}_with_http_info{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}` +{{/useCustomTemplateCode}} ```ruby begin {{#summary}}# {{{.}}}{{/summary}} data, status_code, headers = api_instance.{{{operationId}}}_with_http_info{{#hasParams}}({{^vendorExtensions.x-group-parameters}}{{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}opts{{/vendorExtensions.x-group-parameters}}){{/hasParams}} @@ -55,10 +137,15 @@ {{#allParams}} {{#-first}} | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | {{/-first}} +{{^useCustomTemplateCode}} +| **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} | {{^required}}[optional]{{/required}}{{#defaultValue}}[default to {{.}}]{{/defaultValue}} | +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} | `{{paramName}}` | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} | {{^required}}[optional]{{/required}}{{#defaultValue}}[default to {{.}}]{{/defaultValue}} | +{{/useCustomTemplateCode}} {{/allParams}} ### Return type {{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil (empty response body){{/returnType}}