Skip to main content

GitHubClient

Struct GitHubClient 

Source
pub struct GitHubClient { /* private fields */ }

Implementations§

Source§

impl GitHubClient

Source

pub fn new(base_url: impl Into<String>, token: Option<String>) -> Result<Self>

Source

pub fn with_options(options: GitHubClientOptions) -> Result<Self>

Source

pub fn latest_reference( &self, owner: &str, repository: &str, ) -> Result<LatestReference>

Source

pub fn resolve_reference( &self, owner: &str, repository: &str, reference: &str, ) -> Result<String>

Source

pub fn validate_token_scopes(&self) -> Result<()>

Source

pub fn default_branch(&self, owner: &str, repository: &str) -> Result<String>

Source

pub fn branch_head_sha( &self, owner: &str, repository: &str, branch: &str, ) -> Result<String>

Source

pub fn commit_tree_sha( &self, owner: &str, repository: &str, commit_sha: &str, ) -> Result<String>

Source

pub fn create_branch( &self, owner: &str, repository: &str, branch: &str, base_sha: &str, ) -> Result<()>

Source

pub fn create_ref( &self, owner: &str, repository: &str, ref_path: &str, sha: &str, ) -> Result<()>

Source

pub fn create_annotated_tag( &self, owner: &str, repository: &str, tag: &str, message: &str, commit_sha: &str, ) -> Result<String>

Create an annotated tag object pointing at commit_sha and return the tag object’s SHA. The tagger identity derives from the token. A ref must still be created separately to make the tag reachable.

Source

pub fn reference_sha( &self, owner: &str, repository: &str, ref_path: &str, ) -> Result<Option<String>>

Source

pub fn create_blob( &self, owner: &str, repository: &str, content: &str, ) -> Result<String>

Source

pub fn create_tree( &self, owner: &str, repository: &str, base_tree_sha: &str, entries: &[TreeEntry], ) -> Result<String>

Source

pub fn create_commit( &self, owner: &str, repository: &str, message: &str, tree_sha: &str, parent_sha: &str, ) -> Result<String>

Source

pub fn update_branch( &self, owner: &str, repository: &str, branch: &str, commit_sha: &str, ) -> Result<()>

Source

pub fn update_ref( &self, owner: &str, repository: &str, ref_path: &str, sha: &str, force: bool, ) -> Result<()>

Source

pub fn update_ref_fast_forward( &self, owner: &str, repository: &str, ref_path: &str, sha: &str, ) -> Result<bool>

Fast-forward ref_path to sha; returns Ok(false) when GitHub rejects the update because it is not a fast forward (HTTP 422).

Source

pub fn list_tags( &self, owner: &str, repository: &str, max_pages: u32, ) -> Result<Vec<TagInfo>>

Source

pub fn latest_semver_tag( &self, owner: &str, repository: &str, prefix: &str, ) -> Result<Option<TagInfo>>

Latest tag whose name is prefix followed by a semver version, scanning up to 1000 tags.

Source

pub fn compare_commits( &self, owner: &str, repository: &str, base: &str, head: &str, max_pages: u32, ) -> Result<CommitRange>

Source

pub fn list_commits( &self, owner: &str, repository: &str, head_sha: &str, max_pages: u32, ) -> Result<CommitRange>

Source

pub fn create_release( &self, owner: &str, repository: &str, tag_name: &str, name: &str, body: &str, target_commitish: &str, ) -> Result<ReleaseInfo>

Source

pub fn ensure_token(&self) -> Result<()>

Source

pub fn create_pull_request( &self, owner: &str, repository: &str, title: &str, body: &str, head: &str, base: &str, ) -> Result<PullRequestInfo>

Source

pub fn find_open_pull_request( &self, owner: &str, repository: &str, head: &str, base: &str, ) -> Result<Option<PullRequestInfo>>

Source

pub fn update_pull_request( &self, owner: &str, repository: &str, number: u64, title: &str, body: &str, ) -> Result<PullRequestInfo>

Source

pub fn add_labels( &self, owner: &str, repository: &str, issue_number: u64, labels: &[String], ) -> Result<()>

Trait Implementations§

Source§

impl Clone for GitHubClient

Source§

fn clone(&self) -> GitHubClient

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for GitHubClient

Source§

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

Formats the value using the given formatter. 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more