open-library-api-rs 0.1.0

Async Rust client for the Open Library API
Documentation
// v0.0.1
use serde::{Deserialize, Serialize};

use super::common::ChangeKind;

/// One entry in the recent-changes feed.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RecentChange {
    #[serde(default)]
    pub kind: Option<ChangeKind>,
    #[serde(default)]
    pub key: Option<String>,
    #[serde(default)]
    pub author: Option<ChangeAuthor>,
    #[serde(default)]
    pub ip: Option<String>,
    #[serde(default)]
    pub timestamp: Option<String>,
    #[serde(default)]
    pub comment: Option<String>,
    #[serde(default)]
    pub changes: Option<Vec<ChangeDetail>>,
}

/// The user who made a change.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ChangeAuthor {
    #[serde(default)]
    pub key: Option<String>,
    #[serde(default)]
    pub displayname: Option<String>,
}

/// An individual field change within a recent-changes entry.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ChangeDetail {
    #[serde(default)]
    pub key: Option<String>,
    #[serde(default)]
    pub value: Option<serde_json::Value>,
    #[serde(rename = "type")]
    #[serde(default)]
    pub kind: Option<String>,
}

/// Parameters for the recent-changes endpoints.
#[derive(Debug, Clone, Default)]
pub struct ChangesParams {
    pub limit: Option<u32>,
    pub offset: Option<u32>,
    /// If `Some(true)`, include bot edits; if `Some(false)`, exclude them.
    pub bot: Option<bool>,
}