90 lines
2.2 KiB
Rust
90 lines
2.2 KiB
Rust
mod git;
|
|
pub use git::KagamiSourceGit;
|
|
|
|
#[cfg(feature = "forgejo")]
|
|
mod forgejo;
|
|
#[cfg(feature = "forgejo")]
|
|
pub use forgejo::KagamiSourceForgejo;
|
|
|
|
#[cfg(feature = "gitea")]
|
|
mod gitea;
|
|
#[cfg(feature = "gitea")]
|
|
pub use gitea::KagamiSourceGitea;
|
|
|
|
#[cfg(feature = "github")]
|
|
mod github;
|
|
#[cfg(feature = "github")]
|
|
pub use github::KagamiSourceGithub;
|
|
|
|
#[cfg(feature = "gitlab")]
|
|
mod gitlab;
|
|
#[cfg(feature = "gitlab")]
|
|
pub use gitlab::KagamiSourceGitlab;
|
|
|
|
use std::collections::HashSet;
|
|
|
|
use crate::config::RepositoryFilterConfig;
|
|
|
|
pub trait KagamiSource {
|
|
const NAME: &'static str;
|
|
const DEFAULT_HOST: &'static str;
|
|
|
|
fn api_base(&self) -> String;
|
|
|
|
// Get Repository
|
|
// - Use native API if available
|
|
// - Which branches to get
|
|
// - Which tags to get
|
|
// - Get LFS objects
|
|
// - Get Releases
|
|
// - Get Pull Requests
|
|
// Get Issues
|
|
// - Filter by label(s)
|
|
// - Filter by assignee(s)
|
|
// - Filter by milestone(s)
|
|
// - Filter by state (open, closed, all)
|
|
// Get Wiki
|
|
|
|
fn get_repositories_by_user(
|
|
&self,
|
|
owner: &str,
|
|
token: Option<&str>,
|
|
filter: &RepositoryFilterConfig,
|
|
) -> impl std::future::Future<Output = anyhow::Result<HashSet<RepositoryInfo>>> + Send;
|
|
|
|
fn get_repositories_by_organization(
|
|
&self,
|
|
owner: &str,
|
|
token: Option<&str>,
|
|
recurse_groups: bool,
|
|
filter: &RepositoryFilterConfig,
|
|
) -> impl std::future::Future<Output = anyhow::Result<HashSet<RepositoryInfo>>> + Send;
|
|
|
|
fn get_repositories_by_stars(
|
|
&self,
|
|
owner: &str,
|
|
token: Option<&str>,
|
|
filter: &RepositoryFilterConfig,
|
|
) -> impl std::future::Future<Output = anyhow::Result<HashSet<RepositoryInfo>>> + Send;
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
pub enum RepositoryVisibility {
|
|
Public,
|
|
Internal,
|
|
Private,
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
pub struct RepositoryInfo {
|
|
pub owner: String,
|
|
pub name: String,
|
|
pub url: String,
|
|
pub icon_url: Option<String>,
|
|
pub is_fork: bool,
|
|
pub is_archived: bool,
|
|
pub visibility: RepositoryVisibility,
|
|
pub stars: u32,
|
|
pub description: Option<String>,
|
|
}
|