pub struct InputFileRef {
pub attach_name: Option<String>,
pub bytes: Vec<u8>,
pub mime_type: Option<String>,
pub file_name: Option<String>,
}Expand description
Metadata for a single file that is uploaded as part of a multipart form.
The attach_name is the name used in the attach://<name> URI scheme.
When it is None the file must be sent as the sole binary part and the
parameter value itself is omitted from the JSON payload (matching the
Python if value.attach_uri branch).
Fields§
§attach_name: Option<String>Multipart form part name. When present the JSON value is
"attach://<attach_name>". When absent the file is sent directly and
the parameter’s JSON value is None.
bytes: Vec<u8>Raw file bytes.
mime_type: Option<String>Optional MIME type (defaults to application/octet-stream).
file_name: Option<String>Optional file name hint sent to Telegram.
Implementations§
Source§impl InputFileRef
impl InputFileRef
Sourcepub fn direct(bytes: Vec<u8>) -> Self
pub fn direct(bytes: Vec<u8>) -> Self
Build an InputFileRef that is uploaded directly (no attach URI).
Sourcepub fn with_attach_name(attach_name: impl Into<String>, bytes: Vec<u8>) -> Self
pub fn with_attach_name(attach_name: impl Into<String>, bytes: Vec<u8>) -> Self
Build an InputFileRef uploaded via an attach://<name> URI.
Sourcepub fn attach_uri(&self) -> Option<String>
pub fn attach_uri(&self) -> Option<String>
The attach:// URI string, if this file has an attach name.
Sourcepub fn effective_mime(&self) -> &str
pub fn effective_mime(&self) -> &str
The MIME type string used when building the multipart part, falling back
to application/octet-stream.
Trait Implementations§
Source§impl Clone for InputFileRef
impl Clone for InputFileRef
Source§fn clone(&self) -> InputFileRef
fn clone(&self) -> InputFileRef
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more