Skip to main content

ZenodoClient

Struct ZenodoClient 

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

Typed async client for the core Zenodo REST API.

Implementations§

Source§

impl ZenodoClient

Source

pub fn builder(auth: Auth) -> ZenodoClientBuilder

Starts building a new client from authentication settings.

§Examples
use zenodo_rs::{Auth, Endpoint, ZenodoClient};

let client = ZenodoClient::builder(Auth::new("token"))
    .sandbox()
    .build()?;

assert!(matches!(client.endpoint(), Endpoint::Sandbox));
Source

pub fn new(auth: Auth) -> Result<Self, ZenodoError>

Builds a client with default endpoint and polling options.

§Errors

Returns an error if the underlying HTTP client cannot be initialized.

Source

pub fn with_token(token: impl Into<String>) -> Result<Self, ZenodoError>

Builds a client directly from a raw bearer token.

§Examples
use zenodo_rs::ZenodoClient;

let client = ZenodoClient::with_token("token")?;
assert_eq!(client.endpoint().base_url()?.as_str(), "https://zenodo.org/api/");
§Errors

Returns an error if the underlying HTTP client cannot be initialized.

Source

pub fn from_env() -> Result<Self, ZenodoError>

Builds a production client from Auth::TOKEN_ENV_VAR.

§Errors

Returns an error if the environment variable is missing or invalid, or if the underlying HTTP client cannot be initialized.

Source

pub fn from_sandbox_env() -> Result<Self, ZenodoError>

Builds a sandbox client from Auth::SANDBOX_TOKEN_ENV_VAR.

§Errors

Returns an error if the environment variable is missing or invalid, or if the underlying HTTP client cannot be initialized.

Source

pub fn endpoint(&self) -> &Endpoint

Returns the configured API endpoint.

Source

pub fn poll_options(&self) -> &PollOptions

Returns the configured polling behavior.

Source

pub fn request_timeout(&self) -> Option<Duration>

Returns the configured overall HTTP request timeout.

Source

pub fn connect_timeout(&self) -> Option<Duration>

Returns the configured TCP connect timeout.

Source

pub async fn create_deposition(&self) -> Result<Deposition, ZenodoError>

Creates a new empty deposition draft.

§Errors

Returns an error if the request fails or Zenodo returns a non-success response.

Source

pub async fn get_deposition( &self, id: DepositionId, ) -> Result<Deposition, ZenodoError>

Fetches a single deposition by deposition ID.

§Errors

Returns an error if the request fails or Zenodo returns a non-success response.

Source

pub async fn update_metadata( &self, id: DepositionId, metadata: &DepositMetadataUpdate, ) -> Result<Deposition, ZenodoError>

Replaces the draft metadata for a deposition.

§Errors

Returns an error if the request fails or Zenodo rejects the metadata.

Source

pub async fn list_files( &self, id: DepositionId, ) -> Result<Vec<DepositionFile>, ZenodoError>

Lists the files currently attached to a draft deposition.

§Errors

Returns an error if the request fails or Zenodo returns a non-success response.

Source

pub async fn delete_file( &self, id: DepositionId, file_id: DepositionFileId, ) -> Result<(), ZenodoError>

Deletes a file from a draft deposition.

§Errors

Returns an error if the request fails or Zenodo rejects the delete.

Source

pub async fn upload_path( &self, bucket: &BucketUrl, filename: &str, path: &Path, ) -> Result<BucketObject, ZenodoError>

Uploads a local file to a Zenodo bucket using a fixed content length.

§Errors

Returns an error if the local file cannot be read, if the upload URL cannot be formed, or if Zenodo rejects the upload.

Source

pub async fn upload_path_with_progress<P>( &self, bucket: &BucketUrl, filename: &str, path: &Path, progress: P, ) -> Result<BucketObject, ZenodoError>
where P: TransferProgress + 'static,

Uploads a local file to a Zenodo bucket while reporting progress.

The supplied progress sink receives the fixed upload size before the transfer starts and one advance event per streamed chunk.

