Skip to main content

Article

Struct Article 

Source
pub struct Article {
Show 25 fields pub identifier: u64, pub name: String, pub url: String, pub abstract_text: Option<String>, pub description: Option<String>, pub date_modified: DateTime<Utc>, pub date_previously_modified: Option<DateTime<Utc>>, pub in_language: Language, pub is_part_of: ProjectRef, pub namespace: Option<Namespace>, pub main_entity: Option<WikidataEntity>, pub additional_entities: Option<Vec<WikidataEntityUsage>>, pub categories: Option<Vec<Category>>, pub templates: Option<Vec<Template>>, pub redirects: Option<Vec<Redirect>>, pub version: Version, pub previous_version: OptionalPreviousVersion, pub watchers_count: Option<u64>, pub protection: Option<Vec<Protection>>, pub visibility: Option<Visibility>, pub image: Option<Image>, pub license: Vec<License>, pub article_body: Option<ArticleBody>, pub event: Option<EventMetadata>, pub has_parts: Option<Vec<Section>>,
}
Expand description

Complete article from Enterprise API.

This is the primary data structure returned by all Enterprise APIs. The same schema is used across On-demand, Snapshot, and Realtime endpoints.

§Example

use wme_models::Article;
use serde_json;

let json = r#"{
    "name": "Squirrel",
    "identifier": 28492,
    "url": "https://en.wikipedia.org/wiki/Squirrel",
    "date_created": "2001-01-15T00:00:00Z",
    "date_modified": "2024-01-15T12:00:00Z",
    "in_language": {"identifier": "en", "name": "English"},
    "is_part_of": {"identifier": "enwiki"},
    "namespace": {"identifier": 0, "name": ""},
    "license": [{"name": "CC BY-SA 4.0", "url": "https://creativecommons.org/licenses/by-sa/4.0/"}],
    "version": {
        "identifier": 1182847293,
        "editor": {"identifier": 12345, "name": "SomeUser"}
    }
}"#;

let article: Article = serde_json::from_str(json).unwrap();
assert_eq!(article.name, "Squirrel");
assert_eq!(article.identifier, 28492);

Fields§

§identifier: u64

Article ID (MediaWiki page ID)

§name: String

Article name/title

§url: String

Article URL

§abstract_text: Option<String>

Article abstract/summary

§description: Option<String>

Short description (e.g., “Family of rodents”)

§date_modified: DateTime<Utc>

Last modification timestamp

§date_previously_modified: Option<DateTime<Utc>>

Before-last modification timestamp

§in_language: Language

Language information

§is_part_of: ProjectRef

Project this article belongs to (simplified reference)

§namespace: Option<Namespace>

Namespace information

§main_entity: Option<WikidataEntity>

Main Wikidata entity (primary topic)

§additional_entities: Option<Vec<WikidataEntityUsage>>

Additional Wikidata entities used

§categories: Option<Vec<Category>>

Categories this article belongs to

§templates: Option<Vec<Template>>

Templates used in this article

§redirects: Option<Vec<Redirect>>

Redirects to this article (alternative names)

§version: Version

Current version information with credibility signals

§previous_version: OptionalPreviousVersion

Previous version information

§watchers_count: Option<u64>

Number of editors watching this page

§protection: Option<Vec<Protection>>

Protection settings (edit/move restrictions)

§visibility: Option<Visibility>

Visibility flags (for visibility-change events)

§image: Option<Image>

Main image for the article

§license: Vec<License>

License(s) for this article (usually CC-BY-SA)

§article_body: Option<ArticleBody>

Article body content (HTML and wikitext)

§event: Option<EventMetadata>

Event metadata (present in Realtime API responses)

§has_parts: Option<Vec<Section>>

Has parts - structured content sections (when using fields filter)

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