RainClient

Struct RainClient 

Source
pub struct RainClient { /* private fields */ }
Expand description

Main client for interacting with the Rain API

This client provides methods to interact with all Rain API endpoints. It handles authentication, request building, and response parsing automatically.

§Thread Safety

The client is Clone and can be shared across threads safely.

§Examples

use rain_sdk::{RainClient, Config, Environment, AuthConfig};

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

Implementations§

Source§

impl RainClient

Source

pub async fn create_company_application( &self, request: &CreateCompanyApplicationRequest, ) -> Result<CompanyApplicationResponse>

Create a company application

§Arguments
  • request - The company application request
§Returns

Returns a CompanyApplicationResponse containing the application information.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::applications::*;
use rain_sdk::models::common::*;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

// Note: In practice, you would populate all required fields.
// This is a simplified example - see the full struct definitions for required fields.
let application = client.create_company_application(&request).await?;
Source

pub async fn get_company_application( &self, company_id: &Uuid, ) -> Result<CompanyApplicationResponse>

Get a company application by ID

§Arguments
  • company_id - The unique identifier of the company
§Returns

Returns a CompanyApplicationResponse containing the application information.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 404 - Company not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let company_id = Uuid::new_v4();
let application = client.get_company_application(&company_id).await?;
Source

pub async fn update_company_application( &self, company_id: &Uuid, request: &UpdateCompanyApplicationRequest, ) -> Result<CompanyApplicationResponse>

Update a company application

§Arguments
  • company_id - The unique identifier of the company
  • request - The update request
§Returns

Returns a CompanyApplicationResponse containing the updated application information.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - Company not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::applications::UpdateCompanyApplicationRequest;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let company_id = Uuid::new_v4();
let request = UpdateCompanyApplicationRequest {
    name: Some("Updated Name".to_string()),
    address: None,
    entity: None,
};
let application = client.update_company_application(&company_id, &request).await?;
Source

pub async fn update_ultimate_beneficial_owner( &self, company_id: &Uuid, ubo_id: &Uuid, request: &UpdateUltimateBeneficialOwnerRequest, ) -> Result<CompanyApplicationResponse>

Update an ultimate beneficial owner

§Arguments
  • company_id - The unique identifier of the company
  • ubo_id - The unique identifier of the ultimate beneficial owner
  • request - The update request
§Returns

Returns a CompanyApplicationResponse containing the updated application information.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - Company or UBO not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::applications::UpdateUltimateBeneficialOwnerRequest;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let company_id = Uuid::new_v4();
let ubo_id = Uuid::new_v4();
let request = UpdateUltimateBeneficialOwnerRequest {
    first_name: Some("John".to_string()),
    last_name: Some("Doe".to_string()),
    birth_date: None,
    national_id: None,
    country_of_issue: None,
    email: None,
    address: None,
};
let application = client.update_ultimate_beneficial_owner(&company_id, &ubo_id, &request).await?;
Source

pub async fn upload_company_document( &self, company_id: &Uuid, params: &DocumentUploadParams, ) -> Result<Value>

Upload a document for a company application

§Arguments
  • company_id - The unique identifier of the company
  • params - Document upload parameters
§Returns

Returns a success response.

§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::applications::DocumentUploadParams;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let company_id = Uuid::new_v4();
let params = DocumentUploadParams {
    document_type: "directorsRegistry".to_string(),
    side: "front".to_string(),
    country: Some("US".to_string()),
    country_code: Some("US".to_string()),
    name: Some("Document Name".to_string()),
    file_path: "/path/to/file.pdf".to_string(),
};
client.upload_company_document(&company_id, &params).await?;
Source

pub async fn upload_ubo_document( &self, company_id: &Uuid, ubo_id: &Uuid, params: &DocumentUploadParams, ) -> Result<Value>

Upload a document for an ultimate beneficial owner

§Arguments
  • company_id - The unique identifier of the company
  • ubo_id - The unique identifier of the ultimate beneficial owner
  • params - Document upload parameters
§Returns

Returns a success response.

§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::applications::DocumentUploadParams;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let company_id = Uuid::new_v4();
let ubo_id = Uuid::new_v4();
let params = DocumentUploadParams {
    document_type: "idCard".to_string(),
    side: "front".to_string(),
    country: Some("US".to_string()),
    country_code: Some("US".to_string()),
    name: None,
    file_path: "/path/to/file.pdf".to_string(),
};
client.upload_ubo_document(&company_id, &ubo_id, &params).await?;
Source

pub async fn create_user_application( &self, request: &CreateUserApplicationRequest, ) -> Result<UserApplicationResponse>

Create a user application

This method supports three verification methods (oneOf in OpenAPI spec):

  1. Using Sumsub Share Token: Provide only sumsub_share_token
  2. Using Persona Share Token: Provide only persona_share_token
  3. Using API: Provide full person data (all IssuingApplicationPerson fields)

Exactly one verification method must be provided. The API will validate this at runtime.

§Arguments
  • request - The user application request
§Returns

Returns a UserApplicationResponse containing the application information.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 500 - Internal server error
§Examples
§Using Sumsub Share Token
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::applications::CreateUserApplicationRequest;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let request = CreateUserApplicationRequest {
    // Verification method: Sumsub Share Token
    sumsub_share_token: Some("your-sumsub-token".to_string()),
    persona_share_token: None,
    // Person data fields should be None when using tokens
    id: None,
    first_name: None,
    last_name: None,
    birth_date: None,
    national_id: None,
    country_of_issue: None,
    email: None,
    phone_country_code: None,
    phone_number: None,
    address: None,
    // Required fields
    ip_address: "127.0.0.1".to_string(),
    occupation: "Engineer".to_string(),
    annual_salary: "100000".to_string(),
    account_purpose: "Business".to_string(),
    expected_monthly_volume: "5000".to_string(),
    is_terms_of_service_accepted: true,
    // Optional fields
    wallet_address: None,
    solana_address: None,
    tron_address: None,
    stellar_address: None,
    chain_id: None,
    contract_address: None,
    source_key: None,
    has_existing_documents: None,
};
let application = client.create_user_application(&request).await?;
§Using Persona Share Token
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::applications::CreateUserApplicationRequest;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let request = CreateUserApplicationRequest {
    // Verification method: Persona Share Token
    sumsub_share_token: None,
    persona_share_token: Some("your-persona-token".to_string()),
    // Person data fields should be None when using tokens
    id: None,
    first_name: None,
    last_name: None,
    birth_date: None,
    national_id: None,
    country_of_issue: None,
    email: None,
    phone_country_code: None,
    phone_number: None,
    address: None,
    // Required fields
    ip_address: "127.0.0.1".to_string(),
    occupation: "Engineer".to_string(),
    annual_salary: "100000".to_string(),
    account_purpose: "Business".to_string(),
    expected_monthly_volume: "5000".to_string(),
    is_terms_of_service_accepted: true,
    // Optional fields
    wallet_address: None,
    solana_address: None,
    tron_address: None,
    stellar_address: None,
    chain_id: None,
    contract_address: None,
    source_key: None,
    has_existing_documents: None,
};
let application = client.create_user_application(&request).await?;
§Using Full API (IssuingApplicationPerson)
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::applications::CreateUserApplicationRequest;
use rain_sdk::models::common::Address;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let request = CreateUserApplicationRequest {
    // Verification method: Full API - no tokens
    sumsub_share_token: None,
    persona_share_token: None,
    // Person data fields (required for API method)
    id: None, // Optional: only if application was previously initiated
    first_name: Some("John".to_string()),
    last_name: Some("Doe".to_string()),
    birth_date: Some("2000-01-01".to_string()),
    national_id: Some("123456789".to_string()),
    country_of_issue: Some("US".to_string()),
    email: Some("john@example.com".to_string()),
    phone_country_code: Some("1".to_string()),
    phone_number: Some("5555555555".to_string()),
    address: Some(Address {
        line1: "123 Main St".to_string(),
        line2: None,
        city: "New York".to_string(),
        region: "NY".to_string(),
        postal_code: "10001".to_string(),
        country_code: "US".to_string(),
        country: None,
    }),
    // Required fields
    ip_address: "127.0.0.1".to_string(),
    occupation: "Engineer".to_string(),
    annual_salary: "100000".to_string(),
    account_purpose: "Business".to_string(),
    expected_monthly_volume: "5000".to_string(),
    is_terms_of_service_accepted: true,
    // Optional fields
    wallet_address: None,
    solana_address: None,
    tron_address: None,
    stellar_address: None,
    chain_id: None,
    contract_address: None,
    source_key: None,
    has_existing_documents: None,
};
let application = client.create_user_application(&request).await?;
Source

pub async fn initiate_user_application( &self, request: &InitiateUserApplicationRequest, ) -> Result<UserApplicationResponse>

Initiate a user application

§Arguments
  • request - The initiate user application request
§Returns

Returns a UserApplicationResponse containing the application information.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::applications::InitiateUserApplicationRequest;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let request = InitiateUserApplicationRequest {
    first_name: Some("John".to_string()),
    last_name: Some("Doe".to_string()),
    email: Some("john@example.com".to_string()),
    wallet_address: None,
};
let application = client.initiate_user_application(&request).await?;
Source

pub async fn get_user_application( &self, user_id: &Uuid, ) -> Result<UserApplicationResponse>

Get a user application by ID

§Arguments
  • user_id - The unique identifier of the user
§Returns

Returns a UserApplicationResponse containing the application information.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 404 - User not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let user_id = Uuid::new_v4();
let application = client.get_user_application(&user_id).await?;
Source

pub async fn update_user_application( &self, user_id: &Uuid, request: &UpdateUserApplicationRequest, ) -> Result<UserApplicationResponse>

Update a user application

§Arguments
  • user_id - The unique identifier of the user
  • request - The update request
§Returns

Returns a UserApplicationResponse containing the updated application information.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - User not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::applications::UpdateUserApplicationRequest;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let user_id = Uuid::new_v4();
let request = UpdateUserApplicationRequest {
    first_name: Some("John".to_string()),
    last_name: None,
    birth_date: None,
    national_id: None,
    country_of_issue: None,
    address: None,
    ip_address: None,
    occupation: None,
    annual_salary: None,
    account_purpose: None,
    expected_monthly_volume: None,
    is_terms_of_service_accepted: None,
    has_existing_documents: None,
};
let application = client.update_user_application(&user_id, &request).await?;
Source

pub async fn upload_user_document( &self, user_id: &Uuid, params: &DocumentUploadParams, ) -> Result<Value>

Upload a document for a user application

