api-project
Source: crates/lvcs-api/src/project.rs.
/// `project.summary` (decision 303). On a project's connection, that
/// project's [`Summary`]. On the host's connection, a
/// [`ProjectSummaryResult`]: one entry per hosted project, each read as
/// its default participant.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
pub struct ProjectSummaryParams {}
/// `project.summary` result on the host's connection, by root.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ProjectSummaryResult {
#[serde(default)]
pub projects: Vec<ProjectSummary>,
}
/// One hosted project's summary on the host's connection. `summary` is
/// absent, and the counts zero, while the project isn't open, or when it
/// didn't answer within `HOST_GATHER_MS`.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ProjectSummary {
/// Its canonical root.
pub root: String,
/// Its lifecycle stage, as `HostedProject.stage`.
pub stage: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub summary: Option<Summary>,
/// The participants present now (`presence.list`), by name, sorted.
#[serde(default)]
pub present: Vec<String>,
/// The participant's open asks and holds.
#[serde(default)]
pub open: u32,
/// The participant's unread notifications.
#[serde(default)]
pub unread: u32,
}
/// `project.summary` result on a project's connection.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Summary {
/// Its project id, in `ID_ENCODING`.
pub project: String,
/// The owner, by name (`Named`).
pub owner: String,
/// The connection's participant, by name.
pub participant: String,
/// The connected peers.
#[serde(default)]
pub peers: u32,
/// The workspaces in the registry.
#[serde(default)]
pub workspaces: u32,
/// Each channel and combination, by name, with its value's frontier
/// count.
#[serde(default)]
pub channels: Vec<SummaryChannel>,
/// The `activity` pushes of the last `ACTIVITY_RECENT_SECS`.
#[serde(default)]
pub activity: u32,
/// The protected paths waiting for approval (decision 314).
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub waiting: Vec<String>,
}
/// A channel's name and how many frontiers its value holds.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SummaryChannel {
pub name: String,
pub frontiers: u32,
}
/// `inbox` (decision 303): every hosted project's notifications for its
/// default participant, metadata only, as `notifications` lists them;
/// nothing is marked read.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
pub struct InboxParams {}
/// `inbox` result, by root.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct InboxResult {
#[serde(default)]
pub projects: Vec<InboxProject>,
}
/// One hosted project's notifications: the default participant's
/// `notifications` listing, absent while the project isn't open, or when
/// it didn't answer within `HOST_GATHER_MS`.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct InboxProject {
pub root: String,
/// Its lifecycle stage, as `HostedProject.stage`.
pub stage: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub notifications: Option<NotificationsResult>,
}