diff options
author | Valentin Popov <valentin@popov.link> | 2024-01-11 20:06:15 +0300 |
---|---|---|
committer | Valentin Popov <valentin@popov.link> | 2024-01-11 20:06:15 +0300 |
commit | 4cbb43c1e2db4c90293e55f2497ae0d0d841c9bd (patch) | |
tree | 97eac47006c118b1dbafd8b2a1321afb4126b324 /src/main.rs | |
parent | 5c89b37d49ee3eed6f520dd26e0409b65af6993d (diff) | |
download | gitlab-duplicator-4cbb43c1e2db4c90293e55f2497ae0d0d841c9bd.tar.xz gitlab-duplicator-4cbb43c1e2db4c90293e55f2497ae0d0d841c9bd.zip |
Getting repository data
Signed-off-by: Valentin Popov <valentin@popov.link>
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 8c82ed1..48d1772 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,15 @@ +#[macro_use] +extern crate dotenv_codegen; + use clap::Parser; +use gitlab::api::{projects, Query}; +use gitlab::Gitlab; +use serde::Deserialize; + +#[derive(Debug, Deserialize)] +struct Project { + http_url_to_repo: String, +} /// Create a mirror of a repository #[derive(Parser, Debug)] @@ -13,7 +24,22 @@ struct Args { url: String, } +/* Get project info from Gitlab */ +fn get_project(url: &str) -> Project { + let gl_client = Gitlab::new(dotenv!("GITLAB_URL"), dotenv!("GITLAB_TOKEN")).unwrap(); + + let gl_endpoint = projects::Project::builder().project(url).build().unwrap(); + let gl_project: Project = gl_endpoint.query(&gl_client).unwrap(); + + gl_project +} + fn main() { + dotenv::dotenv().ok(); + let args = Args::parse(); println!("{:?}", args); + + let project = get_project(&args.url); + dbg!(project); } |