wikimedia-api 0.1.1

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

// Wikimedia SearchResult object: https://api.wikimedia.org/wiki/Core_REST_API/Reference/Search/Search_result_object
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
pub struct SearchResult {
    pub id: usize,     // Page identifier
    pub key: String,   // Page title in URL-friendly format
    pub title: String, // Page title in reading-friendly format
    /* For search content endpoint:
    A few lines giving a sample of page content with search terms highlighted with <span class=\"searchmatch\"> tags. Excerpts may end mid-sentence.
    For search titles endpoint:
    Page title in reading-friendly format */
    pub excerpt: String,
    /* Title of the page redirected from, if the search term matched a redirect page, or null if search term did not match a redirect page */
    pub matched_title: Option<String>,
    pub description: Option<String>, // Short summary of the page or null if no description exists
    pub thumbnail: Option<ThumbNailFormat>, // Reduced-size version of the page's lead image or null if no lead image exists
}

#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
pub struct ThumbNailFormat {
    pub mimetype: String,        // Media type for the image. For example: image/jpeg
    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
}