diff --git a/src/comment.rs b/src/comment.rs new file mode 100644 index 0000000..e995736 --- /dev/null +++ b/src/comment.rs @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2023 Aravinth Manivannan + * + * 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 . + */ +//! 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>, +} diff --git a/src/lib.rs b/src/lib.rs index 6e36b67..46c6c0b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,6 +18,7 @@ //! //! 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. +pub mod comment; pub mod identities; pub mod label; pub mod reaction; @@ -25,6 +26,7 @@ pub mod repository; pub mod topic; pub mod user; +pub use comment::Comment; pub use identities::Identities; pub use label::Label; pub use reaction::Reaction;