Service

Struct Service 

Source
pub struct Service<'a> { /* private fields */ }
Expand description

Service is used to make calls to file API.

Implementations§

Source§

impl Service<'_>

Source

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.

Source

pub fn from_url(&self, params: FromUrlParams) -> Result<FromUrlData>

Uploads file by its public URL.

Source

pub fn from_url_status(&self, token: &str) -> Result<FromUrlStatusData>

Check the status of a file uploaded from URL.

Source

pub fn file_info(&self, file_id: &str) -> Result<FileInfo>

Returns uploading file info.

Source

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/”, ]

Source

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”

Source

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.

Source

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.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,