A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.rs/octocrab/latest/octocrab/repos/struct.RepoHandler.html below:

RepoHandler in octocrab::repos - Rust

pub struct RepoHandler<'octo> {  }
Expand description Source§ Source

List forks of a repository. Optionally, specify the sort order, page, and items per_page

use octocrab::params::repos::forks::Sort;
let forks = octocrab::instance()
    .repos("owner", "repo")
    .list_forks()
    .sort(Sort::Oldest)
    .page(2u32)
    .per_page(30)
    .send()
    .await?;
Source

Creates a fork of a repository. Optionally, specify the target organization or name to create the fork in, or default_branch_only to fork with only the default branch.

let new_fork = octocrab::instance()
    .repos("owner", "repo")
    .create_fork()
    .organization("weyland-yutani")
    .name("new-repo-name")
    .default_branch_only(true)
    .send()
    .await?;
Source§ Source

Get’s a repository’s license.

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

Get’s a repository’s public key.

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

Fetches a single repository.

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

Fetches a repository’s metrics.

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

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?;
Source

Fetches information about a git tag with the given tag_sha.

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

let master = octocrab::instance()
    .repos("owner", "repo")
    .get_tag("402b2026a41b26b691c429ddb0b9c27a31b27a6b")
    .await?;
Source

Creates a new reference for the repository.

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

octocrab::instance()
    .repos("owner", "repo")
    .create_ref(&Reference::Tag("1.0".to_string()), master_sha)
    .await?;
Source

Deletes an existing reference from the repository.

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

octocrab::instance()
    .repos("owner", "repo")
    .delete_ref(&Reference::Branch("temporary-branch".to_string()))
    .await?;
Source

Get repository content.


octocrab::instance()
    .repos("owner", "repo")
    .get_content()
    .path("path/to/file")
    .r#ref("main")
    .send()
    .await?;
Source

Get repository readme.


octocrab::instance()
    .repos("owner", "repo")
    .get_readme()
    .path("path/to/file")
    .r#ref("main")
    .send()
    .await?;
Source

Creates a new file in the repository.

use octocrab::models::repos::CommitAuthor;

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(CommitAuthor {
        name: "Octocat".to_string(),
        email: "octocat@github.com".to_string(),
        date: None,
    })
    .author(CommitAuthor {
        name: "Ferris".to_string(),
        email: "ferris@rust-lang.org".to_string(),
        date: None,
    })
    .send()
    .await?;
Source

Update an existing file.

GitHub API documentation

use octocrab::models::repos::CommitAuthor;

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(CommitAuthor {
        name: "Octocat".to_string(),
        email: "octocat@github.com".to_string(),
        date: None,
    })
    .author(CommitAuthor {
        name: "Ferris".to_string(),
        email: "ferris@rust-lang.org".to_string(),
        date: None,
    })
    .send()
    .await?;
Source

Deletes a file in the repository.

use octocrab::models::repos::CommitAuthor;

octocrab::instance()
    .repos("owner", "repo")
    .delete_file(
        "crabs/ferris.txt",
        "Deleted ferris.txt",
        blob_sha
    )
    .branch("master")
    .commiter(CommitAuthor {
        name: "Octocat".to_string(),
        email: "octocat@github.com".to_string(),
        date: None,
    })
    .author(CommitAuthor {
        name: "Ferris".to_string(),
        email: "ferris@rust-lang.org".to_string(),
        date: None,
    })
    .send()
    .await?;
Source

List tags from a repository.

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

List branches from a repository.

let branches = octocrab::instance()
    .repos("owner", "repo")
    .list_branches()
    .send()
    .await?;
Source

List commits from a repository

let commits = octocrab::instance().repos("owner", "repo").list_commits().send().await?;
Source

List teams from a repository.

let teams = octocrab::instance().repos("owner", "repo").list_teams().send().await?;
Source

List collaborators from a repository.

let collaborators = octocrab::instance().repos("owner", "repo").list_collaborators().send().await?;
Source

List contributors from a repository.

let contributors = octocrab::instance().repos("owner", "repo").list_contributors().send().await?;
Source

List star_gazers from a repository.

let stargazers = octocrab::instance().repos("owner", "repo").list_stargazers().send().await?;
Source

Lists languages for the specified repository. The value shown for each language is the number of bytes of code written in that language.


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

Creates a ReleaseAssetsHandler for the specified repository.

Source

Creates a ReleasesHandler for the specified repository.

Source

Create a status for a specified commit in the specified repository.

Source

List statuses for a reference.

Source

List pull requests for a reference.

Source

List events on this repository.

Takes an optional etag which allows for efficient polling. Here is a quick example to poll a repositories events.

let mut etag = None;
loop {
    let response: Etagged<Page<Event>> = octocrab::instance()
        .repos("owner", "repo")
        .events()
        .etag(etag)
        .send()
        .await?;
    if let Some(page) = response.value {
        } else {
        println!("No new data received, trying again soon");
    }
    etag = response.etag;
    }
Source

Creates a new webhook for the specified repository.

§Notes

Only authorized users or apps can modify repository webhooks.

§Examples
use octocrab::models::hooks::{Hook, Config as HookConfig, ContentType as HookContentType};

let config = HookConfig {
  url: "https://example.com".to_string(),
  content_type: Some(HookContentType::Json),
  insecure_ssl: None,
  secret: None
};

let hook = Hook {
  name: "web".to_string(),
  config,
  ..Hook::default()
};

let hook = octocrab.repos("owner", "repo").create_hook(hook).await?;
Source

Gets the combined status for the specified reference.

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

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

Creates a new repository from repository if it is a template.

 async fn run() -> octocrab::Result<()> {
octocrab::instance()
    .repos("owner", "repo")
    .generate("rust")
    .owner("new_owner")
    .description("Description")
    .include_all_branches(true)
    .private(true)
    .send()
    .await
Source

Retrieve the contents of a file in raw format

Source

Deletes this repository.

octocrab::instance().repos("owner", "repo").delete().await
Source

Stream the repository contents as a .tar.gz

Source

Check if a user is a repository collaborator

Source

Merges head into the base branch.


octocrab::instance()
    .repos("owner", "repo")
    .merge("feature", "master")
    .send()
    .await?;
Source

Handle secrets on the repository

Source

Handle dependabot alerts on the repository

Source

Handle secrets scanning alerts on the repository

Source

Creates a new Git commit object. See https://docs.github.com/en/rest/git/commits?apiVersion=2022-11-28#create-a-commit

use octocrab::models::repos::CommitAuthor;
 async fn run() -> octocrab::Result<(GitCommitObject)> {

let git_commit_object = octocrab::instance()
    .repos("owner", "repo")
    .create_git_commit_object("message", "tree")
    .signature("signature")
    .author(CommitAuthor{
            name: "name".to_owned(),
            email: "email".to_owned(),
            date: None
        })
    .send()
    .await;

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4