summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-10 13:48:51 -0600
committermo khan <mo@mokhan.ca>2025-07-10 13:48:51 -0600
commit460a463d15e76fe9e3e7ceac1c2afc6c0069a5d2 (patch)
tree922d448dad767ffe6ce8e87f6212846b6f926afa /src
parentafe29973c577b32de20d876d2dd30e3a6adcc1af (diff)
refactor: move gitlab types to a separate module
Diffstat (limited to 'src')
-rw-r--r--src/authorization/entities.rs38
-rw-r--r--src/gitlab/group.rs10
-rw-r--r--src/gitlab/member.rs10
-rw-r--r--src/gitlab/mod.rs9
-rw-r--r--src/gitlab/namespace.rs11
-rw-r--r--src/gitlab/project.rs11
-rw-r--r--src/lib.rs1
7 files changed, 53 insertions, 37 deletions
diff --git a/src/authorization/entities.rs b/src/authorization/entities.rs
index e47cf00f..b4f5a762 100644
--- a/src/authorization/entities.rs
+++ b/src/authorization/entities.rs
@@ -1,3 +1,4 @@
+use crate::gitlab::{Group, Member, Project};
use serde::Serialize;
use std::collections::HashSet;
@@ -23,43 +24,6 @@ pub struct CedarParent {
pub id: String,
}
-// API structures
-#[derive(Debug, serde::Deserialize)]
-pub struct Project {
- pub id: u64,
- pub name: String,
- pub path: String,
- pub namespace: Namespace,
-}
-
-#[derive(Debug, serde::Deserialize)]
-pub struct Namespace {
- pub id: u64,
- pub name: String,
- pub path: String,
- pub kind: String,
- pub full_path: String,
- pub parent_id: Option<u64>,
-}
-
-#[derive(Debug, serde::Deserialize)]
-pub struct Member {
- pub id: u64,
- pub username: String,
- pub name: String,
- pub state: String,
- pub access_level: u8,
-}
-
-#[derive(Debug, serde::Deserialize)]
-pub struct Group {
- pub id: u64,
- pub name: String,
- pub path: String,
- pub full_path: String,
- pub parent_id: Option<u64>,
-}
-
pub struct EntitiesRepository {
pub token: String,
pub host: String,
diff --git a/src/gitlab/group.rs b/src/gitlab/group.rs
new file mode 100644
index 00000000..6b00e87d
--- /dev/null
+++ b/src/gitlab/group.rs
@@ -0,0 +1,10 @@
+use serde::Deserialize;
+
+#[derive(Debug, Deserialize)]
+pub struct Group {
+ pub id: u64,
+ pub name: String,
+ pub path: String,
+ pub full_path: String,
+ pub parent_id: Option<u64>,
+}
diff --git a/src/gitlab/member.rs b/src/gitlab/member.rs
new file mode 100644
index 00000000..0b4997e9
--- /dev/null
+++ b/src/gitlab/member.rs
@@ -0,0 +1,10 @@
+use serde::Deserialize;
+
+#[derive(Debug, Deserialize)]
+pub struct Member {
+ pub id: u64,
+ pub username: String,
+ pub name: String,
+ pub state: String,
+ pub access_level: u8,
+}
diff --git a/src/gitlab/mod.rs b/src/gitlab/mod.rs
new file mode 100644
index 00000000..04e85786
--- /dev/null
+++ b/src/gitlab/mod.rs
@@ -0,0 +1,9 @@
+pub mod group;
+pub mod member;
+pub mod namespace;
+pub mod project;
+
+pub use group::Group;
+pub use member::Member;
+pub use namespace::Namespace;
+pub use project::Project;
diff --git a/src/gitlab/namespace.rs b/src/gitlab/namespace.rs
new file mode 100644
index 00000000..d4a1e8f4
--- /dev/null
+++ b/src/gitlab/namespace.rs
@@ -0,0 +1,11 @@
+use serde::Deserialize;
+
+#[derive(Debug, Deserialize)]
+pub struct Namespace {
+ pub id: u64,
+ pub name: String,
+ pub path: String,
+ pub kind: String,
+ pub full_path: String,
+ pub parent_id: Option<u64>,
+}
diff --git a/src/gitlab/project.rs b/src/gitlab/project.rs
new file mode 100644
index 00000000..ba88c2e3
--- /dev/null
+++ b/src/gitlab/project.rs
@@ -0,0 +1,11 @@
+use serde::Deserialize;
+
+use super::Namespace;
+
+#[derive(Debug, Deserialize)]
+pub struct Project {
+ pub id: u64,
+ pub name: String,
+ pub path: String,
+ pub namespace: Namespace,
+}
diff --git a/src/lib.rs b/src/lib.rs
index e70e64f7..3681a859 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,5 @@
pub mod authorization;
+pub mod gitlab;
pub use authorization::{
Authorizer, CedarAuthorizer, CedarEntity, CheckService, EntitiesRepository, Server,