pub struct GitHubService { /* private fields */ }Expand description
GitHub API service.
Provides access to GitHub REST API for issues, pull requests, and review comments. Uses octocrab for API access and requires a personal access token for authentication.
§Authentication
Requires a GitHub personal access token with appropriate scopes:
repo- Required for private repositoriespublic_repo- Sufficient for public repositories
§Examples
ⓘ
use crate::services::github::{GitHubService, Repo};
use crate::{GithubOwner, GithubRepo};
let github = GitHubService::new("ghp_...".to_string())?;
let repo = Repo {
owner: GithubOwner::from("anthropics"),
name: GithubRepo::from("exomonad"),
};
let issues = github.list_issues(&repo, None).await?;
println!("Found {} issues", issues.len());Implementations§
Source§impl GitHubService
impl GitHubService
Sourcepub async fn list_issues(
&self,
repo: &Repo,
filter: Option<&IssueFilter>,
) -> Result<Vec<Issue>>
pub async fn list_issues( &self, repo: &Repo, filter: Option<&IssueFilter>, ) -> Result<Vec<Issue>>
List issues in a repository.
§Arguments
repo- Repository identifier (owner + name)filter- Optional filter criteria (state, labels)
§Returns
A vector of issues matching the filter criteria.
§Errors
Returns an error if:
- Repository doesn’t exist or is not accessible
- Network request fails
- Authentication fails
pub async fn get_issue(&self, repo: &Repo, number: u64) -> Result<Issue>
pub async fn create_pr( &self, repo: &Repo, spec: CreatePRSpec, ) -> Result<PullRequest>
pub async fn list_prs( &self, repo: &Repo, filter: Option<&PRFilter>, ) -> Result<Vec<PullRequest>>
pub async fn get_pr_for_branch( &self, repo: &Repo, head: &str, ) -> Result<Option<PullRequest>>
pub async fn get_pr_review_comments( &self, _repo: &Repo, pr_number: u64, ) -> Result<Vec<ReviewComment>>
Trait Implementations§
Source§impl Clone for GitHubService
impl Clone for GitHubService
Source§fn clone(&self) -> GitHubService
fn clone(&self) -> GitHubService
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 GitHubService
impl !RefUnwindSafe for GitHubService
impl Send for GitHubService
impl Sync for GitHubService
impl Unpin for GitHubService
impl !UnwindSafe for GitHubService
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more