2024-12-08 17:23:54 +00:00
|
|
|
//
|
|
|
|
use crate::api_result::APIResult;
|
2024-12-08 22:15:23 +00:00
|
|
|
use crate::trello::model::list::TrelloList;
|
2024-12-08 17:23:54 +00:00
|
|
|
use crate::trello::TrelloConfig;
|
2024-12-08 22:15:23 +00:00
|
|
|
use crate::trello::{api::lists, model::board::TrelloBoard};
|
2024-12-08 17:23:54 +00:00
|
|
|
use crate::FullCtx;
|
|
|
|
|
2024-12-08 22:15:23 +00:00
|
|
|
use super::model::TrelloBoardId;
|
|
|
|
|
2024-12-08 17:23:54 +00:00
|
|
|
pub(crate) struct TrelloClient<'ctx> {
|
|
|
|
ctx: &'ctx FullCtx,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'ctx> TrelloClient<'ctx> {
|
|
|
|
pub(crate) async fn boards(&self, cfg: &TrelloConfig) -> APIResult<Vec<TrelloBoard>> {
|
|
|
|
super::api::members::get_boards_that_member_belongs_to(cfg, &self.ctx.net, &self.ctx.prt)
|
|
|
|
.await
|
|
|
|
}
|
2024-12-08 22:15:23 +00:00
|
|
|
|
|
|
|
pub(crate) async fn lists(&self, board_id: &TrelloBoardId) -> APIResult<Vec<TrelloList>> {
|
|
|
|
lists::get_board_lists(&self.ctx.cfg.trello, board_id, &self.ctx.net, &self.ctx.prt).await
|
|
|
|
}
|
2024-12-08 17:23:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl TrelloClient<'_> {
|
|
|
|
pub(crate) fn new(ctx: &FullCtx) -> TrelloClient {
|
|
|
|
TrelloClient { ctx }
|
|
|
|
}
|
|
|
|
}
|