64 lines
1.8 KiB
C++
64 lines
1.8 KiB
C++
#pragma once
|
|
#include "{{filename name}}.pb.h"
|
|
#include "lib/api/public/ServiceContext.h"
|
|
#include "lib/api/public/ClientChannel.h"
|
|
#include "lib/api/public/Result.h"
|
|
#include "lib/api/public/Update.h"
|
|
#include "lib/utils/bts_export.h"
|
|
|
|
#include <rxcpp/rx.hpp>
|
|
#include <string>
|
|
#include <functional>
|
|
#include <future>
|
|
#include <memory>
|
|
|
|
{{ns-open package}}
|
|
|
|
// Forward declaractions
|
|
{{#each message_type}}
|
|
class {{name}};
|
|
{{/each}}
|
|
|
|
{{#each service}}
|
|
{{#each method}}{{#if server_streaming}}
|
|
class {{../name}};
|
|
typedef bts::api::Update<std::shared_ptr<const {{output_type_cpp}}>, const {{key_type.cpptype}}, {{../name}}> {{cap name}}Update;
|
|
{{/if}}{{/each}}
|
|
|
|
// {{comment}}
|
|
class BTS_EXPORT {{name}} {
|
|
|
|
std::unique_ptr<bts::api::ClientChannel> _pchannel;
|
|
friend class bts::api::ServiceContext;
|
|
{{name}}(std::unique_ptr<bts::api::ClientChannel> pchannel);
|
|
// Key functions
|
|
{{#each method}} {{#if server_streaming}}
|
|
{{#if key_type.natural_key}}
|
|
static {{key_type.cpptype}} {{name}}_key(const {{output_type_cpp}}& row);
|
|
{{else}}
|
|
static const {{key_type.cpptype}}& {{name}}_key(const {{output_type_cpp}}& row);
|
|
{{/if}}
|
|
{{/if}} {{/each}}
|
|
|
|
public:
|
|
{{name}}({{name}}&&);
|
|
static const char* name() { return "{{name}}"; }
|
|
|
|
{{#each method}}
|
|
{{#if server_streaming}}
|
|
// {{comment}}
|
|
rxcpp::observable<{{cap name}}Update> subscribe_{{name}}(std::string const& qualifier);
|
|
// {{comment}}
|
|
rxcpp::observable<{{cap name}}Update> subscribe_{{name}}();
|
|
{{else}}
|
|
// {{comment}}
|
|
void {{name}}(const {{input_type_cpp}}&, std::function<void(bts::api::Result<{{output_type_cpp}}>)>, uint32_t timeout_ms=0);
|
|
// {{comment}}
|
|
bts::api::Result<{{output_type_cpp}}> {{name}}(const {{input_type_cpp}}&, uint32_t timeout_ms=0);
|
|
{{/if}}
|
|
{{/each}}
|
|
};
|
|
{{/each}}
|
|
|
|
{{ns-close package}}
|