From 855717781a1b2c601df5adc40c48450d7e302aa1 Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Tue, 3 Jan 2023 13:07:13 +0530 Subject: [PATCH] chore: make IssueState unrelated to issues --- src/issue.rs | 20 ++------------------ src/lib.rs | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/issue.rs b/src/issue.rs index dd9857e..70a2bdf 100644 --- a/src/issue.rs +++ b/src/issue.rs @@ -17,23 +17,7 @@ //! Issues associated to a repository within a forge (Gitea, GitLab, etc.). use serde::{Deserialize, Serialize}; -use crate::Reaction; - -#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)] -#[serde(rename_all = "lowercase")] -/// states of an issue -pub enum IssueState { - /// A 'closed' issue will not see any activity in the future - Closed, - /// An 'open' issue will see activity in the future - Open, -} - -impl Default for IssueState { - fn default() -> Self { - Self::Open - } -} +use crate::{OpenCloseState, Reaction}; /// Issues associated to a repository within a forge (Gitea, GitLab, etc.). #[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq)] @@ -62,7 +46,7 @@ pub struct Issue { pub milestone: Option, /// state of the issue - pub state: IssueState, + pub state: OpenCloseState, /// A locked issue can only be modified by privileged users pub is_locked: bool, diff --git a/src/lib.rs b/src/lib.rs index 8792154..c2760f8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,10 +18,13 @@ //! //! Please refer to the [main documentation](https://f3.forgefriends.org/) for a complete overview. //! This is an incomplete Rust port of the F3 library created by the ForgeFriends project. +use serde::{Deserialize, Serialize}; + pub mod comment; pub mod identities; pub mod issue; pub mod label; +pub mod milestone; pub mod reaction; pub mod repository; pub mod topic; @@ -31,7 +34,25 @@ pub use comment::Comment; pub use identities::Identities; pub use issue::Issue; pub use label::Label; +pub use milestone::Milestone; pub use reaction::Reaction; pub use repository::Repository; pub use topic::Topic; pub use user::User; + +#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)] +#[serde(rename_all = "lowercase")] +/// states of issue, milestone, etc with only "open" and "closed" states and "closed" states and +/// "closed" states and "closed" states +pub enum OpenCloseState { + /// A 'closed' issue will not see any activity in the future + Closed, + /// An 'open' issue will see activity in the future + Open, +} + +impl Default for OpenCloseState { + fn default() -> Self { + Self::Open + } +}