summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/authzd/gitlab.com/gitlab-org/gitlab/entities.json84
-rw-r--r--src/gitlab/api.rs20
2 files changed, 53 insertions, 51 deletions
diff --git a/etc/authzd/gitlab.com/gitlab-org/gitlab/entities.json b/etc/authzd/gitlab.com/gitlab-org/gitlab/entities.json
index 1992a9c7..a7af8c80 100644
--- a/etc/authzd/gitlab.com/gitlab-org/gitlab/entities.json
+++ b/etc/authzd/gitlab.com/gitlab-org/gitlab/entities.json
@@ -41,32 +41,32 @@
{
"uid": {
"type": "User",
- "id": "2293"
+ "id": "370493"
},
"attrs": {
- "username": "brodock",
- "access_level": 40
+ "username": "luke",
+ "access_level": 30
},
"parents": []
},
{
"uid": {
"type": "User",
- "id": "138401"
+ "id": "426128"
},
"attrs": {
- "username": "chriscool",
- "access_level": 30
+ "username": "felipe_artur",
+ "access_level": 40
},
"parents": []
},
{
"uid": {
"type": "User",
- "id": "527558"
+ "id": "138401"
},
"attrs": {
- "username": "eliran.mesika",
+ "username": "chriscool",
"access_level": 30
},
"parents": []
@@ -74,10 +74,10 @@
{
"uid": {
"type": "User",
- "id": "215818"
+ "id": "367626"
},
"attrs": {
- "username": "tmaczukin",
+ "username": "alejandro",
"access_level": 40
},
"parents": []
@@ -85,10 +85,10 @@
{
"uid": {
"type": "User",
- "id": "429540"
+ "id": "516904"
},
"attrs": {
- "username": "ahanselka",
+ "username": "tauriedavis",
"access_level": 30
},
"parents": []
@@ -96,10 +96,10 @@
{
"uid": {
"type": "User",
- "id": "581582"
+ "id": "527558"
},
"attrs": {
- "username": "arihantar",
+ "username": "eliran.mesika",
"access_level": 30
},
"parents": []
@@ -107,21 +107,21 @@
{
"uid": {
"type": "User",
- "id": "626804"
+ "id": "215818"
},
"attrs": {
- "username": "pedroms",
- "access_level": 30
+ "username": "tmaczukin",
+ "access_level": 40
},
"parents": []
},
{
"uid": {
"type": "User",
- "id": "597578"
+ "id": "429540"
},
"attrs": {
- "username": "WarheadsSE",
+ "username": "ahanselka",
"access_level": 30
},
"parents": []
@@ -129,10 +129,10 @@
{
"uid": {
"type": "User",
- "id": "739252"
+ "id": "506061"
},
"attrs": {
- "username": "jdrumtra",
+ "username": "ahmadsherif",
"access_level": 30
},
"parents": []
@@ -140,10 +140,10 @@
{
"uid": {
"type": "User",
- "id": "739361"
+ "id": "581582"
},
"attrs": {
- "username": "Elsje",
+ "username": "arihantar",
"access_level": 30
},
"parents": []
@@ -151,32 +151,32 @@
{
"uid": {
"type": "User",
- "id": "201566"
+ "id": "626804"
},
"attrs": {
- "username": "annabeldunstone",
- "access_level": 40
+ "username": "pedroms",
+ "access_level": 30
},
"parents": []
},
{
"uid": {
"type": "User",
- "id": "829774"
+ "id": "597578"
},
"attrs": {
- "username": "jivanvl",
- "access_level": 40
+ "username": "WarheadsSE",
+ "access_level": 30
},
"parents": []
},
{
"uid": {
"type": "User",
- "id": "4849"
+ "id": "739252"
},
"attrs": {
- "username": "balasankarc",
+ "username": "jdrumtra",
"access_level": 30
},
"parents": []
@@ -184,10 +184,10 @@
{
"uid": {
"type": "User",
- "id": "790854"
+ "id": "739361"
},
"attrs": {
- "username": "harishsr",
+ "username": "Elsje",
"access_level": 30
},
"parents": []
@@ -195,10 +195,10 @@
{
"uid": {
"type": "User",
- "id": "273486"
+ "id": "201566"
},
"attrs": {
- "username": "jameslopez",
+ "username": "annabeldunstone",
"access_level": 40
},
"parents": []
@@ -206,10 +206,10 @@
{
"uid": {
"type": "User",
- "id": "411701"
+ "id": "829774"
},
"attrs": {
- "username": "kushalpandya",
+ "username": "jivanvl",
"access_level": 40
},
"parents": []
@@ -217,21 +217,21 @@
{
"uid": {
"type": "User",
- "id": "508743"
+ "id": "4849"
},
"attrs": {
- "username": "jarka",
- "access_level": 40
+ "username": "balasankarc",
+ "access_level": 30
},
"parents": []
},
{
"uid": {
"type": "User",
- "id": "506061"
+ "id": "790854"
},
"attrs": {
- "username": "ahmadsherif",
+ "username": "harishsr",
"access_level": 30
},
"parents": []
diff --git a/src/gitlab/api.rs b/src/gitlab/api.rs
index 7f733b4c..3ddf4ec4 100644
--- a/src/gitlab/api.rs
+++ b/src/gitlab/api.rs
@@ -60,13 +60,17 @@ impl Api {
}
pub async fn get_group(&self, group_id: u64) -> Result<Group, Box<dyn std::error::Error>> {
- let url = format!(
- "{}/api/v4/groups/{}",
- self.host.trim_end_matches('/'),
- group_id
- );
+ self.get::<Group>(format!("/api/v4/groups/{}", group_id))
+ .await
+ }
- let group = self
+ async fn get<T: serde::de::DeserializeOwned>(
+ &self,
+ path: String,
+ ) -> Result<T, Box<dyn std::error::Error>> {
+ let url = format!("{}{}", self.host.trim_end_matches('/'), path);
+
+ Ok(self
.client
.get(&url)
.header("PRIVATE-TOKEN", &self.token)
@@ -74,8 +78,6 @@ impl Api {
.await?
.error_for_status()?
.json()
- .await?;
-
- Ok(group)
+ .await?)
}
}