pub struct GitHubClient { /* private fields */ }Expand description
GitHub API client
Implementations§
Source§impl GitHubClient
impl GitHubClient
Sourcepub fn new(
token: impl Into<String>,
owner: impl Into<String>,
repo: impl Into<String>,
) -> Result<Self>
pub fn new( token: impl Into<String>, owner: impl Into<String>, repo: impl Into<String>, ) -> Result<Self>
Sourcepub async fn verify_auth(&self) -> Result<String>
pub async fn verify_auth(&self) -> Result<String>
Verify authentication by fetching current user
Sourcepub async fn get_repository(&self) -> Result<Repository>
pub async fn get_repository(&self) -> Result<Repository>
Get repository information
Source§impl GitHubClient
impl GitHubClient
Sourcepub async fn list_issues(
&self,
state: Option<State>,
labels: Vec<String>,
) -> Result<Vec<Issue>>
pub async fn list_issues( &self, state: Option<State>, labels: Vec<String>, ) -> Result<Vec<Issue>>
Sourcepub async fn update_issue(
&self,
number: u64,
title: Option<&str>,
body: Option<&str>,
state: Option<State>,
) -> Result<Issue>
pub async fn update_issue( &self, number: u64, title: Option<&str>, body: Option<&str>, state: Option<State>, ) -> Result<Issue>
Sourcepub async fn close_issue(&self, number: u64) -> Result<Issue>
pub async fn close_issue(&self, number: u64) -> Result<Issue>
Close an issue
Sourcepub async fn reopen_issue(&self, number: u64) -> Result<Issue>
pub async fn reopen_issue(&self, number: u64) -> Result<Issue>
Reopen an issue
Sourcepub async fn get_issues_by_state(&self, state: IssueState) -> Result<Vec<Issue>>
pub async fn get_issues_by_state(&self, state: IssueState) -> Result<Vec<Issue>>
Source§impl GitHubClient
impl GitHubClient
Sourcepub async fn list_labels(&self) -> Result<Vec<Label>>
pub async fn list_labels(&self) -> Result<Vec<Label>>
List all labels in the repository
Sourcepub async fn create_label(
&self,
name: &str,
color: &str,
description: Option<&str>,
) -> Result<Label>
pub async fn create_label( &self, name: &str, color: &str, description: Option<&str>, ) -> Result<Label>
Create a new label
§Arguments
name- Label namecolor- Label color (hex without #, e.g., “ff0000”)description- Label description (optional)
Sourcepub async fn update_label(
&self,
name: &str,
new_name: Option<&str>,
color: Option<&str>,
description: Option<&str>,
) -> Result<Label>
pub async fn update_label( &self, name: &str, new_name: Option<&str>, color: Option<&str>, description: Option<&str>, ) -> Result<Label>
Update an existing label
§Arguments
name- Current label namenew_name- New label name (optional)color- New color (optional)description- New description (optional)
Sourcepub async fn delete_label(&self, name: &str) -> Result<()>
pub async fn delete_label(&self, name: &str) -> Result<()>
Delete a label
Sourcepub async fn label_exists(&self, name: &str) -> Result<bool>
pub async fn label_exists(&self, name: &str) -> Result<bool>
Check if a label exists
Source§impl GitHubClient
GitHub Projects V2 client
impl GitHubClient
GitHub Projects V2 client
Sourcepub async fn get_project_items(
&self,
project_number: u32,
) -> Result<Vec<ProjectItem>>
pub async fn get_project_items( &self, project_number: u32, ) -> Result<Vec<ProjectItem>>
Sourcepub async fn update_project_field(
&self,
project_id: &str,
item_id: &str,
field_name: &str,
value: &str,
) -> Result<()>
pub async fn update_project_field( &self, project_id: &str, item_id: &str, field_name: &str, value: &str, ) -> Result<()>
Update a custom field value for a project item
§Arguments
project_id- Project node ID (e.g., “PVT_kwDOAB…”)item_id- Project item node IDfield_name- Custom field name (e.g., “Status”, “Agent”)value- New value
§Example
use miyabi_github::GitHubClient;
let client = GitHubClient::new("ghp_xxx", "owner", "repo")?;
client.update_project_field(
"PVT_kwDOAB...",
"PVTI_lADO...",
"Status",
"Done"
).await?;Source§impl GitHubClient
impl GitHubClient
Sourcepub async fn get_pull_request(&self, number: u64) -> Result<PRResult>
pub async fn get_pull_request(&self, number: u64) -> Result<PRResult>
Sourcepub async fn create_pull_request(
&self,
title: &str,
head: &str,
base: &str,
body: Option<&str>,
draft: bool,
) -> Result<PRResult>
pub async fn create_pull_request( &self, title: &str, head: &str, base: &str, body: Option<&str>, draft: bool, ) -> Result<PRResult>
Create a pull request
§Arguments
title- PR titlehead- Branch containing changesbase- Base branch (e.g., “main”)body- PR body (optional)draft- Create as draft PR
Sourcepub async fn update_pull_request(
&self,
number: u64,
title: Option<&str>,
body: Option<&str>,
state: Option<PullState>,
) -> Result<PRResult>
pub async fn update_pull_request( &self, number: u64, title: Option<&str>, body: Option<&str>, state: Option<PullState>, ) -> Result<PRResult>
Update a pull request
§Arguments
number- PR number to updatetitle- New title (optional)body- New body (optional)state- New state (optional)
Sourcepub async fn close_pull_request(&self, number: u64) -> Result<PRResult>
pub async fn close_pull_request(&self, number: u64) -> Result<PRResult>
Close a pull request (without merging)
Sourcepub async fn merge_pull_request(
&self,
number: u64,
commit_title: Option<&str>,
commit_message: Option<&str>,
) -> Result<()>
pub async fn merge_pull_request( &self, number: u64, commit_title: Option<&str>, commit_message: Option<&str>, ) -> Result<()>
Merge a pull request
§Arguments
number- PR number to mergecommit_title- Merge commit title (optional)commit_message- Merge commit message (optional)
Sourcepub async fn is_mergeable(&self, number: u64) -> Result<bool>
pub async fn is_mergeable(&self, number: u64) -> Result<bool>
Check if a pull request is mergeable
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 !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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§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