crypto_pay_api/models/
mod.rs

1mod balance;
2mod check;
3mod currency;
4mod exchange_rate;
5mod invoice;
6mod response;
7mod stats;
8mod transfer;
9mod webhook;
10
11pub use balance::*;
12pub use check::*;
13pub use currency::*;
14pub use exchange_rate::*;
15pub use invoice::*;
16pub use response::*;
17use serde::{Deserialize, Serialize};
18pub use stats::*;
19pub use transfer::*;
20pub use webhook::*;
21
22#[derive(Debug)]
23pub enum APIEndpoint {
24    GetMe,
25    CreateInvoice,
26    DeleteInvoice,
27    CreateCheck,
28    DeleteCheck,
29    Transfer,
30    GetInvoices,
31    GetChecks,
32    GetTransfers,
33    GetBalance,
34    GetExchangeRates,
35    GetCurrencies,
36    GetStats,
37}
38
39impl APIEndpoint {
40    pub fn as_str(&self) -> &'static str {
41        match self {
42            APIEndpoint::GetMe => "getMe",
43            APIEndpoint::CreateInvoice => "createInvoice",
44            APIEndpoint::DeleteInvoice => "deleteInvoice",
45            APIEndpoint::CreateCheck => "createCheck",
46            APIEndpoint::DeleteCheck => "deleteCheck",
47            APIEndpoint::Transfer => "transfer",
48            APIEndpoint::GetInvoices => "getInvoices",
49            APIEndpoint::GetChecks => "getChecks",
50            APIEndpoint::GetTransfers => "getTransfers",
51            APIEndpoint::GetBalance => "getBalance",
52            APIEndpoint::GetExchangeRates => "getExchangeRates",
53            APIEndpoint::GetCurrencies => "getCurrencies",
54            APIEndpoint::GetStats => "getStats",
55        }
56    }
57}
58
59pub enum Method {
60    POST,
61    GET,
62    DELETE,
63}
64
65pub struct APIMethod {
66    pub endpoint: APIEndpoint,
67    pub method: Method,
68}
69
70#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone)]
71pub enum PayButtonName {
72    #[serde(rename = "viewItem")]
73    ViewItem,
74    #[serde(rename = "openChannel")]
75    OpenChannel,
76    #[serde(rename = "openBot")]
77    OpenBot,
78    #[serde(rename = "callback")]
79    Callback,
80}
81
82pub struct Missing;
83pub struct Set;