pub trait GitHub {
// Required methods
fn run_summary(
&self,
repo: Option<&str>,
run_id: &str,
) -> Result<String, Box<dyn Error>>;
fn failed_job_log(
&self,
repo: Option<&str>,
job_id: &str,
) -> Result<String, Box<dyn Error>>;
fn create_issue(
&self,
repo: Option<&str>,
title: &str,
body: &str,
labels: &[String],
) -> Result<(), Box<dyn Error>>;
fn issue_bodies_open_with_label(
&self,
repo: Option<&str>,
label: &str,
) -> Result<Vec<String>, Box<dyn Error>>;
fn all_labels(
&self,
repo: Option<&str>,
) -> Result<Vec<String>, Box<dyn Error>>;
fn create_label(
&self,
repo: Option<&str>,
name: &str,
color: &str,
description: &str,
force: bool,
) -> Result<(), Box<dyn Error>>;
fn default_repo(&self) -> &str;
}
Expand description
Trait describing the methods that the GitHub CLI should implement
Required Methods§
Sourcefn run_summary(
&self,
repo: Option<&str>,
run_id: &str,
) -> Result<String, Box<dyn Error>>
fn run_summary( &self, repo: Option<&str>, run_id: &str, ) -> Result<String, Box<dyn Error>>
Get the summary of a run in a GitHub repository, if repo
is None
the default repository is used
Returns the summary as a String
Sourcefn failed_job_log(
&self,
repo: Option<&str>,
job_id: &str,
) -> Result<String, Box<dyn Error>>
fn failed_job_log( &self, repo: Option<&str>, job_id: &str, ) -> Result<String, Box<dyn Error>>
Get the log of a failed job in a GitHub repository, if repo
is None
the default repository is used
Returns the log as a String
Sourcefn create_issue(
&self,
repo: Option<&str>,
title: &str,
body: &str,
labels: &[String],
) -> Result<(), Box<dyn Error>>
fn create_issue( &self, repo: Option<&str>, title: &str, body: &str, labels: &[String], ) -> Result<(), Box<dyn Error>>
Create an issue in a GitHub repository, if repo
is None
the default repository is used
Sourcefn issue_bodies_open_with_label(
&self,
repo: Option<&str>,
label: &str,
) -> Result<Vec<String>, Box<dyn Error>>
fn issue_bodies_open_with_label( &self, repo: Option<&str>, label: &str, ) -> Result<Vec<String>, Box<dyn Error>>
Get the bodies of open issues with a specific label in a GitHub repository, if repo
is None
the default repository is used
Returns Vec<String>
of issue bodies
Sourcefn all_labels(&self, repo: Option<&str>) -> Result<Vec<String>, Box<dyn Error>>
fn all_labels(&self, repo: Option<&str>) -> Result<Vec<String>, Box<dyn Error>>
Get all labels in a GitHub repository, if repo
is None
the default repository is used
Returns Vec<String>
of GitHub labels
Sourcefn create_label(
&self,
repo: Option<&str>,
name: &str,
color: &str,
description: &str,
force: bool,
) -> Result<(), Box<dyn Error>>
fn create_label( &self, repo: Option<&str>, name: &str, color: &str, description: &str, force: bool, ) -> Result<(), Box<dyn Error>>
Create a label in a GitHub repository, if repo
is None
the default repository is used
The color should be a 6 character hex code (e.g. “FF0000”)
if force
is true and the label already exists, it will be overwritten
Sourcefn default_repo(&self) -> &str
fn default_repo(&self) -> &str
Get the default repository for the GitHub CLI