Skip to content

feat(client): add list_fees and get_fee methods#47

Merged
vladmarascu merged 5 commits into
mainfrom
list-fees-client
May 20, 2026
Merged

feat(client): add list_fees and get_fee methods#47
vladmarascu merged 5 commits into
mainfrom
list-fees-client

Conversation

@vladmarascu
Copy link
Copy Markdown
Contributor

@vladmarascu vladmarascu commented May 20, 2026

Summary

Adds two read-only client methods consuming the /fees endpoint types that landed in #44 + were published as lago-types 0.1.23 (via #45):

  • LagoClient::list_fees(Option<ListFeesRequest>) — list with FeeFilters (fee_type, billable_metric_code, customer, subscription, currency, payment_status, created_at_from/to) plus pagination
  • LagoClient::get_fee(GetFeeRequest) — single fee by Lago ID (UUID)

Plus an examples/fee.rs showing the four common flows: default list, filter by FeeType::Subscription (MRR base), filter by billable_metric_code (selected usage charges), single-fee lookup.

Context

Downstream consumers — including the Lago Agent Toolkit MCP server need fee-level data access. Today the SDK exposes invoices but no way to drill into the fee breakdown. This PR closes that gap by adding the client methods on top of #44's types and #45's release.

Implementation notes

Version bumps

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --all-features -- -D warnings
  • cargo test --all-features
  • cargo build --release --all-features
  • cargo publish --dry-run for both lago-types and lago-client
  • Smoke-tested locally end-to-end through the downstream MCP server against a real Lago account (4,521 fees in test data, list_fees and get_fee both return correctly through tools/call)

Commits

1c8b071 chore: bump lago-client to 0.1.25 and lago-types dep to 0.1.23
d827d77 refactor(client): use Url::parse in get_fee
c94deb9 style: format list_fees signature per cargo fmt
4967b91 feat(client): add fee usage example
06a2f9f feat(client): add list_fees and get_fee methods on LagoClient

Followups (separate PR)

  • Downstream PR in getlago/lago-agent-toolkit adding list_fees / get_fee as MCP tools — branch is ready, blocked on this PR + a lago-client 0.1.25 publish.

## Context

With FeeFilters, requests, and responses now defined in lago-types,
the client side needs query methods to actually hit Lago's `/fees`
endpoint.

## Description

Adds `LagoClient::list_fees` and `LagoClient::get_fee` in
`lago-client/src/queries/fee.rs`, registered via `queries.rs`. The list
method mirrors `list_invoices`: it composes pagination and filter
query params and dispatches a GET request. The detail method hits
`/fees/{lago_id}`.
## Context

Each resource module ships with a runnable example demonstrating common
operations against a real Lago account. Adding the fee example keeps
the convention consistent and gives downstream consumers a quick
reference for the new methods.

## Description

Adds `lago-client/examples/fee.rs` showing four flows: a default list,
filtering by FeeType::Subscription for MRR base fees, filtering by
billable metric code for selected usage charges, and a single fee
lookup by Lago ID. Registers the example in `lago-client/Cargo.toml`.
## Context

CI step `cargo fmt --all -- --check` failed on the multi-line signature
of `LagoClient::list_fees`. The signature fits within rustfmt's line
budget on a single line.

## Description

Collapses the `list_fees` signature to one line so `cargo fmt --check`
passes. No behavioral change.
Aligns `get_fee` with the pattern established by `update_billable_metric`
in #38 — wraps the constructed URL in `Url::parse` with explicit
`LagoError::Configuration` mapping rather than passing a raw `format!`
string to `make_request`. No behavioral change.
## 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
@vladmarascu vladmarascu merged commit 6c578ed into main May 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants