Skip to main content

DraftWorkflow

Trait DraftWorkflow 

Source
pub trait DraftWorkflow: ClientContext {
    type Draft: DraftResource;
    type Metadata;
    type Upload;
    type FilePolicy;
    type UploadResult;
    type Published;

    // Required methods
    fn create_draft(
        &self,
        metadata: &Self::Metadata,
    ) -> impl Future<Output = Result<Self::Draft, Self::Error>>;
    fn update_draft_metadata(
        &self,
        draft_id: &<Self::Draft as DraftResource>::Id,
        metadata: &Self::Metadata,
    ) -> impl Future<Output = Result<Self::Draft, Self::Error>>;
    fn reconcile_draft_files(
        &self,
        draft: &Self::Draft,
        policy: Self::FilePolicy,
        uploads: Vec<Self::Upload>,
    ) -> impl Future<Output = Result<Vec<Self::UploadResult>, Self::Error>>;
    fn publish_draft(
        &self,
        draft_id: &<Self::Draft as DraftResource>::Id,
    ) -> impl Future<Output = Result<Self::Published, Self::Error>>;
}
Expand description

Lower-level mutable-draft workflow shared most directly by Zenodo and Figshare.

Required Associated Types§

Source

type Draft: DraftResource

Service-specific mutable draft type.

Source

type Metadata

Service-specific metadata type.

Source

type Upload

Service-specific upload specification type.

Source

type FilePolicy

Service-specific draft file policy.

Source

type UploadResult

Service-specific upload result type.

Source

type Published

Result returned by the publish step.

Required Methods§

Source

fn create_draft( &self, metadata: &Self::Metadata, ) -> impl Future<Output = Result<Self::Draft, Self::Error>>

Creates a new mutable draft-like resource with the supplied metadata.

Source

fn update_draft_metadata( &self, draft_id: &<Self::Draft as DraftResource>::Id, metadata: &Self::Metadata, ) -> impl Future<Output = Result<Self::Draft, Self::Error>>

Replaces or merges the draft metadata.

Source

fn reconcile_draft_files( &self, draft: &Self::Draft, policy: Self::FilePolicy, uploads: Vec<Self::Upload>, ) -> impl Future<Output = Result<Vec<Self::UploadResult>, Self::Error>>

Reconciles the draft file set under the requested policy.

Source

fn publish_draft( &self, draft_id: &<Self::Draft as DraftResource>::Id, ) -> impl Future<Output = Result<Self::Published, Self::Error>>

Publishes the draft-like resource.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§