Lago Types
A comprehensive type library for the Lago billing system, providing Rust data structures for API requests, responses, and domain models.
Overview
This crate contains all the type definitions needed to interact with the Lago billing API, including:
- Models: Core domain objects like
Customer,Invoice,UsageThreshold - Requests: Structured request types for API operations
- Responses: Typed responses from API endpoints
- Filters: Query parameter builders for list operations
- Error handling: Common error types and API error responses
Features
- Type Safety: Strongly typed structs and enums for all API interactions
- Serialization: Full serde support for JSON serialization/deserialization
- Filtering: Composable filter builders for list queries
- Pagination: Built-in pagination support with metadata
- Documentation: Comprehensive documentation for all public APIs
Usage
Add this crate to your Cargo.toml:
[]
= { = "../lago-types" }
Basic Example
use ;
// Create a request to list invoices with filters
let request = new
.with_pagination
.with_filters;
// Convert to query parameters
let params = request.to_query_params;
Module Structure
models/- Core domain models and data structuresrequests/- Request types for API operationsresponses/- Response types from API endpointsfilters/- Filter builders for list operationserror.rs- Error types and handling
Release
Before publishing a release
cargo check
cargo test
cargo doc --no-deps --open
cargo package
Run the release
cargo login API_KEY
cargo publish
License
This project is licensed under the MIT License - see the LICENSE file for details.