Skip to main content

asana_cli/models/
workspace.rs

1//! Workspace and team references.
2
3use serde::{Deserialize, Serialize};
4
5/// Lightweight workspace reference.
6#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
7pub struct WorkspaceReference {
8    /// Globally unique identifier.
9    pub gid: String,
10    /// Optional display name.
11    #[serde(default)]
12    pub name: Option<String>,
13    /// Optional resource type marker from Asana.
14    #[serde(default)]
15    pub resource_type: Option<String>,
16}
17
18impl WorkspaceReference {
19    /// Display helper returning a human readable label.
20    #[must_use]
21    pub fn label(&self) -> String {
22        self.name.clone().unwrap_or_else(|| self.gid.clone())
23    }
24}
25
26/// Full workspace payload.
27#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
28#[serde(rename_all = "snake_case")]
29pub struct Workspace {
30    /// Globally unique identifier.
31    pub gid: String,
32    /// Workspace name.
33    pub name: String,
34    /// Resource type marker.
35    #[serde(default)]
36    pub resource_type: Option<String>,
37    /// Email domains for organization (if applicable).
38    #[serde(default)]
39    pub email_domains: Vec<String>,
40    /// Whether workspace is an organization.
41    #[serde(default)]
42    pub is_organization: bool,
43}
44
45/// Parameters for listing workspaces.
46#[derive(Debug, Clone, Default)]
47pub struct WorkspaceListParams {
48    /// Maximum number to fetch.
49    pub limit: Option<usize>,
50}