use serde::Deserialize;
use crate::{DateTime, Oid, User};
#[derive(Deserialize, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ShortRepo {
pub id: u64,
pub name: String,
pub full_name: String,
pub private: bool,
}
#[derive(Deserialize, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Repository {
pub id: u64,
pub owner: User,
pub name: String,
pub full_name: String,
pub description: Option<String>,
pub private: bool,
pub fork: bool,
pub url: String,
pub html_url: String,
pub archive_url: String,
pub assignees_url: String,
pub blobs_url: String,
pub branches_url: String,
pub clone_url: String,
pub collaborators_url: String,
pub comments_url: String,
pub commits_url: String,
pub compare_url: String,
pub contents_url: String,
pub contributors_url: String,
pub deployments_url: String,
pub downloads_url: String,
pub events_url: String,
pub forks_url: String,
pub git_commits_url: String,
pub git_refs_url: String,
pub git_tags_url: String,
pub git_url: String,
pub hooks_url: String,
pub issue_comment_url: String,
pub issue_events_url: String,
pub issues_url: String,
pub keys_url: String,
pub labels_url: String,
pub languages_url: String,
pub merges_url: String,
pub milestones_url: String,
pub mirror_url: Option<String>,
pub notifications_url: String,
pub pulls_url: String,
pub releases_url: String,
pub ssh_url: String,
pub stargazers_url: String,
pub statuses_url: String,
pub subscribers_url: String,
pub subscription_url: String,
pub svn_url: String,
pub tags_url: String,
pub teams_url: String,
pub trees_url: String,
pub homepage: Option<String>,
pub language: Option<String>,
pub forks_count: u64,
pub stargazers_count: u64,
pub watchers_count: u64,
pub size: u64,
pub default_branch: String,
pub open_issues_count: u64,
pub has_issues: bool,
pub has_wiki: bool,
pub has_pages: bool,
pub has_downloads: bool,
pub archived: bool,
pub pushed_at: DateTime,
pub created_at: DateTime,
pub updated_at: DateTime,
}
#[derive(Deserialize, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Comment {
pub id: u64,
pub url: String,
pub html_url: String,
pub body: String,
pub user: User,
pub created_at: DateTime,
pub updated_at: DateTime,
}
#[derive(Deserialize, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PullRequest {
pub id: u64,
pub url: String,
pub html_url: String,
pub diff_url: String,
pub patch_url: String,
pub issue_url: String,
pub commits_url: String,
pub review_comments_url: String,
pub review_comment_url: String,
pub comments_url: String,
pub statuses_url: String,
pub number: u64,
pub state: String,
pub title: String,
pub body: Option<String>,
pub created_at: DateTime,
pub updated_at: DateTime,
pub closed_at: Option<DateTime>,
pub merged_at: Option<DateTime>,
pub head: ShortCommit,
pub base: ShortCommit,
pub user: User,
pub assignee: Option<User>,
pub assignees: Vec<User>,
pub merge_commit_sha: Option<String>,
pub merged: bool,
pub mergeable: Option<bool>,
pub merged_by: Option<User>,
pub comments: Option<u64>,
pub commits: Option<u64>,
pub additions: Option<u64>,
pub deletions: Option<u64>,
pub changed_files: Option<u64>,
pub labels: Vec<Label>,
}
#[derive(Deserialize, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ShortCommit {
pub label: String,
#[serde(rename = "ref")]
pub commit_ref: String,
pub sha: Oid,
pub user: User,
}
#[derive(Deserialize, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Label {
pub url: String,
pub name: String,
pub color: String,
}
#[derive(Deserialize, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Issue {
pub id: u64,
pub url: String,
pub labels_url: String,
pub comments_url: String,
pub events_url: String,
pub html_url: String,
pub number: u64,
pub state: String,
pub title: String,
pub body: Option<String>,
pub user: User,
pub labels: Vec<Label>,
pub assignee: Option<User>,
pub locked: bool,
pub comments: u64,
pub pull_request: Option<PullRef>,
pub closed_at: Option<DateTime>,
pub created_at: DateTime,
pub updated_at: DateTime,
pub assignees: Vec<User>,
}
#[derive(Deserialize, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PullRef {
pub url: String,
pub html_url: String,
pub diff_url: String,
pub patch_url: String,
}
#[derive(
Deserialize, Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash,
)]
#[serde(rename_all = "snake_case")]
pub enum ReviewState {
Commented,
}
#[derive(Deserialize, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Review {
pub id: u64,
pub user: User,
pub body: Option<String>,
pub commit_id: Oid,
pub submitted_at: DateTime,
pub state: ReviewState,
pub html_url: String,
pub pull_request_url: String,
pub author_association: String,
}