1use chrono::{DateTime, Utc};
2
3#[derive(Debug, Clone)]
4pub struct PullRequest {
5 pub title: String,
6 pub number: u64,
7 pub author: String,
8 pub repo: String, pub url: String, pub created_at: DateTime<Utc>,
11 pub updated_at: DateTime<Utc>,
12 pub additions: u64, pub deletions: u64, pub approvals: u32, pub draft: bool,
16 pub labels: Vec<String>, pub user_has_reviewed: bool, pub filtered_size: Option<u64>, }
20
21impl PullRequest {
22 pub fn age(&self) -> chrono::Duration {
24 Utc::now() - self.created_at
25 }
26
27 pub fn size(&self) -> u64 {
29 self.filtered_size
30 .unwrap_or(self.additions + self.deletions)
31 }
32
33 pub fn short_ref(&self) -> String {
35 format!("{}#{}", self.repo, self.number)
36 }
37}