Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }

Implementations§

Source§

impl Client

Source

pub fn start_copilot_agent_task( &self, input: &StartTask, scope: &TaskScope, ) -> Result<Task, Error>

Source

pub fn start_copilot_agent_task_with_submission( &self, input: &StartTask, scope: &TaskScope, submission: &Submission, ) -> Result<Task, Error>

Source

pub fn list_my_copilot_agent_tasks(&self) -> Result<TaskList, Error>

The authenticated work user’s recent tasks across every repository, read with one pinned work credential (Client::pin_work).

Source

pub fn get_copilot_agent_task_detail( &self, task_id: &str, subject: Option<Subject>, ) -> Result<TaskDetail, Error>

One task and its sessions, by id, without a repository path, read with one pinned work credential (Client::pin_work).

Source§

impl Client

Source

pub fn copilot_api_url(&self) -> Result<String, Error>

The Copilot API base for the work account. GraphQL answers it, and the answer is kept for the run, so one process asks once.

Source

pub fn copilot_agent_session( &self, session_id: &str, ) -> Result<CopilotAgentSession, Error>

One session document, read with one pinned work credential (Client::pin_work). It carries the pull request number and state the REST task artifact may be missing.

Source

pub fn copilot_agent_session_log( &self, session_id: &str, max_bytes: usize, ) -> Result<SessionLog, Error>

One session’s log, parsed, read with one pinned work credential (Client::pin_work). max_bytes never goes above MAX_LOG_BYTES; a log the cap cut says so.

Source§

impl Client

Source

pub fn prepare_issue_report(&self, report: PreparedReport) -> ReportPlan

Resolve credentials in the existing priority, using gh’s active account. Performs no HTTP request and never switches or refreshes an account.

Source

pub fn submit_issue_report(&self, plan: ReportPlan) -> Result<Outcome, Error>

Consume the review plan. No automatic retry, including parse failures.

Source§

impl Client

Source

pub fn recent_closed_pulls( &self, login: &str, repo: &str, ) -> Result<Vec<ClosedPull>, Error>

The 100 most recently updated closed pull requests.

Source

pub fn commit_pulls( &self, login: &str, repo: &str, sha: &str, ) -> Result<Vec<ClosedPull>, Error>

Pull requests GitHub associates with the deployment commit.

Source

pub fn recent_deployments( &self, login: &str, repo: &str, ) -> Result<Vec<Deployment>, Error>

The 100 newest deployment records, without reading each one’s history.

Source

pub fn deployment_history( &self, login: &str, repo: &str, id: u64, ) -> Result<Vec<DeploymentStatus>, Error>

The newest 100 status records for one deployment.

Source§

impl Client

Source

pub fn bind_read(&self, login: &str) -> Result<BoundRead, Error>

Capture one credential and verify that it owns the requested login.

Source

pub fn new(credentials: Arc<Credentials>) -> Self

One bounded repository search. Scope is part of the GraphQL repository, so user search text cannot widen it to other repositories.

Source

pub fn agent_write( &self, login: &str, key: &str, action: &str, fields: Value, ) -> Result<Value, Error>

Named GraphQL writes, each sent once. Never offers a raw HTTP surface.

Source

pub fn with_api_url(self, api_url: impl Into<String>) -> Self

Sends every request to api_url instead of api.github.com (tests).

Source

pub fn with_work_account(self, login: Option<String>) -> Self

Prefer this configured gh account for Copilot work, before EMU detection.

Source

pub fn accounts(&self) -> Result<GitHubAccounts, Error>

The accounts to offer: the signed-in and gh accounts for github.com; but when the token comes from the environment or the config file, the one account that token belongs to (REQ-60).

Source

pub fn viewer_login(&self, login: Option<&str>) -> Result<String, Error>

The login of the token for login (or the default token).

Source

pub fn pin_work(&self) -> Result<PinnedWork<'_>, Error>

Resolves the work account’s credential once and verifies whose it is with that same credential, for an operation whose every request must be made as one account. The chosen gh account wins, else the first enterprise (EMU) login, as in Client::work_login. A credential verified earlier this run is not looked up again, so this needs no request then, offline included.

Source

pub fn work_login(&self) -> Result<String, Error>

Selects the chosen gh account, else the first enterprise (EMU) login, and verifies that the selected credential really belongs to it. Environment tokens belonging to another account are rejected. A caller that goes on to make requests as that account should use Client::pin_work instead, so they go out with the credential verified here.

Source

pub fn credential( &self, login: Option<&str>, ) -> Result<Credential, CredentialError>

The credential for login (REQ-21), for callers that only need to know whether one exists.

Source

pub fn section( &self, login: &str, section_id: &str, repos: Option<&[String]>, ) -> Result<SectionResponse, Error>

One section: up to 50 items, most recently updated first. repos limits it to those repositories (None: everything the account can see); a repos_only section without repositories is empty and sends nothing. Long repository lists run as several searches in parallel, merged by update time.

Source

pub fn repositories( &self, login: &str, text: &str, ) -> Result<Vec<GhRepository>, Error>

Repositories the account can see for text: GitHub’s repository search, or with no text the account’s own and member repositories, most recently pushed first. At most 30.

