Skip to main content

gitfox_client/models/
space.rs

1use serde::{Deserialize, Serialize};
2
3use super::Principal;
4
5/// A space — GitFox's organisation, which can nest.
6#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7pub struct Space {
8    #[serde(default)]
9    pub id: Option<i64>,
10    #[serde(default)]
11    pub identifier: String,
12    /// The full path, e.g. `org/team`.
13    #[serde(default)]
14    pub path: String,
15    #[serde(default)]
16    pub description: Option<String>,
17    #[serde(default)]
18    pub is_public: Option<bool>,
19    #[serde(default)]
20    pub parent_id: Option<i64>,
21    #[serde(default)]
22    pub created: Option<i64>,
23    #[serde(default)]
24    pub updated: Option<i64>,
25}
26
27impl Space {
28    pub fn reference(&self) -> String {
29        if self.path.is_empty() {
30            self.identifier.clone()
31        } else {
32            self.path.clone()
33        }
34    }
35}
36
37/// A space the caller belongs to, and in what role.
38#[derive(Debug, Clone, Default, Serialize, Deserialize)]
39pub struct Membership {
40    #[serde(default)]
41    pub space: Space,
42    #[serde(default)]
43    pub role: Option<String>,
44    #[serde(default)]
45    pub added_by: Option<Principal>,
46    #[serde(default)]
47    pub created: Option<i64>,
48}
49
50/// A secret stored in a space. GitFox never returns the value.
51#[derive(Debug, Clone, Default, Serialize, Deserialize)]
52pub struct SpaceSecret {
53    #[serde(default)]
54    pub identifier: String,
55    #[serde(default)]
56    pub description: Option<String>,
57    #[serde(default)]
58    pub space_id: Option<i64>,
59    #[serde(default)]
60    pub created: Option<i64>,
61    #[serde(default)]
62    pub updated: Option<i64>,
63}
64
65/// An SSH public key on the caller's account.
66#[derive(Debug, Clone, Default, Serialize, Deserialize)]
67pub struct PublicKey {
68    #[serde(default)]
69    pub identifier: String,
70    #[serde(default)]
71    pub fingerprint: Option<String>,
72    /// The key algorithm, e.g. `ssh-ed25519`.
73    #[serde(default, rename = "type")]
74    pub key_type: Option<String>,
75    /// `auth` — GitFox has no signing keys.
76    #[serde(default)]
77    pub usage: Option<String>,
78    #[serde(default)]
79    pub comment: Option<String>,
80    #[serde(default)]
81    pub created: Option<i64>,
82    #[serde(default)]
83    pub verified: Option<i64>,
84}
85
86/// `GET /api/v1/system/config` — what this instance has switched on.
87#[derive(Debug, Clone, Default, Serialize, Deserialize)]
88pub struct SystemConfig {
89    #[serde(default)]
90    pub gitspace_enabled: Option<bool>,
91    #[serde(default)]
92    pub ssh_enabled: Option<bool>,
93    #[serde(default)]
94    pub user_signup_allowed: Option<bool>,
95    #[serde(default)]
96    pub public_resource_creation_enabled: Option<bool>,
97    #[serde(default)]
98    pub artifact_registry_enabled: Option<bool>,
99}
100
101/// One entry of `GET /api/v1/resources/license`.
102#[derive(Debug, Clone, Default, Serialize, Deserialize)]
103pub struct LicenseTemplate {
104    #[serde(default)]
105    pub label: String,
106    #[serde(default)]
107    pub value: String,
108}