ik-mini 0.2.0-alpha.5

Minimal async API Wrapper for IK | Only Reader/Public API | Extremely minimal.
Documentation
use serde::Deserialize;

/// The top-level wrapper returned by the Inkitt API.
#[derive(Debug, Deserialize, Clone)]
pub struct StoryResult {
    pub response: Story,
}

/// Represents a full story object from the Inkitt API.
#[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "snake_case")]
pub struct Story {
    /// The unique identifier of the story.
    pub id: u64,

    /// Cover image details.
    pub cover: CoverImage,

    /// Total likes/votes.
    pub story_likes_count: u64,

    /// Age rating (e.g., "adults").
    pub age_rating: String,

    /// The title of the story.
    pub title: String,

    /// The status of the story (e.g., "complete", "inprogress").
    pub story_status: String,

    /// Word count.
    pub words_count: u64,

    /// The calculated rating (float).
    pub overall_rating_cache: Option<f64>,

    /// Boolean indicating if this is exclusive to patrons.
    pub for_patrons_only: bool,

    /// Author notes containing HTML.
    pub author_notes: Option<String>,

    /// Boolean indicating if the story contains inline comments.
    pub inline_comments: bool,

    pub ai_assisted: Option<bool>,

    /// Total number of chapters.
    pub chapters_count: u64,

    /// Total reviews.
    pub reviews_count: u64,

    /// Addiction Tags
    pub addiction_tag: Option<Vec<String>>,

    /// Blud Image (Base64)
    pub blur_image: String,

    /// Unknown
    pub rev: u64,

    /// The text of the teaser/hook.
    pub teaser: String,

    /// The full description/blurb of the story.
    pub blurb: String,

    /// The author of the story.
    pub user: User,

    /// Vertical cover details (often high res for mobile).
    pub vertical_cover: VerticalCover,

    /// Current access permission for the viewer.
    pub has_access: bool,

    /// Unknown
    pub content_labels: Vec<ContentLabel>,

    /// Unknown
    pub test_cover: Option<CoverImage>,

    /// Unknown
    pub test_summary: Option<String>,

    /// Unknown
    pub test_title: Option<String>,

    /// Unknown
    pub patron_icon_state: String,

    /// The simplistic list of genre strings (e.g., ["erotica", "romance"]).
    pub genres: Vec<String>,

    /// Detailed genre categorization.
    pub story_genres: Vec<StoryGenreEntry>,
}

/// Represents content_label map
#[derive(Debug, Deserialize, Clone)]
pub struct ContentLabel {
    pub id: u64,
    pub name: String,
}

/// Represents the author of the Inkitt story.
#[derive(Debug, Deserialize, Clone)]
pub struct User {
    pub id: u64,
    pub name: String,
    pub username: String,
    pub small_profile_picture_url: String,
}

/// Represents the standard cover image.
#[derive(Debug, Deserialize, Clone)]
pub struct CoverImage {
    pub url: String,
}

/// Represents the vertical cover variants (mobile/app specific).
#[derive(Debug, Deserialize, Clone)]
pub struct VerticalCover {
    pub blur: String,     // Base64 tiny placeholder
    pub blurhash: String, // Algorithm string for blurring
    pub ipad: String,     // URL
    pub iphone: String,   // URL
}

/// Wrapper for the complex genre object array.
#[derive(Debug, Deserialize, Clone)]
pub struct StoryGenreEntry {
    pub id: u64,
    pub sorting_order: u64,
    pub main_genre: GenreDetails,
    pub sub_genre: GenreDetails,
}

/// Details for a specific genre category.
#[derive(Debug, Deserialize, Clone)]
pub struct GenreDetails {
    pub id: u64,
    pub name: String,
    pub shortname: String,
    pub parent_id: Option<u64>,
    pub cover_url: Option<String>,
    pub small_cover_url: Option<String>,
    pub icon_cover_url: Option<String>,
}