v2.Java.libraries.feign.api.mustache Maven / Gradle / Ivy
The newest version!
package {{package}};
import {{invokerPackage}}.ApiClient;
import {{invokerPackage}}.EncodingUtils;
{{#legacyDates}}
import {{invokerPackage}}.ParamExpander;
{{/legacyDates}}
{{#imports}}import {{import}};
{{/imports}}
{{^fullJavaUtil}}
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
{{/fullJavaUtil}}
import feign.*;
{{>generatedAnnotation}}
public interface {{classname}} extends ApiClient.Api {
{{#operations}}{{#operation}}
/**
* {{summary}}
* {{notes}}
{{#allParams}}
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{/allParams}}
{{#returnType}}
* @return {{returnType}}
{{/returnType}}
{{#externalDocs}}
* {{description}}
* @see {{summary}} Documentation
{{/externalDocs}}
*/
@RequestLine("{{httpMethod}} {{{path}}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{#has this 'more'}}&{{/has}}{{/queryParams}}")
@Headers({
{{#vendorExtensions.x-contentType}}"Content-Type: {{vendorExtensions.x-contentType}}"{{#vendorExtensions.x-accepts}},{{/vendorExtensions.x-accepts}}{{/vendorExtensions.x-contentType}}
{{#vendorExtensions.x-accepts}}"Accept: {{vendorExtensions.x-accepts}}"{{/vendorExtensions.x-accepts}}{{#headerParams}},{{/headerParams}}{{#headerParams}}
"{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{#has this 'more'}},
{{/has}}{{/headerParams}}
})
{{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{#isNot this 'body-param'}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isNot}}{{{dataType}}} {{paramName}}{{#has this 'more'}}, {{/has}}{{/allParams}});
{{#hasQueryParams}}
/**
* {{summary}}
* {{notes}}
* Note, this is equivalent to the other {{operationId}}
method,
* but with the query parameters collected into a single Map parameter. This
* is convenient for services with optional query parameters, especially when
* used with the {@link {{operationIdCamelCase}}QueryParams} class that allows for
* building up this map in a fluent style.
{{#allParams}}
{{#isNot this 'query-param'}}
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{/isNot}}
{{/allParams}}
* @param queryParams Map of query parameters as name-value pairs
* The following elements may be specified in the query map:
*
{{#queryParams}}
* - {{paramName}} - {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{/queryParams}}
*
{{#returnType}}
* @return {{returnType}}
{{/returnType}}
{{#externalDocs}}
* {{description}}
* @see {{summary}} Documentation
{{/externalDocs}}
*/
@RequestLine("{{httpMethod}} {{{path}}}?{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{#has this 'more'}}&{{/has}}{{/queryParams}}")
@Headers({
{{#vendorExtensions.x-contentType}}"Content-Type: {{vendorExtensions.x-contentType}}"{{#vendorExtensions.x-accepts}},{{/vendorExtensions.x-accepts}}{{/vendorExtensions.x-contentType}}
{{#vendorExtensions.x-accepts}}"Accept: {{vendorExtensions.x-accepts}}"{{/vendorExtensions.x-accepts}}{{#headerParams}},{{/headerParams}}{{#headerParams}}
"{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{#has this 'more'}},
{{/has}}{{/headerParams}}
})
{{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{#isNot this 'query-param'}}{{#isNot this 'body-param'}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isNot}}{{{dataType}}} {{paramName}}, {{/isNot}}{{/allParams}}@QueryMap(encoded=true) Map queryParams);
/**
* A convenience class for generating query parameters for the
* {{operationId}}
method in a fluent style.
*/
public static class {{operationIdCamelCase}}QueryParams extends HashMap {
{{#queryParams}}
public {{operationIdCamelCase}}QueryParams {{paramName}}(final {{{dataType}}} value) {
{{#collectionFormat}}
put("{{baseName}}", EncodingUtils.encodeCollection(value, "{{collectionFormat}}"));
{{/collectionFormat}}
{{^collectionFormat}}
put("{{baseName}}", EncodingUtils.encode(value));
{{/collectionFormat}}
return this;
}
{{/queryParams}}
}
{{/hasQueryParams}}
{{/operation}}
{{/operations}}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy