CryptoBot

Struct CryptoBot 

Source
pub struct CryptoBot { /* private fields */ }

Implementations§

Source§

impl CryptoBot

Source

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 @CryptoBot
  • base_url - Optional, defaults to “https://pay.crypt.bot/api”
  • timeout - Optional, defaults to 30 seconds
  • headers - 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
Source§

impl CryptoBot

Source

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

Source§

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

Source§

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<'_>

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
Source§

fn delete_check(&self, check_id: u64) -> DeleteCheckBuilder<'_>

Source§

impl Debug for CryptoBot

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ExchangeRateAPI for CryptoBot

Source§

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

Source§

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<'_>

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
Source§

fn delete_invoice(&self, invoice_id: u64) -> DeleteInvoiceBuilder<'_>

Source§

impl MiscAPI for CryptoBot

Source§

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<'_>

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
Source§

fn get_stats(&self) -> GetStatsBuilder<'_>

Gets application statistics for a specified time period

Retrieves statistics about your application’s usage, including transaction volumes, number of invoices, and user counts.

§Returns
  • GetStatsBuilder - A builder to construct the filter parameters
Source§

impl TransferAPI for CryptoBot

Source§

fn transfer(&self) -> TransferBuilder<'_>

Transfer cryptocurrency to a user

§Returns
  • TransferBuilder - A builder to construct the transfer parameters
Source§

fn get_transfers(&self) -> GetTransfersBuilder<'_>

Get transfers history

§Returns
  • GetTransfersBuilder - A builder to construct the filter parameters

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more