Repository navigation
feat(account-tree): add usage attribution types and attributed usage - #427
Open
lovrocolic wants to merge 1 commit into
Open
lovrocolic wants to merge 1 commit into
lovrocolic wants to merge 1 commit into
Conversation
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.
Context
The account tree feature lets usage be tracked under custom types, such as teams or users. The API exposes CRUD endpoints for usage attribution types (getlago/lago-api#6415) and an endpoint that reads attributed usage (getlago/lago-api#6566).
Description
Usage attribution types
client.usage_attribution_typesclient withcreate,update,find,destroyandfind_all. Each one is keyed bycode.UsageAttributionTypeinput model andUsageAttributionTypeResponseresponse model.find_allacceptspage,per_page,roleandsearch_termoptions.Attributed usage
client.customers.attributed_usage(external_customer_id, external_subscription_id, group_by=None, filters=None, options=None). It callsGET /customers/:external_customer_id/attributed_usage.filters, a string value is sent asfilters[key]=valueand a list value as repeatedfilters[key][]=value. The other query params (from_datetime,to_datetime,charge_codes[],split_charge_code,search_term,basis,page,per_page) go throughoptions.{"attributed_usage": AttributedUsageResponse, "meta": {...}}. The response includes the rows, the unattributed usage and the totals, and each one is split into charge usage.Fixtures and tests cover each endpoint.
🤖 Generated with Claude Code