§Arguments
  • user_id - The unique identifier of the user
  • params - Document upload parameters
§Returns

Returns a success response.

§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::applications::DocumentUploadParams;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let user_id = Uuid::new_v4();
let params = DocumentUploadParams {
    document_type: "idCard".to_string(),
    side: "front".to_string(),
    country: Some("US".to_string()),
    country_code: Some("US".to_string()),
    name: Some("ID Card".to_string()),
    file_path: "/path/to/file.pdf".to_string(),
};
client.upload_user_document(&user_id, &params).await?;
Source§

impl RainClient

Source

pub async fn get_balances(&self) -> Result<BalanceResponse>

Get a tenant’s credit balances

§Returns

Returns a BalanceResponse containing the tenant’s balance information.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let balance = client.get_balances().await?;
println!("Credit limit: {}", balance.credit_limit);
println!("Spending power: {}", balance.spending_power);
Source

pub async fn get_company_balances( &self, company_id: &Uuid, ) -> Result<BalanceResponse>

Get a company’s credit balances

§Arguments
  • company_id - The unique identifier of the company
§Returns

Returns a BalanceResponse containing the company’s balance information.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 404 - Company not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let company_id = Uuid::new_v4();
let balance = client.get_company_balances(&company_id).await?;
println!("Credit limit: {}", balance.credit_limit);
Source

pub async fn get_user_balances(&self, user_id: &Uuid) -> Result<BalanceResponse>

Get a user’s credit balances

§Arguments
  • user_id - The unique identifier of the user
§Returns

Returns a BalanceResponse containing the user’s balance information.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 404 - User not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let user_id = Uuid::new_v4();
let balance = client.get_user_balances(&user_id).await?;
println!("Credit limit: {}", balance.credit_limit);
Source§

impl RainClient

Source

pub async fn list_cards( &self, params: &ListCardsParams, ) -> Result<ListCardsResponse>

Get all cards for a user or company

§Arguments
  • params - Query parameters for filtering cards
§Returns

Returns a Vec<Card> containing the list of cards.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::cards::ListCardsParams;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let user_id = Uuid::new_v4();
let params = ListCardsParams {
    user_id: Some(user_id),
    company_id: None,
    status: None,
    cursor: None,
    limit: Some(20),
};
let cards = client.list_cards(&params).await?;
Source

pub async fn get_card(&self, card_id: &Uuid) -> Result<Card>

Get a card by its ID

§Arguments
  • card_id - The unique identifier of the card
§Returns

Returns a Card containing the card information.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 404 - Card not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let card_id = Uuid::new_v4();
let card = client.get_card(&card_id).await?;
Source

pub async fn update_card( &self, card_id: &Uuid, request: &UpdateCardRequest, ) -> Result<Card>

Update a card

§Arguments
  • card_id - The unique identifier of the card
  • request - The update request
§Returns

Returns a Card containing the updated card information.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - Card not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::cards::{UpdateCardRequest, CardStatus};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let card_id = Uuid::new_v4();
let request = UpdateCardRequest {
    status: Some(CardStatus::Active),
    limit: None,
    billing: None,
    configuration: None,
};
let card = client.update_card(&card_id, &request).await?;
Source

pub async fn get_card_secrets( &self, card_id: &Uuid, session_id: &str, ) -> Result<CardSecrets>

Get a card’s encrypted data (PAN and CVC)

§Arguments
  • card_id - The unique identifier of the card
  • session_id - The encrypted session ID
§Returns

Returns a CardSecrets containing the encrypted PAN and CVC.

§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let card_id = Uuid::new_v4();
let session_id = "your-session-id".to_string();
let secrets = client.get_card_secrets(&card_id, &session_id).await?;
Source

pub async fn get_card_processor_details( &self, card_id: &Uuid, ) -> Result<ProcessorDetails>

Get processor details of a card

§Arguments
  • card_id - The unique identifier of the card
§Returns

Returns a ProcessorDetails containing the processor card ID.

§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let card_id = Uuid::new_v4();
let details = client.get_card_processor_details(&card_id).await?;
Source

pub async fn get_card_pin( &self, card_id: &Uuid, session_id: &str, ) -> Result<CardPin>

Get a card’s PIN

§Arguments
  • card_id - The unique identifier of the card
  • session_id - The encrypted session ID
§Returns

Returns a CardPin containing the encrypted PIN.

§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let card_id = Uuid::new_v4();
let session_id = "your-session-id".to_string();
let pin = client.get_card_pin(&card_id, &session_id).await?;
Source

pub async fn update_card_pin( &self, card_id: &Uuid, request: &UpdateCardPinRequest, session_id: &str, ) -> Result<()>

Update a card’s PIN

§Arguments
  • card_id - The unique identifier of the card
  • request - The PIN update request with encrypted PIN
  • session_id - The encrypted session ID
§Returns

Returns success (200 OK) with no response body.

§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::cards::{UpdateCardPinRequest, EncryptedData};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let card_id = Uuid::new_v4();
let session_id = "your-session-id".to_string();
let request = UpdateCardPinRequest {
    encrypted_pin: EncryptedData {
        iv: "initialization-vector".to_string(),
        data: "encrypted-data".to_string(),
    },
};
client.update_card_pin(&card_id, &request, &session_id).await?;
Source

pub async fn create_user_card( &self, user_id: &Uuid, request: &CreateCardRequest, ) -> Result<Card>

