gitea_sdk/model/
pulls.rs

1use serde::{Deserialize, Serialize};
2
3use super::{
4    issues::{Label, StateType},
5    repos::Repository,
6    user::User,
7};
8
9#[derive(Debug, Clone, Serialize, Deserialize)]
10pub struct PullRequest {
11    pub additions: i64,
12    pub allow_maintainer_edit: bool,
13    pub assignees: Option<Vec<User>>,
14    pub base: PrBranchInfo,
15    pub body: String,
16    pub changed_files: i64,
17    pub closed_at: Option<String>,
18    pub comments: i64,
19    pub created_at: String,
20    pub deletions: i64,
21    pub diff_url: String,
22    pub draft: bool,
23    pub due_date: Option<String>,
24    pub head: PrBranchInfo,
25    pub html_url: String,
26    pub id: i64,
27    pub is_locked: bool,
28    pub labels: Vec<Label>,
29    pub merge_base: String,
30    pub merge_commit_sha: Option<String>,
31    pub mergeable: bool,
32    pub merged: bool,
33    pub merged_at: Option<String>,
34    pub merged_by: Option<User>,
35    // TODO: pub milestone: Option<Milestone>,
36    pub number: i64,
37    pub patch_url: String,
38    pub pin_order: i64,
39    pub requested_reviewers: Option<Vec<Option<User>>>,
40    /// Number of review comments made on the diff of a PR review (not including comments on commits or issues in a PR)
41    pub review_comments: i64,
42    pub state: StateType,
43    pub title: String,
44    // TODO: Make this a DateTime<Utc>
45    pub updated_at: String,
46    pub url: String,
47    pub user: User,
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
51pub struct PrBranchInfo {
52    pub label: String,
53    pub r#ref: String,
54    pub repo: Repository,
55    pub repo_id: i64,
56    pub sha: String,
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(rename_all = "lowercase")]
61pub enum Sort {
62    Oldest,
63    RecentUpdate,
64    LeastUpdate,
65    MostComment,
66    LeastComment,
67    Priority,
68}