feat: define Comment

This commit is contained in:
Aravinth Manivannan 2023-01-03 12:28:05 +05:30
parent 533e9485cf
commit d1eff66bab
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
2 changed files with 50 additions and 0 deletions

48
src/comment.rs Normal file
View file

@ -0,0 +1,48 @@
/*
* Copyright (C) 2023 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
//! Comments associated to an issue or a pull/merge request within the repository of a forge
//! (Gitea, GitLab, etc.).",
use serde::{Deserialize, Serialize};
use crate::Reaction;
/// Comments associated to an issue or a pull/merge request within the repository of a forge (Gitea, GitLab, etc.).",
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
pub struct Comment {
/// Unique identifier of the issue or pull/merge request containing the comment
pub issue_index: usize,
/// Unique identifier of the comment
pub index: usize,
/// Unique identifier of the user who authored the comment
pub poster_id: usize,
// TODO: add validation for format "date-time"
/// Creating time
pub created: String,
// TODO: add validation for format "date-time"
/// Last update time
pub updated: String,
/// Multiline content of the comment
pub content: String,
/// Multiline content of the comment
pub reactions: Option<Vec<Reaction>>,
}

View file

@ -18,6 +18,7 @@
//! //!
//! 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.
pub mod comment;
pub mod identities; pub mod identities;
pub mod label; pub mod label;
pub mod reaction; pub mod reaction;
@ -25,6 +26,7 @@ pub mod repository;
pub mod topic; pub mod topic;
pub mod user; pub mod user;
pub use comment::Comment;
pub use identities::Identities; pub use identities::Identities;
pub use label::Label; pub use label::Label;
pub use reaction::Reaction; pub use reaction::Reaction;