58 lines
1.5 KiB
Rust
58 lines
1.5 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
|
pub struct Author {
|
|
pub id: i64,
|
|
pub login: String,
|
|
pub full_name: String,
|
|
pub email: String,
|
|
pub avatar_url: String,
|
|
pub language: String,
|
|
pub is_admin: bool,
|
|
pub last_login: String,
|
|
pub created: String,
|
|
pub username: String,
|
|
}
|
|
|
|
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
|
pub struct Release {
|
|
pub id: i64,
|
|
pub tag_name: String,
|
|
pub target_commitish: String,
|
|
pub name: String,
|
|
pub body: String,
|
|
pub url: String,
|
|
pub tarball_url: String,
|
|
pub zipball_url: String,
|
|
pub draft: bool,
|
|
pub prerelease: bool,
|
|
pub created_at: String,
|
|
pub published_at: String,
|
|
pub author: Author,
|
|
pub assets: Vec<::serde_json::Value>,
|
|
}
|
|
|
|
use cli_table::{Cell, Row};
|
|
impl Release {
|
|
pub fn row(&self) -> Row {
|
|
Row::new(vec![
|
|
Cell::new(&format!("{}", self.id), Default::default()),
|
|
Cell::new(&self.tag_name, Default::default()),
|
|
Cell::new(&self.created_at, Default::default()),
|
|
Cell::new(&self.target_commitish, Default::default()),
|
|
Cell::new(&self.author.username, Default::default()),
|
|
Cell::new(&self.name, Default::default()),
|
|
])
|
|
}
|
|
}
|
|
|
|
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
|
pub struct CreateRelease {
|
|
pub body: String,
|
|
pub draft: bool,
|
|
pub name: String,
|
|
pub prerelease: bool,
|
|
pub tag_name: String,
|
|
pub target_commitish: String,
|
|
}
|