2023-10-24 20:03:59 +05:30
|
|
|
// Copyright (C) 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
|
|
|
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2023-01-03 12:53:10 +05:30
|
|
|
//! Issues associated to a repository within a forge (Gitea, GitLab, etc.).
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
2023-01-03 13:07:13 +05:30
|
|
|
use crate::{OpenCloseState, Reaction};
|
2023-01-03 12:53:10 +05:30
|
|
|
|
|
|
|
/// Issues associated to a repository within a forge (Gitea, GitLab, etc.).
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq)]
|
|
|
|
pub struct Issue {
|
|
|
|
/// Unique identifier, relative to the repository
|
|
|
|
pub index: usize,
|
|
|
|
|
|
|
|
/// Unique identifier of the user who authored the issue.
|
|
|
|
pub poster_id: usize,
|
|
|
|
|
|
|
|
/// Short description displayed as the title.
|
|
|
|
pub title: String,
|
|
|
|
|
|
|
|
/// Long, multiline, description
|
|
|
|
pub content: String,
|
|
|
|
|
|
|
|
/// Target branch in the repository.
|
|
|
|
///
|
|
|
|
/// NOTE: Actual property is called "ref" but it is a keyword in Rust so we are using
|
|
|
|
/// "reference". However, "reference" will automatically be renamed to "ref" while serializing
|
|
|
|
/// and vice versa
|
|
|
|
#[serde(rename(serialize = "ref", deserialize = "ref"))]
|
|
|
|
pub reference: Option<String>,
|
|
|
|
|
|
|
|
/// Name of the milestone
|
|
|
|
pub milestone: Option<String>,
|
|
|
|
|
|
|
|
/// state of the issue
|
2023-01-03 13:07:13 +05:30
|
|
|
pub state: OpenCloseState,
|
2023-01-03 12:53:10 +05:30
|
|
|
|
|
|
|
/// A locked issue can only be modified by privileged users
|
|
|
|
pub is_locked: bool,
|
|
|
|
|
|
|
|
// TODO: add validation for format "date-time"
|
2023-01-03 13:34:23 +05:30
|
|
|
/// Creation time
|
2023-01-03 12:53:10 +05:30
|
|
|
pub created: String,
|
|
|
|
|
|
|
|
// TODO: add validation for format "date-time"
|
|
|
|
/// Last update time
|
|
|
|
pub updated: String,
|
|
|
|
|
|
|
|
// TODO: add validation for format "date-time"
|
|
|
|
/// The last time 'state' changed to 'closed'
|
|
|
|
pub closed: Option<String>,
|
|
|
|
|
|
|
|
/// List of labels.
|
|
|
|
pub labels: Option<Vec<String>>,
|
|
|
|
|
2023-01-03 13:34:23 +05:30
|
|
|
/// List of reactions
|
2023-01-03 12:53:10 +05:30
|
|
|
pub reactions: Option<Vec<Reaction>>,
|
|
|
|
|
|
|
|
/// List of assignees.
|
|
|
|
pub assignees: Option<Vec<String>>,
|
|
|
|
}
|