pub struct Github { /* private fields */ }Expand description
A GitHub API client for one token. Requests on one URL are conditional on its last ETag, so an unchanged
answer costs no rate limit.
Implementations§
Source§impl Github
impl Github
Sourcepub fn new(base: &str, token_source: TokenSource) -> Result<Github, Error>
pub fn new(base: &str, token_source: TokenSource) -> Result<Github, Error>
A client for base (API_URL, or a test server) that takes its token from token_source.
Sourcepub fn requests(&self) -> Report
pub fn requests(&self) -> Report
What the requests of this client counted since its last line was logged, and the rate limit as last read.
Sourcepub fn blocked_until(&self) -> Option<SystemTime>
pub fn blocked_until(&self) -> Option<SystemTime>
When the next request may be sent: None now, otherwise when the rate limit resets.
Trait Implementations§
Source§impl GithubApi for Github
impl GithubApi for Github
Source§async fn queued_jobs(&self, repository: &str) -> Result<Vec<QueuedJob>, Error>
async fn queued_jobs(&self, repository: &str) -> Result<Vec<QueuedJob>, Error>
The repository’s jobs waiting for a runner, in queued runs and in runs that started some of their jobs.
Source§async fn runners(&self, repository: &str) -> Result<Vec<Runner>, Error>
async fn runners(&self, repository: &str) -> Result<Vec<Runner>, Error>
The repository’s self-hosted runners.
Source§async fn jit_config(
&self,
repository: &str,
name: &str,
labels: &[String],
) -> Result<(Runner, JitConfig), Error>
async fn jit_config( &self, repository: &str, name: &str, labels: &[String], ) -> Result<(Runner, JitConfig), Error>
Registers a runner for one job and returns it with the config the runner’s listener takes.
Source§async fn delete_runner(
&self,
repository: &str,
id: u64,
) -> Result<Deleted, Error>
async fn delete_runner( &self, repository: &str, id: u64, ) -> Result<Deleted, Error>
Removes a runner from the repository.
Source§async fn job(&self, repository: &str, id: u64) -> Result<JobDetails, Error>
async fn job(&self, repository: &str, id: u64) -> Result<JobDetails, Error>
One job’s progress and steps.
Source§async fn run_trigger(
&self,
repository: &str,
run: u64,
) -> Result<RunTrigger, Error>
async fn run_trigger( &self, repository: &str, run: u64, ) -> Result<RunTrigger, Error>
What started a workflow run.
Source§async fn pull_request(
&self,
repository: &str,
number: u64,
) -> Result<PullRequest, Error>
async fn pull_request( &self, repository: &str, number: u64, ) -> Result<PullRequest, Error>
One pull request: who opened it and where its head branch is.
Source§async fn repository(&self, repository: &str) -> Result<RepositoryDetails, Error>
async fn repository(&self, repository: &str) -> Result<RepositoryDetails, Error>
The repository’s default branch and visibility.
Source§async fn on_branch(
&self,
repository: &str,
branch: &str,
sha: &str,
) -> Result<bool, Error>
async fn on_branch( &self, repository: &str, branch: &str, sha: &str, ) -> Result<bool, Error>
Whether
branch of the repository has the commit sha: its head or an ancestor of it. A tag of the same
name, which git would take for it, does not count.Source§async fn cancel_run(&self, repository: &str, run: u64) -> Result<(), Error>
async fn cancel_run(&self, repository: &str, run: u64) -> Result<(), Error>
Cancels a workflow run, and so every job in it: GitHub cancels runs, not single jobs. A run that already
completed is left as it is.
Source§async fn job_action(
&self,
repository: &str,
request: JobActionRequest,
permit: &Permit<'_>,
) -> Result<u16, ActionFailure>
async fn job_action( &self, repository: &str, request: JobActionRequest, permit: &Permit<'_>, ) -> Result<u16, ActionFailure>
Sends an owner’s job action once, and returns GitHub’s success status (201, 202, …) without reading its body,
which is an acknowledgement, not a new job. It is never sent again but after a 401, which GitHub answers before
it acts.
permit is asked once the token is in hand, before each send, the 401’s second included: when it
says no, nothing is sent and the answer is ActionFailure::Withdrawn.Source§async fn action_run(
&self,
repository: &str,
run: u64,
) -> Result<RunNow, ActionFailure>
async fn action_run( &self, repository: &str, run: u64, ) -> Result<RunNow, ActionFailure>
Reads a workflow run’s current attempt and whether it completed, for a job action; failures as a class and a
status.
Source§async fn named_runs(&self) -> Vec<NamedRun>
async fn named_runs(&self) -> Vec<NamedRun>
The workflows’ names of the runs whose job reads kept GitHub’s name because the workflow’s could not be read
then, as far as they can be read now (ADR 0140). Each run is given once; one whose workflow GitHub does not
give is dropped, and keeps GitHub’s name.
Auto Trait Implementations§
impl !Freeze for Github
impl !RefUnwindSafe for Github
impl !UnwindSafe for Github
impl Forget for Github
impl Move for Github
impl Send for Github
impl Sync for Github
impl Unpin for Github
impl UnsafeUnpin for Github
Blanket Implementations§
Source§impl<G> ActionsGithub for Gwhere
G: GithubApi + 'static,
impl<G> ActionsGithub for Gwhere
G: GithubApi + 'static,
Source§fn run<'call>(
&'call self,
repository: &'call str,
run: u64,
) -> Pin<Box<dyn Future<Output = Result<RunNow, ActionFailure>> + Send + 'call>>
fn run<'call>( &'call self, repository: &'call str, run: u64, ) -> Pin<Box<dyn Future<Output = Result<RunNow, ActionFailure>> + Send + 'call>>
Reads the run’s current attempt and whether it completed.
Source§fn send<'call>(
&'call self,
repository: &'call str,
request: JobActionRequest,
permit: &'call (dyn Fn() -> Pin<Box<dyn Future<Output = bool> + Send + 'call>> + Send + Sync),
) -> Pin<Box<dyn Future<Output = Result<u16, ActionFailure>> + Send + 'call>>
fn send<'call>( &'call self, repository: &'call str, request: JobActionRequest, permit: &'call (dyn Fn() -> Pin<Box<dyn Future<Output = bool> + Send + 'call>> + Send + Sync), ) -> Pin<Box<dyn Future<Output = Result<u16, ActionFailure>> + Send + 'call>>
Sends
request once, asking permit once the token is in hand and before each send; GitHub’s success
status, or why not.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