Skip to main content

wikimedia_api/endpoints/
revision.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
4pub struct PageHistory {
5    latest: String,           // API route to get the latest revisions
6    older: Option<String>,    // If available, API route to get the prior revisions
7    newer: Option<String>,    // If available, API route to get the following revisions
8    revisions: Vec<Revision>, // Array of 0-20 revisions
9}
10
11#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
12pub struct Revision {
13    id: usize,          // Revision identifier
14    user: RevisionUser, // Object containing information about the user who made the edit
15    timestamp: String,  // Time of the edit in ISO 8601 format
16    comment: String, // Comment or edit summary written by the editor. For revisions without a comment, the API returns null or "".
17    size: usize,     // Size of the revision in bytes
18    delta: usize, // Number of bytes changed, positive or negative, between a revision and the preceding revision (example: -20). If the preceding revision is unavailable, the API returns null.
19    minor: bool,  // Set to true for edits marked as minor
20    // Get revision only:
21    page: Option<RevisionPage>, // Object containing information about the page
22}
23
24#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
25pub struct RevisionUser {
26    name: String,      // Username, or originating IP address for anonymous users
27    id: Option<usize>, // User identifier, or null for anonymous users
28}
29
30#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
31pub struct RevisionPage {
32    page_id: usize, // Page identifier,
33    title: String,  // Page title in reading-friendly format
34}