feat: check command lists trello boards
This commit is contained in:
parent
3d48e2f408
commit
6ee44dc7d4
1 changed files with 35 additions and 26 deletions
61
src/check.rs
61
src/check.rs
|
@ -4,34 +4,43 @@ use color_eyre::eyre::{OptionExt as _, Result};
|
||||||
use crate::{f, p, trello::model::board::TrelloBoards as _, FullCtx};
|
use crate::{f, p, trello::model::board::TrelloBoards as _, FullCtx};
|
||||||
|
|
||||||
pub(crate) async fn run(ctx: FullCtx) -> Result<()> {
|
pub(crate) async fn run(ctx: FullCtx) -> Result<()> {
|
||||||
// test trello by getting a list of the boards for the user
|
{
|
||||||
p!(ctx.prt, ">> Testing Trello details...");
|
// test trello by getting a list of the boards for the user
|
||||||
let boards = ctx.trello_client().boards().await.result?;
|
p!(ctx.prt, ">> Testing Trello details...");
|
||||||
p!(ctx.prt, "<<< Trello Credentials: OKAY");
|
let boards = ctx.trello_client().boards().await.result?;
|
||||||
let board_name = &ctx.cfg.trello.board_name;
|
p!(ctx.prt, "<<< Trello Credentials: OKAY");
|
||||||
p!(ctx.prt, ">> Trello Board: {board_name}");
|
let board_name = &ctx.cfg.trello.board_name;
|
||||||
let board = boards
|
p!(ctx.prt, ">> Trello Board: {board_name}");
|
||||||
.find_by_name(board_name)
|
let board = boards
|
||||||
.ok_or_eyre(f!("board not found: {board_name}"))?;
|
.find_by_name(board_name)
|
||||||
p!(ctx.prt, "<<< Trello Board: OKAY");
|
.ok_or_eyre(f!("board not found: {board_name}"))?;
|
||||||
for list in &board.lists {
|
p!(ctx.prt, "<<< Trello Board: OKAY");
|
||||||
p!(ctx.prt, "<<< List: {}", list.name);
|
for list in &board.lists {
|
||||||
|
p!(ctx.prt, "<<<< List: {}", list.name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p!(ctx.prt, ">> Testing Nextcloud details...");
|
{
|
||||||
let deck_client = ctx.deck_client();
|
p!(ctx.prt, ">> Testing Nextcloud details...");
|
||||||
let board = deck_client
|
let deck_client = ctx.deck_client();
|
||||||
.get_board(ctx.cfg.nextcloud.board_id)
|
let boards = deck_client.get_boards().await.result?;
|
||||||
.await
|
p!(ctx.prt, "<<< Nextcloud Boards");
|
||||||
.result?;
|
for board in &boards {
|
||||||
p!(ctx.prt, "<<< Nextcloud Credentials: OKAY");
|
p!(ctx.prt, "<<<< Board: {}", board.title);
|
||||||
p!(ctx.prt, "<<< Nextcloud Board: {}", board.title);
|
}
|
||||||
let stacks = deck_client
|
p!(ctx.prt, "<<< Nextcloud Credentials: OKAY");
|
||||||
.get_stacks(ctx.cfg.nextcloud.board_id)
|
let board = boards
|
||||||
.await
|
.iter()
|
||||||
.result?;
|
.find(|b| b.id == ctx.cfg.nextcloud.board_id)
|
||||||
for stack in stacks {
|
.ok_or_eyre("board not found")?;
|
||||||
p!(ctx.prt, "<<< Stack: {}", stack.title);
|
p!(ctx.prt, "<<< Nextcloud Board: {}", board.title);
|
||||||
|
let stacks = deck_client
|
||||||
|
.get_stacks(ctx.cfg.nextcloud.board_id)
|
||||||
|
.await
|
||||||
|
.result?;
|
||||||
|
for stack in stacks {
|
||||||
|
p!(ctx.prt, "<<<< Stack: {}", stack.title);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue