f3_rs/issue.rs
1// Copyright (C) 2023 Aravinth Manivannan <realaravinth@batsense.net>
2// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
3//
4// SPDX-License-Identifier: MIT
5
6//! Issues associated to a repository within a forge (Gitea, GitLab, etc.).
7use serde::{Deserialize, Serialize};
8
9use crate::{OpenCloseState, Reaction};
10
11/// Issues associated to a repository within a forge (Gitea, GitLab, etc.).
12#[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq)]
13pub struct Issue {
14 /// Unique identifier, relative to the repository
15 pub index: usize,
16
17 /// Unique identifier of the user who authored the issue.
18 pub poster_id: usize,
19
20 /// Short description displayed as the title.
21 pub title: String,
22
23 /// Long, multiline, description
24 pub content: String,
25
26 /// Target branch in the repository.
27 ///
28 /// NOTE: Actual property is called "ref" but it is a keyword in Rust so we are using
29 /// "reference". However, "reference" will automatically be renamed to "ref" while serializing
30 /// and vice versa
31 #[serde(rename(serialize = "ref", deserialize = "ref"))]
32 pub reference: Option<String>,
33
34 /// Name of the milestone
35 pub milestone: Option<String>,
36
37 /// state of the issue
38 pub state: OpenCloseState,
39
40 /// A locked issue can only be modified by privileged users
41 pub is_locked: bool,
42
43 // TODO: add validation for format "date-time"
44 /// Creation time
45 pub created: String,
46
47 // TODO: add validation for format "date-time"
48 /// Last update time
49 pub updated: String,
50
51 // TODO: add validation for format "date-time"
52 /// The last time 'state' changed to 'closed'
53 pub closed: Option<String>,
54
55 /// List of labels.
56 pub labels: Option<Vec<String>>,
57
58 /// List of reactions
59 pub reactions: Option<Vec<Reaction>>,
60
61 /// List of assignees.
62 pub assignees: Option<Vec<String>>,
63}