wikimedia-api 0.1.1

Interact with Wikimedia REST API.
Documentation
use serde::{Deserialize, Serialize};

// Wikimedia File object: https://api.wikimedia.org/wiki/Core_REST_API/Reference/Media_files/File_object
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
pub struct File {
    pub title: String,                // File title
    pub file_description_url: String, // URL for the page describing the file, including license information and other metadata
    pub latest: FileLatest, // Object containing information about the latest revision to the file
    pub preferred: FileFormat, // Information about the file's preferred preview format
    pub original: FileFormat, // Information about the file's original format
    // Get file only:
    pub thumbnail: Option<FileFormat>, // Information about the file's thumbnail format
}

#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
pub struct FileLatest {
    pub timestamp: String, // Timestamp of the latest revision in ISO 8601 format
    pub user: FileUser,    // Object containing information about the user who uploaded the file
}

#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
pub struct FileUser {
    id: usize,    // User identifier
    name: String, // Username
}

#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
pub struct FileFormat {
    pub mediatype: String, // File type, one of: BITMAP, DRAWING, AUDIO, VIDEO, MULTIMEDIA, UNKNOWN, OFFICE, TEXT, EXECUTABLE, ARCHIVE, or 3D
    pub size: Option<usize>, // File size in bytes or null if not available
    pub width: Option<usize>, // Maximum recommended image width in pixels or null if not available
    pub height: Option<usize>, // Maximum recommended image height in pixels or null if not available
    pub duration: Option<usize>, // Length of the video, audio, or multimedia file or null for other media types
    pub url: String,             // URL to download the file
}