linear-tui 0.13.0

A TUI client for Linear.app — manage issues, projects, and cycles from your terminal
//! A team, and the people in the workspace.

use serde::{Deserialize, Serialize};

use super::ids::*;

#[allow(dead_code)]
#[derive(Debug, Clone, Deserialize)]
pub struct User {
    pub id: UserId,
    pub name: String,
    #[serde(default)]
    pub email: Option<String>,
    #[serde(default, rename = "displayName")]
    pub display_name: Option<String>,
}

#[allow(dead_code)]
#[derive(Debug, Clone, Deserialize)]
pub struct Team {
    pub id: TeamId,
    pub name: String,
    pub key: String,
    #[serde(default)]
    pub color: Option<String>,
    /// Whether the team runs cycles at all — teams with them switched off get
    /// no Cycles entry in the sidebar, exactly as in Linear.
    #[serde(default = "default_true", rename = "cyclesEnabled")]
    pub cycles_enabled: bool,
}

fn default_true() -> bool {
    true
}

#[allow(dead_code)]
#[derive(Debug, Clone, Deserialize)]
pub struct Viewer {
    pub id: UserId,
    pub name: String,
    #[serde(default, rename = "displayName")]
    pub display_name: Option<String>,
    /// The workspace the credentials were issued for. A token and an API key
    /// both belong to exactly one.
    #[serde(default)]
    pub organization: Option<Organization>,
}

/// A Linear workspace.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Organization {
    pub id: OrganizationId,
    pub name: String,
    /// The slug in `linear.app/<urlKey>/…`.
    #[serde(rename = "urlKey")]
    pub url_key: String,
}

/// A workspace the user is signed in to, and whether linear-tui acts in it
/// now. A value: the organization's id says which workspace it is.
#[derive(Debug, Clone, PartialEq)]
pub struct Workspace {
    pub organization: Organization,
    pub current: bool,
}