Create a card for a user

§Arguments
  • user_id - The unique identifier of the user
  • request - The card creation request
§Returns

Returns a Card containing the created card information.

§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::cards::{CreateCardRequest, CardType};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let user_id = Uuid::new_v4();
let request = CreateCardRequest {
    r#type: CardType::Virtual,
    status: None,
    limit: None,
    configuration: None,
    shipping: None,
    bulk_shipping_group_id: None,
    billing: None,
};
let card = client.create_user_card(&user_id, &request).await?;
Source§

impl RainClient

Source

pub async fn list_companies( &self, params: &ListCompaniesParams, ) -> Result<Vec<Company>>

Get all companies

§Arguments
  • params - Query parameters for filtering companies
§Returns

Returns a Vec<Company> containing the list of companies.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::companies::ListCompaniesParams;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let params = ListCompaniesParams {
    cursor: None,
    limit: Some(20),
};
let companies = client.list_companies(&params).await?;
Source

pub async fn get_company(&self, company_id: &Uuid) -> Result<Company>

Get a company by its ID

§Arguments
  • company_id - The unique identifier of the company
§Returns

Returns a Company containing the company information.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 404 - Team not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let company_id = Uuid::new_v4();
let company = client.get_company(&company_id).await?;
Source

pub async fn update_company( &self, company_id: &Uuid, request: &UpdateCompanyRequest, ) -> Result<Company>

Update a company

§Arguments
  • company_id - The unique identifier of the company
  • request - The update request
§Returns

Returns a Company containing the updated company information.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - Team not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::companies::UpdateCompanyRequest;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let company_id = Uuid::new_v4();
let request = UpdateCompanyRequest {
    name: Some("New Company Name".to_string()),
    address: None,
};
let company = client.update_company(&company_id, &request).await?;
Source

pub async fn charge_company( &self, company_id: &Uuid, request: &CreateChargeRequest, ) -> Result<Charge>

Charge a company a custom fee

§Arguments
  • company_id - The unique identifier of the company
  • request - The charge request
§Returns

Returns a Charge containing the created charge information.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - Company not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::charges::CreateChargeRequest;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let company_id = Uuid::new_v4();
let request = CreateChargeRequest {
    amount: 1000, // $10.00 in cents
    description: "Custom fee".to_string(),
};
let charge = client.charge_company(&company_id, &request).await?;
Source

pub async fn create_company_user( &self, company_id: &Uuid, request: &CreateCompanyUserRequest, ) -> Result<User>

Create a user in a company

§Arguments
  • company_id - The unique identifier of the company
  • request - The user creation request
§Returns

Returns a crate::models::User containing the created user information.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - Company not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::users::CreateCompanyUserRequest;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let company_id = Uuid::new_v4();
let request = CreateCompanyUserRequest {
    first_name: "John".to_string(),
    last_name: "Doe".to_string(),
    email: "john@example.com".to_string(),
    is_terms_of_service_accepted: true,
    birth_date: None,
    wallet_address: None,
    solana_address: None,
    address: None,
    phone_country_code: None,
    phone_number: None,
};
let user = client.create_company_user(&company_id, &request).await?;
Source§

impl RainClient

Source

pub async fn get_company_contracts( &self, company_id: &Uuid, ) -> Result<Vec<Contract>>

Get smart contract information for a company

§Arguments
  • company_id - The unique identifier of the company
§Returns

Returns a Vec<Contract> containing the list of contracts.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 404 - Company not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let company_id = Uuid::new_v4();
let contracts = client.get_company_contracts(&company_id).await?;
Source

pub async fn create_company_contract( &self, company_id: &Uuid, request: &CreateCompanyContractRequest, ) -> Result<()>

Create a smart contract for a company

§Arguments
  • company_id - The unique identifier of the company
  • request - The contract creation request
§Returns

Returns success (202 Accepted) with no response body.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - Company not found
  • 409 - Company already has a contract on this chain
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::contracts::CreateCompanyContractRequest;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let company_id = Uuid::new_v4();
let request = CreateCompanyContractRequest {
    chain_id: 1, // Ethereum mainnet
    owner_address: "0x1234...".to_string(),
};
client.create_company_contract(&company_id, &request).await?;
Source

pub async fn get_contracts(&self) -> Result<Vec<Contract>>

Get smart contract information for an authorized user tenant

§Returns

Returns a Vec<Contract> containing the list of contracts.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let contracts = client.get_contracts().await?;
println!("Found {} contracts", contracts.len());
Source

pub async fn update_contract( &self, contract_id: &Uuid, request: &UpdateContractRequest, ) -> Result<Value>

Update a smart contract

§Arguments
  • contract_id - The unique identifier of the contract
  • request - The contract update request
§Returns

Returns success (200 OK) with response body.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - Contract not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::contracts::UpdateContractRequest;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let contract_id = Uuid::new_v4();
let request = UpdateContractRequest {
    onramp: true,
};
let response: serde_json::Value = client.update_contract(&contract_id, &request).await?;
Source

pub async fn get_user_contracts(&self, user_id: &Uuid) -> Result<Vec<Contract>>

Get smart contract information for a user

§Arguments
  • user_id - The unique identifier of the user
§Returns

Returns a Vec<Contract> containing the list of contracts.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 404 - User not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let user_id = Uuid::new_v4();
let contracts = client.get_user_contracts(&user_id).await?;
Source

