79 lines
1.8 KiB
Rust
79 lines
1.8 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct PrReviewDocument {
|
|
pub meta: PrMeta,
|
|
pub commits: Vec<CommitItem>,
|
|
pub diff_stat: DiffStat,
|
|
pub reviews: Vec<ReviewItem>,
|
|
pub threads: Vec<CommentThread>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct PrMeta {
|
|
pub repo: String,
|
|
pub pr_index: i64,
|
|
pub title: String,
|
|
pub description: Option<String>,
|
|
pub fetched_at: Option<String>,
|
|
pub state: String,
|
|
pub author: String,
|
|
pub base_branch: String,
|
|
pub head_branch: String,
|
|
pub created_at: String,
|
|
pub updated_at: String,
|
|
pub merged_at: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct CommitItem {
|
|
pub sha: String,
|
|
pub short_sha: String,
|
|
pub title: String,
|
|
pub author: String,
|
|
pub date: String,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct DiffStat {
|
|
pub files_changed: usize,
|
|
pub additions: i64,
|
|
pub deletions: i64,
|
|
pub files: Vec<FileStat>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct FileStat {
|
|
pub path: String,
|
|
pub additions: i64,
|
|
pub deletions: i64,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ReviewItem {
|
|
pub id: i64,
|
|
pub state: String,
|
|
pub reviewer: String,
|
|
pub submitted_at: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct CommentThread {
|
|
pub thread_id: String,
|
|
pub file_path: Option<String>,
|
|
pub line: Option<i64>,
|
|
pub root_comment: CommentItem,
|
|
pub replies: Vec<CommentItem>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct CommentItem {
|
|
pub id: i64,
|
|
pub review_id: Option<i64>,
|
|
pub user: String,
|
|
pub created_at: String,
|
|
pub path: Option<String>,
|
|
pub line: Option<i64>,
|
|
pub body: String,
|
|
}
|