Skip to main content

JobGraphBuilder

Struct JobGraphBuilder 

Source
pub struct JobGraphBuilder { /* private fields */ }
Expand description

Builder for branched CloudConvert job graphs.

JobGraphBuilder is usually used through JobCreateRequest::graph. Each task method appends one task and returns a TaskName handle that can be passed to later graph methods.

use cloudconvert_sdk::{FileExtension, JobCreateRequest};

let request = JobCreateRequest::graph(|job| {
    let imported = job.import_url("https://example.test/input.docx");
    let pdf = job.convert(&imported, FileExtension::Pdf);
    let png = job.convert(&imported, FileExtension::Png);
    job.export_url(vec![&pdf, &png]);
})
.build();

let payload = serde_json::to_value(request).unwrap();
assert_eq!(payload["tasks"]["export-url"]["input"], serde_json::json!(["convert", "convert-2"]));

Implementations§

Source§

impl JobGraphBuilder

Source

pub fn new() -> Self

Creates an empty graph builder.

Prefer JobCreateRequest::graph when the graph can be configured in a single closure.

Source

pub fn tag(&mut self, tag: impl Into<String>) -> &mut Self

Sets an optional job tag.

Source

pub fn webhook_url(&mut self, webhook_url: impl Into<String>) -> &mut Self

Sets the webhook URL CloudConvert should call for this job.

Source

pub fn redirect(&mut self, redirect: bool) -> &mut Self

Sets whether CloudConvert should redirect on synchronous job completion.

Source

pub fn option( &mut self, key: impl Into<String>, value: impl Into<Value>, ) -> &mut Self

Adds a custom top-level job field.

Source

pub fn add_task(&mut self, task: impl Into<TaskRequest>) -> TaskName

Adds a task with a generated task name and returns that name as a handle.

Source

pub fn add_named_task( &mut self, name: impl Into<String>, task: impl Into<TaskRequest>, ) -> TaskName

Adds a task with an explicit task name and returns that name as a handle.

Source

pub fn import_url(&mut self, url: impl Into<String>) -> TaskName

Adds an import/url task.

Source

pub fn import_url_with<F>( &mut self, url: impl Into<String>, configure: F, ) -> TaskName

Adds and configures an import/url task.

Source

pub fn import_upload(&mut self) -> TaskName

Adds an import/upload task.

Source

pub fn import_upload_with<F>(&mut self, configure: F) -> TaskName

Adds and configures an import/upload task.

Source

pub fn import_base64( &mut self, file: impl Into<String>, filename: impl Into<String>, ) -> TaskName

Adds an import/base64 task.

Source

pub fn import_raw( &mut self, file: impl Into<String>, filename: impl Into<String>, ) -> TaskName

Adds an import/raw task.

Source

pub fn import_s3( &mut self, bucket: impl Into<String>, region: impl Into<String>, access_key_id: impl Into<String>, secret_access_key: impl Into<String>, ) -> TaskName

Adds an import/s3 task.

Source

pub fn import_s3_with<F>( &mut self, bucket: impl Into<String>, region: impl Into<String>, access_key_id: impl Into<String>, secret_access_key: impl Into<String>, configure: F, ) -> TaskName

Adds and configures an import/s3 task.

Source

pub fn import_azure_blob( &mut self, storage_account: impl Into<String>, container: impl Into<String>, ) -> TaskName

Adds an import/azure/blob task.

Source

pub fn import_azure_blob_with<F>( &mut self, storage_account: impl Into<String>, container: impl Into<String>, configure: F, ) -> TaskName

Adds and configures an import/azure/blob task.

Source

pub fn import_google_cloud_storage( &mut self, project_id: impl Into<String>, bucket: impl Into<String>, client_email: impl Into<String>, private_key: impl Into<String>, ) -> TaskName

Adds an import/google-cloud-storage task.

Source

pub fn import_google_cloud_storage_with<F>( &mut self, project_id: impl Into<String>, bucket: impl Into<String>, client_email: impl Into<String>, private_key: impl Into<String>, configure: F, ) -> TaskName

Adds and configures an import/google-cloud-storage task.

Source

pub fn import_openstack( &mut self, auth_url: impl Into<String>, username: impl Into<String>, password: impl Into<String>, region: impl Into<String>, container: impl Into<String>, ) -> TaskName

Adds an import/openstack task.

Source

pub fn import_openstack_with<F>( &mut self, auth_url: impl Into<String>, username: impl Into<String>, password: impl Into<String>, region: impl Into<String>, container: impl Into<String>, configure: F, ) -> TaskName

Adds and configures an import/openstack task.

Source

pub fn import_sftp( &mut self, host: impl Into<String>, username: impl Into<String>, ) -> TaskName

Adds an import/sftp task.

Source

pub fn import_sftp_with<F>( &mut self, host: impl Into<String>, username: impl Into<String>, configure: F, ) -> TaskName

Adds and configures an import/sftp task.

