1
0
Fork 0

make issue and pr state an enum

This commit is contained in:
Cyborus 2024-05-14 11:36:44 -04:00
parent 80cba9a6c3
commit ed310f7001
No known key found for this signature in database
2 changed files with 15 additions and 6 deletions

View file

@ -1445,7 +1445,7 @@ pub struct Issue {
#[serde(rename = "ref")] #[serde(rename = "ref")]
pub r#ref: Option<String>, pub r#ref: Option<String>,
pub repository: Option<RepositoryMeta>, pub repository: Option<RepositoryMeta>,
pub state: Option<String>, pub state: Option<StateType>,
pub title: Option<String>, pub title: Option<String>,
#[serde(with = "time::serde::rfc3339::option")] #[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>, pub updated_at: Option<time::OffsetDateTime>,
@ -1738,7 +1738,7 @@ pub struct Milestone {
pub due_on: Option<time::OffsetDateTime>, pub due_on: Option<time::OffsetDateTime>,
pub id: Option<u64>, pub id: Option<u64>,
pub open_issues: Option<u64>, pub open_issues: Option<u64>,
pub state: Option<String>, pub state: Option<StateType>,
pub title: Option<String>, pub title: Option<String>,
#[serde(with = "time::serde::rfc3339::option")] #[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>, pub updated_at: Option<time::OffsetDateTime>,
@ -1822,7 +1822,7 @@ pub struct NotificationSubject {
pub latest_comment_html_url: Option<url::Url>, pub latest_comment_html_url: Option<url::Url>,
#[serde(deserialize_with = "crate::none_if_blank_url")] #[serde(deserialize_with = "crate::none_if_blank_url")]
pub latest_comment_url: Option<url::Url>, pub latest_comment_url: Option<url::Url>,
pub state: Option<String>, pub state: Option<StateType>,
pub title: Option<String>, pub title: Option<String>,
#[serde(rename = "type")] #[serde(rename = "type")]
pub r#type: Option<String>, pub r#type: Option<String>,
@ -2035,7 +2035,7 @@ pub struct PullRequest {
pub patch_url: Option<url::Url>, pub patch_url: Option<url::Url>,
pub pin_order: Option<u64>, pub pin_order: Option<u64>,
pub requested_reviewers: Option<Vec<User>>, pub requested_reviewers: Option<Vec<User>>,
pub state: Option<String>, pub state: Option<StateType>,
pub title: Option<String>, pub title: Option<String>,
#[serde(with = "time::serde::rfc3339::option")] #[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>, pub updated_at: Option<time::OffsetDateTime>,
@ -2327,9 +2327,14 @@ pub struct ServerVersion {
} }
/// StateType issue state type /// StateType issue state type
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct StateType {}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum StateType {
#[serde(rename = "open")]
Open,
#[serde(rename = "closed")]
Closed,
}
/// StopWatch represent a running stopwatch /// StopWatch represent a running stopwatch
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct StopWatch { pub struct StopWatch {

View file

@ -21435,6 +21435,10 @@
"StateType": { "StateType": {
"description": "StateType issue state type", "description": "StateType issue state type",
"type": "string", "type": "string",
"enum": [
"open",
"closed"
],
"x-go-package": "code.gitea.io/gitea/modules/structs" "x-go-package": "code.gitea.io/gitea/modules/structs"
}, },
"StopWatch": { "StopWatch": {