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
impl RainClient
Sourcepub async fn create_company_application(
&self,
request: &CreateCompanyApplicationRequest,
) -> Result<CompanyApplicationResponse>
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 request401- Invalid authorization500- 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?;Sourcepub async fn get_company_application(
&self,
company_id: &Uuid,
) -> Result<CompanyApplicationResponse>
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 authorization404- Company not found500- 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?;Sourcepub async fn update_company_application(
&self,
company_id: &Uuid,
request: &UpdateCompanyApplicationRequest,
) -> Result<CompanyApplicationResponse>
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 companyrequest- The update request
§Returns
Returns a CompanyApplicationResponse containing the updated application information.
§Errors
This method can return the following errors:
400- Invalid request401- Invalid authorization404- Company not found500- 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?;Sourcepub async fn update_ultimate_beneficial_owner(
&self,
company_id: &Uuid,
ubo_id: &Uuid,
request: &UpdateUltimateBeneficialOwnerRequest,
) -> Result<CompanyApplicationResponse>
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 companyubo_id- The unique identifier of the ultimate beneficial ownerrequest- The update request
§Returns
Returns a CompanyApplicationResponse containing the updated application information.
§Errors
This method can return the following errors:
400- Invalid request401- Invalid authorization404- Company or UBO not found500- 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?;Sourcepub async fn upload_company_document(
&self,
company_id: &Uuid,
params: &DocumentUploadParams,
) -> Result<Value>
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 companyparams- 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, ¶ms).await?;Sourcepub async fn upload_ubo_document(
&self,
company_id: &Uuid,
ubo_id: &Uuid,
params: &DocumentUploadParams,
) -> Result<Value>
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 companyubo_id- The unique identifier of the ultimate beneficial ownerparams- 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, ¶ms).await?;Sourcepub async fn create_user_application(
&self,
request: &CreateUserApplicationRequest,
) -> Result<UserApplicationResponse>
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):
- Using Sumsub Share Token: Provide only
sumsub_share_token - Using Persona Share Token: Provide only
persona_share_token - Using API: Provide full person data (all
IssuingApplicationPersonfields)
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 request401- Invalid authorization500- 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?;Sourcepub async fn initiate_user_application(
&self,
request: &InitiateUserApplicationRequest,
) -> Result<UserApplicationResponse>
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 request401- Invalid authorization500- 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?;Sourcepub async fn get_user_application(
&self,
user_id: &Uuid,
) -> Result<UserApplicationResponse>
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 authorization404- User not found500- 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?;Sourcepub async fn update_user_application(
&self,
user_id: &Uuid,
request: &UpdateUserApplicationRequest,
) -> Result<UserApplicationResponse>
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 userrequest- The update request
§Returns
Returns a UserApplicationResponse containing the updated application information.
§Errors
This method can return the following errors:
400- Invalid request401- Invalid authorization404- User not found500- 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?;Sourcepub async fn upload_user_document(
&self,
user_id: &Uuid,
params: &DocumentUploadParams,
) -> Result<Value>
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 userparams- 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, ¶ms).await?;Source§impl RainClient
impl RainClient
Sourcepub async fn get_balances(&self) -> Result<BalanceResponse>
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 authorization500- 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);Sourcepub async fn get_company_balances(
&self,
company_id: &Uuid,
) -> Result<BalanceResponse>
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 authorization404- Company not found500- 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);Sourcepub async fn get_user_balances(&self, user_id: &Uuid) -> Result<BalanceResponse>
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 authorization404- User not found500- 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
impl RainClient
Sourcepub async fn list_cards(
&self,
params: &ListCardsParams,
) -> Result<ListCardsResponse>
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 authorization500- 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(¶ms).await?;Sourcepub async fn get_card(&self, card_id: &Uuid) -> Result<Card>
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 authorization404- Card not found500- 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?;Sourcepub async fn update_card(
&self,
card_id: &Uuid,
request: &UpdateCardRequest,
) -> Result<Card>
pub async fn update_card( &self, card_id: &Uuid, request: &UpdateCardRequest, ) -> Result<Card>
Update a card
§Arguments
card_id- The unique identifier of the cardrequest- The update request
§Returns
Returns a Card containing the updated card information.
§Errors
This method can return the following errors:
400- Invalid request401- Invalid authorization404- Card not found500- 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?;Sourcepub async fn get_card_secrets(
&self,
card_id: &Uuid,
session_id: &str,
) -> Result<CardSecrets>
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 cardsession_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?;Sourcepub async fn get_card_processor_details(
&self,
card_id: &Uuid,
) -> Result<ProcessorDetails>
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?;Sourcepub async fn get_card_pin(
&self,
card_id: &Uuid,
session_id: &str,
) -> Result<CardPin>
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 cardsession_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?;Sourcepub async fn update_card_pin(
&self,
card_id: &Uuid,
request: &UpdateCardPinRequest,
session_id: &str,
) -> Result<()>
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 cardrequest- The PIN update request with encrypted PINsession_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?;Sourcepub async fn create_user_card(
&self,
user_id: &Uuid,
request: &CreateCardRequest,
) -> Result<Card>
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 userrequest- 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
impl RainClient
Sourcepub async fn list_companies(
&self,
params: &ListCompaniesParams,
) -> Result<Vec<Company>>
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 authorization500- 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(¶ms).await?;Sourcepub async fn get_company(&self, company_id: &Uuid) -> Result<Company>
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 authorization404- Team not found500- 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?;Sourcepub async fn update_company(
&self,
company_id: &Uuid,
request: &UpdateCompanyRequest,
) -> Result<Company>
pub async fn update_company( &self, company_id: &Uuid, request: &UpdateCompanyRequest, ) -> Result<Company>
Update a company
§Arguments
company_id- The unique identifier of the companyrequest- The update request
§Returns
Returns a Company containing the updated company information.
§Errors
This method can return the following errors:
400- Invalid request401- Invalid authorization404- Team not found500- 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?;Sourcepub async fn charge_company(
&self,
company_id: &Uuid,
request: &CreateChargeRequest,
) -> Result<Charge>
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 companyrequest- The charge request
§Returns
Returns a Charge containing the created charge information.
§Errors
This method can return the following errors:
400- Invalid request401- Invalid authorization404- Company not found500- 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?;Sourcepub async fn create_company_user(
&self,
company_id: &Uuid,
request: &CreateCompanyUserRequest,
) -> Result<User>
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 companyrequest- 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 request401- Invalid authorization404- Company not found500- 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
impl RainClient
Sourcepub async fn get_company_contracts(
&self,
company_id: &Uuid,
) -> Result<Vec<Contract>>
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 authorization404- Company not found500- 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?;Sourcepub async fn create_company_contract(
&self,
company_id: &Uuid,
request: &CreateCompanyContractRequest,
) -> Result<()>
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 companyrequest- The contract creation request
§Returns
Returns success (202 Accepted) with no response body.
§Errors
This method can return the following errors:
400- Invalid request401- Invalid authorization404- Company not found409- Company already has a contract on this chain500- 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?;Sourcepub async fn get_contracts(&self) -> Result<Vec<Contract>>
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 authorization500- 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());Sourcepub async fn update_contract(
&self,
contract_id: &Uuid,
request: &UpdateContractRequest,
) -> Result<Value>
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 contractrequest- The contract update request
§Returns
Returns success (200 OK) with response body.
§Errors
This method can return the following errors:
400- Invalid request401- Invalid authorization404- Contract not found500- 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?;Sourcepub async fn get_user_contracts(&self, user_id: &Uuid) -> Result<Vec<Contract>>
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 authorization404- User not found500- 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?;Sourcepub async fn create_user_contract(
&self,
user_id: &Uuid,
request: &CreateUserContractRequest,
) -> Result<()>
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 request401- Invalid authorization404- User not found409- User already has a contract on this chain500- 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
impl RainClient
Sourcepub async fn list_disputes(
&self,
params: &ListDisputesParams,
) -> Result<Vec<Dispute>>
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 authorization500- Internal server error
Sourcepub async fn get_dispute(&self, dispute_id: &Uuid) -> Result<Dispute>
pub async fn get_dispute(&self, dispute_id: &Uuid) -> Result<Dispute>
Sourcepub async fn update_dispute(
&self,
dispute_id: &Uuid,
request: &UpdateDisputeRequest,
) -> Result<()>
pub async fn update_dispute( &self, dispute_id: &Uuid, request: &UpdateDisputeRequest, ) -> Result<()>
Update a dispute
§Arguments
dispute_id- The unique identifier of the disputerequest- The update request
§Returns
Returns success (204 No Content) with no response body.
§Errors
This method can return the following errors:
400- Invalid request401- Invalid authorization404- Dispute not found500- Internal server error
Sourcepub async fn upload_dispute_evidence(
&self,
dispute_id: &Uuid,
request: &UploadDisputeEvidenceRequest,
) -> Result<()>
pub async fn upload_dispute_evidence( &self, dispute_id: &Uuid, request: &UploadDisputeEvidenceRequest, ) -> Result<()>
Sourcepub async fn create_transaction_dispute(
&self,
transaction_id: &Uuid,
request: &CreateDisputeRequest,
) -> Result<Dispute>
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 transactionrequest- The dispute creation request
§Returns
Returns a Dispute containing the created dispute information.
§Errors
This method can return the following errors:
400- Invalid request401- Invalid authorization404- Transaction not found500- Internal server error
Source§impl RainClient
impl RainClient
Sourcepub async fn create_key(&self, request: &CreateKeyRequest) -> Result<Key>
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 request401- Invalid authorization500- 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);Sourcepub async fn delete_key(&self, key_id: &Uuid) -> Result<()>
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 authorization404- Key not found500- 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
impl RainClient
Sourcepub async fn initiate_company_payment(
&self,
company_id: &Uuid,
request: &InitiatePaymentRequest,
) -> Result<InitiatePaymentResponse>
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 companyrequest- The payment initiation request
§Returns
Returns an InitiatePaymentResponse containing the payment address.
§Errors
This method can return the following errors:
400- Invalid request401- Invalid authorization404- Company not found423- User address is locked500- 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);Sourcepub async fn initiate_payment(
&self,
request: &InitiatePaymentRequest,
) -> Result<InitiatePaymentResponse>
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 request401- Invalid authorization423- User address is locked500- 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?;Sourcepub async fn initiate_user_payment(
&self,
user_id: &Uuid,
request: &InitiatePaymentRequest,
) -> Result<InitiatePaymentResponse>
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 userrequest- The payment initiation request
§Returns
Returns an InitiatePaymentResponse containing the payment address.
§Errors
This method can return the following errors:
400- Invalid request401- Invalid authorization404- User not found423- User address is locked500- 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
impl RainClient
Sourcepub async fn get_report(
&self,
year: &str,
month: &str,
day: &str,
params: &GetReportParams,
) -> Result<Vec<u8>>
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 reportmonth- Month of the reportday- Day of the reportparams- 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 request401- Invalid authorization404- Report not found500- 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", ¶ms).await?;Source§impl RainClient
impl RainClient
Sourcepub async fn list_shipping_groups(
&self,
params: &ListShippingGroupsParams,
) -> Result<Vec<ShippingGroup>>
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 authorization500- 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(¶ms).await?;Sourcepub async fn create_shipping_group(
&self,
request: &CreateShippingGroupRequest,
) -> Result<ShippingGroup>
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 request401- Invalid authorization500- 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?;Sourcepub async fn get_shipping_group(
&self,
shipping_group_id: &Uuid,
) -> Result<ShippingGroup>
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 authorization404- Shipping group not found500- Internal server error
Source§impl RainClient
impl RainClient
Sourcepub async fn get_company_payment_signature(
&self,
company_id: &Uuid,
params: &PaymentSignatureParams,
) -> Result<PaymentSignatureResponse>
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 companyparams- 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 request401- Invalid authorization404- Company not found409- Another active signature already exists500- 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, ¶ms).await?;Sourcepub async fn get_company_withdrawal_signature(
&self,
company_id: &Uuid,
params: &WithdrawalSignatureParams,
) -> Result<WithdrawalSignatureResponse>
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 companyparams- 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 request401- Invalid authorization404- Company not found409- Another active signature already exists500- 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, ¶ms).await?;Sourcepub async fn get_payment_signature(
&self,
params: &PaymentSignatureParams,
) -> Result<PaymentSignatureResponse>
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 request401- Invalid authorization409- Another active signature already exists500- Internal server error
Sourcepub async fn get_withdrawal_signature(
&self,
params: &WithdrawalSignatureParams,
) -> Result<WithdrawalSignatureResponse>
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 request401- Invalid authorization409- Another active signature already exists500- Internal server error
Sourcepub async fn get_user_payment_signature(
&self,
user_id: &Uuid,
params: &PaymentSignatureParams,
) -> Result<PaymentSignatureResponse>
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 userparams- 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 request401- Invalid authorization404- User not found409- Another active signature already exists500- Internal server error
Sourcepub async fn get_user_withdrawal_signature(
&self,
user_id: &Uuid,
params: &WithdrawalSignatureParams,
) -> Result<WithdrawalSignatureResponse>
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 userparams- 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 request401- Invalid authorization404- User not found409- Another active signature already exists500- Internal server error
Source§impl RainClient
impl RainClient
Sourcepub async fn list_subtenants(&self) -> Result<Vec<Subtenant>>
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 authorization500- 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());Sourcepub async fn create_subtenant(
&self,
request: &CreateSubtenantRequest,
) -> Result<Subtenant>
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 request401- Invalid authorization500- 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?;Sourcepub async fn get_subtenant(&self, subtenant_id: &Uuid) -> Result<Subtenant>
pub async fn get_subtenant(&self, subtenant_id: &Uuid) -> Result<Subtenant>
Sourcepub async fn update_subtenant(
&self,
subtenant_id: &Uuid,
request: &UpdateSubtenantRequest,
) -> Result<()>
pub async fn update_subtenant( &self, subtenant_id: &Uuid, request: &UpdateSubtenantRequest, ) -> Result<()>
Update a subtenant
§Arguments
subtenant_id- The unique identifier of the subtenantrequest- The update request
§Returns
Returns success (204 No Content) with no response body.
§Errors
This method can return the following errors:
400- Invalid request401- Invalid authorization404- Subtenant not found500- Internal server error
Source§impl RainClient
impl RainClient
Sourcepub async fn list_transactions(
&self,
params: &ListTransactionsParams,
) -> Result<Vec<Transaction>>
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 authorization500- Internal server error
Sourcepub async fn get_transaction(
&self,
transaction_id: &Uuid,
) -> Result<Transaction>
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 authorization404- Transaction not found500- Internal server error
Sourcepub async fn update_transaction(
&self,
transaction_id: &Uuid,
request: &UpdateTransactionRequest,
) -> Result<()>
pub async fn update_transaction( &self, transaction_id: &Uuid, request: &UpdateTransactionRequest, ) -> Result<()>
Update a transaction
§Arguments
transaction_id- The unique identifier of the transactionrequest- The update request
§Returns
Returns success (204 No Content) with no response body.
§Errors
This method can return the following errors:
400- Invalid request401- Invalid authorization404- Transaction not found500- Internal server error
Sourcepub async fn upload_transaction_receipt(
&self,
transaction_id: &Uuid,
request: &UploadReceiptRequest,
) -> Result<()>
pub async fn upload_transaction_receipt( &self, transaction_id: &Uuid, request: &UploadReceiptRequest, ) -> Result<()>
Source§impl RainClient
impl RainClient
Sourcepub async fn list_users(&self, params: &ListUsersParams) -> Result<Vec<User>>
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 authorization500- 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(¶ms).await?;Sourcepub async fn create_user(&self, request: &CreateUserRequest) -> Result<User>
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 request401- Invalid authorization500- 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?;Sourcepub async fn get_user(&self, user_id: &Uuid) -> Result<User>
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 authorization404- User not found500- 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?;Sourcepub async fn delete_user(&self, user_id: &Uuid) -> Result<()>
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 authorization404- User not found500- 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?;Sourcepub async fn update_user(
&self,
user_id: &Uuid,
request: &UpdateUserRequest,
) -> Result<User>
pub async fn update_user( &self, user_id: &Uuid, request: &UpdateUserRequest, ) -> Result<User>
Update a user
§Arguments
user_id- The unique identifier of the userrequest- The update request
§Returns
Returns a User containing the updated user information.
§Errors
This method can return the following errors:
400- Invalid request401- Invalid authorization404- User not found423- User address is locked500- 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?;Sourcepub async fn charge_user(
&self,
user_id: &Uuid,
request: &CreateChargeRequest,
) -> Result<Charge>
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 userrequest- The charge request
§Returns
Returns a Charge containing the created charge information.
§Errors
This method can return the following errors:
400- Invalid request401- Invalid authorization404- User not found500- 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
impl RainClient
Sourcepub async fn list_webhooks(
&self,
params: &ListWebhooksParams,
) -> Result<Vec<Webhook>>
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 authorization403- Forbidden404- User not found500- 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(¶ms).await?;Sourcepub async fn get_webhook(&self, webhook_id: &Uuid) -> Result<Webhook>
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 authorization403- Forbidden404- Transaction not found500- 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
impl RainClient
Sourcepub fn new(config: Config, auth_config: AuthConfig) -> Result<Self>
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)?;Sourcepub fn base_url(&self) -> &Url
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);Sourcepub async fn get<T: DeserializeOwned>(&self, path: &str) -> Result<T>
pub async fn get<T: DeserializeOwned>(&self, path: &str) -> Result<T>
Make an async GET request
Sourcepub async fn get_bytes(&self, path: &str) -> Result<Vec<u8>>
pub async fn get_bytes(&self, path: &str) -> Result<Vec<u8>>
Make an async GET request and return raw bytes
Sourcepub async fn post<T: DeserializeOwned, B: Serialize>(
&self,
path: &str,
body: &B,
) -> Result<T>
pub async fn post<T: DeserializeOwned, B: Serialize>( &self, path: &str, body: &B, ) -> Result<T>
Make an async POST request
Sourcepub async fn patch<T: DeserializeOwned, B: Serialize>(
&self,
path: &str,
body: &B,
) -> Result<T>
pub async fn patch<T: DeserializeOwned, B: Serialize>( &self, path: &str, body: &B, ) -> Result<T>
Make an async PATCH request
Sourcepub async fn put<T: DeserializeOwned, B: Serialize>(
&self,
path: &str,
body: &B,
) -> Result<T>
pub async fn put<T: DeserializeOwned, B: Serialize>( &self, path: &str, body: &B, ) -> Result<T>
Make an async PUT request
Sourcepub async fn get_with_headers<T: DeserializeOwned>(
&self,
path: &str,
headers: Vec<(&str, &str)>,
) -> Result<T>
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
Sourcepub async fn put_with_headers<T: DeserializeOwned, B: Serialize>(
&self,
path: &str,
body: &B,
headers: Vec<(&str, &str)>,
) -> Result<T>
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
Sourcepub async fn put_multipart<T: DeserializeOwned>(
&self,
path: &str,
form: Form,
) -> Result<T>
pub async fn put_multipart<T: DeserializeOwned>( &self, path: &str, form: Form, ) -> Result<T>
Make an async PUT request with multipart form data
Trait Implementations§
Source§impl Clone for RainClient
impl Clone for RainClient
Source§fn clone(&self) -> RainClient
fn clone(&self) -> RainClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more