[][src]Struct octocrab::repos::RepoHandler

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

Handler for GitHub's repository API.

Created with Octocrab::repos.

Implementations

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

pub async fn license<'_>(&'_ self) -> Result<Content>[src]

Get's a repository's license.

let license = octocrab::instance().repos("owner", "repo").license().await?;

pub async fn get_ref<'_, '_>(&'_ self, reference: &'_ Reference) -> Result<Ref>[src]

Fetches a single reference in the Git database.

use octocrab::params::repos::Reference;

let master = octocrab::instance()
    .repos("owner", "repo")
    .get_ref(&Reference::Branch("master".to_string()))
    .await?;

pub async fn create_ref<'_, '_>(
    &'_ self,
    reference: &'_ Reference,
    sha: impl Into<String>
) -> Result<Ref>
[src]

Creates a new reference for the repository.

use octocrab::params::repos::Reference;

// Given the SHA of the master branch, creates a 1.0 tag (🎉)
octocrab::instance()
    .repos("owner", "repo")
    .create_ref(&Reference::Tag("1.0".to_string()), master_sha)
    .await?;

pub fn create_file(
    &self,
    path: impl Into<String>,
    message: impl Into<String>,
    content: impl AsRef<[u8]>
) -> UpdateFileBuilder<'_, '_>
[src]

Creates a new file in the repository.

use octocrab::models::repos::GitUser;

// Commit to add "crabs/ferris.txt"
octocrab::instance()
    .repos("owner", "repo")
    .create_file(
        "crabs/ferris.txt",
        "Created ferris.txt",
        "Thought there’d never be a Rust Rap?\n"
    )
    .branch("master")
    .commiter(GitUser {
        name: "Octocat".to_string(),
        email: "octocat@github.com".to_string(),
    })
    .author(GitUser {
        name: "Ferris".to_string(),
        email: "ferris@rust-lang.org".to_string(),
    })
    .send()
    .await?;

pub fn update_file(
    &self,
    path: impl Into<String>,
    message: impl Into<String>,
    content: impl AsRef<[u8]>,
    sha: impl Into<String>
) -> UpdateFileBuilder<'_, '_>
[src]

use octocrab::models::repos::GitUser;

// Given the file blob for "crabs/ferris.txt", commit to update the file.
octocrab::instance()
    .repos("owner", "repo")
    .update_file(
        "crabs/ferris.txt",
        "Updated ferris.txt",
        "But me and Ferris Crab: best friends to the end.\n",
        blob_sha
    )
    .branch("master")
    .commiter(GitUser {
        name: "Octocat".to_string(),
        email: "octocat@github.com".to_string(),
    })
    .author(GitUser {
        name: "Ferris".to_string(),
        email: "ferris@rust-lang.org".to_string(),
    })
    .send()
    .await?;

pub fn list_tags(&self) -> ListTagsBuilder<'_, '_>[src]

List tags from a repository.

let tags = octocrab::instance().repos("owner", "repo").list_tags().send().await?;

pub fn releases(&self) -> ReleasesHandler<'_, '_>[src]

Creates a ReleasesHandler for the specified repository.

Auto Trait Implementations

impl<'octo> !RefUnwindSafe for RepoHandler<'octo>[src]

impl<'octo> Send for RepoHandler<'octo>[src]

impl<'octo> Sync for RepoHandler<'octo>[src]

impl<'octo> Unpin for RepoHandler<'octo>[src]

impl<'octo> !UnwindSafe for RepoHandler<'octo>[src]

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> Instrument for T[src]

impl<T> Instrument 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.