uniformity

This commit is contained in:
Quaternions 2024-12-26 16:59:38 -08:00
parent a16e8faf8b
commit bc11f918aa

View File

@ -21,7 +21,9 @@ enum Commands{
#[derive(Args)] #[derive(Args)]
struct ReviewCommand{ struct ReviewCommand{
#[arg(long)] #[arg(long)]
cookie:String, session_id:String,
#[arg(long)]
api_url:String,
} }
#[derive(Args)] #[derive(Args)]
struct UploadScriptsCommand{ struct UploadScriptsCommand{
@ -36,7 +38,8 @@ async fn main(){
let cli=Cli::parse(); let cli=Cli::parse();
match cli.command{ match cli.command{
Commands::Review(command)=>review(ReviewConfig{ Commands::Review(command)=>review(ReviewConfig{
cookie:command.cookie, session_id:command.session_id,
api_url:command.api_url,
}).await.unwrap(), }).await.unwrap(),
Commands::UploadScripts(command)=>upload_scripts(UploadConfig{ Commands::UploadScripts(command)=>upload_scripts(UploadConfig{
session_id:command.session_id, session_id:command.session_id,
@ -82,14 +85,15 @@ enum ReviewError{
} }
struct ReviewConfig{ struct ReviewConfig{
cookie:String, session_id:String,
api_url:String,
} }
async fn review(config:ReviewConfig)->Result<(),ReviewError>{ async fn review(config:ReviewConfig)->Result<(),ReviewError>{
// download unreviewed policies // download unreviewed policies
// review them // review them
let cookie=submissions_api::Cookie::new(&config.cookie).map_err(ReviewError::Cookie)?; let cookie=submissions_api::Cookie::new(&config.session_id).map_err(ReviewError::Cookie)?;
let api=submissions_api::external::Context::new("http://localhost:8083".to_owned(),cookie).map_err(ReviewError::Reqwest)?; let api=submissions_api::external::Context::new(config.api_url,cookie).map_err(ReviewError::Reqwest)?;
let unreviewed_policies=api.get_script_policies(submissions_api::types::GetScriptPoliciesRequest{ let unreviewed_policies=api.get_script_policies(submissions_api::types::GetScriptPoliciesRequest{
Page:1, Page:1,