|
tgbot-cpp
|
This object represents the contents of a file to be uploaded. More...
#include <InputFile.h>
Public Types | |
| using | Ptr = std::shared_ptr<InputFile> |
Static Public Member Functions | |
| static std::shared_ptr< InputFile > | fromData (std::string data, std::string mimeType, std::string fileName) |
| Creates new std::shared_ptr<InputFile> from binary data held in memory. | |
| static std::shared_ptr< InputFile > | fromFile (std::string_view filePath, std::string mimeType) |
| Creates new std::shared_ptr<InputFile> from an existing file. | |
Public Attributes | |
| std::string | data |
| Contents used for an in-memory upload. | |
| std::string | mimeType |
| Mime type of the contents. | |
| std::string | fileName |
| File name. | |
| std::optional< std::string > | filePath |
| Local path used for a streaming upload. | |
This object represents the contents of a file to be uploaded.
Definition at line 17 of file InputFile.h.
| using TgBot::InputFile::Ptr = std::shared_ptr<InputFile> |
Definition at line 18 of file InputFile.h.
|
static |
|
static |
Creates new std::shared_ptr<InputFile> from an existing file.
Stores the path without reading the file. The HTTP client streams its contents during the request and uses the basename of filePath as the multipart file name. The file must remain accessible and unchanged until the request completes.
| filePath | Path to the file to stream. |
| mimeType | Mime type of the file. |
| std::string TgBot::InputFile::data |
Contents used for an in-memory upload.
Empty for files created with fromFile().
Definition at line 25 of file InputFile.h.
| std::string TgBot::InputFile::fileName |
File name.
Definition at line 35 of file InputFile.h.
| std::optional<std::string> TgBot::InputFile::filePath |
Local path used for a streaming upload.
When set, the file is read by the HTTP client during the request and data is ignored. The file must remain accessible and unchanged until the request completes.
Definition at line 43 of file InputFile.h.
| std::string TgBot::InputFile::mimeType |
Mime type of the contents.
Definition at line 30 of file InputFile.h.