tgbot-cpp
Loading...
Searching...
No Matches
TgBot::HttpClient Class Referenceabstract

This class makes http requests. More...

#include <HttpClient.h>

Inheritance diagram for TgBot::HttpClient:
TgBot::BoostHttpOnlySslClient TgBot::CurlHttpClient

Public Member Functions

virtual ~HttpClient ()=default
 
virtual std::string makeRequest (const Url &url, const std::vector< HttpReqArg > &args) const =0
 Sends a request to the url.
 
virtual int getRequestMaxRetries () const
 Get the maximum number of makeRequest() retries before giving up and throwing an exception.
 
virtual int getRequestBackoff () const
 Get the makeRequest() backoff duration between retries, in seconds.
 

Public Attributes

std::int32_t _timeout = 25
 

Detailed Description

This class makes http requests.

Definition at line 18 of file HttpClient.h.

Constructor & Destructor Documentation

◆ ~HttpClient()

virtual TgBot::HttpClient::~HttpClient ( )
virtualdefault

Member Function Documentation

◆ getRequestBackoff()

virtual int TgBot::HttpClient::getRequestBackoff ( ) const
inlinevirtual

Get the makeRequest() backoff duration between retries, in seconds.

Definition at line 43 of file HttpClient.h.

◆ getRequestMaxRetries()

virtual int TgBot::HttpClient::getRequestMaxRetries ( ) const
inlinevirtual

Get the maximum number of makeRequest() retries before giving up and throwing an exception.

Definition at line 36 of file HttpClient.h.

◆ makeRequest()

virtual std::string TgBot::HttpClient::makeRequest ( const Url & url,
const std::vector< HttpReqArg > & args ) const
pure virtual

Sends a request to the url.

If there's no args specified, a GET request will be sent, otherwise a POST request will be sent. If at least 1 arg is marked as file, the content type of a request will be multipart/form-data, otherwise it will be application/x-www-form-urlencoded.

Implemented in TgBot::BoostHttpOnlySslClient, and TgBot::CurlHttpClient.

Member Data Documentation

◆ _timeout

std::int32_t TgBot::HttpClient::_timeout = 25

Definition at line 31 of file HttpClient.h.


The documentation for this class was generated from the following file: