tgbot-cpp
Toggle main menu visibility
Loading...
Searching...
No Matches
InputFile.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
tgbot/export.h
"
4
5
#include <memory>
6
#include <optional>
7
#include <string>
8
#include <string_view>
9
10
namespace
TgBot
{
11
17
struct
TGBOT_API
InputFile
{
18
using
Ptr
= std::shared_ptr<InputFile>;
19
25
std::string
data
;
26
30
std::string
mimeType
;
31
35
std::string
fileName
;
36
43
std::optional<std::string>
filePath
;
44
52
static
std::shared_ptr<InputFile>
fromData
(std::string
data
, std::string
mimeType
, std::string
fileName
);
53
64
static
std::shared_ptr<InputFile>
fromFile
(std::string_view
filePath
, std::string
mimeType
);
65
};
66
72
struct
InputFileAttachment
{
76
std::string
name
;
77
81
std::shared_ptr<InputFile>
file
;
82
};
83
84
}
// namespace TgBot
export.h
TGBOT_API
#define TGBOT_API
Definition
export.h:5
TgBot
Definition
Api.h:18
TgBot::InputFileAttachment
A named multipart file referenced from a Telegram API argument as attach://name.
Definition
InputFile.h:72
TgBot::InputFileAttachment::name
std::string name
Multipart form field name used in the attach:// reference.
Definition
InputFile.h:76
TgBot::InputFileAttachment::file
std::shared_ptr< InputFile > file
File contents to upload under the specified name.
Definition
InputFile.h:81
TgBot::InputFile
This object represents the contents of a file to be uploaded.
Definition
InputFile.h:17
TgBot::InputFile::mimeType
std::string mimeType
Mime type of the contents.
Definition
InputFile.h:30
TgBot::InputFile::data
std::string data
Contents used for an in-memory upload.
Definition
InputFile.h:25
TgBot::InputFile::fromData
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.
TgBot::InputFile::Ptr
std::shared_ptr< InputFile > Ptr
Definition
InputFile.h:18
TgBot::InputFile::filePath
std::optional< std::string > filePath
Local path used for a streaming upload.
Definition
InputFile.h:43
TgBot::InputFile::fileName
std::string fileName
File name.
Definition
InputFile.h:35
TgBot::InputFile::fromFile
static std::shared_ptr< InputFile > fromFile(std::string_view filePath, std::string mimeType)
Creates new std::shared_ptr<InputFile> from an existing file.
include
tgbot
InputFile.h
Generated on
for tgbot-cpp by
1.18.0