[][src]Struct octocrab::pulls::PullRequestHandler

pub struct PullRequestHandler<'octo> { /* fields omitted */ }

A client to GitHub's pull request API.

Created with Octocrab::pulls.

Implementations

impl<'octo> PullRequestHandler<'octo>[src]

pub fn media_type(self, media_type: MediaType) -> Self[src]

Set the media type for this request.

let pr = octocrab::instance()
    .pulls("owner", "repo")
    .media_type(octocrab::params::pulls::MediaType::Full)
    .get(404)
    .await?;

pub async fn is_merged<'_>(&'_ self, pr: u64) -> Result<bool>[src]

Checks if a given pull request has been merged.

octocrab.pulls("owner", "repo").is_merged(101).await?;

pub async fn get<'_>(&'_ self, pr: u64) -> Result<PullRequest>[src]

Get's a given pull request with by its pr number.

let pr = octocrab::instance().pulls("owner", "repo").get(101).await?;

pub async fn get_diff<'_>(&'_ self, pr: u64) -> Result<String>[src]

Get's a given pull request's diff.

let diff = octocrab::instance().pulls("owner", "repo").get_diff(101).await?;

pub async fn get_patch<'_>(&'_ self, pr: u64) -> Result<String>[src]

Get's a given pull request's patch.

let diff = octocrab::instance().pulls("owner", "repo").get_patch(101).await?;

pub fn create(
    &self,
    title: impl Into<String>,
    head: impl Into<String>,
    base: impl Into<String>
) -> CreatePullRequestBuilder<'octo, '_>
[src]

Create a new pull request.

  • title — The title of the new pull request.
  • head — The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace head with a user like this: username:branch.
  • base — The name of the branch you want the changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository.
let pr = octocrab
    .pulls("owner", "repo")
    .create("title", "head", "base")
    .body("hello world!")
    .send()
    .await?;

pub fn list(&self) -> ListPullRequestsBuilder<'_, '_>[src]

Creates a new ListPullRequestsBuilder that can be configured to filter listing pulling requests.

use octocrab::params;

let page = octocrab.pulls("owner", "repo").list()
    // Optional Parameters
    .state(params::State::Open)
    .head("master")
    .base("branch")
    .sort(params::pulls::Sort::Popularity)
    .direction(params::Direction::Ascending)
    .per_page(100)
    .page(5u32)
    // Send the request
    .send()
    .await?;

Auto Trait Implementations

impl<'octo> !RefUnwindSafe for PullRequestHandler<'octo>

impl<'octo> Send for PullRequestHandler<'octo>

impl<'octo> Sync for PullRequestHandler<'octo>

impl<'octo> Unpin for PullRequestHandler<'octo>

impl<'octo> !UnwindSafe for PullRequestHandler<'octo>

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, 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.