use chrono::{DateTime, Utc};
#[derive(Debug, Clone)]
pub struct PullRequest {
pub title: String,
pub number: u64,
pub author: String,
pub repo: String, pub url: String, pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub additions: u64, pub deletions: u64, pub approvals: u32, pub draft: bool,
pub labels: Vec<String>, pub user_has_reviewed: bool, pub filtered_size: Option<u64>, }
impl PullRequest {
pub fn age(&self) -> chrono::Duration {
Utc::now() - self.created_at
}
pub fn size(&self) -> u64 {
self.filtered_size
.unwrap_or(self.additions + self.deletions)
}
pub fn short_ref(&self) -> String {
format!("{}#{}", self.repo, self.number)
}
}