pub struct GitHubClient { /* private fields */ }Expand description
Client for the GitHub REST API, focused on issue/PR comments.
Implementations§
Source§impl GitHubClient
impl GitHubClient
Sourcepub fn new(base_url: &str, token: &str) -> Result<Self, GitHubError>
pub fn new(base_url: &str, token: &str) -> Result<Self, GitHubError>
Creates a new GitHubClient with the given token.
The base_url should be https://api.github.com for github.com
or https://github.example.com/api/v3 for GitHub Enterprise.
Sourcepub async fn list_comments(
&self,
owner: &str,
repo: &str,
pr_number: u64,
) -> Result<Vec<GitHubComment>, GitHubError>
pub async fn list_comments( &self, owner: &str, repo: &str, pr_number: u64, ) -> Result<Vec<GitHubComment>, GitHubError>
List comments on a pull request / issue.
Sourcepub async fn create_comment(
&self,
owner: &str,
repo: &str,
pr_number: u64,
body: &str,
) -> Result<GitHubComment, GitHubError>
pub async fn create_comment( &self, owner: &str, repo: &str, pr_number: u64, body: &str, ) -> Result<GitHubComment, GitHubError>
Create a new comment on a pull request / issue.
Sourcepub async fn update_comment(
&self,
owner: &str,
repo: &str,
comment_id: u64,
body: &str,
) -> Result<GitHubComment, GitHubError>
pub async fn update_comment( &self, owner: &str, repo: &str, comment_id: u64, body: &str, ) -> Result<GitHubComment, GitHubError>
Update an existing comment.
Sourcepub async fn find_perfgate_comment(
&self,
owner: &str,
repo: &str,
pr_number: u64,
) -> Result<Option<GitHubComment>, GitHubError>
pub async fn find_perfgate_comment( &self, owner: &str, repo: &str, pr_number: u64, ) -> Result<Option<GitHubComment>, GitHubError>
Find an existing perfgate comment on a PR by looking for the marker.
Sourcepub async fn upsert_comment(
&self,
owner: &str,
repo: &str,
pr_number: u64,
body: &str,
) -> Result<(GitHubComment, bool), GitHubError>
pub async fn upsert_comment( &self, owner: &str, repo: &str, pr_number: u64, body: &str, ) -> Result<(GitHubComment, bool), GitHubError>
Create or update the perfgate comment on a PR (idempotent).
If a comment with the perfgate marker already exists, it is updated. Otherwise, a new comment is created.
Returns (comment, created) where created is true if a new comment was made.
Trait Implementations§
Source§impl Clone for GitHubClient
impl Clone for GitHubClient
Source§fn clone(&self) -> GitHubClient
fn clone(&self) -> GitHubClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GitHubClient
impl !RefUnwindSafe for GitHubClient
impl Send for GitHubClient
impl Sync for GitHubClient
impl Unpin for GitHubClient
impl UnsafeUnpin 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