I use a standard set of templates, changes are made in api-header.mustache and api-source.mustache. Their _old versions contain the originals. Additions are necessary for the header argument in the generated functions so that you can authenticate using cookies.
86 lines
2.5 KiB
Text
86 lines
2.5 KiB
Text
{{>licenseInfo}}
|
|
{{#operations}}/*
|
|
* {{classname}}.h
|
|
*
|
|
* {{description}}
|
|
*/
|
|
|
|
#ifndef {{apiHeaderGuardPrefix}}_{{classname}}_H_
|
|
#define {{apiHeaderGuardPrefix}}_{{classname}}_H_
|
|
|
|
{{{defaultInclude}}}
|
|
|
|
#include "{{packageName}}/ApiClient.h"
|
|
{{^hasModelImport}}#include "{{packageName}}/ModelBase.h"{{/hasModelImport}}
|
|
{{#imports}}{{{import}}}
|
|
{{/imports}}
|
|
#include <boost/optional.hpp>
|
|
#include <map> // <-- добавлено для std::map
|
|
|
|
{{#apiNamespaceDeclarations}}
|
|
namespace {{this}} {
|
|
{{/apiNamespaceDeclarations}}
|
|
|
|
using namespace {{modelNamespace}};
|
|
|
|
{{#gmockApis}}
|
|
class {{declspec}} I{{classname}}
|
|
{
|
|
public:
|
|
I{{classname}}() = default;
|
|
virtual ~I{{classname}}() = default;
|
|
|
|
{{#operation}}
|
|
virtual pplx::task<{{{returnType}}}{{^returnType}}void{{/returnType}}> {{operationId}}(
|
|
{{#allParams}}
|
|
{{^required}}boost::optional<{{/required}}{{{dataType}}}{{^required}}>{{/required}} {{paramName}},{{/allParams}}
|
|
const std::map<utility::string_t, utility::string_t>& customHeaders = {} // <-- добавлено
|
|
) const = 0;
|
|
{{/operation}}
|
|
};{{/gmockApis}}
|
|
|
|
class {{declspec}} {{classname}} {{#gmockApis}} : public I{{classname}} {{/gmockApis}}
|
|
{
|
|
public:
|
|
{{#gmockApis}}
|
|
using Base = I{{classname}};
|
|
{{/gmockApis}}
|
|
|
|
explicit {{classname}}( std::shared_ptr<const ApiClient> apiClient );
|
|
|
|
{{#gmockApis}}
|
|
~{{classname}}() override;
|
|
{{/gmockApis}}
|
|
{{^gmockApis}}
|
|
virtual ~{{classname}}();
|
|
{{/gmockApis}}
|
|
|
|
{{#operation}}
|
|
/// <summary>
|
|
/// {{summary}}
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// {{notes}}
|
|
/// </remarks>
|
|
{{#allParams}}
|
|
/// <param name="{{paramName}}">{{#lambda.multiline_comment_4}}{{description}}{{/lambda.multiline_comment_4}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
|
|
{{/allParams}}
|
|
/// <param name="customHeaders">Additional HTTP headers to send with the request (optional)</param>
|
|
pplx::task<{{{returnType}}}{{^returnType}}void{{/returnType}}> {{operationId}}(
|
|
{{#allParams}}
|
|
{{^required}}boost::optional<{{/required}}{{{dataType}}}{{^required}}>{{/required}} {{paramName}},{{/allParams}}
|
|
const std::map<utility::string_t, utility::string_t>& customHeaders = {} // <-- добавлено
|
|
) const{{#gmockApis}} override{{/gmockApis}};
|
|
{{/operation}}
|
|
|
|
protected:
|
|
std::shared_ptr<const ApiClient> m_ApiClient;
|
|
};
|
|
|
|
{{#apiNamespaceDeclarations}}
|
|
}
|
|
{{/apiNamespaceDeclarations}}
|
|
|
|
#endif /* {{apiHeaderGuardPrefix}}_{{classname}}_H_ */
|
|
|
|
{{/operations}}
|