§Errors

Returns an error if the local file cannot be read, if the upload URL cannot be formed, or if Zenodo rejects the upload.

Source

pub async fn upload_reader<R>( &self, bucket: &BucketUrl, filename: &str, reader: R, content_length: u64, content_type: Mime, ) -> Result<BucketObject, ZenodoError>
where R: Read + Send + 'static,

Uploads data from a blocking reader to a Zenodo bucket.

The caller must provide the exact content length.

§Errors

Returns an error if the upload URL cannot be formed, if the reader fails, or if Zenodo rejects the upload.

Source

pub async fn upload_reader_with_progress<R, P>( &self, bucket: &BucketUrl, filename: &str, reader: R, content_length: u64, content_type: Mime, progress: P, ) -> Result<BucketObject, ZenodoError>
where R: Read + Send + 'static, P: TransferProgress + 'static,

Uploads data from a blocking reader to a Zenodo bucket while reporting progress.

The caller must provide the exact content length. The supplied progress sink receives the fixed upload size before the transfer starts and one advance event per chunk that is accepted by the request body stream.

§Errors

Returns an error if the upload URL cannot be formed, if the reader fails, or if Zenodo rejects the upload.

Source

pub async fn publish(&self, id: DepositionId) -> Result<Deposition, ZenodoError>

Publishes a draft deposition.

§Errors

Returns an error if the request fails or Zenodo rejects the publish action.

Source

pub async fn edit(&self, id: DepositionId) -> Result<Deposition, ZenodoError>

Enters edit mode for a published deposition draft.

§Errors

Returns an error if the request fails or Zenodo rejects the edit action.

Source

pub async fn discard(&self, id: DepositionId) -> Result<Deposition, ZenodoError>

Discards the current draft changes for a deposition.

§Errors

Returns an error if the request fails or Zenodo rejects the discard action.

Source

pub async fn new_version( &self, id: DepositionId, ) -> Result<Deposition, ZenodoError>

Creates a new draft version from a published deposition.

§Errors

Returns an error if the request fails or Zenodo rejects the versioning action.

Source§

impl ZenodoClient

Source

pub async fn open_artifact( &self, selector: &ArtifactSelector, ) -> Result<DownloadStream, ZenodoError>

Opens a download stream for a Zenodo artifact selector.

§Examples
use zenodo_rs::{ArtifactSelector, Auth, RecordId, ZenodoClient};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = ZenodoClient::new(Auth::new("token"))?;
    let stream = client
        .open_artifact(&ArtifactSelector::latest_file(RecordId(123), "artifact.tar.gz"))
        .await?;
    let _ = stream.content_length;
    Ok(())
}
§Errors

Returns an error if selector resolution fails or if Zenodo returns a non-success response for the resolved download.

Source

pub async fn download_record_file_by_key_to_path( &self, id: RecordId, key: &str, path: &Path, ) -> Result<ResolvedDownload, ZenodoError>

Downloads a named file from a specific record to a local path.

Returns resolution metadata describing the record and file that ultimately produced the bytes.

§Errors

Returns an error if the record lookup fails, if the file is missing, or if writing the destination path fails.

Source

pub async fn download_record_file_by_key_to_path_with_progress<P>( &self, id: RecordId, key: &str, path: &Path, progress: P, ) -> Result<ResolvedDownload, ZenodoError>

Downloads a named file from a specific record to a local path while reporting progress.

Returns resolution metadata describing the record and file that ultimately produced the bytes.

§Errors

Returns an error if the record lookup fails, if the file is missing, or if writing the destination path fails.

Source

pub async fn download_latest_record_file_by_key_to_path( &self, id: RecordId, key: &str, path: &Path, ) -> Result<ResolvedDownload, ZenodoError>

Downloads a named file from the latest record version to a local path.

§Errors

Returns an error if latest-version resolution fails, if the file is missing, or if writing the destination path fails.

Source

