Skip to main content

comindly_api/
hosting.rs

1use serde::{Deserialize, Serialize};
2
3/// Where the repositories live: a provider, its host and the owner or group path.
4#[derive(Debug, Clone, PartialEq)]
5pub struct Source {
6    pub provider: Provider,
7    pub host: String,
8    /// Organisation or user on GitHub; group or project path (`team/platform`) on GitLab.
9    pub owner: String,
10    /// The repository, when the URL names one (`github.com/acme/orders`, `….git`, `git@…`).
11    pub repo: Option<String>,
12}
13
14#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
15#[serde(rename_all = "lowercase")]
16pub enum Provider {
17    GitHub,
18    GitLab,
19}
20
21/// A repository on the host.
22#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
23pub struct RemoteRepo {
24    pub name: String,
25    /// `owner/name` or `group/sub/name`.
26    pub full_path: String,
27    pub clone_url: String,
28    pub description: Option<String>,
29    pub default_branch: Option<String>,
30    pub archived: bool,
31    pub fork: bool,
32    pub last_activity: Option<String>,
33    /// Size in KiB, when the host reports it.
34    pub size_kib: Option<u64>,
35}