tgbot-cpp
Toggle main menu visibility
Loading...
Searching...
No Matches
Api.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
tgbot/HttpFormField.h
"
4
#include "
tgbot/InputFile.h
"
5
#include "
tgbot/Types.h
"
6
#include "
tgbot/export.h
"
7
8
#include <nlohmann/json_fwd.hpp>
9
10
#include <cstdint>
11
#include <memory>
12
#include <optional>
13
#include <string>
14
#include <variant>
15
#include <vector>
16
17
namespace
TgBot
{
18
19
class
Bot
;
20
class
HttpClient
;
21
30
class
TGBOT_API
Api
{
31
friend
class
Bot
;
32
33
public
:
34
Api
(std::string token,
const
HttpClient
& httpClient, std::string url);
35
36
#include "
tgbot/ApiMethods.inc.h
"
37
41
std::string
downloadFile
(
const
std::string& filePath,
const
std::vector<HttpFormField>& fields = { })
const
;
42
43
const
HttpClient
&
_httpClient
;
44
45
protected
:
46
nlohmann::json
sendRequest
(
const
std::string& method,
const
std::vector<HttpFormField>& fields)
const
;
47
48
const
std::string
_token
;
49
const
std::string
_url
;
50
};
51
52
}
// namespace TgBot
ApiMethods.inc.h
HttpFormField.h
InputFile.h
Types.h
TgBot::Api::_url
const std::string _url
Definition
Api.h:49
TgBot::Api::_httpClient
const HttpClient & _httpClient
Definition
Api.h:43
TgBot::Api::Api
Api(std::string token, const HttpClient &httpClient, std::string url)
TgBot::Api::downloadFile
std::string downloadFile(const std::string &filePath, const std::vector< HttpFormField > &fields={ }) const
Downloads a Telegram file and returns its contents.
TgBot::Api::sendRequest
nlohmann::json sendRequest(const std::string &method, const std::vector< HttpFormField > &fields) const
TgBot::Api::_token
const std::string _token
Definition
Api.h:48
TgBot::Api::Bot
friend class Bot
Definition
Api.h:31
TgBot::Bot
This object holds other objects specific for this bot instance.
Definition
Bot.h:20
TgBot::HttpClient
This class makes http requests.
Definition
HttpClient.h:18
export.h
TGBOT_API
#define TGBOT_API
Definition
export.h:5
TgBot
Definition
Api.h:17
include
tgbot
Api.h
Generated on
for tgbot-cpp by
1.17.0