pub async fn download_latest_record_file_by_key_to_path_with_progress<P>( &self, id: RecordId, key: &str, path: &Path, progress: P, ) -> Result<ResolvedDownload, ZenodoError>

Downloads a named file from the latest record version to a local path while reporting progress.

§Errors

Returns an error if latest-version resolution fails, if the file is missing, or if writing the destination path fails.

Source

pub async fn download_record_archive_to_path( &self, id: RecordId, path: &Path, ) -> Result<ResolvedDownload, ZenodoError>

Downloads the archive for a specific record to a local path.

Returns resolution metadata describing the record that produced the archive bytes.

§Errors

Returns an error if the record lookup fails, if the archive link is missing, or if writing the destination path fails.

Source

pub async fn download_record_archive_to_path_with_progress<P>( &self, id: RecordId, path: &Path, progress: P, ) -> Result<ResolvedDownload, ZenodoError>

Downloads the archive for a specific record to a local path while reporting progress.

Returns resolution metadata describing the record that produced the archive bytes.

§Errors

Returns an error if the record lookup fails, if the archive link is missing, or if writing the destination path fails.

Source

pub async fn download_file_by_doi_to_path( &self, doi: &Doi, key: &str, latest: bool, path: &Path, ) -> Result<ResolvedDownload, ZenodoError>

Downloads a named file after resolving a DOI to a record.

§Errors

Returns an error if DOI resolution fails, if the file is missing, or if writing the destination path fails.

Source

pub async fn download_file_by_doi_to_path_with_progress<P>( &self, doi: &Doi, key: &str, latest: bool, path: &Path, progress: P, ) -> Result<ResolvedDownload, ZenodoError>

Downloads a named file after resolving a DOI to a record while reporting progress.

§Errors

Returns an error if DOI resolution fails, if the file is missing, or if writing the destination path fails.

Source

pub async fn download_artifact( &self, selector: &ArtifactSelector, destination: &Path, ) -> Result<ResolvedDownload, ZenodoError>

Downloads an artifact selected by high-level record or DOI selectors.

§Examples
use std::path::Path;
use zenodo_rs::{ArtifactSelector, Auth, ZenodoClient};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = ZenodoClient::new(Auth::new("token"))?;
    let resolved = client
        .download_artifact(
            &ArtifactSelector::latest_archive_by_doi("10.5281/zenodo.123")?,
            Path::new("record.zip"),
        )
        .await?;
    let _ = resolved.bytes_written;
    Ok(())
}
§Errors

Returns an error if record resolution fails, if the requested artifact is unavailable, if checksum validation fails, or if writing the destination path fails.

Source

pub async fn download_artifact_with_progress<P>( &self, selector: &ArtifactSelector, destination: &Path, progress: P, ) -> Result<ResolvedDownload, ZenodoError>

Downloads an artifact selected by high-level record or DOI selectors while reporting progress.

The supplied progress sink receives the response Content-Length when Zenodo provides one and one advance event per chunk successfully written to disk.

§Errors

Returns an error if record resolution fails, if the requested artifact is unavailable, if checksum validation fails, or if writing the destination path fails.

Source§

impl ZenodoClient

Source

pub async fn search_records( &self, query: &RecordQuery, ) -> Result<Page<Record>, ZenodoError>

Searches published records using Zenodo’s records API.

§Examples
use zenodo_rs::{Auth, RecordQuery, ZenodoClient};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = ZenodoClient::new(Auth::new("token"))?;
    let page = client
        .search_records(
            &RecordQuery::builder()
                .query("doi:\"10.5281/zenodo.123\"")
                .published()
                .most_recent()
                .size(10)
                .build(),
        )
        .await?;
    let _ = page.hits;
    Ok(())
}
§Errors

Returns an error if the request fails or Zenodo returns malformed search data.

Source

pub async fn get_record(&self, id: RecordId) -> Result<Record, ZenodoError>

Fetches a published record by record ID.

§Errors

Returns an error if the request fails or Zenodo returns a non-success response.

Source

pub async fn get_record_by_doi(&self, doi: &Doi) -> Result<Record, ZenodoError>

