crypto_pay_api/api/
mod.rs

1mod balance;
2mod check;
3mod exchange;
4mod invoice;
5mod misc;
6mod transfer;
7
8use async_trait::async_trait;
9
10use crate::{
11    error::CryptoBotResult,
12    models::{
13        AppStats, Balance, Check, CreateCheckParams, CreateInvoiceParams, Currency, ExchangeRate, GetChecksParams,
14        GetInvoicesParams, GetMeResponse, GetStatsParams, GetTransfersParams, Invoice, Transfer, TransferParams,
15    },
16};
17
18#[async_trait]
19pub trait MiscAPI {
20    async fn get_me(&self) -> CryptoBotResult<GetMeResponse>;
21    async fn get_currencies(&self) -> CryptoBotResult<Vec<Currency>>;
22    async fn get_stats(&self, params: Option<&GetStatsParams>) -> CryptoBotResult<AppStats>;
23}
24
25#[async_trait]
26pub trait BalanceAPI {
27    async fn get_balance(&self) -> CryptoBotResult<Vec<Balance>>;
28}
29
30#[async_trait]
31pub trait CheckAPI {
32    async fn create_check(&self, params: &CreateCheckParams) -> CryptoBotResult<Check>;
33    async fn delete_check(&self, check_id: u64) -> CryptoBotResult<bool>;
34    async fn get_checks(&self, params: Option<&GetChecksParams>) -> CryptoBotResult<Vec<Check>>;
35}
36
37#[async_trait]
38pub trait ExchangeRateAPI {
39    async fn get_exchange_rates(&self) -> CryptoBotResult<Vec<ExchangeRate>>;
40}
41#[async_trait]
42pub trait TransferAPI {
43    async fn transfer(&self, params: &TransferParams) -> CryptoBotResult<Transfer>;
44    async fn get_transfers(&self, params: Option<&GetTransfersParams>) -> CryptoBotResult<Vec<Transfer>>;
45}
46
47#[async_trait]
48pub trait InvoiceAPI {
49    async fn create_invoice(&self, params: &CreateInvoiceParams) -> CryptoBotResult<Invoice>;
50    async fn delete_invoice(&self, invoice_id: u64) -> CryptoBotResult<bool>;
51    async fn get_invoices(&self, params: Option<&GetInvoicesParams>) -> CryptoBotResult<Vec<Invoice>>;
52}