diff --git a/bank_client/src/lib.rs b/bank_client/src/lib.rs index a1c81a0..94b30ee 100644 --- a/bank_client/src/lib.rs +++ b/bank_client/src/lib.rs @@ -5,6 +5,7 @@ use bank_core::{ ApiError, NameOrUuid, TokenResponse, account::{Account, UserAccountInfo}, chat::{Chat, ChatInfo, ChatMessage, SendMessage, StartChat}, + meta::{Bank, Motd}, pagination::{Pagination, RequestPagination}, transaction::{Direction, Transaction}, user::{User, UserAccounts, UserBalance}, @@ -162,10 +163,6 @@ pub async fn handle_response( } } -pub struct UsersApi<'a> { - api: &'a ApiClient, -} - macro_rules! request { ($api:expr, $method:ident, $path:expr) => {{ let api = &$api; @@ -173,6 +170,28 @@ macro_rules! request { }}; } +pub struct MetaApi<'a> { + api: &'a ApiClient, +} + +impl MetaApi<'_> { + pub async fn motd(&self) -> Result { + let response = request!(self.api, get, "/api/meta/motd").send().await?; + let body = handle_response(response).await?; + Ok(body) + } + + pub async fn bank(&self) -> Result { + let response = request!(self.api, get, "/api/meta/bank").send().await?; + let body = handle_response(response).await?; + Ok(body) + } +} + +pub struct UsersApi<'a> { + api: &'a ApiClient, +} + impl UsersApi<'_> { pub async fn list(&self, limit: u64, offset: u64) -> Result, ClientError> { let response = request!(