Skip to main content

GithubApi

Trait GithubApi 

Source
pub trait GithubApi: Send + Sync {
Show 14 methods // Required methods fn queued_jobs( &self, repository: &str, ) -> impl Future<Output = Result<Vec<QueuedJob>, Error>> + Send; fn runners( &self, repository: &str, ) -> impl Future<Output = Result<Vec<Runner>, Error>> + Send; fn jit_config( &self, repository: &str, name: &str, labels: &[String], ) -> impl Future<Output = Result<(Runner, JitConfig), Error>> + Send; fn delete_runner( &self, repository: &str, id: u64, ) -> impl Future<Output = Result<Deleted, Error>> + Send; fn job( &self, repository: &str, id: u64, ) -> impl Future<Output = Result<JobDetails, Error>> + Send; fn run_trigger( &self, repository: &str, run: u64, ) -> impl Future<Output = Result<RunTrigger, Error>> + Send; fn pull_request( &self, repository: &str, number: u64, ) -> impl Future<Output = Result<PullRequest, Error>> + Send; fn repository( &self, repository: &str, ) -> impl Future<Output = Result<RepositoryDetails, Error>> + Send; fn on_branch( &self, repository: &str, branch: &str, sha: &str, ) -> impl Future<Output = Result<bool, Error>> + Send; fn cancel_run( &self, repository: &str, run: u64, ) -> impl Future<Output = Result<(), Error>> + Send; fn job_action( &self, repository: &str, request: JobActionRequest, permit: &Permit<'_>, ) -> impl Future<Output = Result<u16, ActionFailure>> + Send; fn action_run( &self, repository: &str, run: u64, ) -> impl Future<Output = Result<RunNow, ActionFailure>> + Send; fn named_runs(&self) -> impl Future<Output = Vec<NamedRun>> + Send; fn spend(&self) -> Spend;
}
Expand description

The GitHub calls the scheduler makes. Github is the real client; the engine’s tests use a fake.

Required Methods§

Source

fn queued_jobs( &self, repository: &str, ) -> impl Future<Output = Result<Vec<QueuedJob>, Error>> + Send

The repository’s jobs waiting for a runner, in queued runs and in runs that started some of their jobs.

Source

fn runners( &self, repository: &str, ) -> impl Future<Output = Result<Vec<Runner>, Error>> + Send

The repository’s self-hosted runners.

Source

fn jit_config( &self, repository: &str, name: &str, labels: &[String], ) -> impl Future<Output = Result<(Runner, JitConfig), Error>> + Send

Registers a runner for one job and returns it with the config the runner’s listener takes.

Source

fn delete_runner( &self, repository: &str, id: u64, ) -> impl Future<Output = Result<Deleted, Error>> + Send

Removes a runner from the repository.

Source

fn job( &self, repository: &str, id: u64, ) -> impl Future<Output = Result<JobDetails, Error>> + Send

One job’s progress and steps.

Source

fn run_trigger( &self, repository: &str, run: u64, ) -> impl Future<Output = Result<RunTrigger, Error>> + Send

What started a workflow run.

Source

fn pull_request( &self, repository: &str, number: u64, ) -> impl Future<Output = Result<PullRequest, Error>> + Send

One pull request: who opened it and where its head branch is.

Source

fn repository( &self, repository: &str, ) -> impl Future<Output = Result<RepositoryDetails, Error>> + Send

The repository’s default branch and visibility.

Source

fn on_branch( &self, repository: &str, branch: &str, sha: &str, ) -> impl Future<Output = Result<bool, Error>> + Send

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

fn cancel_run( &self, repository: &str, run: u64, ) -> impl Future<Output = Result<(), Error>> + Send

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

fn job_action( &self, repository: &str, request: JobActionRequest, permit: &Permit<'_>, ) -> impl Future<Output = Result<u16, ActionFailure>> + Send

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

fn action_run( &self, repository: &str, run: u64, ) -> impl Future<Output = Result<RunNow, ActionFailure>> + Send

Reads a workflow run’s current attempt and whether it completed, for a job action; failures as a class and a status.

Source

fn named_runs(&self) -> impl Future<Output = Vec<NamedRun>> + Send

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.

Source

fn spend(&self) -> Spend

What the reads are paced by (ADR 0127): the rate limit as last read, and the registrations and deletes sent.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§