cpp-httplib-based agents¶
Available agents
- blocking
- async
- coroutine
❌
Agent implemented on top of cpp-httplib library. Link with banana-httplib
to use it.
Note
Please note that you should define CPPHTTPLIB_OPENSSL_SUPPORT
and link with OpenSSL to enable https: support.
- CMake Target
banana-httplib
- Include
#include <banana/agent/httplib.hpp>
- Supported platforms
Windows, Linux, macOS
- Dependencies
cpp-httplib, OpenSSL
-
class httplib_blocking¶
cpp-httplib-based blocking agent with exception-based error handling.
-
httplib_blocking::httplib_blocking(std::string token)¶
Default constructor accepting Telegram Bot token.
-
httplib_blocking::httplib_blocking(std::string token)¶
- Example
#include <banana/agent/httplib.hpp> banana::agent::httplib_blocking agent("TG_BOT_TOKEN"); banana::api::message_t msg = banana::api::send_message(agent, { "@user", "Hello, world!" });
-
class httplib_blocking_monadic¶
cpp-httplib-based blocking agent with monadic error handling.
-
httplib_blocking_monadic::httplib_blocking_monadic(std::string token)¶
Default constructor accepting Telegram Bot token.
-
httplib_blocking_monadic::httplib_blocking_monadic(std::string token)¶
- Example
#include <banana/agent/httplib.hpp> banana::agent::httplib_blocking_monadic agent("TG_BOT_TOKEN"); banana::expected<banana::api::message_t> msg = banana::api::send_message(agent, { "@user", "Hello, world!" });
-
class httplib_async¶
cpp-httplib-based non-blocking agent that wraps all requests in std::async.
-
httplib_async::httplib_async(std::string token)¶
Default constructor accepting Telegram Bot token.
-
httplib_async::httplib_async(std::string token)¶
- Example
#include <banana/agent/httplib.hpp> banana::agent::httplib_async agent("TG_BOT_TOKEN"); std::future<banana::api::message_t> msg = banana::api::send_message(agent, { "@user", "Hello, world!" });