trello-to-deck/src/trello/client.rs

30 lines
861 B
Rust
Raw Normal View History

//
use crate::api_result::APIResult;
use crate::trello::model::list::TrelloList;
use crate::trello::TrelloConfig;
use crate::trello::{api::lists, model::board::TrelloBoard};
use crate::FullCtx;
use super::model::TrelloBoardId;
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
}
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
}
}
impl TrelloClient<'_> {
pub(crate) fn new(ctx: &FullCtx) -> TrelloClient {
TrelloClient { ctx }
}
}