Skip to main content

Article

Struct Article 

Source
pub struct Article {
Show 41 fields pub id: ArticleId, pub title: String, pub doi: Option<Doi>, pub group_id: Option<u64>, pub url: Option<Url>, pub url_public_html: Option<Url>, pub url_public_api: Option<Url>, pub url_private_html: Option<Url>, pub url_private_api: Option<Url>, pub figshare_url: Option<Url>, pub published_date: Option<String>, pub modified_date: Option<String>, pub created_date: Option<String>, pub thumb: Option<Url>, pub defined_type: Option<DefinedType>, pub resource_title: Option<String>, pub resource_doi: Option<String>, pub citation: Option<String>, pub confidential_reason: Option<String>, pub embargo_type: Option<ArticleEmbargo>, pub is_confidential: Option<bool>, pub size: Option<u64>, pub funding: Option<String>, pub tags: Vec<String>, pub version: Option<u64>, pub is_active: Option<bool>, pub is_metadata_record: Option<bool>, pub metadata_reason: Option<String>, pub status: Option<ArticleStatus>, pub description: Option<String>, pub is_embargoed: Option<bool>, pub embargo_date: Option<String>, pub is_public: Option<bool>, pub has_linked_file: Option<bool>, pub categories: Vec<ArticleCategory>, pub license: Option<ArticleLicense>, pub references: Vec<String>, pub files: Vec<ArticleFile>, pub authors: Vec<ArticleAuthor>, pub custom_fields: Vec<CustomField>, pub extra: BTreeMap<String, Value>,
}
Expand description

Article payload shared across public and own article endpoints.

Fields§

§id: ArticleId

Article identifier.

§title: String

Article title.

§doi: Option<Doi>

Version-specific DOI, when present.

§group_id: Option<u64>

Group identifier, when present.

§url: Option<Url>

Figshare-provided article URL, when present.

§url_public_html: Option<Url>

Public HTML URL, when present.

§url_public_api: Option<Url>

Public API URL, when present.

§url_private_html: Option<Url>

Private HTML URL, when present.

§url_private_api: Option<Url>

Private API URL, when present.

§figshare_url: Option<Url>

Public Figshare landing page, when present.

§published_date: Option<String>

Publication timestamp as returned by Figshare, when present.

§modified_date: Option<String>

Last modification timestamp as returned by Figshare, when present.

§created_date: Option<String>

Creation timestamp as returned by Figshare, when present.

§thumb: Option<Url>

Preview thumbnail URL, when present.

§defined_type: Option<DefinedType>

Typed article kind, when present.

§resource_title: Option<String>

Related resource title, when present.

§resource_doi: Option<String>

Related resource DOI, when present.

§citation: Option<String>

Citation string, when present.

§confidential_reason: Option<String>

Confidentiality reason, when present.

§embargo_type: Option<ArticleEmbargo>

Embargo mode, when present.

§is_confidential: Option<bool>

Whether the article is confidential, when present.

§size: Option<u64>

Total article size in bytes, when present.

§funding: Option<String>

Funding string, when present.

§tags: Vec<String>

Tags, when present.

§version: Option<u64>

Version number, when present.

§is_active: Option<bool>

Whether the article is active, when present.

§is_metadata_record: Option<bool>

Whether the article is only a metadata record, when present.

§metadata_reason: Option<String>

Metadata reason, when present.

§status: Option<ArticleStatus>

Article status, when present.

§description: Option<String>

Description, when present.

§is_embargoed: Option<bool>

Whether the article is embargoed, when present.

§embargo_date: Option<String>

Embargo end timestamp, when present.

§is_public: Option<bool>

Whether the article is public, when present.

§has_linked_file: Option<bool>

Whether the article contains a linked file, when present.

§categories: Vec<ArticleCategory>

Attached categories.

§license: Option<ArticleLicense>

Attached license, when present.

§references: Vec<String>

Attached references.

§files: Vec<ArticleFile>

Attached files embedded in the article payload, when present.

Figshare caps embedded article file lists, so use dedicated file-list endpoints or the download helpers when complete enumeration matters.

§authors: Vec<ArticleAuthor>

Attached authors, when present.

§custom_fields: Vec<CustomField>

Attached custom fields, when present.

§extra: BTreeMap<String, Value>

Additional untyped fields preserved for forward compatibility.

Implementations§

Source§

impl Article

Source

pub fn is_public_article(&self) -> bool

Returns true when the article is public according to the available flags in the payload.

Source

pub fn version_number(&self) -> Option<u64>

Returns the best version number visible in the payload.

Source

pub fn file_by_name(&self, name: &str) -> Option<&ArticleFile>

Finds a file by exact file name within the embedded article payload.

Figshare may return only a partial embedded file list, so prefer the dedicated file-list endpoints when completeness matters.

§Examples
use figshare_rs::{Article, FileId};

let article: Article = serde_json::from_value(serde_json::json!({
    "id": 1,
    "title": "Example",
    "files": [{
        "id": 7,
        "name": "artifact.bin",
        "size": 12
    }]
}))?;

let file = article.file_by_name("artifact.bin").expect("embedded file");
assert_eq!(file.id, FileId(7));
Source

pub fn file_by_id(&self, id: FileId) -> Option<&ArticleFile>

Finds a file by ID.

Trait Implementations§

Source§

impl Clone for Article

Source§

fn clone(&self) -> Article

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Article

Source§

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

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

impl<'de> Deserialize<'de> for Article

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl DoiBackedRecord for Article

Source§

type Doi = Doi

Service-specific DOI type.
Source§

fn doi(&self) -> Option<Self::Doi>

Returns the resource DOI when one is present.
Source§

impl DraftResource for Article

Source§

type Id = ArticleId

Service-specific draft identifier type.
Source§

type File = ArticleFile

Service-specific draft file entry type.
Source§

fn draft_id(&self) -> Self::Id

Returns the draft identifier.
Source§

fn files(&self) -> &[Self::File]

Returns the embedded draft file list.
Source§

impl DraftState for Article

Source§

fn is_published(&self) -> bool

Returns whether the remote object is already published.
Source§

fn allows_metadata_updates(&self) -> bool

Returns whether metadata edits are currently allowed.
Source§

impl PartialEq for Article

Source§

fn eq(&self, other: &Article) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PublicationOutcome for Article

Source§

type PublicResource = Article

Public resource type returned by the workflow.
Source§

fn public_resource(&self) -> &Self::PublicResource

Returns the final public resource visible after the workflow completes.
Source§

fn created(&self) -> Option<bool>

Returns whether the workflow definitely created a brand-new resource. Read more
Source§

impl RepositoryRecord for Article

Source§

type Id = ArticleId

Service-specific resource identifier type.
Source§

type File = ArticleFile

Service-specific file entry type.
Source§

fn resource_id(&self) -> Option<Self::Id>

Returns the top-level resource identifier when it can be read directly from the payload.
Source§

fn title(&self) -> Option<&str>

Returns a display title when one is available.
Source§

fn files(&self) -> &[Self::File]

Returns the embedded file list on the payload.
Source§

impl Serialize for Article

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Article

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,