[−][src]Struct octocrab::Octocrab
The GitHub API client.
Fields
base_url: Url
Implementations
impl Octocrab
[src]
pub fn builder() -> OctocrabBuilder
[src]
Returns a new OctocrabBuilder
.
impl Octocrab
[src]
pub fn actions(&self) -> ActionsHandler<'_>
[src]
Creates a new actions::ActionsHandler
for accessing information from
GitHub Actions.
pub fn current(&self) -> CurrentAuthHandler<'_>
[src]
Creates a current::CurrentAuthHandler
that allows you to access
information about the current authenticated user.
pub fn activity(&self) -> ActivityHandler<'_>
[src]
Creates a activity::ActivityHandler
for the current authenticated user.
pub fn gitignore(&self) -> GitignoreHandler<'_>
[src]
Creates a gitignore::GitignoreHandler
for accessing information
about gitignore
.
pub fn issues(
&self,
owner: impl Into<String>,
repo: impl Into<String>
) -> IssueHandler<'_>
[src]
&self,
owner: impl Into<String>,
repo: impl Into<String>
) -> IssueHandler<'_>
Creates a issues::IssueHandler
for the repo specified at owner/repo
,
that allows you to access GitHub's issues API.
pub fn licenses(&self) -> LicenseHandler<'_>
[src]
Creates a licenses::LicenseHandler
.
pub fn markdown(&self) -> MarkdownHandler<'_>
[src]
Creates a markdown::MarkdownHandler
.
pub fn orgs(&self, owner: impl Into<String>) -> OrgHandler<'_>
[src]
Creates an orgs::OrgHandler
for the specified organization,
that allows you to access GitHub's organization API.
pub fn pulls(
&self,
owner: impl Into<String>,
repo: impl Into<String>
) -> PullRequestHandler<'_>
[src]
&self,
owner: impl Into<String>,
repo: impl Into<String>
) -> PullRequestHandler<'_>
Creates a pulls::PullRequestHandler
for the repo specified at
owner/repo
, that allows you to access GitHub's pull request API.
pub fn repos(
&self,
owner: impl Into<String>,
repo: impl Into<String>
) -> RepoHandler<'_>
[src]
&self,
owner: impl Into<String>,
repo: impl Into<String>
) -> RepoHandler<'_>
Creates a repos::RepoHandler
for the repo specified at owner/repo
,
that allows you to access GitHub's repository API.
pub fn search(&self) -> SearchHandler<'_>
[src]
Creates a search::SearchHandler
that allows you to construct general queries
to GitHub's API.
pub fn teams(&self, owner: impl Into<String>) -> TeamHandler<'_>
[src]
Creates a teams::TeamHandler
for the specified organization that allows
you to access GitHub's teams API.
impl Octocrab
[src]
pub async fn graphql<R: FromResponse, '_, '_>(
&'_ self,
body: &'_ impl Serialize + ?Sized
) -> Result<R>
[src]
&'_ self,
body: &'_ impl Serialize + ?Sized
) -> Result<R>
Sends a graphql query to GitHub, and deserialises the response from JSON.
let response: serde_json::Value = octocrab::instance() .graphql("query { viewer { login }}") .await?;
impl Octocrab
[src]
HTTP Methods
A collection of different of HTTP methods to use with Octocrab's
configuration (Authenication, etc.). All of the HTTP methods (get
, post
,
etc.) perform some amount of pre-processing such as making relative urls
absolute, and post processing such as mapping any potential GitHub errors
into Err()
variants, and deserializing the response body.
This isn't always ideal when working with GitHub's API and as such there are
additional methods available prefixed with _
(e.g. _get
, _post
,
etc.) that perform no pre or post processing and directly return the
reqwest::Response
struct.
pub async fn post<P: Serialize + ?Sized, R: FromResponse, '_, '_>(
&'_ self,
route: impl AsRef<str>,
body: Option<&'_ P>
) -> Result<R>
[src]
&'_ self,
route: impl AsRef<str>,
body: Option<&'_ P>
) -> Result<R>
Send a POST
request to route
with an optional body, returning the body
of the response.
pub async fn _post<P: Serialize + ?Sized, '_, '_>(
&'_ self,
url: impl IntoUrl,
body: Option<&'_ P>
) -> Result<Response>
[src]
&'_ self,
url: impl IntoUrl,
body: Option<&'_ P>
) -> Result<Response>
Send a POST
request with no additional pre/post-processing.
pub async fn get<R, A, P: ?Sized, '_, '_>(
&'_ self,
route: A,
parameters: Option<&'_ P>
) -> Result<R> where
A: AsRef<str>,
P: Serialize,
R: FromResponse,
[src]
&'_ self,
route: A,
parameters: Option<&'_ P>
) -> Result<R> where
A: AsRef<str>,
P: Serialize,
R: FromResponse,
Send a GET
request to route
with optional query parameters, returning
the body of the response.
pub async fn _get<P: Serialize + ?Sized, '_, '_>(
&'_ self,
url: impl IntoUrl,
parameters: Option<&'_ P>
) -> Result<Response>
[src]
&'_ self,
url: impl IntoUrl,
parameters: Option<&'_ P>
) -> Result<Response>
Send a GET
request with no additional post-processing.
pub async fn patch<R, A, B: ?Sized, '_, '_>(
&'_ self,
route: A,
body: Option<&'_ B>
) -> Result<R> where
A: AsRef<str>,
B: Serialize,
R: FromResponse,
[src]
&'_ self,
route: A,
body: Option<&'_ B>
) -> Result<R> where
A: AsRef<str>,
B: Serialize,
R: FromResponse,
Send a PATCH
request to route
with optional query parameters,
returning the body of the response.
pub async fn _patch<B: Serialize + ?Sized, '_, '_>(
&'_ self,
url: impl IntoUrl,
parameters: Option<&'_ B>
) -> Result<Response>
[src]
&'_ self,
url: impl IntoUrl,
parameters: Option<&'_ B>
) -> Result<Response>
Send a PATCH
request with no additional post-processing.
pub async fn put<R, A, B: ?Sized, '_, '_>(
&'_ self,
route: A,
body: Option<&'_ B>
) -> Result<R> where
A: AsRef<str>,
B: Serialize,
R: FromResponse,
[src]
&'_ self,
route: A,
body: Option<&'_ B>
) -> Result<R> where
A: AsRef<str>,
B: Serialize,
R: FromResponse,
Send a PUT
request to route
with optional query parameters,
returning the body of the response.
pub async fn _put<B: Serialize + ?Sized, '_, '_>(
&'_ self,
url: impl IntoUrl,
body: Option<&'_ B>
) -> Result<Response>
[src]
&'_ self,
url: impl IntoUrl,
body: Option<&'_ B>
) -> Result<Response>
Send a PATCH
request with no additional post-processing.
pub async fn delete<R, A, P: ?Sized, '_, '_>(
&'_ self,
route: A,
parameters: Option<&'_ P>
) -> Result<R> where
A: AsRef<str>,
P: Serialize,
R: FromResponse,
[src]
&'_ self,
route: A,
parameters: Option<&'_ P>
) -> Result<R> where
A: AsRef<str>,
P: Serialize,
R: FromResponse,
Send a DELETE
request to route
with optional query parameters,
returning the body of the response.
pub async fn _delete<P: Serialize + ?Sized, '_, '_>(
&'_ self,
url: impl IntoUrl,
parameters: Option<&'_ P>
) -> Result<Response>
[src]
&'_ self,
url: impl IntoUrl,
parameters: Option<&'_ P>
) -> Result<Response>
Send a DELETE
request with no additional post-processing.
pub fn request_builder(
&self,
url: impl IntoUrl,
method: Method
) -> RequestBuilder
[src]
&self,
url: impl IntoUrl,
method: Method
) -> RequestBuilder
Construct a reqwest::RequestBuilder
with the given http method. This can be executed
with execute.
let octocrab = octocrab::instance(); let url = format!("{}/events", octocrab.base_url); let builder = octocrab::instance().request_builder(&url, reqwest::Method::GET) .header("if-none-match", "\"73ca617c70cd2bd9b6f009dab5e2d49d\""); let response = octocrab.execute(builder).await?;
pub async fn execute<'_>(&'_ self, request: RequestBuilder) -> Result<Response>
[src]
Execute the given request
octocrab's Client.
impl Octocrab
[src]
pub fn absolute_url(&self, url: impl AsRef<str>) -> Result<Url>
[src]
Returns an absolute url version of url
using the base_url
(default:
https://api.github.com
)
pub async fn get_page<R: DeserializeOwned, '_, '_>(
&'_ self,
url: &'_ Option<Url>
) -> Result<Option<Page<R>>>
[src]
&'_ self,
url: &'_ Option<Url>
) -> Result<Option<Page<R>>>
A convience method to get the a page of results (if present).
Trait Implementations
impl Clone for Octocrab
[src]
impl Debug for Octocrab
[src]
impl Default for Octocrab
[src]
Defaults for Octocrab:
base_url
:https://api.github.com
auth
:None
client
: reqwest client with theoctocrab
user agent.
Auto Trait Implementations
impl !RefUnwindSafe for Octocrab
[src]
impl Send for Octocrab
[src]
impl Sync for Octocrab
[src]
impl Unpin for Octocrab
[src]
impl !UnwindSafe for Octocrab
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,