generated from userver-framework/service_template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhello_client.cpp
39 lines (30 loc) · 1.01 KB
/
hello_client.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "hello_client.hpp"
#include <fmt/format.h>
#include <userver/yaml_config/merge_schemas.hpp>
namespace service_template {
std::string HelloClient::SayHello(std::string name) {
handlers::api::HelloRequest request;
request.set_name(std::move(name));
// Perform RPC by sending the request and receiving the response.
auto response = client_.SayHello(request);
return std::move(*response.mutable_text());
}
userver::yaml_config::Schema HelloClient::GetStaticConfigSchema() {
return userver::yaml_config::MergeSchemas<
userver::components::LoggableComponentBase>(R"(
type: object
description: >
a user-defined wrapper around api::GreeterServiceClient that provides
a simplified interface.
additionalProperties: false
properties:
endpoint:
type: string
description: >
Some other service endpoint (URI).
)");
}
void AppendHelloClient(userver::components::ComponentList& component_list) {
component_list.Append<HelloClient>();
}
} // namespace service_template