Source

pub fn sections( &self, login: &str, ) -> Vec<(&'static str, Result<SectionResponse, Error>)>

Every section, account-wide, in SECTIONS order, in parallel.

Source

pub fn item(&self, login: &str, key: &str) -> Result<GhItemDetail, Error>

The detail of key (owner/name#number).

Source

pub fn assignable( &self, login: &str, repo: &str, ) -> Result<AssignableResponse, Error>

The people who can be assigned in repo, cached for 10 minutes.

Source

pub fn review( &self, login: &str, key: &str, event: ReviewEvent, body: &str, ) -> Result<GhItemDetail, Error>

Approves, requests changes or comments as a review; returns the fresh detail. The body is required except for an approval.

Source

pub fn default_branch(&self, login: &str, repo: &str) -> Result<String, Error>

The repository’s default branch, which a cloud agent task branches from when the caller names none.

Source

pub fn issue_comment( &self, login: &str, key: &str, body: &str, ) -> Result<(), Error>

Post an issue comment without a refresh or automatic retry.

Source

pub fn close_pull_request(&self, login: &str, key: &str) -> Result<(), Error>

Close a pull request without a refresh or automatic retry.

Source

pub fn comment( &self, login: &str, key: &str, body: &str, ) -> Result<GhItemDetail, Error>

Comments on an issue or pull request; returns the fresh detail.

Source

pub fn set_assignees( &self, login: &str, key: &str, add: &[String], remove: &[String], ) -> Result<GhItemDetail, Error>

Adds and removes assignees (at most 10 each, at least one in all); returns the fresh detail.

Source

pub fn diff(&self, login: &str, key: &str) -> Result<DiffResponse, Error>

A pull request’s changed files, with the merge base as the old side of every patch. Cached per base and head SHA.

Source

pub fn file( &self, login: &str, repo: &str, sha: &str, path: &str, ) -> Result<FileResponse, Error>

One file’s text at a commit, up to 1 MB (else 413); a binary file is a 415. Cached per account, up to 50 MB.

Source

pub fn image( &self, login: &str, repo: &str, sha: &str, path: &str, ) -> Result<Image, Error>

One image at a commit, up to 10 MB. Only the extensions of image_type; other paths are a 415. Not cached.

Trait Implementations§

Source§

impl ActionsApi for Client

Source§

fn actions_workflows( &self, login: &str, repo: &str, ) -> Result<Page<Workflow>, Error>

Source§

fn actions_runs( &self, login: &str, repo: &str, filters: &RunFilters, ) -> Result<Page<WorkflowRun>, Error>

Source§

fn actions_run( &self, login: &str, repo: &str, run_id: u64, ) -> Result<WorkflowRun, Error>

Source§

fn actions_jobs( &self, login: &str, repo: &str, run_id: u64, ) -> Result<Page<Job>, Error>

Source§

fn actions_attempt_jobs( &self, login: &str, repo: &str, run_id: u64, attempt: u64, ) -> Result<Page<Job>, Error>

The jobs of attempt attempt of run run_id. A re-run is a new attempt with jobs of its own, so a caller that read one attempt’s run asks for that attempt’s jobs, not whichever attempt is newest by the time the read lands. Attempt 0, which a run without run_attempt maps to, reads the run’s latest jobs. Read more
Source§

fn actions_job_log( &self, login: &str, repo: &str, job_id: u64, ) -> Result<JobLog, Error>

Source§

fn actions_workflow_definition( &self, login: &str, repo: &str, sha: &str, path: &str, ) -> Result<Definition<WorkflowDefinition>, Error>

Source§

fn actions_pending_deployments( &self, login: &str, repo: &str, run_id: u64, ) -> Result<Vec<PendingDeployment>, Error>

Source§

fn actions_environments( &self, login: &str, repo: &str, ) -> Result<Page<Environment>, Error>

Source§

fn actions_deployments( &self, login: &str, repo: &str, environment: Option<&str>, ) -> Result<Page<Deployment>, Error>

Source§

fn actions_latest_deployment( &self, login: &str, repo: &str, environment: &str, ) -> Result<Option<Deployment>, Error>

Source§

fn actions_releases( &self, login: &str, repo: &str, ) -> Result<Page<Release>, Error>

Source§

fn actions_tags(&self, login: &str, repo: &str) -> Result<Page<TagRef>, Error>

Source§

fn dispatch_workflow( &self, login: &str, request: &DispatchRequest<'_>, ) -> Result<(), Error>

Source§

fn rerun_workflow( &self, login: &str, repo: &str, run_id: u64, ) -> Result<(), Error>

Source§

fn rerun_failed_jobs( &self, login: &str, repo: &str, run_id: u64, ) -> Result<(), Error>

Source§

fn cancel_workflow( &self, login: &str, repo: &str, run_id: u64, ) -> Result<(), Error>

Source§

fn review_pending_deployments( &self, login: &str, request: &ReviewPendingRequest<'_>, ) -> Result<(), Error>

Auto Trait Implementations§

§

impl !Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl !UnwindSafe for Client

§

impl Forget for Client

§

impl Move for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl UnsafeUnpin for Client

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more