subspace_contracts/issues/summary/
facts.rs1#[derive(Clone, PartialEq, Eq)]
4#[non_exhaustive]
5pub struct IssuePerson {
6 pub id: String,
7 pub name: String,
8 pub kind: String,
9}
10impl IssuePerson {
11 pub fn new(id: &str, name: &str, kind: &str) -> Self {
12 Self {
13 id: id.into(),
14 name: name.into(),
15 kind: kind.into(),
16 }
17 }
18}
19
20#[derive(Clone, Copy, PartialEq, Eq)]
21#[non_exhaustive]
22pub struct IssueProgress {
23 pub done: u32,
24 pub total: u32,
25}
26impl IssueProgress {
27 pub fn new(done: u32, total: u32) -> Self {
28 Self {
29 done: done.min(total),
30 total,
31 }
32 }
33}
34
35#[derive(Clone, PartialEq, Eq)]
36#[non_exhaustive]
37pub struct PullRequestSummary {
38 pub total: u32,
39 pub open: u32,
40 pub closed: u32,
41 pub merged: u32,
42 pub checks: Option<String>,
44}
45impl PullRequestSummary {
46 pub fn new(total: u32, open: u32, closed: u32, merged: u32) -> Self {
47 Self {
48 total,
49 open,
50 closed,
51 merged,
52 checks: None,
53 }
54 }
55 pub fn with_checks(mut self, checks: Option<&str>) -> Self {
56 self.checks = checks.map(str::to_owned);
57 self
58 }
59}
60
61#[derive(Clone, PartialEq, Eq)]
62#[non_exhaustive]
63pub struct LatestActivity {
64 pub kind: String,
65 pub occurred_at: String,
67 pub actor: Option<String>,
68}
69impl LatestActivity {
70 pub fn new(kind: &str, occurred_at: &str) -> Self {
71 Self {
72 kind: kind.into(),
73 occurred_at: occurred_at.into(),
74 actor: None,
75 }
76 }
77 pub fn with_actor(mut self, actor: Option<&str>) -> Self {
79 self.actor = actor.map(str::to_owned);
80 self
81 }
82}