mirror of
https://seed.radicle.dev/rad:z4D5UCArafTzTQpDZNQRuqswh3ury.git
synced 2026-11-29 06:40:29 +08:00
Add list_repo and config commands
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
use radicle::crypto::PublicKey;
|
||||
use serde::Serialize;
|
||||
use ts_rs::TS;
|
||||
|
||||
use radicle::node::config::DefaultSeedingPolicy;
|
||||
use radicle::node::Alias;
|
||||
|
||||
/// Service configuration.
|
||||
#[derive(Debug, Clone, TS, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct Config {
|
||||
/// Node Public Key in NID format.
|
||||
#[ts(as = "String")]
|
||||
pub public_key: PublicKey,
|
||||
/// Node alias.
|
||||
#[ts(as = "String")]
|
||||
pub alias: Alias,
|
||||
/// Default seeding policy.
|
||||
#[serde(default)]
|
||||
#[ts(type = "{ default: 'allow', scope: 'followed' | 'all' } | { default: 'block' }")]
|
||||
pub seeding_policy: DefaultSeedingPolicy,
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
pub mod config;
|
||||
pub mod repo;
|
||||
@@ -0,0 +1,50 @@
|
||||
use serde::Serialize;
|
||||
use serde_json::Value;
|
||||
use ts_rs::TS;
|
||||
|
||||
use radicle::identity::RepoId;
|
||||
|
||||
/// Repos info.
|
||||
#[derive(Serialize, TS)]
|
||||
#[ts(export)]
|
||||
pub struct RepoInfo {
|
||||
pub payloads: SupportedPayloads,
|
||||
#[ts(type = "({ id: string } | { id: string, alias?: string })[]")]
|
||||
pub delegates: Vec<Value>,
|
||||
pub threshold: usize,
|
||||
#[ts(type = "{ type: 'public' } | { type: 'private', allow?: string[] }")]
|
||||
pub visibility: radicle::identity::Visibility,
|
||||
#[ts(as = "String")]
|
||||
pub rid: RepoId,
|
||||
pub seeding: usize,
|
||||
}
|
||||
|
||||
#[derive(Serialize, TS)]
|
||||
#[ts(export)]
|
||||
pub struct SupportedPayloads {
|
||||
#[serde(rename = "xyz.radicle.project")]
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
#[ts(type = r#"{
|
||||
data: {
|
||||
defaultBranch: string,
|
||||
description: string,
|
||||
name: string,
|
||||
},
|
||||
meta: {
|
||||
head: string,
|
||||
issues: {
|
||||
open: number,
|
||||
closed: number,
|
||||
},
|
||||
patches: {
|
||||
open: number,
|
||||
draft: number,
|
||||
archived: number,
|
||||
merged: number,
|
||||
}
|
||||
lastCommit: number,
|
||||
}
|
||||
}"#)]
|
||||
pub project: Option<Value>,
|
||||
}
|
||||
Reference in New Issue
Block a user