pub async fn create_user_contract( &self, user_id: &Uuid, request: &CreateUserContractRequest, ) -> Result<()>

Create a smart contract for a user

§Arguments
  • user_id - The unique identifier of the user (must have EVM or Solana address)
  • request - The contract creation request
§Returns

Returns success (202 Accepted) with no response body.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - User not found
  • 409 - User already has a contract on this chain
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::contracts::CreateUserContractRequest;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let user_id = Uuid::new_v4();
let request = CreateUserContractRequest {
    chain_id: 1, // Ethereum mainnet
};
client.create_user_contract(&user_id, &request).await?;
Source§

impl RainClient

Source

pub async fn list_disputes( &self, params: &ListDisputesParams, ) -> Result<Vec<Dispute>>

Get all disputes

§Arguments
  • params - Query parameters to filter disputes
§Returns

Returns a Vec<Dispute> containing the list of disputes.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 500 - Internal server error
Source

pub async fn get_dispute(&self, dispute_id: &Uuid) -> Result<Dispute>

Get a dispute by its id

§Arguments
  • dispute_id - The unique identifier of the dispute
§Returns

Returns a Dispute containing the dispute information.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 404 - Dispute not found
  • 500 - Internal server error
Source

pub async fn update_dispute( &self, dispute_id: &Uuid, request: &UpdateDisputeRequest, ) -> Result<()>

Update a dispute

§Arguments
  • dispute_id - The unique identifier of the dispute
  • request - The update request
§Returns

Returns success (204 No Content) with no response body.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - Dispute not found
  • 500 - Internal server error
Source

pub async fn get_dispute_evidence(&self, dispute_id: &Uuid) -> Result<Vec<u8>>

Get a dispute’s file evidence

§Arguments
  • dispute_id - The unique identifier of the dispute
§Returns

Returns the file evidence as raw bytes (application/octet-stream).

Source

pub async fn upload_dispute_evidence( &self, dispute_id: &Uuid, request: &UploadDisputeEvidenceRequest, ) -> Result<()>

Upload a file as evidence for a dispute

§Arguments
  • dispute_id - The unique identifier of the dispute
  • request - The evidence upload request
§Returns

Returns success (204 No Content) with no response body.

Source

pub async fn create_transaction_dispute( &self, transaction_id: &Uuid, request: &CreateDisputeRequest, ) -> Result<Dispute>

Create a dispute for a transaction

§Arguments
  • transaction_id - The unique identifier of the transaction
  • request - The dispute creation request
§Returns

Returns a Dispute containing the created dispute information.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - Transaction not found
  • 500 - Internal server error
Source§

impl RainClient

Source

pub async fn create_key(&self, request: &CreateKeyRequest) -> Result<Key>

Create a key

§Arguments
  • request - The key creation request
§Returns

Returns a Key containing the created key information (including the key itself).

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::keys::CreateKeyRequest;
use chrono::Utc;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let request = CreateKeyRequest {
    name: "My API Key".to_string(),
    expires_at: Utc::now() + chrono::Duration::days(90),
};
let key = client.create_key(&request).await?;
println!("Created key: {}", key.key);
Source

pub async fn delete_key(&self, key_id: &Uuid) -> Result<()>

Delete a key

§Arguments
  • key_id - The unique identifier of the key to delete
§Returns

Returns success (204 No Content) with no response body.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 404 - Key not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let key_id = Uuid::new_v4();
client.delete_key(&key_id).await?;
Source§

impl RainClient

Source

pub async fn initiate_company_payment( &self, company_id: &Uuid, request: &InitiatePaymentRequest, ) -> Result<InitiatePaymentResponse>

Initiate a payment for a company

§Arguments
  • company_id - The unique identifier of the company
  • request - The payment initiation request
§Returns

Returns an InitiatePaymentResponse containing the payment address.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - Company not found
  • 423 - User address is locked
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::payments::InitiatePaymentRequest;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let company_id = Uuid::new_v4();
let request = InitiatePaymentRequest {
    amount: 10000, // $100.00 in cents
    wallet_address: "0x1234...".to_string(),
    chain_id: Some(1), // Ethereum mainnet
};
let response = client.initiate_company_payment(&company_id, &request).await?;
println!("Payment address: {}", response.address);
Source

pub async fn initiate_payment( &self, request: &InitiatePaymentRequest, ) -> Result<InitiatePaymentResponse>

Initiate a payment for an authorized user tenant

§Arguments
  • request - The payment initiation request
§Returns

Returns an InitiatePaymentResponse containing the payment address.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 423 - User address is locked
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::payments::InitiatePaymentRequest;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let request = InitiatePaymentRequest {
    amount: 5000, // $50.00 in cents
    wallet_address: "0x5678...".to_string(),
    chain_id: Some(137), // Polygon
};
let response = client.initiate_payment(&request).await?;
Source

pub async fn initiate_user_payment( &self, user_id: &Uuid, request: &InitiatePaymentRequest, ) -> Result<InitiatePaymentResponse>

Initiate a payment for a user

§Arguments
  • user_id - The unique identifier of the user
  • request - The payment initiation request
§Returns

