chore: make IssueState unrelated to issues
This commit is contained in:
parent
7003b3ff05
commit
855717781a
2 changed files with 23 additions and 18 deletions
20
src/issue.rs
20
src/issue.rs
|
@ -17,23 +17,7 @@
|
||||||
//! Issues associated to a repository within a forge (Gitea, GitLab, etc.).
|
//! Issues associated to a repository within a forge (Gitea, GitLab, etc.).
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::Reaction;
|
use crate::{OpenCloseState, 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Issues associated to a repository within a forge (Gitea, GitLab, etc.).
|
/// Issues associated to a repository within a forge (Gitea, GitLab, etc.).
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq)]
|
#[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq)]
|
||||||
|
@ -62,7 +46,7 @@ pub struct Issue {
|
||||||
pub milestone: Option<String>,
|
pub milestone: Option<String>,
|
||||||
|
|
||||||
/// state of the issue
|
/// state of the issue
|
||||||
pub state: IssueState,
|
pub state: OpenCloseState,
|
||||||
|
|
||||||
/// A locked issue can only be modified by privileged users
|
/// A locked issue can only be modified by privileged users
|
||||||
pub is_locked: bool,
|
pub is_locked: bool,
|
||||||
|
|
21
src/lib.rs
21
src/lib.rs
|
@ -18,10 +18,13 @@
|
||||||
//!
|
//!
|
||||||
//! Please refer to the [main documentation](https://f3.forgefriends.org/) for a complete overview.
|
//! 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.
|
//! This is an incomplete Rust port of the F3 library created by the ForgeFriends project.
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
pub mod comment;
|
pub mod comment;
|
||||||
pub mod identities;
|
pub mod identities;
|
||||||
pub mod issue;
|
pub mod issue;
|
||||||
pub mod label;
|
pub mod label;
|
||||||
|
pub mod milestone;
|
||||||
pub mod reaction;
|
pub mod reaction;
|
||||||
pub mod repository;
|
pub mod repository;
|
||||||
pub mod topic;
|
pub mod topic;
|
||||||
|
@ -31,7 +34,25 @@ pub use comment::Comment;
|
||||||
pub use identities::Identities;
|
pub use identities::Identities;
|
||||||
pub use issue::Issue;
|
pub use issue::Issue;
|
||||||
pub use label::Label;
|
pub use label::Label;
|
||||||
|
pub use milestone::Milestone;
|
||||||
pub use reaction::Reaction;
|
pub use reaction::Reaction;
|
||||||
pub use repository::Repository;
|
pub use repository::Repository;
|
||||||
pub use topic::Topic;
|
pub use topic::Topic;
|
||||||
pub use user::User;
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue