use std::collections::HashMap;
use crate::{
CheckRun, CreateComment, CreatePullRequest, IssueComment, MergePullRequest, MergeResult,
PullRequest, Result, UpdateComment, UpdatePullRequest,
};
pub trait GitHubApi: Send + Sync {
fn get_pr(
&self,
owner: &str,
repo: &str,
number: u64,
) -> impl std::future::Future<Output = Result<PullRequest>> + Send;
fn get_prs_batch(
&self,
owner: &str,
repo: &str,
numbers: &[u64],
) -> impl std::future::Future<Output = Result<HashMap<u64, PullRequest>>> + Send;
fn find_pr_for_branch(
&self,
owner: &str,
repo: &str,
branch: &str,
) -> impl std::future::Future<Output = Result<Option<PullRequest>>> + Send;
fn create_pr(
&self,
owner: &str,
repo: &str,
pr: CreatePullRequest,
) -> impl std::future::Future<Output = Result<PullRequest>> + Send;
fn update_pr(
&self,
owner: &str,
repo: &str,
number: u64,
update: UpdatePullRequest,
) -> impl std::future::Future<Output = Result<PullRequest>> + Send;
fn get_check_runs(
&self,
owner: &str,
repo: &str,
commit_sha: &str,
) -> impl std::future::Future<Output = Result<Vec<CheckRun>>> + Send;
fn merge_pr(
&self,
owner: &str,
repo: &str,
number: u64,
merge: MergePullRequest,
) -> impl std::future::Future<Output = Result<MergeResult>> + Send;
fn delete_ref(
&self,
owner: &str,
repo: &str,
ref_name: &str,
) -> impl std::future::Future<Output = Result<()>> + Send;
fn get_default_branch(
&self,
owner: &str,
repo: &str,
) -> impl std::future::Future<Output = Result<String>> + Send;
fn list_pr_comments(
&self,
owner: &str,
repo: &str,
pr_number: u64,
) -> impl std::future::Future<Output = Result<Vec<IssueComment>>> + Send;
fn create_pr_comment(
&self,
owner: &str,
repo: &str,
pr_number: u64,
comment: CreateComment,
) -> impl std::future::Future<Output = Result<IssueComment>> + Send;
fn update_pr_comment(
&self,
owner: &str,
repo: &str,
comment_id: u64,
comment: UpdateComment,
) -> impl std::future::Future<Output = Result<IssueComment>> + Send;
}