From 9f04b1ae6cd380318ab7b755d7adc6baf44f727a Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 28 May 2024 06:45:34 +0100 Subject: [PATCH] fix: remove old implementation of forgejo get all branches --- crates/forge-forgejo/src/branch/get_all.rs | 45 ---------------------- crates/forge-forgejo/src/branch/mod.rs | 3 -- crates/forge-forgejo/src/lib.rs | 2 - 3 files changed, 50 deletions(-) delete mode 100644 crates/forge-forgejo/src/branch/get_all.rs delete mode 100644 crates/forge-forgejo/src/branch/mod.rs diff --git a/crates/forge-forgejo/src/branch/get_all.rs b/crates/forge-forgejo/src/branch/get_all.rs deleted file mode 100644 index 46a9d27..0000000 --- a/crates/forge-forgejo/src/branch/get_all.rs +++ /dev/null @@ -1,45 +0,0 @@ -use git_next_config as config; -use git_next_git as git; - -use kxio::network::{self, Network}; - -pub async fn get_all( - repo_details: &git::RepoDetails, - net: &Network, -) -> git::branch::Result> { - let hostname = &repo_details.forge.hostname(); - let repo_path = &repo_details.repo_path; - use secrecy::ExposeSecret; - let token = repo_details.forge.token().expose_secret(); - let url = network::NetUrl::new(format!( - "https://{hostname}/api/v1/repos/{repo_path}/branches?token={token}" - )); - - let request = network::NetRequest::new( - network::RequestMethod::Get, - url, - network::NetRequestHeaders::new(), - network::RequestBody::None, - network::ResponseType::Json, - None, - network::NetRequestLogging::None, - ); - let response = net.get::>(request).await?; - let branches = response - .response_body() - .unwrap_or_default() - .into_iter() - .map(config::BranchName::from) - .collect::>(); - Ok(branches) -} - -#[derive(Debug, serde::Deserialize)] -struct Branch { - name: String, -} -impl From for config::BranchName { - fn from(value: Branch) -> Self { - Self::new(value.name) - } -} diff --git a/crates/forge-forgejo/src/branch/mod.rs b/crates/forge-forgejo/src/branch/mod.rs deleted file mode 100644 index c357a28..0000000 --- a/crates/forge-forgejo/src/branch/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -mod get_all; - -pub use get_all::get_all; diff --git a/crates/forge-forgejo/src/lib.rs b/crates/forge-forgejo/src/lib.rs index 692e5eb..c80c752 100644 --- a/crates/forge-forgejo/src/lib.rs +++ b/crates/forge-forgejo/src/lib.rs @@ -1,5 +1,3 @@ -pub mod branch; - use git_next_git as git; use kxio::network::{self, Network};