Returns an InitiatePaymentResponse containing the payment address.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - User not found
  • 423 - User address is locked
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::payments::InitiatePaymentRequest;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let user_id = Uuid::new_v4();
let request = InitiatePaymentRequest {
    amount: 2500, // $25.00 in cents
    wallet_address: "0xabcd...".to_string(),
    chain_id: Some(1),
};
let response = client.initiate_user_payment(&user_id, &request).await?;
Source§

impl RainClient

Source

pub async fn get_report( &self, year: &str, month: &str, day: &str, params: &GetReportParams, ) -> Result<Vec<u8>>

Get a tenant’s report

§Arguments
  • year - Year of the report
  • month - Month of the report
  • day - Day of the report
  • params - Optional query parameters (format)
§Returns

Returns the report as raw bytes (content type depends on format: csv, json, or ssrp).

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - Report not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::reports::{GetReportParams, ReportFormat};

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let params = GetReportParams {
    format: Some(ReportFormat::Csv),
};
let report = client.get_report("2024", "01", "15", &params).await?;
Source§

impl RainClient

Source

pub async fn list_shipping_groups( &self, params: &ListShippingGroupsParams, ) -> Result<Vec<ShippingGroup>>

Get all bulk shipping groups

§Arguments
  • params - Query parameters for filtering shipping groups
§Returns

Returns a Vec<ShippingGroup> containing the list of shipping groups.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::shipping_groups::{ListShippingGroupsParams, ShippingGroup};

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let params = ListShippingGroupsParams {
    cursor: None,
    limit: Some(20),
};
let shipping_groups = client.list_shipping_groups(&params).await?;
Source

pub async fn create_shipping_group( &self, request: &CreateShippingGroupRequest, ) -> Result<ShippingGroup>

Create a bulk shipping group

§Arguments
  • request - The shipping group creation request
§Returns

Returns a ShippingGroup containing the created shipping group information (202 Accepted).

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::shipping_groups::CreateShippingGroupRequest;
use rain_sdk::models::common::Address;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let request = CreateShippingGroupRequest {
    recipient_first_name: "John".to_string(),
    recipient_last_name: Some("Doe".to_string()),
    recipient_phone_country_code: Some("1".to_string()),
    recipient_phone_number: Some("5555555555".to_string()),
    address: Address {
        line1: "123 Main St".to_string(),
        line2: None,
        city: "New York".to_string(),
        region: "NY".to_string(),
        postal_code: "10001".to_string(),
        country_code: "US".to_string(),
        country: None,
    },
};
let shipping_group = client.create_shipping_group(&request).await?;
Source

pub async fn get_shipping_group( &self, shipping_group_id: &Uuid, ) -> Result<ShippingGroup>

Get a bulk shipping group by its id

§Arguments
  • shipping_group_id - The unique identifier of the shipping group
§Returns

Returns a ShippingGroup containing the shipping group information.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 404 - Shipping group not found
  • 500 - Internal server error
Source§

impl RainClient

Source

pub async fn get_company_payment_signature( &self, company_id: &Uuid, params: &PaymentSignatureParams, ) -> Result<PaymentSignatureResponse>

Get payment signature for a company

§Arguments
  • company_id - The unique identifier of the company
  • params - Query parameters for the signature request
§Returns

Returns a PaymentSignatureResponse which can be either pending or ready.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - Company not found
  • 409 - Another active signature already exists
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::signatures::PaymentSignatureParams;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let company_id = Uuid::new_v4();
let params = PaymentSignatureParams {
    chain_id: Some(1),
    token: "0xabc123...".to_string(),
    amount: "1000000".to_string(),
    admin_address: "0xdef456...".to_string(),
    is_amount_native: Some(false),
    rain_collateral_contract_id: None,
};
let response = client.get_company_payment_signature(&company_id, &params).await?;
Source

pub async fn get_company_withdrawal_signature( &self, company_id: &Uuid, params: &WithdrawalSignatureParams, ) -> Result<WithdrawalSignatureResponse>

Get withdrawal signature for a company

§Arguments
  • company_id - The unique identifier of the company
  • params - Query parameters for the signature request
§Returns

Returns a WithdrawalSignatureResponse which can be either pending or ready.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - Company not found
  • 409 - Another active signature already exists
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::signatures::WithdrawalSignatureParams;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let company_id = Uuid::new_v4();
let params = WithdrawalSignatureParams {
    chain_id: Some(1),
    token: "0xabc123...".to_string(),
    amount: "500000".to_string(),
    admin_address: "0xdef456...".to_string(),
    recipient_address: "0x789ghi...".to_string(),
    is_amount_native: Some(false),
    rain_collateral_contract_id: None,
};
let response = client.get_company_withdrawal_signature(&company_id, &params).await?;
Source

pub async fn get_payment_signature( &self, params: &PaymentSignatureParams, ) -> Result<PaymentSignatureResponse>

Get payment signature for an authorized user tenant

§Arguments
  • params - Query parameters for the signature request
§Returns

Returns a PaymentSignatureResponse which can be either pending or ready.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 409 - Another active signature already exists
  • 500 - Internal server error
Source

pub async fn get_withdrawal_signature( &self, params: &WithdrawalSignatureParams, ) -> Result<WithdrawalSignatureResponse>

Get withdrawal signature for an authorized user tenant

§Arguments
  • params - Query parameters for the signature request
§Returns

Returns a WithdrawalSignatureResponse which can be either pending or ready.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 409 - Another active signature already exists
  • 500 - Internal server error
Source

