1 #ifndef VOICEVOX_CLIENT_CPP_CLIEHT_HPP_
2 #define VOICEVOX_CLIENT_CPP_CLIEHT_HPP_
7 #include <pplx/pplxtasks.h>
8 #include <cpprest/http_msg.h>
9 #include <cpprest/json.h>
78 const web::http::http_request& req,
90 const web::http::http_request& req,
105 auto callback = [&out](
const T& in) { out = in; };
106 auto task =
Request(req, callback);
117 Client(
const std::string& uri);
127 std::unique_ptr<web::http::client::http_client> client_;
pplx::task< void > Request(const web::http::http_request &req, const CallbackType< OptionalJson > callback_json)
An interface for sending supplies to the server and receiving responses asynchronously.
pplx::task< void > Request(const web::http::http_request &req, const CallbackType< OptionalBinary > callback_audio)
An interface for sending a request to the server and receiving responses asynchronously.
Client(const Client &)=delete
Copy constructor (deleted)
std::function< void(const T &)> CallbackType
User callback type.
Definition: client.hpp:42
T Request(const web::http::http_request &req)
An interface for sending requests to the server and receiving responses synchronously.
Definition: client.hpp:102
Client & operator=(const Client &)=delete
Copy constructor (deleted)
std::optional< web::json::value > OptionalJson
Responses from the client (in JSON format).
Definition: client.hpp:29
std::optional< std::vector< unsigned char > > OptionalBinary
Responses from the client (in String format)
Definition: client.hpp:34
static Client & GetInstance(const std::string &uri)
The only interface for obtaining the client.
A client class for handlingk requests and responses to/from VOICEVOX.
Definition: client.hpp:24
A base class for a group of builder classes.
Definition: request.hpp:16
const char * RequestString(Client *client, request::Builder *req_builder)
An interface for sending requests to the server and receiving responses synchronously.
const char * RequestJsonString(Client *client, request::Builder *req_builder)
An interface for sending requests to the server and receiving responses synchronously.
void FreeString(const char *str)
Free memories of string object.
Client * GetClientInstance(const char *uri)
[extern "C"] Get instance of the client
Definition: client.hpp:13