f3-rs/src/release.rs

84 lines
2.4 KiB
Rust

// Copyright (C) 2023 Aravinth Manivannan <realaravinth@batsense.net>
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
//
// SPDX-License-Identifier: MIT
//! 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,
}