Compare commits
2 commits
3ce69efeba
...
2750b76391
Author | SHA1 | Date | |
---|---|---|---|
2750b76391 | |||
9f04b1ae6c |
4 changed files with 0 additions and 54 deletions
|
@ -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<Vec<config::BranchName>> {
|
||||
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::<Vec<Branch>>(request).await?;
|
||||
let branches = response
|
||||
.response_body()
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.map(config::BranchName::from)
|
||||
.collect::<Vec<_>>();
|
||||
Ok(branches)
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize)]
|
||||
struct Branch {
|
||||
name: String,
|
||||
}
|
||||
impl From<Branch> for config::BranchName {
|
||||
fn from(value: Branch) -> Self {
|
||||
Self::new(value.name)
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
mod get_all;
|
||||
|
||||
pub use get_all::get_all;
|
|
@ -1,5 +1,3 @@
|
|||
pub mod branch;
|
||||
|
||||
use git_next_git as git;
|
||||
|
||||
use kxio::network::{self, Network};
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
use derive_more::Constructor;
|
||||
use git_next_config as config;
|
||||
use git_next_git as git;
|
||||
|
||||
use kxio::network::Network;
|
||||
|
@ -19,9 +18,6 @@ impl git_next_git::ForgeLike for Github {
|
|||
fn name(&self) -> String {
|
||||
"github".to_string()
|
||||
}
|
||||
async fn branches_get_all(&self) -> Result<Vec<config::BranchName>, git::branch::Error> {
|
||||
todo!();
|
||||
}
|
||||
|
||||
/// Checks the results of any (e.g. CI) status checks for the commit.
|
||||
async fn commit_status(&self, _commit: &git::Commit) -> git::commit::Status {
|
||||
|
|
Loading…
Reference in a new issue