pub struct Service<'a> { /* private fields */ }Expand description
Service is used to make calls to file API.
Implementations§
Source§impl Service<'_>
impl Service<'_>
Sourcepub fn file(&self, params: FileParams) -> Result<HashMap<String, String>>
pub fn file(&self, params: FileParams) -> Result<HashMap<String, String>>
Uploads a file and return its unique id (uuid). Comply with the RFC7578 standard. Resulting HashMap holds filenames as keys and their ids are values.
Sourcepub fn from_url(&self, params: FromUrlParams) -> Result<FromUrlData>
pub fn from_url(&self, params: FromUrlParams) -> Result<FromUrlData>
Uploads file by its public URL.
Sourcepub fn from_url_status(&self, token: &str) -> Result<FromUrlStatusData>
pub fn from_url_status(&self, token: &str) -> Result<FromUrlStatusData>
Check the status of a file uploaded from URL.
Sourcepub fn create_group(&self, ids: &[&str]) -> Result<GroupInfo>
pub fn create_group(&self, ids: &[&str]) -> Result<GroupInfo>
Creates files group from a set of files by using their IDs with or without applied CDN media processing operations.
Example: [ “d6d34fa9-addd-472c-868d-2e5c105f9fcd”, “b1026315-8116-4632-8364-607e64fca723/-/resize/x800/”, ]
Sourcepub fn group_info(&self, group_id: &str) -> Result<GroupInfo>
pub fn group_info(&self, group_id: &str) -> Result<GroupInfo>
Returns group specific info.
GroupID look like UUID~N, for example: “d52d7136-a2e5-4338-9f45-affbf83b857d~2”
Sourcepub fn multipart_start(&self, params: MultipartParams) -> Result<MultipartData>
pub fn multipart_start(&self, params: MultipartParams) -> Result<MultipartData>
Multipart upload is useful when you are dealing with file larger than 100MB or explicitly want to use accelerated uploads. Another benefit is your file will go straight to AWS S3 bypassing our upload instances thus quickly becoming available for further use. Note, there also exists a minimum file size to use with Multipart Uploads, 10MB. Trying to use Multipart upload with a smaller file will result in an error.
Sourcepub fn upload_part(&self, url: &str, data: Vec<u8>) -> Result<()>
pub fn upload_part(&self, url: &str, data: Vec<u8>) -> Result<()>
The second phase is about uploading file parts to the provided URLs. Each uploaded part should be 5MB (5242880 bytes) in size except for the last one that can be smaller. You can upload file parts in parallel provided the byte order stays unchanged. Make sure to define Content-Type header for your data.
Sourcepub fn multipart_complete(&self, uuid: String) -> Result<FileInfo>
pub fn multipart_complete(&self, uuid: String) -> Result<FileInfo>
Complete multipart upload transaction when all file parts are uploaded
Auto Trait Implementations§
impl<'a> Freeze for Service<'a>
impl<'a> !RefUnwindSafe for Service<'a>
impl<'a> !Send for Service<'a>
impl<'a> !Sync for Service<'a>
impl<'a> Unpin for Service<'a>
impl<'a> !UnwindSafe for Service<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more