pub struct GitHubClient { /* private fields */ }Expand description
GitHub API client.
Implementations§
Source§impl GitHubClient
impl GitHubClient
Sourcepub const DEFAULT_API_URL: &'static str = "https://api.github.com"
pub const DEFAULT_API_URL: &'static str = "https://api.github.com"
Default GitHub API URL.
Sourcepub fn with_base_url(auth: &Auth, base_url: impl Into<String>) -> Result<Self>
pub fn with_base_url(auth: &Auth, base_url: impl Into<String>) -> Result<Self>
Create a new GitHub client with a custom API URL (for GitHub Enterprise).
§Errors
Returns error if authentication fails.
Sourcepub async fn get_prs_batch(
&self,
owner: &str,
repo: &str,
numbers: &[u64],
) -> Result<HashMap<u64, PullRequest>>
pub async fn get_prs_batch( &self, owner: &str, repo: &str, numbers: &[u64], ) -> Result<HashMap<u64, PullRequest>>
Get multiple pull requests by number using GraphQL (single API call).
This is more efficient than calling get_pr multiple times when fetching
many PRs, as it uses a single GraphQL query instead of N REST calls.
Returns a map of PR number to PR data. PRs that don’t exist or can’t be fetched are omitted from the result (no error is returned for missing PRs).
§Errors
Returns error if the GraphQL request fails entirely.
Sourcepub async fn find_pr_for_branch(
&self,
owner: &str,
repo: &str,
branch: &str,
) -> Result<Option<PullRequest>>
pub async fn find_pr_for_branch( &self, owner: &str, repo: &str, branch: &str, ) -> Result<Option<PullRequest>>
Sourcepub async fn create_pr(
&self,
owner: &str,
repo: &str,
pr: CreatePullRequest,
) -> Result<PullRequest>
pub async fn create_pr( &self, owner: &str, repo: &str, pr: CreatePullRequest, ) -> Result<PullRequest>
Sourcepub async fn update_pr(
&self,
owner: &str,
repo: &str,
number: u64,
update: UpdatePullRequest,
) -> Result<PullRequest>
pub async fn update_pr( &self, owner: &str, repo: &str, number: u64, update: UpdatePullRequest, ) -> Result<PullRequest>
Sourcepub async fn get_check_runs(
&self,
owner: &str,
repo: &str,
commit_sha: &str,
) -> Result<Vec<CheckRun>>
pub async fn get_check_runs( &self, owner: &str, repo: &str, commit_sha: &str, ) -> Result<Vec<CheckRun>>
Sourcepub async fn merge_pr(
&self,
owner: &str,
repo: &str,
number: u64,
merge: MergePullRequest,
) -> Result<MergeResult>
pub async fn merge_pr( &self, owner: &str, repo: &str, number: u64, merge: MergePullRequest, ) -> Result<MergeResult>
Sourcepub async fn list_pr_comments(
&self,
owner: &str,
repo: &str,
pr_number: u64,
) -> Result<Vec<IssueComment>>
pub async fn list_pr_comments( &self, owner: &str, repo: &str, pr_number: u64, ) -> Result<Vec<IssueComment>>
Sourcepub async fn create_pr_comment(
&self,
owner: &str,
repo: &str,
pr_number: u64,
comment: CreateComment,
) -> Result<IssueComment>
pub async fn create_pr_comment( &self, owner: &str, repo: &str, pr_number: u64, comment: CreateComment, ) -> Result<IssueComment>
Sourcepub async fn update_pr_comment(
&self,
owner: &str,
repo: &str,
comment_id: u64,
comment: UpdateComment,
) -> Result<IssueComment>
pub async fn update_pr_comment( &self, owner: &str, repo: &str, comment_id: u64, comment: UpdateComment, ) -> Result<IssueComment>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GitHubClient
impl !RefUnwindSafe for GitHubClient
impl Send for GitHubClient
impl Sync for GitHubClient
impl Unpin for GitHubClient
impl !UnwindSafe for GitHubClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more