pub async fn get_user_payment_signature( &self, user_id: &Uuid, params: &PaymentSignatureParams, ) -> Result<PaymentSignatureResponse>

Get payment signature for a user

§Arguments
  • user_id - The unique identifier of the user
  • params - Query parameters for the signature request
§Returns

Returns a PaymentSignatureResponse which can be either pending or ready.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - User not found
  • 409 - Another active signature already exists
  • 500 - Internal server error
Source

pub async fn get_user_withdrawal_signature( &self, user_id: &Uuid, params: &WithdrawalSignatureParams, ) -> Result<WithdrawalSignatureResponse>

Get withdrawal signature for a user

§Arguments
  • user_id - The unique identifier of the user
  • params - Query parameters for the signature request
§Returns

Returns a WithdrawalSignatureResponse which can be either pending or ready.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - User not found
  • 409 - Another active signature already exists
  • 500 - Internal server error
Source§

impl RainClient

Source

pub async fn list_subtenants(&self) -> Result<Vec<Subtenant>>

Get all subtenants

§Returns

Returns a Vec<Subtenant> containing the list of subtenants.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let subtenants = client.list_subtenants().await?;
println!("Found {} subtenants", subtenants.len());
Source

pub async fn create_subtenant( &self, request: &CreateSubtenantRequest, ) -> Result<Subtenant>

Create a subtenant

§Arguments
  • request - The subtenant creation request
§Returns

Returns a Subtenant containing the created subtenant information.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::subtenants::CreateSubtenantRequest;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let request = CreateSubtenantRequest {
    name: Some("My Subtenant".to_string()),
};
let subtenant = client.create_subtenant(&request).await?;
Source

pub async fn get_subtenant(&self, subtenant_id: &Uuid) -> Result<Subtenant>

Get a subtenant by its id

§Arguments
  • subtenant_id - The unique identifier of the subtenant
§Returns

Returns a Subtenant containing the subtenant information.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 404 - Subtenant not found
  • 500 - Internal server error
Source

pub async fn update_subtenant( &self, subtenant_id: &Uuid, request: &UpdateSubtenantRequest, ) -> Result<()>

Update a subtenant

§Arguments
  • subtenant_id - The unique identifier of the subtenant
  • request - The update request
§Returns

Returns success (204 No Content) with no response body.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - Subtenant not found
  • 500 - Internal server error
Source§

impl RainClient

Source

pub async fn list_transactions( &self, params: &ListTransactionsParams, ) -> Result<Vec<Transaction>>

Get all transactions

§Arguments
  • params - Query parameters to filter transactions
§Returns

Returns a Vec<Transaction> containing the list of transactions.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 500 - Internal server error
Source

pub async fn get_transaction( &self, transaction_id: &Uuid, ) -> Result<Transaction>

Get a transaction by its id

§Arguments
  • transaction_id - The unique identifier of the transaction
§Returns

Returns a Transaction containing the transaction information.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 404 - Transaction not found
  • 500 - Internal server error
Source

pub async fn update_transaction( &self, transaction_id: &Uuid, request: &UpdateTransactionRequest, ) -> Result<()>

Update a transaction

§Arguments
  • transaction_id - The unique identifier of the transaction
  • request - The update request
§Returns

Returns success (204 No Content) with no response body.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - Transaction not found
  • 500 - Internal server error
Source

pub async fn get_transaction_receipt( &self, transaction_id: &Uuid, ) -> Result<Vec<u8>>

Get a transaction’s receipt

§Arguments
  • transaction_id - The unique identifier of the transaction
§Returns

Returns the receipt as raw bytes (application/octet-stream).

Source

pub async fn upload_transaction_receipt( &self, transaction_id: &Uuid, request: &UploadReceiptRequest, ) -> Result<()>

Upload a transaction’s receipt

§Arguments
  • transaction_id - The unique identifier of the transaction
  • request - The receipt upload request
§Returns

Returns success (204 No Content) with no response body.

Source§

impl RainClient

Source

pub async fn list_users(&self, params: &ListUsersParams) -> Result<Vec<User>>

Get all users

§Arguments
  • params - Query parameters for filtering users
§Returns

Returns a Vec<User> containing the list of users.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::users::ListUsersParams;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let params = ListUsersParams {
    company_id: None,
    cursor: None,
    limit: Some(20),
};
let users = client.list_users(&params).await?;
Source

pub async fn create_user(&self, request: &CreateUserRequest) -> Result<User>

Create an authorized user

§Arguments
  • request - The user creation request
§Returns

Returns a User containing the created user information.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::users::CreateUserRequest;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let request = CreateUserRequest {
    first_name: "John".to_string(),
    last_name: "Doe".to_string(),
    email: "john@example.com".to_string(),
    wallet_address: None,
    solana_address: None,
    address: None,
    phone_country_code: None,
    phone_number: None,
};
let user = client.create_user(&request).await?;
Source

pub async fn get_user(&self, user_id: &Uuid) -> Result<User>

Get a user by its ID

§Arguments
  • user_id - The unique identifier of the user
§Returns

Returns a User containing the user information.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 404 - User not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let user_id = Uuid::new_v4();
let user = client.get_user(&user_id).await?;
Source

pub async fn delete_user(&self, user_id: &Uuid) -> Result<()>

Delete a user

§Arguments
  • user_id - The unique identifier of the user
§Returns