Source

pub fn convert( &mut self, input: impl Into<Input>, output_format: impl Into<String>, ) -> TaskName

Adds a convert task.

Source

pub fn convert_with<F>( &mut self, input: impl Into<Input>, output_format: impl Into<String>, configure: F, ) -> TaskName

Adds and configures a convert task.

Source

pub fn optimize(&mut self, input: impl Into<Input>) -> TaskName

Adds an optimize task.

Source

pub fn optimize_with<F>( &mut self, input: impl Into<Input>, configure: F, ) -> TaskName

Adds and configures an optimize task.

Source

pub fn watermark_text( &mut self, input: impl Into<Input>, text: impl Into<String>, ) -> TaskName

Adds a text watermark task.

Source

pub fn watermark_text_with<F>( &mut self, input: impl Into<Input>, text: impl Into<String>, configure: F, ) -> TaskName

Adds and configures a text watermark task.

Source

pub fn watermark_image( &mut self, input: impl Into<Input>, image_task_name: impl Into<String>, ) -> TaskName

Adds an image watermark task.

Source

pub fn watermark_image_with<F>( &mut self, input: impl Into<Input>, image_task_name: impl Into<String>, configure: F, ) -> TaskName

Adds and configures an image watermark task.

Source

pub fn capture_website( &mut self, url: impl Into<String>, output_format: impl Into<String>, ) -> TaskName

Adds a capture-website task.

Source

pub fn capture_website_with<F>( &mut self, url: impl Into<String>, output_format: impl Into<String>, configure: F, ) -> TaskName

Adds and configures a capture-website task.

Source

pub fn thumbnail( &mut self, input: impl Into<Input>, output_format: impl Into<String>, ) -> TaskName

Adds a thumbnail task.

Source

pub fn thumbnail_with<F>( &mut self, input: impl Into<Input>, output_format: impl Into<String>, configure: F, ) -> TaskName

Adds and configures a thumbnail task.

Source

pub fn metadata(&mut self, input: impl Into<Input>) -> TaskName

Adds a metadata task.

Source

pub fn metadata_with<F>( &mut self, input: impl Into<Input>, configure: F, ) -> TaskName

Adds and configures a metadata task.

Source

pub fn metadata_write(&mut self, input: impl Into<Input>) -> TaskName

Adds a metadata/write task.

Source

pub fn metadata_write_with<F>( &mut self, input: impl Into<Input>, configure: F, ) -> TaskName

Adds and configures a metadata/write task.

Source

pub fn merge( &mut self, input: impl Into<Input>, output_format: impl Into<String>, ) -> TaskName

Adds a merge task.

Source

pub fn merge_with<F>( &mut self, input: impl Into<Input>, output_format: impl Into<String>, configure: F, ) -> TaskName
where F: FnOnce(MergeTask) -> MergeTask,

Adds and configures a merge task.

Source

pub fn archive( &mut self, input: impl Into<Input>, output_format: impl Into<String>, ) -> TaskName

Adds an archive task.

Source

pub fn archive_with<F>( &mut self, input: impl Into<Input>, output_format: impl Into<String>, configure: F, ) -> TaskName

Adds and configures an archive task.

Source

pub fn command( &mut self, input: impl Into<Input>, engine: impl Into<String>, command: impl Into<String>, arguments: impl Into<String>, ) -> TaskName

Adds a command task.

Source

pub fn command_with<F>( &mut self, input: impl Into<Input>, engine: impl Into<String>, command: impl Into<String>, arguments: impl Into<String>, configure: F, ) -> TaskName

Adds and configures a command task.

Source

pub fn pdf_a(&mut self, input: impl Into<Input>) -> TaskName

Adds a PDF operation task.

Source

pub fn pdf_a_with<F>( &mut self, input: impl Into<Input>, configure: F, ) -> TaskName
where F: FnOnce(PdfATask) -> PdfATask,

Adds and configures a PDF operation task.

Source

pub fn pdf_x(&mut self, input: impl Into<Input>) -> TaskName

Adds a PDF operation task.

Source

pub fn pdf_x_with<F>( &mut self, input: impl Into<Input>, configure: F, ) -> TaskName
where F: FnOnce(PdfXTask) -> PdfXTask,

Adds and configures a PDF operation task.

Source

pub fn pdf_ocr(&mut self, input: impl Into<Input>) -> TaskName

Adds a PDF operation task.

Source

pub fn pdf_ocr_with<F>( &mut self, input: impl Into<Input>, configure: F, ) -> TaskName

Adds and configures a PDF operation task.

Source

pub fn pdf_encrypt(&mut self, input: impl Into<Input>) -> TaskName

Adds a PDF operation task.

Source

pub fn pdf_encrypt_with<F>( &mut self, input: impl Into<Input>, configure: F, ) -> TaskName

Adds and configures a PDF operation task.

Source

pub fn pdf_decrypt(&mut self, input: impl Into<Input>) -> TaskName

