subspace_contracts/issues/
summary.rs1use super::IssueState;
4
5mod details;
6mod facts;
7pub use facts::{IssuePerson, IssueProgress, LatestActivity, PullRequestSummary};
8
9#[derive(Clone, PartialEq, Eq)]
11#[non_exhaustive]
12pub struct IssueSummary {
13 pub identifier: String,
14 pub title: String,
15 pub summary: Option<String>,
17 pub url: String,
19 pub state: IssueState,
20 pub tracker: bool,
21 pub archived: bool,
22 pub assignee: Option<String>,
24 details: Option<Box<details::Details>>,
25}
26
27impl IssueSummary {
28 pub fn new(identifier: &str, title: &str, url: &str, state: IssueState) -> Self {
29 Self {
30 identifier: identifier.into(),
31 title: title.into(),
32 summary: None,
33 url: url.into(),
34 state,
35 tracker: false,
36 archived: false,
37 assignee: None,
38 details: None,
39 }
40 }
41
42 pub fn with_markers(mut self, tracker: bool, archived: bool) -> Self {
44 self.tracker = tracker;
45 self.archived = archived;
46 self
47 }
48
49 pub fn with_summary(mut self, summary: Option<&str>) -> Self {
50 self.summary = summary.map(str::to_owned);
51 self
52 }
53
54 pub fn with_assignee(mut self, assignee: Option<&str>) -> Self {
55 self.assignee = assignee.map(str::to_owned);
56 self
57 }
58}