pub struct CryptoBot { /* private fields */ }Implementations§
Source§impl CryptoBot
impl CryptoBot
Sourcepub fn builder() -> ClientBuilder<NoAPIToken>
pub fn builder() -> ClientBuilder<NoAPIToken>
Returns a new builder for creating a customized CryptoBot client
The builder pattern allows you to customize all aspects of the client, including timeout, base URL and headers settings.
§Available Settings
api_token- Required, the API token from @CryptoBotbase_url- Optional, defaults to “https://pay.crypt.bot/api”timeout- Optional, defaults to 30 secondsheaders- Optional, custom headers for all requests
§Example
use crypto_pay_api::prelude::*;
use std::time::Duration;
#[tokio::main]
async fn main() -> Result<(), CryptoBotError> {
let client = CryptoBot::builder()
.api_token("YOUR_API_TOKEN")
.base_url("https://testnet-pay.crypt.bot/api") // Use testnet
.timeout(Duration::from_secs(60)) // 60 second timeout
.headers(vec![(
HeaderName::from_static("x-custom-header"),
HeaderValue::from_static("custom_value")
)])
.build()?;
Ok(())
}§See Also
ClientBuilder- The builder type
Source§impl CryptoBot
impl CryptoBot
Sourcepub fn webhook_handler(&self) -> WebhookHandlerConfigBuilder<'_>
pub fn webhook_handler(&self) -> WebhookHandlerConfigBuilder<'_>
Creates a new webhook handler builder
§Example
use crypto_pay_api::prelude::*;
use std::time::Duration;
#[tokio::main]
async fn main() -> Result<(), CryptoBotError> {
let client = CryptoBot::builder().api_token("YOUR_API_TOKEN").build().unwrap();
let webhook_handler = client.webhook_handler()
.expiration_time(Duration::from_secs(60 * 10))
.build();
Ok(())
}Trait Implementations§
Source§impl BalanceAPI for CryptoBot
impl BalanceAPI for CryptoBot
Source§fn get_balance(&self) -> GetBalanceBuilder<'_>
fn get_balance(&self) -> GetBalanceBuilder<'_>
Gets current balance for all supported cryptocurrencies in your CryptoBot wallet
This method returns the current balance for all cryptocurrencies that are available in your CryptoBot wallet, including both crypto and test currencies.
§Returns
GetBalanceBuilder- A builder to execute the request
Source§impl CheckAPI for CryptoBot
impl CheckAPI for CryptoBot
Source§fn create_check(&self) -> CreateCheckBuilder<'_>
fn create_check(&self) -> CreateCheckBuilder<'_>
Creates a new cryptocurrency check
A check is a unique link that can be used once to transfer cryptocurrency. Anyone who opens the link first can activate the check and get the cryptocurrency.
§Returns
CreateCheckBuilder- A builder to construct the check parameters
Source§fn get_checks(&self) -> GetChecksBuilder<'_>
fn get_checks(&self) -> GetChecksBuilder<'_>
Gets a list of created cryptocurrency checks
Retrieves all checks matching the specified filter parameters. If no parameters are provided, returns all checks.
§Returns
GetChecksBuilder- A builder to construct the filter parameters
fn delete_check(&self, check_id: u64) -> DeleteCheckBuilder<'_>
Source§impl ExchangeRateAPI for CryptoBot
impl ExchangeRateAPI for CryptoBot
Source§fn get_exchange_rates(&self) -> GetExchangeRatesBuilder<'_>
fn get_exchange_rates(&self) -> GetExchangeRatesBuilder<'_>
Gets current exchange rates for all supported cryptocurrencies
This method returns exchange rates between supported cryptocurrencies and target currencies. Exchange rates are updated regularly by CryptoBot.
§Returns
GetExchangeRatesBuilder- A builder to execute the request
Source§impl InvoiceAPI for CryptoBot
impl InvoiceAPI for CryptoBot
Source§fn create_invoice(&self) -> CreateInvoiceBuilder<'_>
fn create_invoice(&self) -> CreateInvoiceBuilder<'_>
Creates a new cryptocurrency invoice
An invoice is a request for cryptocurrency payment with a specific amount and currency. Once created, the invoice can be paid by any user.
§Returns
CreateInvoiceBuilder- A builder to construct the invoice parameters
Source§fn get_invoices(&self) -> GetInvoicesBuilder<'_>
fn get_invoices(&self) -> GetInvoicesBuilder<'_>
Gets a list of invoices with optional filtering
Retrieves all invoices matching the specified filter parameters. If no parameters are provided, returns all invoices.
§Returns
GetInvoicesBuilder- A builder to construct the filter parameters
fn delete_invoice(&self, invoice_id: u64) -> DeleteInvoiceBuilder<'_>
Source§impl MiscAPI for CryptoBot
impl MiscAPI for CryptoBot
Source§fn get_me(&self) -> GetMeBuilder<'_>
fn get_me(&self) -> GetMeBuilder<'_>
Gets basic information about your application
Retrieves information about your application, including app ID, name, and payment processing bot username.
§Returns
GetMeBuilder- A builder to execute the request
Source§fn get_currencies(&self) -> GetCurrenciesBuilder<'_>
fn get_currencies(&self) -> GetCurrenciesBuilder<'_>
Gets a list of all supported cryptocurrencies
Returns information about all cryptocurrencies supported by CryptoBot, including both crypto and fiat currencies.
§Returns
GetCurrenciesBuilder- A builder to execute the request