Feat: add /fees endpoint support to lago-types and lago-client#44
Merged
Conversation
## Context The Lago API exposes a `/fees` endpoint that lets clients enumerate fee line items across invoices with rich filtering. The SDK previously had no module for this — `Fee`, `FeePaymentStatus`, and `FeeItem` lived in `models/invoice.rs` as nested types for the invoice payload, but there was no `FeeType` enum and no filter struct for the `/fees` list query. ## Description Adds `FeeType` (Charge, AddOn, Subscription, Credit, Commitment) to `models/invoice.rs` alongside the existing fee-related types. Introduces `FeeFilters` in `filters/fee.rs` with the standard builder pattern, composing `CustomerFilter` and `DateRangeFilter`. Date keys are remapped to `created_at_from` / `created_at_to`. Enum-to-string serialization uses explicit matches so multi-word variants like `AddOn` correctly emit `add_on`.
## Context Building on the FeeFilters added in the previous commit, the SDK needs matching request/response shapes for the `/fees` list and detail endpoints. ## Description Adds `ListFeesRequest` and `GetFeeRequest` in `requests/fee.rs`. The list request composes `PaginationParams` and `FeeFilters` and exposes `to_query_params()` for serializing into the URL query string. Adds `ListFeesResponse` and `GetFeeResponse` in `responses/fee.rs`, mirroring the existing invoice response shape (`Vec<Fee>` plus `PaginationMeta` for lists; single `Fee` for detail). Registers both modules in `requests.rs` and `responses.rs`.
sarkissianraffi
approved these changes
May 18, 2026
jdenquin
approved these changes
May 19, 2026
5 tasks
vladmarascu
added a commit
that referenced
this pull request
May 20, 2026
## Context `lago-types 0.1.23` was published to crates.io with the `/fees` endpoint types from #44. This commit consumes that release. ## Description - `lago-client/Cargo.toml`: version 0.1.24 → 0.1.25 (new release for the `list_fees` / `get_fee` methods added in this PR) - `lago-client/Cargo.toml`: dep `lago-types = "0.1.22"` → `"0.1.23"` - `Cargo.lock`: regenerated; lago-client now resolves lago-types from the crates.io registry at 0.1.23
This was referenced May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the type definitions needed to consume Lago's
/feesendpoint from the Rust SDK:FeeTypeenum,FeeFilters, request and response shapes. The matching client-side methods (LagoClient::list_fees,LagoClient::get_fee) will follow in a separate PR after this lands andlago-typesis published.What this PR adds
models::FeeType— new enum:Charge,AddOn,Subscription,Credit,Commitment. Added inmodels/invoice.rsnext to the existingFee,FeePaymentStatus, andFeeItemtypes, which are reused as-is.filters::fee::FeeFilters— composesCustomerFilter,DateRangeFilter, plus scalars:fee_type,payment_status,billable_metric_code,external_subscription_id,currency. Date range maps tocreated_at_from/created_at_to.requests::fee::ListFeesRequest,requests::fee::GetFeeRequestresponses::fee::ListFeesResponse,responses::fee::GetFeeResponseWhat this PR does NOT add (intentional)
LagoClient::list_fees/LagoClient::get_fee— split into a follow-up PR after this lands. CI here would have requiredlago-clientto build against an unpublishedlago-types, which is incompatible with the repo'scargo publish --dry-runpolicy. The follow-up will bumplago-client'slago-typesdep to whatever version this lands as.Test plan
cargo fmt --all -- --check— cleancargo clippy --all-features -- -D warnings— cleancargo test --all-features— passes (no new tests; existing 8 doctests still pass)cargo build --release --all-features— cleancargo publish --dry-runforlago-types— cleancargo publish --dry-runforlago-client— clean (no functional change in lago-client)Followups
lago-types 0.1.22— needed before the lago-client work can land.list_feesandget_feemethods, plus an example. Will be opened againstmainonce this is merged and the newlago-typesversion is on crates.io.LagoClientmethods. Opens after the lago-client PR lands.