weeb_api 0.2.0

A Rust library for the Weeb.sh API.
Documentation
//! A set of models used for deserializing the responses from the API.

/// The base Api response.
#[derive(Clone, Debug, Deserialize)]
pub struct ApiResponse {
    /// Basic welcome message.
    pub message: String,
    /// HTTP status code.
    pub status: i16,
    /// Semantic version of the API.
    pub version: String,
}

/// An struct containing all the properties of a returned image.
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Image {
    /// ID of the API account that uploaded the image.
    pub account: String,
    /// Category-like type of the image.
    #[serde(rename = "baseType")]
    pub kind: String,
    /// File type of the image.
    pub file_type: String,
    /// If the image is private and only available to its uploader.
    pub hidden: bool,
    /// Internal document ID of the image.
    pub id: String,
    /// Mime type of the image.
    pub mime_type: String,
    /// If the image contains inappropriate content.
    pub nsfw: bool,
    /// Array of ImageTag structs.
    pub tags: Vec<ImageTag>,
    /// URL of the image.
    pub url: String,
}

/// An image tag.
#[derive(Clone, Debug, Deserialize)]
pub struct ImageTag {
    /// If the tag is private and only available to it's creator.
    pub hidden: bool,
    /// Name of the tag.
    pub name: String,
    /// ID of the account that created the tag.
    pub user: String,
}

/// The response given by the Api when theres a missing scope error.
#[derive(Clone, Debug, Deserialize)]
pub struct MissingScopeResponse {
    /// Missing scope error message.
    pub message: String,
    /// HTTP status code.
    pub status: i16,
}

#[derive(Deserialize)]
pub(crate) struct ImageTagsResponse {
    /// Vector of image tags.
    pub tags: Vec<String>,
}

#[derive(Deserialize)]
pub(crate) struct ImageTypesResponse {
    /// Vector of image types
    pub types: Vec<String>,
}

/// The response given by the Api when uploading an image.
#[derive(Clone, Debug, Deserialize)]
pub struct ImageUploadResponse {
    /// The uploaded image
    pub file: Image,
    /// API response message
    pub message: String,
    /// HTTP status code
    pub status: i16,
}