pub struct InputFile { /* private fields */ }
Expand description
This object represents the contents of a file to be uploaded.
Implementations§
source§impl InputFile
impl InputFile
sourcepub fn url(url: Url) -> InputFile
pub fn url(url: Url) -> InputFile
Creates an InputFile
from an url.
Notes:
- When sending by URL the target file must have the correct MIME type
(e.g.,
audio/mpeg
forSendAudio
, etc.). - In
SendDocument
, sending by URL will currently only work forGIF
,PDF
andZIP
files. - To use
SendVoice
, the file must have the type audio/ogg and be no more than 1MB in size. 1-20MB voice notes will be sent as files. - Other configurations may work but we can’t guarantee that they will.
sourcepub fn file_id(file_id: impl Into<String>) -> InputFile
pub fn file_id(file_id: impl Into<String>) -> InputFile
Creates an InputFile
from a file id.
File id can be obtained from
Notes:
- It is not possible to change the file type when resending by file id. I.e. a video can’t be sent as a photo, a photo can’t be sent as a document, etc.
- It is not possible to resend thumbnails.
- Resending a photo by file id will send all of its sizes.
- file id is unique for each individual bot and can’t be transferred from one bot to another.
- file id uniquely identifies a file, but a file can have different valid file_ids even for the same bot.
sourcepub fn memory(data: impl Into<Bytes>) -> InputFile
pub fn memory(data: impl Into<Bytes>) -> InputFile
Creates an InputFile
from a in-memory bytes.
Trait Implementations§
source§impl From<InputMedia> for InputFile
impl From<InputMedia> for InputFile
source§fn from(media: InputMedia) -> InputFile
fn from(media: InputMedia) -> InputFile
Converts to this type from the input type.
source§impl Serialize for InputFile
impl Serialize for InputFile
source§fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more