pub struct CdnClient { /* private fields */ }Implementations§
Source§impl CdnClient
impl CdnClient
Sourcepub fn upload_large_file_with_progress(
&self,
prepared: &PreparedUpload,
task_id: u64,
progress: impl FnMut(u64, Option<u64>) -> Result<()>,
) -> Result<UploadedMedia>
pub fn upload_large_file_with_progress( &self, prepared: &PreparedUpload, task_id: u64, progress: impl FnMut(u64, Option<u64>) -> Result<()>, ) -> Result<UploadedMedia>
Upload one ordinary file using previously persisted source/key material. Object readback and business-message submission remain separate operations.
Sourcepub fn upload_video_original_with_progress(
&self,
prepared: &PreparedUpload,
task_id: u64,
progress: impl FnMut(u64, Option<u64>) -> Result<()>,
) -> Result<UploadedMedia>
pub fn upload_video_original_with_progress( &self, prepared: &PreparedUpload, task_id: u64, progress: impl FnMut(u64, Option<u64>) -> Result<()>, ) -> Result<UploadedMedia>
Upload the unmodified original as a separate type-4 object. The normal rendition and thumbnail use their own paired upload and final metadata. Persist the task ID and prepared material before calling this method.
Source§impl CdnClient
impl CdnClient
pub fn new(config: CdnConfig, timeout: Duration) -> Result<Self>
pub fn download(&self, descriptor: &MediaDescriptor) -> Result<DownloadedMedia>
pub fn download_with_progress( &self, descriptor: &MediaDescriptor, progress: impl FnMut(u64, Option<u64>) -> Result<()>, ) -> Result<DownloadedMedia>
Sourcepub fn download_storage_with_progress(
&self,
descriptor: &MediaDescriptor,
file_key: &str,
progress: impl FnMut(u64, Option<u64>) -> Result<()>,
) -> Result<DownloadedMedia>
pub fn download_storage_with_progress( &self, descriptor: &MediaDescriptor, file_key: &str, progress: impl FnMut(u64, Option<u64>) -> Result<()>, ) -> Result<DownloadedMedia>
Download a storage object, as the official client does for sticker pack
archives: POST /downloadstorage with the storage request fields
(apptype 10, isstorevideo 0, nocheckaeskey 1, enablehit 1,
existancecheck 0 and filekey). file_key is the caller’s task ID
for the object; it correlates requests and is not a credential. Only
whole-file descriptors are accepted; the downloaded bytes get the same
size and integrity checks as an ordinary file download.
pub fn upload(&self, prepared: &PreparedUpload) -> Result<UploadedMedia>
pub fn upload_with_progress( &self, prepared: &PreparedUpload, progress: impl FnMut(u64, Option<u64>) -> Result<()>, ) -> Result<UploadedMedia>
Source§impl CdnClient
impl CdnClient
pub fn upload_image(&self, p: &PreparedImageUpload) -> Result<UploadedImage>
Sourcepub fn upload_image_with_progress(
&self,
p: &PreparedImageUpload,
progress: impl FnMut(u64, Option<u64>) -> Result<()>,
) -> Result<UploadedImage>
pub fn upload_image_with_progress( &self, p: &PreparedImageUpload, progress: impl FnMut(u64, Option<u64>) -> Result<()>, ) -> Result<UploadedImage>
Upload an image’s original, standard and thumbnail copies, reporting the encrypted bytes of the original sent so far and their total before each request.