Resolves a DOI to a published record.

§Examples
use zenodo_rs::{Auth, ZenodoClient};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = ZenodoClient::new(Auth::new("token"))?;
    let record = client
        .get_record_by_doi_str("https://doi.org/10.5281/zenodo.123")
        .await?;
    let _ = record.id;
    Ok(())
}
§Errors

Returns an error if the search fails or no record matches the DOI.

Source

pub async fn get_record_by_doi_str( &self, doi: impl AsRef<str>, ) -> Result<Record, ZenodoError>

Parses a DOI string and resolves it to a published record.

§Errors

Returns an error if the DOI string is invalid, if the search fails, or if no record matches the DOI.

Source

pub async fn resolve_latest_by_doi( &self, doi: &Doi, ) -> Result<Record, ZenodoError>

Resolves a DOI and then follows the latest-version link when present.

§Errors

Returns an error if DOI resolution fails or the latest record cannot be fetched.

Source

pub async fn resolve_latest_by_doi_str( &self, doi: impl AsRef<str>, ) -> Result<Record, ZenodoError>

Parses a DOI string and resolves the latest version in that record family.

§Errors

Returns an error if the DOI string is invalid, if DOI resolution fails, or if the latest record cannot be fetched.

Source

pub async fn get_latest_record( &self, id: RecordId, ) -> Result<Record, ZenodoError>

Fetches the latest record version for a record family.

§Errors

Returns an error if record lookup fails or the latest record cannot be fetched.

Source

pub async fn resolve_latest_version( &self, id: RecordId, ) -> Result<Record, ZenodoError>

Resolves the latest record version starting from a record ID.

§Errors

Returns an error if record lookup fails or the latest record cannot be fetched.

Source

pub async fn list_record_versions( &self, id: RecordId, ) -> Result<Page<Record>, ZenodoError>

Lists the versions associated with a record family.

§Errors

Returns an error if the record lookup fails or the versions query cannot be completed.

Source

pub async fn list_record_files( &self, id: RecordId, ) -> Result<Vec<RecordFile>, ZenodoError>

Lists files attached to a specific record.

§Errors

Returns an error if the record lookup fails.

Source

pub async fn get_artifact_info( &self, id: RecordId, ) -> Result<ArtifactInfo, ZenodoError>

Returns a record together with its latest version and keyed files map.

§Examples
use zenodo_rs::{Auth, RecordId, ZenodoClient};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = ZenodoClient::new(Auth::new("token"))?;
    let info = client.get_artifact_info(RecordId(123)).await?;
    let _ = info.files_by_key;
    Ok(())
}
§Errors

Returns an error if record lookup or latest-version resolution fails.

Source

pub async fn get_artifact_info_by_doi( &self, doi: &Doi, ) -> Result<ArtifactInfo, ZenodoError>

Resolves artifact information starting from a DOI.

§Errors

Returns an error if DOI resolution fails or latest-version resolution fails.

Source§

impl ZenodoClient

Source

pub async fn enter_edit_mode( &self, id: DepositionId, ) -> Result<Deposition, ZenodoError>

Enters edit mode for the current published version without versioning.

Unpublished depositions are reused directly. Published depositions trigger edit and then wait until the current deposition becomes editable again.

§Examples
use zenodo_rs::{Auth, DepositionId, ZenodoClient};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = ZenodoClient::new(Auth::new("token"))?;
    let draft = client.enter_edit_mode(DepositionId(42)).await?;
    let _ = draft.id;
    Ok(())
}
§Errors

Returns an error if the deposition lookup fails, if Zenodo rejects edit mode, or if the draft never becomes editable.

Source

pub async fn ensure_editable_draft( &self, id: DepositionId, ) -> Result<Deposition, ZenodoError>

Returns an editable draft for the given deposition ID.

Unpublished depositions are reused directly. Published depositions are first resolved to the latest published version and then trigger newversion, after which the helper follows latest_draft.

