travelagent-forge-github 1.11.1

GitHub forge backend for travelagent
Documentation
use serde::Deserialize;

#[derive(Debug, Deserialize)]
pub struct GhPullRequest {
    pub number: u64,
    pub title: String,
    pub body: Option<String>,
    pub state: String,
    pub draft: Option<bool>,
    pub merged_at: Option<String>,
    pub user: GhUser,
    pub base: GhRef,
    pub head: GhRef,
    pub created_at: String,
    pub mergeable_state: Option<String>,
    pub mergeable: Option<bool>,
}

#[derive(Debug, Deserialize)]
pub struct GhUser {
    pub login: String,
    pub id: u64,
}

#[derive(Debug, Deserialize)]
pub struct GhRef {
    #[serde(rename = "ref")]
    pub ref_name: String,
    pub sha: String,
}

#[derive(Debug, Deserialize)]
pub struct GhCommit {
    pub sha: String,
    pub commit: GhCommitDetail,
    pub author: Option<GhUser>,
}

#[derive(Debug, Deserialize)]
pub struct GhCommitDetail {
    pub message: String,
    pub author: GhGitActor,
}

#[derive(Debug, Deserialize)]
pub struct GhGitActor {
    pub name: String,
    pub date: Option<String>,
}

#[derive(Debug, Deserialize)]
pub struct GhFile {
    pub filename: String,
    pub status: String,
    pub additions: u64,
    pub deletions: u64,
    pub patch: Option<String>,
    pub previous_filename: Option<String>,
}

#[derive(Debug, Deserialize)]
pub struct GhReviewComment {
    pub id: u64,
    pub body: String,
    pub path: String,
    pub line: Option<u32>,
    pub start_line: Option<u32>,
    pub side: Option<String>,
    pub start_side: Option<String>,
    pub commit_id: String,
    pub user: GhUser,
    pub created_at: String,
    pub in_reply_to_id: Option<u64>,
}

#[derive(Debug, Deserialize)]
pub struct GhIssueComment {
    pub id: u64,
    pub body: Option<String>,
    pub user: GhUser,
    pub created_at: String,
}

#[derive(Debug, Deserialize)]
pub struct GhReview {
    pub id: u64,
    pub state: String,
    pub body: Option<String>,
    pub user: GhUser,
    pub submitted_at: Option<String>,
}

/// GitHub API permissions object from GET /repos/{owner}/{repo}
#[derive(Debug, Deserialize)]
pub struct GhRepoPermissions {
    pub push: Option<bool>,
    pub maintain: Option<bool>,
    pub admin: Option<bool>,
}

/// Subset of GET /repos/{owner}/{repo} response
#[derive(Debug, Deserialize)]
pub struct GhRepo {
    pub permissions: Option<GhRepoPermissions>,
    pub allow_merge_commit: Option<bool>,
    pub allow_squash_merge: Option<bool>,
    pub allow_rebase_merge: Option<bool>,
}

/// GitHub commit detail response (GET /repos/{owner}/{repo}/commits/{sha})
#[derive(Debug, Deserialize)]
pub struct GhCommitDetail2 {
    pub sha: String,
    pub files: Option<Vec<GhFile>>,
}

/// Row returned by GET /repos/{owner}/{repo}/pulls (list PRs).
/// Only the fields used by the list UI are deserialized.
#[derive(Debug, Deserialize)]
pub struct GhPullRequestListItem {
    pub number: u64,
    pub title: String,
    pub state: String,
    pub draft: Option<bool>,
    pub merged_at: Option<String>,
    pub user: GhUser,
    pub base: GhRef,
    pub head: GhRef,
    pub updated_at: String,
    /// Users GitHub has flagged as review-requested for this PR. Absent on older API versions.
    #[serde(default)]
    pub requested_reviewers: Vec<GhUser>,
    /// Users assigned to the PR. Absent on older API versions / minimal fixtures.
    #[serde(default)]
    pub assignees: Vec<GhUser>,
    /// Count of review comments + issue comments, as reported in the list row. Not always present.
    pub comments: Option<u64>,
    pub review_comments: Option<u64>,
}