pub struct FileUploader<'a, P: AsRef<Path>, B = Body> { /* private fields */ }Expand description
Client implementation to upload files and videos via the Wistia Upload API.
Also check out the rust-wistia docs for usage and examples.
Implementations§
Source§impl<'a, P: AsRef<Path> + Debug> FileUploader<'a, P>
impl<'a, P: AsRef<Path> + Debug> FileUploader<'a, P>
Sourcepub fn new(file_path: P) -> Result<Self>
pub fn new(file_path: P) -> Result<Self>
Create a FileUploader with a new HTTPS client, with the access token
retrieved from the environment.
§Arguments
file_path- The path to the media file. The contents of this file will be multipart-form encoded into the request body.
Sourcepub fn with_token(file_path: P, access_token: &str) -> Self
pub fn with_token(file_path: P, access_token: &str) -> Self
Create a FileUploader with a new HTTPS client and a Wistia access
token.
§Arguments
file_path- The path to the media file. The contents of this file will be multipart-form encoded into the request body.access_token- An API access token used to make requests to the Wistia API.
Sourcepub fn with_client(file_path: P, client: UploadClient<Body>) -> Self
pub fn with_client(file_path: P, client: UploadClient<Body>) -> Self
Create a FileUploader with a file path and an HTTPS client.
§Arguments
file_path- The path to the media file. The contents of this file will be multipart-form encoded into the request body.client- The HTTPS client (UploadClient) to use for requests. Note that the client must support multipart form requests, via amultipart::Body.
Sourcepub fn project_id(self, project_id: &'a str) -> Self
pub fn project_id(self, project_id: &'a str) -> Self
The hashed id of the project to upload media into. If omitted, a new
project will be created and uploaded to. The naming convention used
for such projects is Uploads_YYYY-MM-DD.
Sourcepub fn name(self, name: &'a str) -> Self
pub fn name(self, name: &'a str) -> Self
A display name to use for the media in Wistia. If omitted, the filename will be used instead. This field is limited to 255 characters.
Sourcepub fn description(self, description: &'a str) -> Self
pub fn description(self, description: &'a str) -> Self
A description to use for the media in Wistia. You can use basic HTML here, but note that both HTML and CSS will be sanitized.
Sourcepub fn contact_id(self, contact_id: &'a str) -> Self
pub fn contact_id(self, contact_id: &'a str) -> Self
A Wistia contact id, an integer value. If omitted, it will default to the contact_id of the account’s owner.
Sourcepub async fn send(&self) -> Result<UploadResponse>
pub async fn send(&self) -> Result<UploadResponse>
Send the Upload File request (with the multi-part form data) to the Wistia Upload API.