use anyhow::Result;
use azure_devops_rust_api::test_plan;
use std::env;
mod utils;
#[tokio::main]
async fn main() -> Result<()> {
let credential = utils::get_credential()?;
let organization = env::var("ADO_ORGANIZATION").expect("Must define ADO_ORGANIZATION");
let project = env::var("ADO_PROJECT").expect("Must define ADO_PROJECT");
let test_plan_id_value = env::var("TEST_PLAN_ID").expect("Must define PLAN_ID for the test");
let test_plan_id: i32 = test_plan_id_value
.parse()
.expect("Failed to parse TEST_PLAN_ID");
let test_plan_client = test_plan::ClientBuilder::new(credential).build();
println!("The test plan for project are:");
let test_plans = test_plan_client
.test_plans_client()
.list(&organization, &project)
.await?
.value;
println!("{test_plans:#?}");
println!("The suites for the a plan for project are:");
let test_suites = test_plan_client
.test_suites_client()
.get_test_suites_for_plan(&organization, &project, test_plan_id)
.await?
.value;
println!("{test_suites:#?}");
println!("The test plans variables for project are:");
let test_plan_variables = test_plan_client
.variables_client()
.list(&organization, &project)
.await?
.value;
println!("{test_plan_variables:#?}");
println!("The test plan configuration for project are:");
let test_plan_configuration = test_plan_client
.configurations_client()
.list(&organization, &project)
.await?
.value;
println!("{test_plan_configuration:#?}");
Ok(())
}