#pragma once
#include <string_view>
#include <userver/ugrpc/impl/static_service_metadata.hpp>
#include <samples/greeter_client.usrv.pb.hpp>
namespace samples {
class GreeterClient final {
public:
explicit GreeterClient(api::GreeterServiceClient& raw_client);
std::string SayHello(std::string name) const;
std::vector<std::string> SayHelloResponseStream(std::string name) const;
std::string SayHelloRequestStream(const std::vector<std::string_view>& names) const;
std::vector<std::string> SayHelloStreams(const std::vector<std::string_view>& names) const;
private:
api::GreeterServiceClient& raw_client_;
};
using Client = GreeterClient;
extern const USERVER_NAMESPACE::dynamic_config::Key<ugrpc::client::ClientQos> kGreeterClientQos;
public:
static constexpr std::string_view kName = "greeter-client";
GreeterClientComponent(const ::components::ComponentConfig& config, const ::components::ComponentContext& context)
: Base(config, context, kGreeterClientQos), client_wrapper_(GetClient()) {}
using Base::GetClient;
GreeterClient& GetClientWrapper() noexcept { return client_wrapper_; }
private:
GreeterClient client_wrapper_;
};
}