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

scala-akka-client.api.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
{{>licenseInfo}}
package {{package}}

{{#imports}}
import {{import}}
{{/imports}}
import {{invokerPackage}}._
import {{invokerPackage}}.CollectionFormats._
import {{invokerPackage}}.ApiKeyLocations._

{{#operations}}
object {{classname}} {

  def apply(baseUrl: String = "{{{basePath}}}") = new {{classname}}(baseUrl)
}

class {{classname}}(baseUrl: String) {

{{#operation}}
{{#javadocRenderer}}
{{>javadoc}}
{{/javadocRenderer}}
  def {{operationId}}({{>methodParameters}}): ApiRequest[{{>operationReturnType}}] =
    ApiRequest[{{>operationReturnType}}](ApiMethods.{{httpMethod.toUpperCase}}, baseUrl, "{{{path}}}", {{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}{{^consumes}}"application/json"{{/consumes}})
      {{#authMethods}}{{#isApiKey}}.withApiKey(apiKey, "{{keyParamName}}", {{#isKeyInQuery}}QUERY{{/isKeyInQuery}}{{#isKeyInHeader}}HEADER{{/isKeyInHeader}}{{#isKeyInCookie}}COOKIE{{/isKeyInCookie}})
      {{/isApiKey}}{{#isBasic}}{{#isBasicBasic}}.withCredentials(basicAuth){{/isBasicBasic}}{{#isBasicBearer}}.withCredentials(bearerToken){{/isBasicBearer}}{{/isBasic}}{{/authMethods}}{{#bodyParam}}.withBody({{paramName}})
      {{/bodyParam}}{{#formParams}}.withFormParam({{>paramCreation}})
      {{/formParams}}{{#queryParams}}.withQueryParam({{>paramCreation}})
      {{/queryParams}}{{#pathParams}}.withPathParam({{>paramCreation}})
      {{/pathParams}}{{#headerParams}}.withHeaderParam({{>paramCreation}})
      {{/headerParams}}{{#responses}}{{^isWildcard}}{{#dataType}}.with{{>responseState}}Response[{{dataType}}]({{code}})
      {{/dataType}}{{^dataType}}.with{{>responseState}}Response[Unit]({{code}})
      {{/dataType}}{{/isWildcard}}{{/responses}}{{#responses}}{{#isWildcard}}{{#dataType}}.withDefault{{>responseState}}Response[{{dataType}}]
      {{/dataType}}{{^dataType}}.withDefault{{>responseState}}Response[Unit]
      {{/dataType}}{{/isWildcard}}{{/responses}}
  {{^responseHeaders.isEmpty}}
  object {{#fnCapitalize}}{{operationId}}{{/fnCapitalize}}Headers {
  {{#responseHeaders}}
    def {{{name}}}(r: ApiReturnWithHeaders) = r.get{{^isContainer}}{{baseType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}Header("{{baseName}}")
  {{/responseHeaders}}
  }
  {{/responseHeaders.isEmpty}}

{{/operation}}

  {{#unknownStatusCodes}}
  ApiInvoker.addCustomStatusCode({{{value}}}, isSuccess = false)
  {{/unknownStatusCodes}}

}

{{/operations}}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy