Paylio Rust SDK
The Paylio Rust SDK provides convenient access to the Paylio API from applications written in Rust.
Documentation
See the Paylio API docs.
Requirements
- Rust 1.75+
- Tokio async runtime
Installation
Add to your Cargo.toml:
[]
= "0.1"
= { = "1", = ["full"] }
Usage
use Client;
async
List subscription history
use ;
let client = new?;
// Default pagination
let list = client.subscriptions.list.await?;
println!;
for item in &list.items
// Custom pagination
let opts = ListOptions ;
let page2 = client.subscriptions.list.await?;
println!;
Cancel a subscription
use ;
let client = new?;
// Cancel at end of billing period (safe default)
let result = client.subscriptions.cancel.await?;
println!;
// Cancel immediately
let opts = CancelOptions ;
let result = client.subscriptions.cancel.await?;
Configuration
use Client;
use Duration;
let client = builder
.base_url
.timeout
.build?;
Error handling
use ;
let client = new?;
match client.subscriptions.retrieve.await
Error types
| HTTP Status | Variant | Description |
|---|---|---|
| 401 | PaylioError::Authentication |
Invalid or missing API key |
| 400 | PaylioError::InvalidRequest |
Bad request parameters |
| 404 | PaylioError::NotFound |
Resource not found |
| 429 | PaylioError::RateLimit |
Rate limit exceeded |
| 5xx | PaylioError::Api |
Server error |
| Network | PaylioError::ApiConnection |
Connection or timeout error |
Development
License
MIT