use serde::{Deserialize, Serialize};
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
pub struct PageHistory {
latest: String, // API route to get the latest revisions
older: Option<String>, // If available, API route to get the prior revisions
newer: Option<String>, // If available, API route to get the following revisions
revisions: Vec<Revision>, // Array of 0-20 revisions
}
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
pub struct Revision {
id: usize, // Revision identifier
user: RevisionUser, // Object containing information about the user who made the edit
timestamp: String, // Time of the edit in ISO 8601 format
comment: String, // Comment or edit summary written by the editor. For revisions without a comment, the API returns null or "".
size: usize, // Size of the revision in bytes
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.
minor: bool, // Set to true for edits marked as minor
// Get revision only:
page: Option<RevisionPage>, // Object containing information about the page
}
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
pub struct RevisionUser {
name: String, // Username, or originating IP address for anonymous users
id: Option<usize>, // User identifier, or null for anonymous users
}
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
pub struct RevisionPage {
page_id: usize, // Page identifier,
title: String, // Page title in reading-friendly format
}