Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions crates/crates_io_github/examples/test_github_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ enum Request {
#[clap(long, env = "GITHUB_ACCESS_TOKEN", hide_env_values = true)]
access_token: SecretString,
},
GetRepository {
owner: String,
repo: String,
#[clap(long, env = "GITHUB_ACCESS_TOKEN", hide_env_values = true)]
access_token: SecretString,
},
OrgByName {
org_name: String,
#[clap(long, env = "GITHUB_ACCESS_TOKEN", hide_env_values = true)]
Expand Down Expand Up @@ -64,17 +58,6 @@ async fn main() -> Result<()> {
let response = github_client.current_user(&access_token).await?;
println!("{response:#?}");
}
Request::GetRepository {
owner,
repo,
access_token,
} => {
let access_token = AccessToken::new(access_token.expose_secret().into());
let response = github_client
.get_repository(&owner, &repo, &access_token)
.await?;
println!("{response:#?}");
}
Request::OrgByName {
org_name,
access_token,
Expand Down
29 changes: 0 additions & 29 deletions crates/crates_io_github/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ type Result<T> = std::result::Result<T, GitHubError>;
#[async_trait]
pub trait GitHubClient: Send + Sync {
async fn current_user(&self, auth: &AccessToken) -> Result<GithubUser>;
async fn get_repository(
&self,
owner: &str,
repo: &str,
auth: &AccessToken,
) -> Result<GitHubRepository>;
async fn org_by_name(&self, org_name: &str, auth: &AccessToken) -> Result<GitHubOrganization>;
async fn team_by_name(
&self,
Expand Down Expand Up @@ -108,16 +102,6 @@ impl GitHubClient for RealGitHubClient {
self.request("/user", auth).await
}

async fn get_repository(
&self,
owner: &str,
repo: &str,
auth: &AccessToken,
) -> Result<GitHubRepository> {
let url = format!("/repos/{owner}/{repo}");
self.request(&url, auth).await
}

async fn org_by_name(&self, org_name: &str, auth: &AccessToken) -> Result<GitHubOrganization> {
let url = format!("/orgs/{org_name}");
self.request(&url, auth).await
Expand Down Expand Up @@ -207,19 +191,6 @@ pub struct GithubUser {
pub name: Option<String>,
}

#[derive(Debug, Deserialize)]
pub struct GitHubRepository {
pub id: i64,
pub name: String,
pub owner: GitHubRepositoryOwner,
}

#[derive(Debug, Deserialize)]
pub struct GitHubRepositoryOwner {
pub login: String,
pub id: i32,
}

#[derive(Debug, Deserialize)]
pub struct GitHubOrganization {
pub id: i32, // unique GH id (needed for membership queries)
Expand Down