pub struct Client { /* private fields */ }Implementations§
Source§impl Client
impl Client
pub fn from_env() -> Self
Sourcepub fn with_api_url(self, url: &str) -> Self
pub fn with_api_url(self, url: &str) -> Self
The same client, sending to another API root, such as a test’s fake server.
Sourcepub fn with_token(self, token: &str) -> Self
pub fn with_token(self, token: &str) -> Self
The same client, using only token: no environment variable and no
gh. For a test’s fake server.
Sourcepub fn graphql(
&mut self,
query: &str,
variables: &Value,
) -> Result<Value, String>
pub fn graphql( &mut self, query: &str, variables: &Value, ) -> Result<Value, String>
Runs a GraphQL query and returns its data. Paths GitHub reports as
NOT_FOUND come back as null in the data; every other error fails
the call.
Sourcepub fn mutate(
&mut self,
query: &str,
variables: &Value,
) -> Result<Value, String>
pub fn mutate( &mut self, query: &str, variables: &Value, ) -> Result<Value, String>
Runs a GraphQL mutation. Unlike a query it is not retried after a 5xx or a dropped connection, which can follow a write that succeeded.
Sourcepub fn rest_get(&mut self, path: &str) -> Result<Option<Value>, String>
pub fn rest_get(&mut self, path: &str) -> Result<Option<Value>, String>
GETs a REST path such as /repos/OWNER/NAME/activity. A 404 comes
back as None.
Sourcepub fn get(&mut self, path: &str, etag: Option<&str>) -> Result<Rest, Failure>
pub fn get(&mut self, path: &str, etag: Option<&str>) -> Result<Rest, Failure>
GETs a REST path such as /repos/o/r/pulls/1, or a full URL,
sending If-None-Match when etag is given. Statuses other than 401
are the caller’s to read, and an exhausted rate limit says when it
resets, so a caller can wait it out.
Trait Implementations§
Source§impl Host for Client
impl Host for Client
Source§fn files(
&mut self,
pr: &PrThreads,
oid: &str,
paths: &[String],
) -> Result<Vec<(String, String)>, String>
fn files( &mut self, pr: &PrThreads, oid: &str, paths: &[String], ) -> Result<Vec<(String, String)>, String>
Reads every file in one GraphQL query.
fn forge(&self) -> Forge
Source§fn lacks(&mut self, _feature: Feature) -> Option<String>
fn lacks(&mut self, _feature: Feature) -> Option<String>
feature, or None when it can.Source§fn fetch(&mut self, lookups: Vec<Lookup>) -> Result<FetchResult, String>
fn fetch(&mut self, lookups: Vec<Lookup>) -> Result<FetchResult, String>
pr status
reports them before attention codes are derived.Source§fn threads(
&mut self,
target: &Target,
extra: bool,
bots: &[String],
) -> Result<Option<PrThreads>, String>
fn threads( &mut self, target: &Target, extra: bool, bots: &[String], ) -> Result<Option<PrThreads>, String>
extra its reviews and conversation
comments. None when there is no such PR.Source§fn pushed_at(&mut self, pr: &PrThreads, sha: &str) -> Result<Pushed, Lookup>
fn pushed_at(&mut self, pr: &PrThreads, sha: &str) -> Result<Pushed, Lookup>
sha (a prefix) was pushed to the PR.Source§fn merge_base(&mut self, pr: &PrThreads) -> Result<String, String>
fn merge_base(&mut self, pr: &PrThreads) -> Result<String, String>
Source§fn on_branch(&mut self, pr: &PrThreads, head: &str) -> Result<bool, String>
fn on_branch(&mut self, pr: &PrThreads, head: &str) -> Result<bool, String>
head is on the PR’s branch, for a head this clone cannot
place.