§Examples
use zenodo_rs::{Auth, DepositionId, ZenodoClient};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = ZenodoClient::new(Auth::new("token"))?;
    let draft = client.ensure_editable_draft(DepositionId(42)).await?;
    let _ = draft.id;
    Ok(())
}
§Errors

Returns an error if the deposition lookup fails, if Zenodo rejects version creation, or if the resulting draft never becomes available.

Source

pub async fn replace_all_files<I>( &self, draft: &Deposition, files: I, ) -> Result<Vec<BucketObject>, ZenodoError>
where I: IntoIterator<Item = UploadSpec>,

Replaces all currently visible draft files with the provided uploads.

§Errors

Returns an error if the draft cannot be refreshed, if the bucket link is missing, if file deletion fails, or if any upload fails.

Source

pub async fn reconcile_files<I>( &self, draft: &Deposition, policy: FileReplacePolicy, files: I, ) -> Result<Vec<BucketObject>, ZenodoError>
where I: IntoIterator<Item = UploadSpec>,

Reconciles draft files using the requested replacement policy.

ReplaceAll deletes all currently visible draft files before upload. UpsertByFilename deletes only draft files whose filename matches one of the new uploads. KeepExistingAndAdd leaves all existing files in place and uploads additional files alongside them.

§Examples
use zenodo_rs::{Auth, DepositionId, FileReplacePolicy, UploadSpec, ZenodoClient};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = ZenodoClient::new(Auth::new("token"))?;
    let draft = client.ensure_editable_draft(DepositionId(42)).await?;
    client
        .reconcile_files(
            &draft,
            FileReplacePolicy::UpsertByFilename,
            vec![UploadSpec::from_path("artifact.tar.gz")?],
        )
        .await?;
    Ok(())
}
§Errors

Returns an error if the draft cannot be refreshed, if the bucket link is missing, if duplicate upload filenames are provided, if a keep-existing upload would overwrite an existing draft filename, if file deletion fails, or if any upload fails.

Source

pub async fn reconcile_files_with_progress<I, P>( &self, draft: &Deposition, policy: FileReplacePolicy, files: I, progress: P, ) -> Result<Vec<BucketObject>, ZenodoError>
where I: IntoIterator<Item = UploadSpec>, P: TransferProgress + 'static,

Reconciles a draft’s visible files and reports aggregate upload progress.

The supplied progress sink receives the sum of all upload content lengths before the first upload starts and one advance event as each upload streams bytes into the request body.

§Errors

Returns an error if the draft cannot be refreshed, if the bucket link is missing, if duplicate upload filenames are provided, if a keep-existing upload would overwrite an existing draft filename, if reading a source path length fails, if file deletion fails, or if any upload fails.

Source

pub async fn publish_dataset( &self, root: DepositionId, metadata: &DepositMetadataUpdate, files: impl IntoIterator<Item = UploadSpec>, ) -> Result<PublishedRecord, ZenodoError>

Runs the full publish workflow for a deposition.

§Errors

Returns an error if any draft lookup, metadata update, file upload, publish step, or final record lookup fails.

Source

pub async fn publish_dataset_with_policy( &self, root: DepositionId, metadata: &DepositMetadataUpdate, policy: FileReplacePolicy, files: impl IntoIterator<Item = UploadSpec>, ) -> Result<PublishedRecord, ZenodoError>

Runs the full publish workflow for a deposition using a file policy.

§Examples
use zenodo_rs::{
    AccessRight, Auth, Creator, DepositMetadataUpdate, DepositionId, FileReplacePolicy,
    UploadSpec, UploadType, ZenodoClient,
};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = ZenodoClient::new(Auth::new("token"))?;
    let metadata = DepositMetadataUpdate::builder()
        .title("Example dataset")
        .upload_type(UploadType::Dataset)
        .description_html("<p>Example upload</p>")
        .creator(Creator::builder().name("Doe, Jane").build()?)
        .access_right(AccessRight::Open)
        .build()?;

    let published = client
        .publish_dataset_with_policy(
            DepositionId(42),
            &metadata,
            FileReplacePolicy::KeepExistingAndAdd,
            vec![UploadSpec::from_path("artifact.tar.gz")?],
        )
        .await?;
    let _ = published.record.id;
    Ok(())
}
§Errors

