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

- old
+ new

@@ -2,13 +2,15 @@ {{> api_info}} =end require 'cgi' +{{#useCustomTemplateCode}} module Dropbox end +{{/useCustomTemplateCode}} module {{moduleName}} {{#operations}} class {{classname}} attr_accessor :api_client @@ -189,30 +191,48 @@ # header parameters header_params = opts[:header_params] || {} {{#hasProduces}} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept([{{#produces}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}]) + header_params['Accept'] = @api_client.select_header_accept([{{#produces}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}]) unless header_params['Accept'] {{/hasProduces}} {{#hasConsumes}} # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type([{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}]) if !content_type.nil? header_params['Content-Type'] = content_type end {{/hasConsumes}} {{#headerParams}} {{#required}} - header_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}} + header_params[{{#lambdaFixHeaderKey}}:'{{{baseName}}}'{{/lambdaFixHeaderKey}}] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}} {{/required}} {{/headerParams}} {{#headerParams}} {{^required}} header_params[{{#lambdaFixHeaderKey}}:'{{{baseName}}}'{{/lambdaFixHeaderKey}}] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if !opts[:'{{{paramName}}}'].nil? {{/required}} {{/headerParams}} +{{^useCustomTemplateCode}} + # form parameters + form_params = opts[:form_params] || {} + {{#formParams}} + {{#required}} + form_params['{{baseName}}'] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}} + {{/required}} + {{/formParams}} + {{#formParams}} + {{^required}} + form_params['{{baseName}}'] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if !opts[:'{{paramName}}'].nil? + {{/required}} + {{/formParams}} + + # http body (model) + post_body = opts[:debug_body]{{#bodyParam}} || @api_client.object_to_http_body({{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}){{/bodyParam}} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} post_body = {} form_params = opts[:form_params] || {} {{#bodyParam}} result = @api_client.generate_form_data( {{paramName}}, @@ -231,10 +251,11 @@ {{^bodyParam}} # http body (model) post_body = opts[:debug_body]{{#bodyParam}} || @api_client.object_to_http_body({{#required}}{{{paramName}}}{{/required}}{{^required}}opts[:'{{{paramName}}}']{{/required}}){{/bodyParam}} {{/bodyParam}} +{{/useCustomTemplateCode}} # return_type return_type = opts[:debug_return_type]{{#returnType}} || '{{{.}}}'{{/returnType}} # auth_names @@ -248,10 +269,14 @@ :body => post_body, :auth_names => auth_names, :return_type => return_type ) +{{^useCustomTemplateCode}} + data, status_code, headers = @api_client.call_api(:{{httpMethod}}, local_var_path, new_options) +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} begin data, status_code, headers = @api_client.call_api(:{{httpMethod}}, local_var_path, new_options) rescue Dropbox::Sign::ApiError => e {{#returnType}} {{#responses}} @@ -313,9 +338,10 @@ {{/dataType}} {{/responses}} {{/returnType}} end +{{/useCustomTemplateCode}} if @api_client.config.debugging @api_client.config.logger.debug "API called: {{classname}}#{{operationId}}\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end