Skip to main content

max / makenotwork

1.6 KB · 74 lines History Blame Raw
1 //! The git side: repository visibility and kind, issue state, build state.
2
3 use super::str_enum::impl_str_enum;
4 use serde::{Deserialize, Serialize};
5
6 // --- Git repository visibility ---
7
8 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9 #[serde(rename_all = "lowercase")]
10 pub enum Visibility {
11 Public,
12 Unlisted,
13 Private,
14 }
15
16 impl_str_enum!(Visibility {
17 Public => "public",
18 Unlisted => "unlisted",
19 Private => "private",
20 });
21
22 // --- Git repository kind ---
23
24 /// What a repository is for.
25 ///
26 /// `Source` is every repository a creator makes. `Annotations` is the one
27 /// per-account repository holding nothing but `refs/notes/*`, which is private
28 /// permanently.
29 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
30 #[serde(rename_all = "lowercase")]
31 pub enum GitRepoKind {
32 Source,
33 Annotations,
34 }
35
36 impl_str_enum!(GitRepoKind {
37 Source => "source",
38 Annotations => "annotations",
39 });
40
41 // --- Git Issues ---
42
43 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
44 #[serde(rename_all = "lowercase")]
45 pub enum IssueStatus {
46 Open,
47 Closed,
48 }
49
50 impl_str_enum!(IssueStatus {
51 Open => "open",
52 Closed => "closed",
53 });
54
55 // --- Build Pipeline ---
56
57 #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
58 #[serde(rename_all = "snake_case")]
59 pub enum BuildStatus {
60 Pending,
61 Running,
62 Succeeded,
63 Failed,
64 Cancelled,
65 }
66
67 impl_str_enum!(BuildStatus {
68 Pending => "pending",
69 Running => "running",
70 Succeeded => "succeeded",
71 Failed => "failed",
72 Cancelled => "cancelled",
73 });
74