feat: define Release
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Aravinth Manivannan 2023-01-03 13:47:11 +05:30
parent f42f7005ee
commit 1f1704bf76
Signed by: realaravinth
GPG Key ID: AD9F0F08E855ED88
2 changed files with 96 additions and 0 deletions

View File

@ -28,6 +28,7 @@ pub mod milestone;
pub mod project;
pub mod pullrequest;
pub mod reaction;
pub mod release;
pub mod repository;
pub mod topic;
pub mod user;
@ -40,6 +41,7 @@ pub use milestone::Milestone;
pub use project::Project;
pub use pullrequest::PullRequest;
pub use reaction::Reaction;
pub use release::ReleaseAsset;
pub use repository::Repository;
pub use topic::Topic;
pub use user::User;

94
src/release.rs Normal file
View File

@ -0,0 +1,94 @@
/*
* 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/>.
*/
//! Assets that constitute a release for a given tag.
use serde::{Deserialize, Serialize};
/// Assets that constitute a release for a given tag.
#[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq)]
pub struct Release {
/// Unique identifier
pub index: usize,
/// Git tag name of the release.
pub tag_name: String,
/// Specifies the commitish value that determines where the Git tag is created from. Can be any
/// branch or commit SHA. Unused if the Git tag already exists.
pub target_commitish: Option<String>,
/// The name of the release
pub name: String,
/// Text describing the contents of the release.
pub body: String,
/// True if the release is a draft.
pub draft: bool,
/// True if the release is a pre-release.
pub prerelease: bool,
/// Unique identifier of the user who authored the release.
pub publisher_id: usize,
/// Name of the user who authored the release.
pub publisher_name: String,
/// Email of the user who authored the release.
pub publisher_email: Option<String>,
/// List of assets associated with the release.
pub assets: Option<Vec<ReleaseAsset>>,
// TODO: add validation for format "date-time"
/// Creation time
pub created: String,
// TODO: add validation for format "date-time"
/// Publication time.
pub published: String,
}
/// A file associated with a release.
#[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq)]
pub struct ReleaseAsset {
/// Unique identifier of the release asset.
pub index: usize,
/// The name of the release asset.
pub name: String,
/// The content type of the release asset (application/zip, etc.).
pub content_type: String,
/// Size in bytes of the release asset.
pub size: String,
/// The number of times the release asset was downloaded.
pub download_count: usize,
// TODO: add validation for format "date-time"
/// Creation time
pub created: String,
// TODO: add validation for format "date-time"
/// Last update time.
pub updated: String,
/// The URL from which the release asset can be downloaded.
pub download_url: String,
}