Returns success (204 No Content).

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 404 - User not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let user_id = Uuid::new_v4();
client.delete_user(&user_id).await?;
Source

pub async fn update_user( &self, user_id: &Uuid, request: &UpdateUserRequest, ) -> Result<User>

Update a user

§Arguments
  • user_id - The unique identifier of the user
  • request - The update request
§Returns

Returns a User containing the updated user information.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - User not found
  • 423 - User address is locked
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::users::UpdateUserRequest;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let user_id = Uuid::new_v4();
let request = UpdateUserRequest {
    first_name: Some("Jane".to_string()),
    last_name: None,
    email: None,
    is_active: None,
    is_terms_of_service_accepted: None,
    address: None,
    phone_country_code: None,
    phone_number: None,
    wallet_address: None,
    solana_address: None,
    tron_address: None,
    stellar_address: None,
};
let user = client.update_user(&user_id, &request).await?;
Source

pub async fn charge_user( &self, user_id: &Uuid, request: &CreateChargeRequest, ) -> Result<Charge>

Charge a user a custom fee

§Arguments
  • user_id - The unique identifier of the user
  • request - The charge request
§Returns

Returns a Charge containing the created charge information.

§Errors

This method can return the following errors:

  • 400 - Invalid request
  • 401 - Invalid authorization
  • 404 - User not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::charges::CreateChargeRequest;
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let user_id = Uuid::new_v4();
let request = CreateChargeRequest {
    amount: 500, // $5.00 in cents
    description: "Custom fee".to_string(),
};
let charge = client.charge_user(&user_id, &request).await?;
Source§

impl RainClient

Source

pub async fn list_webhooks( &self, params: &ListWebhooksParams, ) -> Result<Vec<Webhook>>

Get all webhooks

§Arguments
  • params - Query parameters to filter webhooks
§Returns

Returns a Vec<Webhook> containing the list of webhooks.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 403 - Forbidden
  • 404 - User not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use rain_sdk::models::webhooks::ListWebhooksParams;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let params = ListWebhooksParams {
    resource_id: None,
    resource_type: None,
    resource_action: None,
    request_sent_at_before: None,
    request_sent_at_after: None,
    response_received_at_before: None,
    response_received_at_after: None,
    cursor: None,
    limit: Some(20),
};
let webhooks = client.list_webhooks(&params).await?;
Source

pub async fn get_webhook(&self, webhook_id: &Uuid) -> Result<Webhook>

Get a webhook by its id

§Arguments
  • webhook_id - The unique identifier of the webhook
§Returns

Returns a Webhook containing the webhook information.

§Errors

This method can return the following errors:

  • 401 - Invalid authorization
  • 403 - Forbidden
  • 404 - Transaction not found
  • 500 - Internal server error
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};
use uuid::Uuid;

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let webhook_id = Uuid::new_v4();
let webhook = client.get_webhook(&webhook_id).await?;
Source§

impl RainClient

Source

pub fn new(config: Config, auth_config: AuthConfig) -> Result<Self>

Create a new client with the given configuration

§Arguments
  • config - Client configuration (environment, timeout, etc.)
  • auth_config - Authentication configuration (API key)
§Returns

Returns a new RainClient instance ready to make API requests.

§Errors

This function will return an error if:

  • The HTTP client cannot be created
  • The user agent string is invalid
§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;
Source

pub fn base_url(&self) -> &Url

Get the base URL for API requests

Returns the base URL that all API requests will be made against.

§Examples
use rain_sdk::{RainClient, Config, Environment, AuthConfig};

let config = Config::new(Environment::Dev);
let auth = AuthConfig::with_api_key("your-api-key".to_string());
let client = RainClient::new(config, auth)?;

let base_url = client.base_url();
println!("API base URL: {}", base_url);
Source

pub async fn get<T: DeserializeOwned>(&self, path: &str) -> Result<T>

Make an async GET request

Source

pub async fn get_bytes(&self, path: &str) -> Result<Vec<u8>>

Make an async GET request and return raw bytes

Source

pub async fn post<T: DeserializeOwned, B: Serialize>( &self, path: &str, body: &B, ) -> Result<T>

Make an async POST request

Source

pub async fn patch<T: DeserializeOwned, B: Serialize>( &self, path: &str, body: &B, ) -> Result<T>

Make an async PATCH request

Source

pub async fn put<T: DeserializeOwned, B: Serialize>( &self, path: &str, body: &B, ) -> Result<T>

Make an async PUT request

Source

pub async fn get_with_headers<T: DeserializeOwned>( &self, path: &str, headers: Vec<(&str, &str)>, ) -> Result<T>

Make an async GET request with custom headers

Source

pub async fn put_with_headers<T: DeserializeOwned, B: Serialize>( &self, path: &str, body: &B, headers: Vec<(&str, &str)>, ) -> Result<T>

Make an async PUT request with custom headers

Source

pub async fn delete(&self, path: &str) -> Result<()>

Make an async DELETE request

Source

pub async fn put_multipart<T: DeserializeOwned>( &self, path: &str, form: Form, ) -> Result<T>

Make an async PUT request with multipart form data

Source

pub async fn put_multipart_no_content( &self, path: &str, form: Form, ) -> Result<()>

Make an async PUT request with multipart form data that returns nothing (204)

Trait Implementations§

Source§

impl Clone for RainClient

Source§

fn clone(&self) -> RainClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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