source/gitea: implement
This commit is contained in:
+29
-8
@@ -8,7 +8,9 @@ use std::collections::HashSet;
|
||||
|
||||
pub trait KagamiSource {
|
||||
const NAME: &'static str;
|
||||
const DEFAULT_URI_PREFIX: &'static str;
|
||||
const DEFAULT_HOST: &'static str;
|
||||
|
||||
fn api_base(&self) -> String;
|
||||
|
||||
// Get Repository
|
||||
// - Use native API if available
|
||||
@@ -47,28 +49,47 @@ pub trait KagamiSource {
|
||||
) -> impl std::future::Future<Output = anyhow::Result<HashSet<RepositoryInfo>>> + Send;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum RepositoryVisibility {
|
||||
Public,
|
||||
Internal,
|
||||
Private,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum RegexFilter {
|
||||
Include(regex::Regex),
|
||||
Exclude(regex::Regex),
|
||||
Include(String),
|
||||
Exclude(String),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct RepositoryFilter {
|
||||
pub filter_regex: Vec<RegexFilter>,
|
||||
pub include_forks: bool,
|
||||
pub include_archived: bool,
|
||||
pub visibility: HashSet<RepositoryVisibility>,
|
||||
pub min_stars: Option<u32>,
|
||||
pub max_stars: Option<u32>,
|
||||
pub include_public: bool,
|
||||
pub include_internal: bool,
|
||||
pub include_private: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
impl Default for RepositoryFilter {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
filter_regex: Vec::new(),
|
||||
include_forks: true,
|
||||
include_archived: true,
|
||||
min_stars: None,
|
||||
max_stars: None,
|
||||
include_public: true,
|
||||
include_internal: true,
|
||||
include_private: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct RepositoryInfo {
|
||||
pub name: String,
|
||||
pub full_name: String,
|
||||
|
||||
Reference in New Issue
Block a user