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

php-dt.ApiClient.php.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
api_arg_doc
}}     * @return ResponseInterface
     * @throws ClientExceptionInterface
     * @throws DT\Exception\InvalidData
     */
    public function {{operationId}}Raw(
{{>api_arg_declaration
}}    ): ResponseInterface
    {
        $request = $this->createRequest('{{httpMethod}}', '{{{path}}}', {{#pathParams.0}}$this->getPathParameters($parameters){{/pathParams.0}}{{^pathParams.0}}[]{{/pathParams.0}}, {{#queryParams.0}}$this->getQueryParameters($parameters){{/queryParams.0}}{{^queryParams.0}}[]{{/queryParams.0}});
{{#headerParams.0}}
        $request = $this->addCustomHeaders($request, $parameters);
{{/headerParams.0}}
{{#cookieParams.0}}
        $request = $this->addCookies($request, $parameters);
{{/cookieParams.0}}
{{#bodyParam}}
{{#isDate}}
        $request = $this->addBody($request, $requestMediaType, $requestContent, ($this->contentStrategies)('Date', []));
{{/isDate}}
{{#isDateTime}}
        $request = $this->addBody($request, $requestMediaType, $requestContent, ($this->contentStrategies)('DateTime', []));
{{/isDateTime}}
{{^isDate}}
{{^isDateTime}}
        $request = $this->addBody($request, $requestMediaType, $requestContent);
{{/isDateTime}}
{{/isDate}}
{{/bodyParam}}
{{#hasProduces}}
        $request = $this->addAcceptHeader($request, $responseMediaType);
{{/hasProduces}}
{{#hasAuthMethods}}
        $request = $this->addSecurity($request, $security);
{{/hasAuthMethods}}
        return $this->httpClient->sendRequest($request);
    }

    /**
{{>api_arg_doc
}}     * @return array
     * @throws ClientExceptionInterface
     * @throws DT\Exception\InvalidData
     * @throws OAGAC\Exception\InvalidResponseBodySchema
     */
    public function {{operationId}}(
{{>api_arg_declaration
}}    ): array
    {
        $response = $this->{{operationId}}Raw({{>api_arg_call}});
        $responseContent = null;
        $contentStrategy = null;
        $contentValidator = null;
        switch ($response->getStatusCode())
        {
{{#responses}}
            {{#isDefault}}default{{/isDefault}}{{^isDefault}}case {{code}}{{/isDefault}}:
{{#message}}
                /* {{&message}} */
{{/message}}
{{#isArray}}
                $responseContent = new {{dataType}}();
{{/isArray}}
{{#isMap}}
                $responseContent = new {{dataType}}();
{{/isMap}}
{{#isDate}}
                $contentStrategy = ($this->contentStrategies)('Date', []);
                $contentValidator = ($this->contentValidators)('Date', []);
{{/isDate}}
{{#isDateTime}}
                $contentStrategy = ($this->contentStrategies)('DateTime', []);
                $contentValidator = ($this->contentValidators)('DateTime', []);
{{/isDateTime}}
{{^isDate}}
{{^isDateTime}}
{{^isArray}}
{{^isMap}}
{{#isModel}}
                $responseContent = new {{dataType}}();
{{/isModel}}
{{/isMap}}
{{/isArray}}
{{/isDateTime}}
{{/isDate}}
                break;
{{/responses}}
        }
        $this->parseBody($response, $responseContent, $contentStrategy, $contentValidator);
        return [$responseContent, $response->getHeaders(), $response->getStatusCode(), $response->getReasonPhrase()];
    }

    /**
{{>api_arg_doc
}}     * @return {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}mixed{{/returnType}}
     * @throws ClientExceptionInterface
     * @throws DT\Exception\InvalidData
     * @throws OAGAC\Exception\InvalidResponseBodySchema
     * @throws OAGAC\Exception\UnsuccessfulResponse
     */
    public function {{operationId}}Result(
{{>api_arg_declaration
}}    ){{#returnType}}: {{returnType}}{{/returnType}}
    {
        return $this->getSuccessfulContent(...$this->{{operationId}}({{>api_arg_call}}));
    }
    //endregion
{{^-last}}

{{/-last}}
{{/operation}}
}

{{/operations}}
{{/apis}}
{{/apiInfo}}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy