cusku/forgejo-hooks/src/lib.rs

64 lines
1.3 KiB
Rust
Raw Normal View History

use serde::Deserialize;
#[derive(Deserialize, Debug)]
pub struct CommitAuthor {
pub name: String,
pub email: String,
pub username: String,
}
#[derive(Deserialize, Debug)]
pub struct User {
pub id: u32,
pub login: String,
pub full_name: String,
pub email: String,
pub avatar_url: String,
pub username: String,
}
#[derive(Deserialize, Debug)]
pub struct Commit {
pub id: String,
pub message: String,
pub url: String,
pub author: CommitAuthor,
pub committer: CommitAuthor,
pub timestamp: String,
}
#[derive(Deserialize, Debug)]
pub struct Repository {
pub id: u32,
pub owner: User,
pub name: String,
pub full_name: String,
pub description: String,
pub private: bool,
pub fork: bool,
pub html_url: String,
pub ssh_url: String,
pub clone_url: String,
pub website: String,
pub stars_count: u32,
pub forks_count: u32,
pub watchers_count: u32,
pub open_issues_count: u32,
pub default_branch: String,
pub created_at: String,
pub updated_at: String,
}
#[derive(Deserialize, Debug)]
pub struct Hook {
#[serde(rename(deserialize = "ref"))]
pub ref_: String,
pub before: String,
pub compare_url: String,
pub commits: Vec<Commit>,
pub repository: Repository,
pub pusher: User,
pub sender: User,
}