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

julia-client.api.mustache Maven / Gradle / Ivy

There is a newer version: 7.6.0
Show newest version
{{>partial_header}}
{{#operations}}
struct {{classname}} <: OpenAPI.APIClientImpl
    client::OpenAPI.Clients.Client
end

"""
The default API base path for APIs in `{{classname}}`.
This can be used to construct the `OpenAPI.Clients.Client` instance.
"""
basepath(::Type{ {{classname}} }) = "{{basePath}}"

{{#operation}}
const _returntypes_{{operationId}}_{{classname}} = Dict{Regex,Type}(
    {{#responses}}
    {{#dataType}}
    Regex("^" * replace("{{{code}}}", "x"=>".") * "\$") => {{{dataType}}},
    {{/dataType}}
    {{^dataType}}
    Regex("^" * replace("{{{code}}}", "x"=>".") * "\$") => Nothing,
    {{/dataType}}
    {{/responses}}
)

function _oacinternal_{{operationId}}(_api::{{classname}}{{#allParams}}{{#required}}, {{paramName}}::{{#dataType}}{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}{{/dataType}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}=nothing,{{/required}}{{/allParams}} _mediaType=nothing)
{{#allParams}}
{{#hasValidation}}
{{#maxLength}}
    OpenAPI.validate_param("{{paramName}}", "{{operationId}}", :maxLength, {{paramName}}, {{maxLength}})
{{/maxLength}}
{{#minLength}}
    OpenAPI.validate_param("{{paramName}}", "{{operationId}}", :minLength, {{paramName}}, {{minLength}})
{{/minLength}}
{{#maximum}}
    OpenAPI.validate_param("{{paramName}}", "{{operationId}}", :maximum, {{paramName}}, {{maximum}}, {{#exclusiveMaximum}}true{{/exclusiveMaximum}}{{^exclusiveMaximum}}false{{/exclusiveMaximum}})
{{/maximum}}
{{#minimum}}
    OpenAPI.validate_param("{{paramName}}", "{{operationId}}", :minimum, {{paramName}}, {{minimum}}, {{#exclusiveMinimum}}true{{/exclusiveMinimum}}{{^exclusiveMinimum}}false{{/exclusiveMinimum}})
{{/minimum}}
{{#maxItems}}
    OpenAPI.validate_param("{{paramName}}", "{{operationId}}", :maxItems, {{paramName}}, {{maxItems}})
{{/maxItems}}
{{#minItems}}
    OpenAPI.validate_param("{{paramName}}", "{{operationId}}", :minItems, {{paramName}}, {{minItems}})
{{/minItems}}

{{/hasValidation}}
{{/allParams}}
    _ctx = OpenAPI.Clients.Ctx(_api.client, "{{httpMethod}}", _returntypes_{{operationId}}_{{classname}}, "{{path}}", [{{#authMethods}}"{{name}}", {{/authMethods}}]{{#bodyParam}}, {{paramName}}{{/bodyParam}})
{{#pathParams}}
    OpenAPI.Clients.set_param(_ctx.path, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{paramName}}{{#isListContainer}}; collection_format="{{collectionFormat}}"{{/isListContainer}})  # type {{dataType}}
{{/pathParams}}
{{#queryParams}}
    OpenAPI.Clients.set_param(_ctx.query, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{paramName}}{{#isListContainer}}; collection_format="{{collectionFormat}}"{{/isListContainer}})  # type {{dataType}}
{{/queryParams}}
{{#headerParams}}
    OpenAPI.Clients.set_param(_ctx.header, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{paramName}}{{#isListContainer}}; collection_format="{{collectionFormat}}"{{/isListContainer}})  # type {{dataType}}
{{/headerParams}}
{{#formParams}}
{{^isFile}}
    OpenAPI.Clients.set_param(_ctx.form, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{paramName}}{{#isListContainer}}; collection_format="{{collectionFormat}}"{{/isListContainer}})  # type {{dataType}}
{{/isFile}}
{{#isFile}}
    OpenAPI.Clients.set_param(_ctx.file, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{paramName}})  # type {{#dataType}}{{#isBinary}}Vector{UInt8}{{/isBinary}}{{^isBinary}}{{dataType}}{{/isBinary}}{{/dataType}}
{{/isFile}}
{{/formParams}}
    OpenAPI.Clients.set_header_accept(_ctx, [{{#produces}}"{{{mediaType}}}", {{/produces}}])
    OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [{{#consumes}}"{{{mediaType}}}", {{/consumes}}] : [_mediaType])
    return _ctx
end

@doc raw"""{{#summary.length}}{{{summary}}}

{{/summary.length}}{{#notes.length}}{{{notes}}}

{{/notes.length}}Params:
{{#allParams}}- {{paramName}}::{{dataType}}{{#required}} (required){{/required}}
{{/allParams}}

Return: {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Nothing{{/returnType}}, OpenAPI.Clients.ApiResponse
"""
function {{operationId}}(_api::{{classname}}{{#allParams}}{{#required}}, {{paramName}}::{{dataType}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}=nothing,{{/required}}{{/allParams}} _mediaType=nothing)
    _ctx = _oacinternal_{{operationId}}(_api{{#allParams}}{{#required}}, {{paramName}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}={{paramName}},{{/required}}{{/allParams}} _mediaType=_mediaType)
    return OpenAPI.Clients.exec(_ctx)
end

function {{operationId}}(_api::{{classname}}, response_stream::Channel{{#allParams}}{{#required}}, {{paramName}}::{{dataType}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}=nothing,{{/required}}{{/allParams}} _mediaType=nothing)
    _ctx = _oacinternal_{{operationId}}(_api{{#allParams}}{{#required}}, {{paramName}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}={{paramName}},{{/required}}{{/allParams}} _mediaType=_mediaType)
    return OpenAPI.Clients.exec(_ctx, response_stream)
end

{{/operation}}
{{#operation}}
export {{operationId}}
{{/operation}}
{{/operations}}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy