Skip to main content

ephemeris_forge_github/api/model/
labels.rs

1use facet::Facet;
2
3/// A label as GitHub reports it.
4#[derive(Clone, Debug, Eq, PartialEq)]
5pub struct Label {
6    /// The label's name.
7    pub name: String,
8    /// The label's color as six hexadecimal digits.
9    pub color: String,
10    /// The label's description, absent when GitHub reports none.
11    pub description: Option<String>,
12}
13
14/// The wire shape of GitHub's label listing.
15#[derive(Facet)]
16pub(crate) struct LabelResponse {
17    name: String,
18    color: String,
19    #[facet(default)]
20    description: Option<String>,
21}
22
23impl From<LabelResponse> for Label {
24    fn from(value: LabelResponse) -> Self {
25        Self {
26            name: value.name,
27            color: value.color,
28            description: value.description,
29        }
30    }
31}