build(tgbot-gen): Changes and additions required to generate the API client with auth (cookie)
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.
This commit is contained in:
parent
ba4dfec459
commit
20cf8b1fc2
32 changed files with 4213 additions and 0 deletions
86
api/_build/my-cpp-templates/cpp-restsdk/api-header.mustache
Normal file
86
api/_build/my-cpp-templates/cpp-restsdk/api-header.mustache
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
{{>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}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue