[][src]Struct octocrab::issues::IssueHandler

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

Handler for GitHub's issue API.

Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the pull_request key.

Created with Octocrab::issues.

Implementations

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

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

Gets a label from the repository.

let label = octocrab.issues("owner", "repo").get_label("help wanted").await?;

pub fn create(&self, title: impl Into<String>) -> CreateIssueBuilder[src]

Create a issue in the repository.

let issue = octocrab.issues("owner", "repo").create("My first issue")
    // Optional Parameters
    .body("This is an autogenerated issue..")
    .milestone(1001)
    .labels(vec![String::from("help-wanted")])
    .assignees(vec![String::from("ferris")])
    // Send the request
    .send()
    .await?;

pub fn list(&self) -> ListIssuesBuilder[src]

List issues in the repository.

use octocrab::params;

let issue = octocrab.issues("owner", "repo")
    .list()
    // Optional Parameters
    .state(params::State::All)
    .milestone(1234)
    .assignee("ferris")
    .creator("octocrab")
    .mentioned("octocat")
    .labels(&[String::from("help wanted"), String::from("good first issue")])
    .sort(params::issues::Sort::Comments)
    .direction(params::Direction::Ascending)
    .per_page(100)
    .page(1u8)
    // Send the request
    .send()
    .await?;

pub fn update(&self, number: u64) -> UpdateIssueBuilder[src]

Update an issue in the repository.

use octocrab::models;

let issue = octocrab.issues("owner", "repo")
    .update(1234u64)
    // Optional Parameters
    .title("Updated title")
    .body("New body")
    .state(models::IssueState::Closed)
    .milestone(1234u64)
    .assignees(&[String::from("ferris")])
    .labels(&[String::from("help wanted"), String::from("good first issue")])
    // Send the request
    .send()
    .await?;

pub async fn lock<'_>(
    &'_ self,
    number: u64,
    reason: impl Into<Option<LockReason>>
) -> Result<bool>
[src]

Users with push access can lock an issue or pull request's conversation.

Note Providing a reason requires the sailor-v preview to enabled.

See also: https://developer.github.com/v3/issues/#lock-an-issue

use octocrab::params;

assert!(octocrab::instance().issues("owner", "repo").lock(404, params::LockReason::OffTopic).await?);

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

Users with push access can unlock an issue or pull request's conversation.

See also: https://developer.github.com/v3/issues/#unlock-an-issue

use octocrab::params;

assert!(octocrab::instance().issues("owner", "repo").unlock(404).await?);

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

pub async fn add_assignees<'_, '_>(
    &'_ self,
    number: u64,
    assignees: &'_ [u64]
) -> Result<Issue>
[src]

Adds up to 10 assignees to an issue. Users already assigned to an issue are not replaced.

let issue = octocrab.issues("owner", "repo").add_assignees(101, &[56982]).await?;

pub async fn check_assignee<'_>(
    &'_ self,
    assignee: impl AsRef<str>
) -> Result<bool>
[src]

Checks if a user has permission to be assigned to an issue in the repository.

assert!(octocrab.issues("owner", "repo").check_assignee("ferris").await?);

pub fn list_assignees(&self) -> ListAssigneesBuilder[src]

Lists the available assignees for issues in a repository.

let assignees = octocrab
    .issues("owner", "repo")
    .list_assignees()
    .per_page(15)
    .page(2u32)
    .send()
    .await?;

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

pub async fn add_labels<'_, '_>(
    &'_ self,
    number: u64,
    labels: &'_ [String]
) -> Result<Vec<Label>>
[src]

Adds labels to an issue.

let labels = octocrab::instance()
    .issues("owner", "repo")
    .add_labels(101, &[String::from("help wanted")])
    .await?;

pub async fn replace_all_labels<'_, '_>(
    &'_ self,
    number: u64,
    labels: &'_ [String]
) -> Result<Vec<Label>>
[src]

Replaces all labels for an issue.

let labels = octocrab::instance()
    .issues("owner", "repo")
    .replace_all_labels(101, &[String::from("help wanted")])
    .await?;

pub async fn create_label<'_>(
    &'_ self,
    name: impl AsRef<str>,
    color: impl AsRef<str>,
    description: impl AsRef<str>
) -> Result<Label>
[src]

Creates a label in the repository.

let label = octocrab::instance()
    .issues("owner", "repo")
    .create_label("help wanted", "59dd5a", "")
    .await?;

pub async fn get_label<'_>(&'_ self, name: impl AsRef<str>) -> Result<Label>[src]

Gets a label from the repository.

let label = octocrab::instance()
    .issues("owner", "repo")
    .get_label("help wanted")
    .await?;

pub async fn delete_label<'_>(&'_ self, name: impl AsRef<str>) -> Result<Label>[src]

Deletes a label in the repository.

let label = octocrab::instance()
    .issues("owner", "repo")
    .delete_label("help wanted")
    .await?;

pub fn list_labels_for_issue(&self, number: u64) -> ListLabelsForIssueBuilder[src]

List labels from an issue on a repository.

let page = octocrab::instance()
    .issues("owner", "repo")
    .list_labels_for_issue(404)
    // Optional Parameters
    .per_page(20)
    .page(2u32)
    .send()
    .await?;

pub fn list_labels_for_repo(&self) -> ListLabelsForRepoBuilder[src]

List all labels from a repository.

let page = octocrab::instance()
    .issues("owner", "repo")
    .list_labels_for_repo()
    // Optional Parameters
    .per_page(20)
    .page(2u32)
    .send()
    .await?;

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

pub async fn create_comment<'_>(
    &'_ self,
    number: u64,
    body: impl AsRef<str>
) -> Result<Comment>
[src]

Creates a comment in the issue.

let comment = octocrab::instance()
    .issues("owner", "repo")
    .create_comment(101, "Beep Boop")
    .await?;

pub async fn get_comment<'_>(&'_ self, comment_id: u64) -> Result<Comment>[src]

Gets a comment in the issue.

let comment = octocrab::instance()
    .issues("owner", "repo")
    .get_comment(101)
    .await?;

pub async fn delete_comment<'_>(&'_ self, comment_id: u64) -> Result<()>[src]

Deletes a comment in an issue.

octocrab::instance().issues("owner", "repo").delete_comment(101).await?;

pub fn list_comments(&self, issue_number: u64) -> ListCommentsBuilder[src]

Lists comments in the issue.

let comment = octocrab::instance()
    .issues("owner", "repo")
    .list_comments(101)
    .since(chrono::Utc::now())
    .per_page(100)
    .page(2u32)
    .send()
    .await?;

Auto Trait Implementations

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

impl<'octo> Send for IssueHandler<'octo>

impl<'octo> Sync for IssueHandler<'octo>

impl<'octo> Unpin for IssueHandler<'octo>

impl<'octo> !UnwindSafe for IssueHandler<'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.