diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..949dd17 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "f3-schemas"] + path = f3-schemas + url = https://lab.forgefriends.org/friendlyforgeformat/f3-schemas diff --git a/f3-schemas b/f3-schemas new file mode 160000 index 0000000..12240ce --- /dev/null +++ b/f3-schemas @@ -0,0 +1 @@ +Subproject commit 12240cef49703c2e62ba5a6b4a4f98b3053ba365 diff --git a/src/comment.rs b/src/comment.rs index 7e2de53..ca9d25d 100644 --- a/src/comment.rs +++ b/src/comment.rs @@ -22,16 +22,16 @@ 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, Eq, PartialEq)] +#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq)] 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, + pub index: String, /// Unique identifier of the user who authored the comment - pub poster_id: usize, + pub poster_id: String, // TODO: add validation for format "date-time" /// Creating time diff --git a/src/issue.rs b/src/issue.rs index 636ecbf..b13afe5 100644 --- a/src/issue.rs +++ b/src/issue.rs @@ -23,10 +23,10 @@ use crate::{OpenCloseState, Reaction}; #[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq)] pub struct Issue { /// Unique identifier, relative to the repository - pub index: usize, + pub index: String, /// Unique identifier of the user who authored the issue. - pub poster_id: usize, + pub poster_id: String, /// Short description displayed as the title. pub title: String, @@ -40,10 +40,10 @@ pub struct Issue { /// "reference". However, "reference" will automatically be renamed to "ref" while serializing /// and vice versa #[serde(rename(serialize = "ref", deserialize = "ref"))] - pub reference: Option, + pub reference: String, /// Name of the milestone - pub milestone: Option, + pub milestone: String, /// state of the issue pub state: OpenCloseState, diff --git a/src/label.rs b/src/label.rs index 612eb9a..9997d24 100644 --- a/src/label.rs +++ b/src/label.rs @@ -22,7 +22,7 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq)] pub struct Label { /// Unique identifier of the label - pub index: usize, + pub index: String, /// Name of the label, unique within the repository pub name: String, @@ -31,5 +31,5 @@ pub struct Label { pub color: String, /// Long, multi-line description - pub description: Option, + pub description: String, } diff --git a/src/lib.rs b/src/lib.rs index 48c482a..b15a9cb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,6 +25,8 @@ pub mod identities; pub mod issue; pub mod label; pub mod milestone; +pub mod object; +pub mod organization; pub mod project; pub mod pullrequest; pub mod reaction; @@ -39,6 +41,8 @@ pub use identities::Identities; pub use issue::Issue; pub use label::Label; pub use milestone::Milestone; +pub use object::Object; +pub use organization::Organization; pub use project::Project; pub use pullrequest::PullRequest; pub use reaction::Reaction; diff --git a/src/object.rs b/src/object.rs new file mode 100644 index 0000000..5f7d564 --- /dev/null +++ b/src/object.rs @@ -0,0 +1,34 @@ +/* + * 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 . + */ +//! Meta information and reference to an opaque content such as an image. The unique identifier is the SHA-256 of the content of the object. +use serde::{Deserialize, Serialize}; + +/// Meta information and reference to an opaque content such as an image. The unique identifier is the SHA-256 of the content of the object. +#[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq)] +pub struct Object { + /// Unique identifier + pub index: String, + + /// Human readable file name. + pub name: String, + + /// Mime type of the object. + pub mime: String, + + /// Description + pub description: String, +} diff --git a/src/organization.rs b/src/organization.rs new file mode 100644 index 0000000..fa8f0ec --- /dev/null +++ b/src/organization.rs @@ -0,0 +1,28 @@ +/* + * 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 . + */ +//! An organization that contains projects. +use serde::{Deserialize, Serialize}; + +/// An organization that contains projects. +#[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq)] +pub struct Organization { + /// Unique identifier of the organization + pub index: String, + + /// User readable name of the organization." + pub name: String, +} diff --git a/src/project.rs b/src/project.rs index 476895c..c3b79c8 100644 --- a/src/project.rs +++ b/src/project.rs @@ -23,7 +23,7 @@ use crate::Repository; #[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq)] pub struct Project { /// Unique identifier of the project - pub index: usize, + pub index: String, /// Name of the project, relative to the owner pub name: String, diff --git a/src/pullrequest.rs b/src/pullrequest.rs index 61a711f..3ae6780 100644 --- a/src/pullrequest.rs +++ b/src/pullrequest.rs @@ -23,10 +23,10 @@ use crate::{OpenCloseState, Reaction}; #[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq)] pub struct PullRequest { /// Unique identifier, relative to the repository - pub index: usize, + pub index: String, /// Unique identifier of the user who authored the pull request. - pub poster_id: usize, + pub poster_id: String, /// Short description displayed as the title. pub title: String, @@ -35,7 +35,7 @@ pub struct PullRequest { pub content: String, /// Name of the milestone - pub milestone: Option, + pub milestone: String, /// state of the pull request pub state: OpenCloseState, diff --git a/src/user.rs b/src/user.rs index 3208971..5ebaf38 100644 --- a/src/user.rs +++ b/src/user.rs @@ -21,7 +21,7 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq)] pub struct User { /// Unique identifier of the user - pub index: usize, + pub index: String, /// User readable name of the user pub name: String, @@ -30,7 +30,7 @@ pub struct User { pub username: String, /// Mail of the user - pub email: Option, + pub email: String, /// Password of the user pub password: String,