Adds a PDF operation task.

Source

pub fn pdf_decrypt_with<F>( &mut self, input: impl Into<Input>, configure: F, ) -> TaskName

Adds and configures a PDF operation task.

Source

pub fn pdf_split_pages(&mut self, input: impl Into<Input>) -> TaskName

Adds a PDF operation task.

Source

pub fn pdf_split_pages_with<F>( &mut self, input: impl Into<Input>, configure: F, ) -> TaskName

Adds and configures a PDF operation task.

Source

pub fn pdf_extract_pages(&mut self, input: impl Into<Input>) -> TaskName

Adds a PDF operation task.

Source

pub fn pdf_extract_pages_with<F>( &mut self, input: impl Into<Input>, configure: F, ) -> TaskName

Adds and configures a PDF operation task.

Source

pub fn pdf_rotate_pages(&mut self, input: impl Into<Input>) -> TaskName

Adds a PDF operation task.

Source

pub fn pdf_rotate_pages_with<F>( &mut self, input: impl Into<Input>, configure: F, ) -> TaskName

Adds and configures a PDF operation task.

Source

pub fn export_url(&mut self, input: impl Into<Input>) -> TaskName

Adds an export/url task.

Source

pub fn export_url_with<F>( &mut self, input: impl Into<Input>, configure: F, ) -> TaskName

Adds and configures an export/url task.

Source

pub fn export_s3( &mut self, input: impl Into<Input>, bucket: impl Into<String>, region: impl Into<String>, access_key_id: impl Into<String>, secret_access_key: impl Into<String>, ) -> TaskName

Adds an export/s3 task.

Source

pub fn export_s3_with<F>( &mut self, input: impl Into<Input>, bucket: impl Into<String>, region: impl Into<String>, access_key_id: impl Into<String>, secret_access_key: impl Into<String>, configure: F, ) -> TaskName

Adds and configures an export/s3 task.

Source

pub fn export_azure_blob( &mut self, input: impl Into<Input>, storage_account: impl Into<String>, container: impl Into<String>, ) -> TaskName

Adds an export/azure/blob task.

Source

pub fn export_azure_blob_with<F>( &mut self, input: impl Into<Input>, storage_account: impl Into<String>, container: impl Into<String>, configure: F, ) -> TaskName

Adds and configures an export/azure/blob task.

Source

pub fn export_google_cloud_storage( &mut self, input: impl Into<Input>, project_id: impl Into<String>, bucket: impl Into<String>, client_email: impl Into<String>, private_key: impl Into<String>, ) -> TaskName

Adds an export/google-cloud-storage task.

Source

pub fn export_google_cloud_storage_with<F>( &mut self, input: impl Into<Input>, project_id: impl Into<String>, bucket: impl Into<String>, client_email: impl Into<String>, private_key: impl Into<String>, configure: F, ) -> TaskName

Adds and configures an export/google-cloud-storage task.

Source

pub fn export_openstack( &mut self, input: impl Into<Input>, auth_url: impl Into<String>, username: impl Into<String>, password: impl Into<String>, region: impl Into<String>, container: impl Into<String>, ) -> TaskName

Adds an export/openstack task.

Source

pub fn export_openstack_with<F>( &mut self, input: impl Into<Input>, auth_url: impl Into<String>, username: impl Into<String>, password: impl Into<String>, region: impl Into<String>, container: impl Into<String>, configure: F, ) -> TaskName

Adds and configures an export/openstack task.

Source

pub fn export_sftp( &mut self, input: impl Into<Input>, host: impl Into<String>, username: impl Into<String>, ) -> TaskName

Adds an export/sftp task.

Source

pub fn export_sftp_with<F>( &mut self, input: impl Into<Input>, host: impl Into<String>, username: impl Into<String>, configure: F, ) -> TaskName

Adds and configures an export/sftp task.

Source

pub fn export_upload( &mut self, input: impl Into<Input>, url: impl Into<String>, ) -> TaskName

Adds an export/upload task.

Source

pub fn export_upload_with<F>( &mut self, input: impl Into<Input>, url: impl Into<String>, configure: F, ) -> TaskName

Adds and configures an export/upload task.

Source

pub fn into_builder(self) -> JobBuilder

Finishes the graph builder and returns a regular JobBuilder.

Source

pub fn build(self) -> JobCreateRequest

Finishes the graph builder and returns the job creation request.

Trait Implementations§

Source§

impl Clone for JobGraphBuilder

Source§

fn clone(&self) -> JobGraphBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for JobGraphBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for JobGraphBuilder

Source§

fn default() -> JobGraphBuilder

Returns the “default value” for a type. Read more
Source§

impl From<JobGraphBuilder> for JobBuilder

Source§

fn from(builder: JobGraphBuilder) -> Self

Converts to this type from the input type.
Source§

impl From<JobGraphBuilder> for JobCreateRequest

Source§

fn from(builder: JobGraphBuilder) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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, 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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