[][src]Struct octocrab::Octocrab

pub struct Octocrab {
    pub base_url: Url,
    // some fields omitted
}

The GitHub API client.

Fields

base_url: Url

Implementations

impl Octocrab[src]

pub fn builder() -> OctocrabBuilder[src]

Returns a new OctocrabBuilder.

impl Octocrab[src]

GitHub API Methods

pub fn issues(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>
) -> IssueHandler
[src]

Creates a IssueHandler for the repo specified at owner/repo, that allows you to access GitHub's issues API.

pub fn markdown(&self) -> MarkdownHandler[src]

Creates a MarkdownHandler.

pub fn gitignore(&self) -> GitignoreHandler[src]

Creates a GitIgnoreHandler.

pub fn orgs(&self, owner: impl Into<String>) -> OrgHandler[src]

Creates a IssueHandler for the repo specified at owner/repo, that allows you to access GitHub's issues API.

pub fn pulls(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>
) -> PullRequestHandler
[src]

Creates a PullRequestHandler for the repo specified at owner/repo, that allows you to access GitHub's pull request API.

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]

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]

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]

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]

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]

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]

Send a PATCH request with no additional post-processing.

pub async fn put<'_, '_, R, A, P: ?Sized>(
    &'_ self,
    route: A,
    parameters: Option<&'_ P>
) -> Result<R> where
    A: AsRef<str>,
    P: Serialize,
    R: FromResponse
[src]

Send a PUT request to route with optional query parameters, returning the body of the response.

pub async fn _put<'_, '_, P: Serialize + ?Sized>(
    &'_ self,
    url: impl IntoUrl,
    parameters: Option<&'_ P>
) -> Result<Response>
[src]

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]

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]

Send a DELETE request with no additional post-processing.

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 map_github_error(response: Response) -> Result<Response>[src]

Maps a GitHub error response into and Err() variant if the status is not a success.

pub async fn get_page<'_, '_, R: DeserializeOwned>(
    &'_ self,
    url: &'_ Option<Url>
) -> Result<Option<Page<R>>>
[src]

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 the octocrab user agent.

Auto Trait Implementations

impl !RefUnwindSafe for Octocrab

impl Send for Octocrab

impl Sync for Octocrab

impl Unpin for Octocrab

impl !UnwindSafe for Octocrab

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.