Skip to main content

Crate client_uploader_traits

Crate client_uploader_traits 

Source
Expand description

§client-uploader-traits

CI crates.io docs.rs License Rust

Traits defining a common generic traits surface for uploader clients such as zenodo-rs, internetarchive-rs, and figshare-rs.

It covers:

  • client configuration
  • upload, file, and resource inspection
  • public lookup, search, and download capabilities
  • create/update publication workflows
  • publication outcome and search-result inspection
  • small generic helpers and a prelude
use client_uploader_traits::{
    CreatePublication, CreatePublicationRequest, PublicationOutcome,
};

async fn publish<C>(
    client: &C,
    request: CreatePublicationRequest<C::CreateTarget, C::Metadata, C::Upload>,
) -> Result<C::Output, C::Error>
where
    C: CreatePublication,
    C::Output: PublicationOutcome,
{
    client.create_publication(request).await
}

This crate is intentionally self-contained. Real conformance tests against concrete client crates should live in those crates.

Modules§

prelude
Common re-exports for crate consumers and implementers.

Structs§

CreatePublicationRequest
Generic request for “create a brand-new published resource”.
NoCreateTarget
Marker used when a service creates new resources without a caller-supplied target identifier.
UpdatePublicationRequest
Generic request for “update or upsert an existing published resource”.

Enums§

DraftFilePolicyKind
Normalized draft-file reconciliation semantics shared by Zenodo and Figshare.
ExistingFileConflictPolicyKind
Normalized per-file conflict semantics shared by direct-upload services such as Internet Archive.
UploadNameValidationError
Validation error returned by shared upload-name helpers.
UploadSourceKind
Shared classification of upload input sources.

Traits§

ClientContext
Minimal configuration surface shared by the uploader clients.
CoreRepositoryClient
Bundle for the capability set shared by all three current uploader clients.
CreatePublication
Capability for creating and publishing a brand-new resource.
DoiBackedRecord
Shared inspection surface for DOI-backed resources.
DoiVersionedRepositoryClient
Bundle for clients that additionally support DOI lookup and latest-version resolution.
DownloadNamedPublicFile
Capability for downloading one named public file to a local path.
DraftFilePolicy
Shared classification trait for Zenodo/Figshare draft reconciliation policies.
DraftPublishingRepositoryClient
Bundle for clients that expose draft-oriented mutation workflows.
DraftResource
Shared inspection surface for mutable draft-like resources.
DraftState
Shared publication-state inspection for mutable resources.
DraftWorkflow
Lower-level mutable-draft workflow shared most directly by Zenodo and Figshare.
ExistingFileConflictPolicy
Shared classification trait for Internet Archive-style per-file conflict policies.
ListResourceFiles
Capability for enumerating files attached to a public resource.
LookupByDoi
DOI-based lookup for public resources.
MaybeAuthenticatedClient
Shared auth-state inspection surface.
MutablePublicationOutcome
Shared inspection surface for publication workflows that also return a mutable or private-side resource.
PublicationOutcome
Shared inspection surface for publication workflow results.
ReadPublicResource
Capability for reading one public resource by its primary service identifier.
RepositoryFile
Shared inspection surface for remote file entries.
RepositoryRecord
Shared inspection surface for top-level resource payloads.
ResolveLatestPublicResource
Latest-version resolution for public resources that expose version families.
ResolveLatestPublicResourceByDoi
Latest-version resolution for DOI-backed public resources.
SearchPublicResources
Capability for searching public resources.
SearchResultsLike
Shared inspection surface for search result containers.
UpdatePublication
Capability for updating or upserting an existing published resource.
UploadSpecLike
Shared inspection surface for upload specifications.

Functions§

collect_upload_filenames
Collects the set of upload filenames while validating that names are non-empty and unique.
find_embedded_draft_file_by_name
Returns the first embedded file on a draft payload whose name matches name.
find_embedded_record_file_by_name
Returns the first embedded file on a record payload whose name matches name.
find_file_by_name
Returns the first file whose name matches name.
has_file_named
Returns whether any file in the iterator matches name.
has_upload_filename
Returns whether any upload in the iterator targets filename.
validate_upload_filenames
Validates that upload filenames are non-empty and unique.