diff --git a/src/api/mod.rs b/src/api/mod.rs index dc8ae20..559eb3c 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -151,6 +151,19 @@ impl VikunjaAPI { }) } + pub fn new_label(&self, title: &str, description: Option<&str>, color: Option<&str>) -> Label { + let resp = self.put_request( + "/labels", + &serde_json::json!({ + "title": title, + "description": description, + "hex_color": color + }), + ); + + serde_json::from_str(&resp).unwrap() + } + // tasks pub fn get_task_page(&self, page: usize) -> Vec { let resp = self.get_request(&format!("/tasks/all?page={page}")); diff --git a/src/args.rs b/src/args.rs index f5257fb..eb2ebf2 100644 --- a/src/args.rs +++ b/src/args.rs @@ -36,10 +36,21 @@ pub fn get_args() -> clap::ArgMatches { command!() .name("label") .about("Manage labels") - .subcommand(command!().name("ls").about("List all labels")), - // todo : label new - // todo : label rm - // todo : label