Returns an error if any draft lookup, metadata update, file upload, publish step, duplicate/conflicting filename validation, or final record lookup fails.

Source

pub async fn create_and_publish_dataset( &self, metadata: &DepositMetadataUpdate, files: impl IntoIterator<Item = UploadSpec>, ) -> Result<PublishedRecord, ZenodoError>

Creates a fresh deposition and runs the full publish workflow.

This is the ergonomic entrypoint for “publish a new dataset now” automation that does not already have a deposition ID.

§Examples
use zenodo_rs::{
    AccessRight, Auth, DepositMetadataUpdate, UploadSpec, UploadType, ZenodoClient,
};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = ZenodoClient::new(Auth::new("token"))?;
    let metadata = DepositMetadataUpdate::builder()
        .title("Example dataset")
        .upload_type(UploadType::Dataset)
        .description_html("<p>Example upload</p>")
        .creator_named("Doe, Jane")
        .access_right(AccessRight::Open)
        .build()?;

    let published = client
        .create_and_publish_dataset(
            &metadata,
            vec![UploadSpec::from_path_as(
                "target/release.tar.gz",
                "archive.tar.gz",
            )?],
        )
        .await?;
    let _ = published.record.id;
    Ok(())
}
§Errors

Returns an error if deposition creation fails or if any later metadata update, file upload, publish step, or final record lookup fails.

Source

pub async fn create_and_publish_dataset_with_policy( &self, metadata: &DepositMetadataUpdate, policy: FileReplacePolicy, files: impl IntoIterator<Item = UploadSpec>, ) -> Result<PublishedRecord, ZenodoError>

Creates a fresh deposition and runs the full publish workflow with a file policy.

§Errors

Returns an error if deposition creation fails or if any later metadata update, file upload, publish step, duplicate/conflicting filename validation, or final record lookup fails.

Trait Implementations§

Source§

impl ClientContext for ZenodoClient

Source§

type Endpoint = Endpoint

Service-specific endpoint configuration type.
Source§

type PollOptions = PollOptions

Service-specific polling configuration type.
Source§

type Error = ZenodoError

Service-specific error type.
Source§

fn endpoint(&self) -> &Self::Endpoint

Returns the configured endpoint roots.
Source§

fn poll_options(&self) -> &Self::PollOptions

Returns the configured polling behavior.
Source§

fn request_timeout(&self) -> Option<Duration>

Returns the overall request timeout, when configured.
Source§

fn connect_timeout(&self) -> Option<Duration>

Returns the TCP connect timeout, when configured.
Source§

impl Clone for ZenodoClient

Source§

fn clone(&self) -> ZenodoClient

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 CreatePublication for ZenodoClient

Source§

type CreateTarget = NoCreateTarget

Caller-supplied creation target type.
Source§

type Metadata = DepositMetadataUpdate

Service-specific metadata type.
Source§

type Upload = UploadSpec

Service-specific upload specification type.
Source§

type Output = PublishedRecord

Service-specific workflow result type.
Source§

async fn create_publication( &self, request: CreatePublicationRequest<Self::CreateTarget, Self::Metadata, Self::Upload>, ) -> Result<Self::Output, Self::Error>

Runs the service’s “create a new published resource” workflow.
Source§

impl Debug for ZenodoClient

Source§

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

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

impl DownloadNamedPublicFile for ZenodoClient

Source§

type ResourceId = RecordId

Service-specific resource identifier type.
Source§

type Download = ResolvedDownload

Service-specific download result metadata.
Source§

async fn download_named_public_file_to_path( &self, id: &Self::ResourceId, name: &str, path: &Path, ) -> Result<Self::Download, Self::Error>

Downloads one named file from a public resource.
Source§

