pub struct Client { /* private fields */ }Implementations§
Source§impl Client
impl Client
pub fn start_copilot_agent_task( &self, input: &StartTask, scope: &TaskScope, ) -> Result<Task, Error>
pub fn start_copilot_agent_task_with_submission( &self, input: &StartTask, scope: &TaskScope, submission: &Submission, ) -> Result<Task, Error>
Sourcepub fn list_my_copilot_agent_tasks(&self) -> Result<TaskList, Error>
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).
Sourcepub fn get_copilot_agent_task_detail(
&self,
task_id: &str,
subject: Option<Subject>,
) -> Result<TaskDetail, Error>
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
impl Client
Sourcepub fn copilot_api_url(&self) -> Result<String, Error>
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.
Sourcepub fn copilot_agent_session(
&self,
session_id: &str,
) -> Result<CopilotAgentSession, Error>
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.
Sourcepub fn copilot_agent_session_log(
&self,
session_id: &str,
max_bytes: usize,
) -> Result<SessionLog, Error>
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
impl Client
Sourcepub fn prepare_issue_report(&self, report: PreparedReport) -> ReportPlan
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.
Sourcepub fn submit_issue_report(&self, plan: ReportPlan) -> Result<Outcome, Error>
pub fn submit_issue_report(&self, plan: ReportPlan) -> Result<Outcome, Error>
Consume the review plan. No automatic retry, including parse failures.
Source§impl Client
impl Client
Sourcepub fn recent_closed_pulls(
&self,
login: &str,
repo: &str,
) -> Result<Vec<ClosedPull>, Error>
pub fn recent_closed_pulls( &self, login: &str, repo: &str, ) -> Result<Vec<ClosedPull>, Error>
The 100 most recently updated closed pull requests.
Sourcepub fn commit_pulls(
&self,
login: &str,
repo: &str,
sha: &str,
) -> Result<Vec<ClosedPull>, Error>
pub fn commit_pulls( &self, login: &str, repo: &str, sha: &str, ) -> Result<Vec<ClosedPull>, Error>
Pull requests GitHub associates with the deployment commit.
Sourcepub fn recent_deployments(
&self,
login: &str,
repo: &str,
) -> Result<Vec<Deployment>, Error>
pub fn recent_deployments( &self, login: &str, repo: &str, ) -> Result<Vec<Deployment>, Error>
The 100 newest deployment records, without reading each one’s history.
Sourcepub fn deployment_history(
&self,
login: &str,
repo: &str,
id: u64,
) -> Result<Vec<DeploymentStatus>, Error>
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
impl Client
Sourcepub fn bind_read(&self, login: &str) -> Result<BoundRead, Error>
pub fn bind_read(&self, login: &str) -> Result<BoundRead, Error>
Capture one credential and verify that it owns the requested login.
pub fn new(credentials: Arc<Credentials>) -> Self
Sourcepub fn agent_search(
&self,
login: &str,
repo: &str,
query: &str,
limit: u32,
) -> Result<Value, Error>
pub fn agent_search( &self, login: &str, repo: &str, query: &str, limit: u32, ) -> Result<Value, Error>
One bounded repository search. Scope is part of the GraphQL repository, so user search text cannot widen it to other repositories.
Sourcepub fn agent_write(
&self,
login: &str,
key: &str,
action: &str,
fields: Value,
) -> Result<Value, Error>
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.
Sourcepub fn with_api_url(self, api_url: impl Into<String>) -> Self
pub fn with_api_url(self, api_url: impl Into<String>) -> Self
Sends every request to api_url instead of api.github.com (tests).
Sourcepub fn with_work_account(self, login: Option<String>) -> Self
pub fn with_work_account(self, login: Option<String>) -> Self
Prefer this configured gh account for Copilot work, before EMU detection.
Sourcepub fn accounts(&self) -> Result<GitHubAccounts, Error>
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).
Sourcepub fn viewer_login(&self, login: Option<&str>) -> Result<String, Error>
pub fn viewer_login(&self, login: Option<&str>) -> Result<String, Error>
The login of the token for login (or the default token).
Sourcepub fn pin_work(&self) -> Result<PinnedWork<'_>, Error>
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.
Sourcepub fn work_login(&self) -> Result<String, Error>
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.
Sourcepub fn credential(
&self,
login: Option<&str>,
) -> Result<Credential, CredentialError>
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.
Sourcepub fn section(
&self,
login: &str,
section_id: &str,
repos: Option<&[String]>,
) -> Result<SectionResponse, Error>
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.
Sourcepub fn repositories(
&self,
login: &str,
text: &str,
) -> Result<Vec<GhRepository>, Error>
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.
Sourcepub fn sections(
&self,
login: &str,
) -> Vec<(&'static str, Result<SectionResponse, Error>)>
pub fn sections( &self, login: &str, ) -> Vec<(&'static str, Result<SectionResponse, Error>)>
Every section, account-wide, in SECTIONS order, in parallel.
Sourcepub fn item(&self, login: &str, key: &str) -> Result<GhItemDetail, Error>
pub fn item(&self, login: &str, key: &str) -> Result<GhItemDetail, Error>
The detail of key (owner/name#number).
Sourcepub fn assignable(
&self,
login: &str,
repo: &str,
) -> Result<AssignableResponse, Error>
pub fn assignable( &self, login: &str, repo: &str, ) -> Result<AssignableResponse, Error>
The people who can be assigned in repo, cached for 10 minutes.
Sourcepub fn review(
&self,
login: &str,
key: &str,
event: ReviewEvent,
body: &str,
) -> Result<GhItemDetail, Error>
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.
Sourcepub fn default_branch(&self, login: &str, repo: &str) -> Result<String, Error>
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.
Sourcepub fn issue_comment(
&self,
login: &str,
key: &str,
body: &str,
) -> Result<(), Error>
pub fn issue_comment( &self, login: &str, key: &str, body: &str, ) -> Result<(), Error>
Post an issue comment without a refresh or automatic retry.
Sourcepub fn close_pull_request(&self, login: &str, key: &str) -> Result<(), Error>
pub fn close_pull_request(&self, login: &str, key: &str) -> Result<(), Error>
Close a pull request without a refresh or automatic retry.
Sourcepub fn merge_pull_request(
&self,
login: &str,
key: &str,
target: &MergeTarget,
) -> Result<(), Error>
pub fn merge_pull_request( &self, login: &str, key: &str, target: &MergeTarget, ) -> Result<(), Error>
Merge exactly the head the viewer confirmed, using the selected account.
Sourcepub fn comment(
&self,
login: &str,
key: &str,
body: &str,
) -> Result<GhItemDetail, Error>
pub fn comment( &self, login: &str, key: &str, body: &str, ) -> Result<GhItemDetail, Error>
Comments on an issue or pull request; returns the fresh detail.
Sourcepub fn set_assignees(
&self,
login: &str,
key: &str,
add: &[String],
remove: &[String],
) -> Result<GhItemDetail, Error>
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.
Sourcepub fn diff(&self, login: &str, key: &str) -> Result<DiffResponse, Error>
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.
Trait Implementations§
Source§impl ActionsApi for Client
impl ActionsApi for Client
fn actions_workflows( &self, login: &str, repo: &str, ) -> Result<Page<Workflow>, Error>
fn actions_runs( &self, login: &str, repo: &str, filters: &RunFilters, ) -> Result<Page<WorkflowRun>, Error>
fn actions_run( &self, login: &str, repo: &str, run_id: u64, ) -> Result<WorkflowRun, Error>
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>
fn actions_attempt_jobs( &self, login: &str, repo: &str, run_id: u64, attempt: u64, ) -> Result<Page<Job>, Error>
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