mattermost-client 0.2.0

A sane Rust interface to the Mattermost API
Documentation
/*
 * Mattermost API Reference
 *
 * There is also a work-in-progress [Postman API reference](https://documenter.getpostman.com/view/4508214/RW8FERUn).
 *
 * The version of the OpenAPI document: 4.0.0
 * Contact: feedback@mattermost.com
 * Generated by: https://openapi-generator.tech
 */

#[derive(Clone, Debug, PartialEq, Default, serde::Serialize, serde::Deserialize)]
pub struct ChecklistItem {
    /// A unique, 26 characters long, alphanumeric identifier for the checklist item.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// The title of the checklist item.
    #[serde(rename = "title", skip_serializing_if = "Option::is_none")]
    pub title: Option<String>,
    /// The state of the checklist item. An empty string means that the item is not done.
    #[serde(rename = "state", skip_serializing_if = "Option::is_none")]
    pub state: Option<State>,
    /// The timestamp for the latest modification of the item's state, formatted as the number of milliseconds since the Unix epoch. It equals 0 if the item was never modified.
    #[serde(rename = "state_modified", skip_serializing_if = "Option::is_none")]
    pub state_modified: Option<i64>,
    /// The identifier of the user that has been assigned to complete this item. If the item has no assignee, this is an empty string.
    #[serde(rename = "assignee_id", skip_serializing_if = "Option::is_none")]
    pub assignee_id: Option<String>,
    /// The timestamp for the latest modification of the item's assignee, formatted as the number of milliseconds since the Unix epoch. It equals 0 if the item never got an assignee.
    #[serde(rename = "assignee_modified", skip_serializing_if = "Option::is_none")]
    pub assignee_modified: Option<i64>,
    /// The slash command associated with this item. If the item has no slash command associated, this is an empty string
    #[serde(rename = "command", skip_serializing_if = "Option::is_none")]
    pub command: Option<String>,
    /// The timestamp for the latest execution of the item's command, formatted as the number of milliseconds since the Unix epoch. It equals 0 if the command was never executed.
    #[serde(rename = "command_last_run", skip_serializing_if = "Option::is_none")]
    pub command_last_run: Option<i64>,
    /// A detailed description of the checklist item, formatted with Markdown.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
}

impl ChecklistItem {
    pub fn new() -> ChecklistItem {
        ChecklistItem {
            id: None,
            title: None,
            state: None,
            state_modified: None,
            assignee_id: None,
            assignee_modified: None,
            command: None,
            command_last_run: None,
            description: None,
        }
    }
}

/// The state of the checklist item. An empty string means that the item is not done.
#[derive(
    Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, serde::Serialize, serde::Deserialize,
)]
pub enum State {
    #[serde(rename = "")]
    Empty,
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "closed")]
    Closed,
}

impl Default for State {
    fn default() -> State {
        Self::Empty
    }
}