impl DraftWorkflow for ZenodoClient

Source§

type Draft = Deposition

Service-specific mutable draft type.
Source§

type Metadata = DepositMetadataUpdate

Service-specific metadata type.
Source§

type Upload = UploadSpec

Service-specific upload specification type.
Source§

type FilePolicy = FileReplacePolicy

Service-specific draft file policy.
Source§

type UploadResult = BucketObject

Service-specific upload result type.
Source§

type Published = Deposition

Result returned by the publish step.
Source§

async fn create_draft( &self, metadata: &Self::Metadata, ) -> Result<Self::Draft, Self::Error>

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

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

Replaces or merges the draft metadata.
Source§

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

Reconciles the draft file set under the requested policy.
Source§

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

Publishes the draft-like resource.
Source§

impl ListResourceFiles for ZenodoClient

Source§

type ResourceId = RecordId

Service-specific resource identifier type.
Source§

type File = RecordFile

Service-specific file entry type.
Source§

async fn list_resource_files( &self, id: &Self::ResourceId, ) -> Result<Vec<Self::File>, Self::Error>

Returns the complete visible file list for the resource.
Source§

impl LookupByDoi for ZenodoClient

Source§

type Doi = Doi

Service-specific DOI type.
Source§

type Resource = Record

Returned public resource payload.
Source§

async fn get_public_resource_by_doi( &self, doi: &Self::Doi, ) -> Result<Self::Resource, Self::Error>

Fetches one public resource by DOI.
Source§

impl MaybeAuthenticatedClient for ZenodoClient

Source§

fn has_auth(&self) -> bool

Returns whether the client currently has credentials available for authenticated calls.
Source§

impl ReadPublicResource for ZenodoClient

Source§

type ResourceId = RecordId

Service-specific resource identifier type.
Source§

type Resource = Record

Returned public resource payload.
Source§

async fn get_public_resource( &self, id: &Self::ResourceId, ) -> Result<Self::Resource, Self::Error>

Fetches one public resource.
Source§

impl ResolveLatestPublicResource for ZenodoClient

Source§

type ResourceId = RecordId

Service-specific resource identifier type.
Source§

type Resource = Record

Returned public resource payload.
Source§

async fn resolve_latest_public_resource( &self, id: &Self::ResourceId, ) -> Result<Self::Resource, Self::Error>

Resolves the latest public version in the resource family.
Source§

impl ResolveLatestPublicResourceByDoi for ZenodoClient

Source§

type Doi = Doi

Service-specific DOI type.
Source§

type Resource = Record

Returned public resource payload.
Source§

async fn resolve_latest_public_resource_by_doi( &self, doi: &Self::Doi, ) -> Result<Self::Resource, Self::Error>

Resolves the latest public version in the DOI-backed resource family.
Source§

impl SearchPublicResources for ZenodoClient

Source§

type Query = RecordQuery

Service-specific query type.
Source§

type SearchResults = Page<Record>

Service-specific search result shape.
Source§

async fn search_public_resources( &self, query: &Self::Query, ) -> Result<Self::SearchResults, Self::Error>

Executes a public search request.
Source§

impl UpdatePublication for ZenodoClient

Source§

type ResourceId = DepositionId

Service-specific resource identifier type.
Source§

type Metadata = DepositMetadataUpdate

Service-specific metadata type.
Source§

type FilePolicy = FileReplacePolicy

Service-specific upload-policy type.
Source§

type Upload = UploadSpec

Service-specific upload specification type.
Source§

type Output = PublishedRecord

Service-specific workflow result type.
Source§

async fn update_publication( &self, request: UpdatePublicationRequest<Self::ResourceId, Self::Metadata, Self::FilePolicy, Self::Upload>, ) -> Result<Self::Output, Self::Error>

Runs the service’s “update or upsert an existing resource” workflow.

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

impl<T> CoreRepositoryClient for T

Source§

impl<T> DoiVersionedRepositoryClient for T

Source§

impl<T> DraftPublishingRepositoryClient for T