PullRequest

Struct PullRequest 

Source
pub struct PullRequest {
Show 16 fields pub id: u64, pub repo_key: String, pub number: u32, pub title: String, pub description: String, pub author: String, pub state: PullRequestState, pub source_branch: String, pub target_branch: String, pub source_commit: ObjectId, pub target_commit: ObjectId, pub labels: Vec<Label>, pub created_at: u64, pub updated_at: u64, pub merged_at: Option<u64>, pub merged_by: Option<String>,
}
Expand description

A pull request for proposing changes to a repository.

Fields§

§id: u64

Unique identifier within the store.

§repo_key: String

Repository key (owner/repo).

§number: u32

Pull request number within the repository (#1, #2, etc.).

§title: String

Title of the pull request.

§description: String

Description/body of the pull request (Markdown).

§author: String

Author’s public key (hex encoded).

§state: PullRequestState

Current state of the pull request.

§source_branch: String

Source branch name.

§target_branch: String

Target branch name (usually “main” or “master”).

§source_commit: ObjectId

Head commit of the source branch.

§target_commit: ObjectId

Head commit of the target branch at PR creation.

§labels: Vec<Label>

Labels applied to this pull request.

§created_at: u64

Unix timestamp when the PR was created.

§updated_at: u64

Unix timestamp when the PR was last updated.

§merged_at: Option<u64>

Unix timestamp when the PR was merged (if merged).

§merged_by: Option<String>

Public key of the user who merged the PR (if merged).

Implementations§

Source§

impl PullRequest

Source

pub fn new( id: u64, repo_key: impl Into<String>, number: u32, title: impl Into<String>, description: impl Into<String>, author: impl Into<String>, source_branch: impl Into<String>, target_branch: impl Into<String>, source_commit: ObjectId, target_commit: ObjectId, ) -> Self

Creates a new pull request.

Source

pub fn is_open(&self) -> bool

Returns true if the pull request is open.

Source

pub fn is_merged(&self) -> bool

Returns true if the pull request is merged.

Source

pub fn is_closed(&self) -> bool

Returns true if the pull request is closed (not merged).

Source

pub fn close(&mut self) -> Result<()>

Closes the pull request without merging.

Source

pub fn reopen(&mut self) -> Result<()>

Reopens a closed pull request.

Source

pub fn merge(&mut self, merged_by: impl Into<String>) -> Result<()>

Merges the pull request.

Source

pub fn update_title(&mut self, title: impl Into<String>)

Updates the title.

Source

pub fn update_description(&mut self, description: impl Into<String>)

Updates the description.

Source

pub fn add_label(&mut self, label: Label)

Adds a label.

Source

pub fn remove_label(&mut self, name: &str)

Removes a label by name.

Source

pub fn update_source_commit(&mut self, commit: ObjectId)

Updates the source commit (when new commits are pushed).

Trait Implementations§

Source§

impl Clone for PullRequest

Source§

fn clone(&self) -> PullRequest

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PullRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PullRequest

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for PullRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,