added features
This commit is contained in:
@@ -47,8 +47,6 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
|
||||
Unix timestamp (milliseconds) when the balance expires. Mutually exclusive with reset.
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="granted_balance" type="number" />
|
||||
|
||||
|
||||
### Response
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ const response = await autumn.billing.attach({
|
||||
How to handle billing when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'next_cycle_only' skips creating any charges and applies the change at the next billing cycle.
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="discounts" type="object[]">
|
||||
<DynamicParamField body="discounts" type="object | object[]">
|
||||
List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.
|
||||
<Expandable title="properties">
|
||||
<DynamicParamField body="reward_id" type="string">
|
||||
|
||||
@@ -154,7 +154,7 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
|
||||
How to handle billing when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'next_cycle_only' skips creating any charges and applies the change at the next billing cycle.
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="discounts" type="object[]">
|
||||
<DynamicParamField body="discounts" type="object | object[]">
|
||||
List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.
|
||||
<Expandable title="properties">
|
||||
<DynamicParamField body="reward_id" type="string">
|
||||
|
||||
@@ -98,35 +98,57 @@ const { allowed } = await autumn.check({
|
||||
<DynamicResponseField name="feature" type="object">
|
||||
The full feature object if expanded.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="id" type="string" />
|
||||
<DynamicResponseField name="id" type="string">
|
||||
The unique identifier for this feature, used in /check and /track calls.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="name" type="string" />
|
||||
<DynamicResponseField name="name" type="string">
|
||||
Human-readable name displayed in the dashboard and billing UI.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'" />
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'">
|
||||
Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="consumable" type="boolean" />
|
||||
<DynamicResponseField name="consumable" type="boolean">
|
||||
For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage).
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="event_names" type="string[]" />
|
||||
<DynamicResponseField name="event_names" type="string[]">
|
||||
Event names that trigger this feature's balance. Allows multiple features to respond to a single event.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_schema" type="object[]">
|
||||
For credit_system features: maps metered features to their credit costs.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="metered_feature_id" type="string" />
|
||||
<DynamicResponseField name="metered_feature_id" type="string">
|
||||
ID of the metered feature that draws from this credit system.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_cost" type="number" />
|
||||
<DynamicResponseField name="credit_cost" type="number">
|
||||
Credits consumed per unit of the metered feature.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="display" type="object">
|
||||
Display names for the feature in billing UI and customer-facing components.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="singular" type="string | null" />
|
||||
<DynamicResponseField name="singular" type="string | null">
|
||||
Singular form for UI display (e.g., 'API call', 'seat').
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="plural" type="string | null" />
|
||||
<DynamicResponseField name="plural" type="string | null">
|
||||
Plural form for UI display (e.g., 'API calls', 'seats').
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="archived" type="boolean" />
|
||||
<DynamicResponseField name="archived" type="boolean">
|
||||
Whether the feature is archived and hidden from the dashboard.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
@@ -97,35 +97,57 @@ await autumn.track({
|
||||
<DynamicResponseField name="feature" type="object">
|
||||
The full feature object if expanded.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="id" type="string" />
|
||||
<DynamicResponseField name="id" type="string">
|
||||
The unique identifier for this feature, used in /check and /track calls.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="name" type="string" />
|
||||
<DynamicResponseField name="name" type="string">
|
||||
Human-readable name displayed in the dashboard and billing UI.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'" />
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'">
|
||||
Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="consumable" type="boolean" />
|
||||
<DynamicResponseField name="consumable" type="boolean">
|
||||
For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage).
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="event_names" type="string[]" />
|
||||
<DynamicResponseField name="event_names" type="string[]">
|
||||
Event names that trigger this feature's balance. Allows multiple features to respond to a single event.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_schema" type="object[]">
|
||||
For credit_system features: maps metered features to their credit costs.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="metered_feature_id" type="string" />
|
||||
<DynamicResponseField name="metered_feature_id" type="string">
|
||||
ID of the metered feature that draws from this credit system.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_cost" type="number" />
|
||||
<DynamicResponseField name="credit_cost" type="number">
|
||||
Credits consumed per unit of the metered feature.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="display" type="object">
|
||||
Display names for the feature in billing UI and customer-facing components.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="singular" type="string | null" />
|
||||
<DynamicResponseField name="singular" type="string | null">
|
||||
Singular form for UI display (e.g., 'API call', 'seat').
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="plural" type="string | null" />
|
||||
<DynamicResponseField name="plural" type="string | null">
|
||||
Plural form for UI display (e.g., 'API calls', 'seats').
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="archived" type="boolean" />
|
||||
<DynamicResponseField name="archived" type="boolean">
|
||||
Whether the feature is archived and hidden from the dashboard.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
@@ -273,35 +295,57 @@ await autumn.track({
|
||||
<DynamicResponseField name="feature" type="object">
|
||||
The full feature object if expanded.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="id" type="string" />
|
||||
<DynamicResponseField name="id" type="string">
|
||||
The unique identifier for this feature, used in /check and /track calls.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="name" type="string" />
|
||||
<DynamicResponseField name="name" type="string">
|
||||
Human-readable name displayed in the dashboard and billing UI.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'" />
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'">
|
||||
Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="consumable" type="boolean" />
|
||||
<DynamicResponseField name="consumable" type="boolean">
|
||||
For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage).
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="event_names" type="string[]" />
|
||||
<DynamicResponseField name="event_names" type="string[]">
|
||||
Event names that trigger this feature's balance. Allows multiple features to respond to a single event.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_schema" type="object[]">
|
||||
For credit_system features: maps metered features to their credit costs.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="metered_feature_id" type="string" />
|
||||
<DynamicResponseField name="metered_feature_id" type="string">
|
||||
ID of the metered feature that draws from this credit system.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_cost" type="number" />
|
||||
<DynamicResponseField name="credit_cost" type="number">
|
||||
Credits consumed per unit of the metered feature.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="display" type="object">
|
||||
Display names for the feature in billing UI and customer-facing components.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="singular" type="string | null" />
|
||||
<DynamicResponseField name="singular" type="string | null">
|
||||
Singular form for UI display (e.g., 'API call', 'seat').
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="plural" type="string | null" />
|
||||
<DynamicResponseField name="plural" type="string | null">
|
||||
Plural form for UI display (e.g., 'API calls', 'seats').
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="archived" type="boolean" />
|
||||
<DynamicResponseField name="archived" type="boolean">
|
||||
Whether the feature is archived and hidden from the dashboard.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
@@ -562,35 +562,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
|
||||
<DynamicResponseField name="feature" type="object">
|
||||
The full feature object if expanded.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="id" type="string" />
|
||||
<DynamicResponseField name="id" type="string">
|
||||
The unique identifier for this feature, used in /check and /track calls.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="name" type="string" />
|
||||
<DynamicResponseField name="name" type="string">
|
||||
Human-readable name displayed in the dashboard and billing UI.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'" />
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'">
|
||||
Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="consumable" type="boolean" />
|
||||
<DynamicResponseField name="consumable" type="boolean">
|
||||
For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage).
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="event_names" type="string[]" />
|
||||
<DynamicResponseField name="event_names" type="string[]">
|
||||
Event names that trigger this feature's balance. Allows multiple features to respond to a single event.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_schema" type="object[]">
|
||||
For credit_system features: maps metered features to their credit costs.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="metered_feature_id" type="string" />
|
||||
<DynamicResponseField name="metered_feature_id" type="string">
|
||||
ID of the metered feature that draws from this credit system.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_cost" type="number" />
|
||||
<DynamicResponseField name="credit_cost" type="number">
|
||||
Credits consumed per unit of the metered feature.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="display" type="object">
|
||||
Display names for the feature in billing UI and customer-facing components.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="singular" type="string | null" />
|
||||
<DynamicResponseField name="singular" type="string | null">
|
||||
Singular form for UI display (e.g., 'API call', 'seat').
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="plural" type="string | null" />
|
||||
<DynamicResponseField name="plural" type="string | null">
|
||||
Plural form for UI display (e.g., 'API calls', 'seats').
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="archived" type="boolean" />
|
||||
<DynamicResponseField name="archived" type="boolean">
|
||||
Whether the feature is archived and hidden from the dashboard.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
@@ -547,35 +547,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
|
||||
<DynamicResponseField name="feature" type="object">
|
||||
The full feature object if expanded.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="id" type="string" />
|
||||
<DynamicResponseField name="id" type="string">
|
||||
The unique identifier for this feature, used in /check and /track calls.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="name" type="string" />
|
||||
<DynamicResponseField name="name" type="string">
|
||||
Human-readable name displayed in the dashboard and billing UI.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'" />
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'">
|
||||
Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="consumable" type="boolean" />
|
||||
<DynamicResponseField name="consumable" type="boolean">
|
||||
For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage).
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="event_names" type="string[]" />
|
||||
<DynamicResponseField name="event_names" type="string[]">
|
||||
Event names that trigger this feature's balance. Allows multiple features to respond to a single event.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_schema" type="object[]">
|
||||
For credit_system features: maps metered features to their credit costs.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="metered_feature_id" type="string" />
|
||||
<DynamicResponseField name="metered_feature_id" type="string">
|
||||
ID of the metered feature that draws from this credit system.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_cost" type="number" />
|
||||
<DynamicResponseField name="credit_cost" type="number">
|
||||
Credits consumed per unit of the metered feature.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="display" type="object">
|
||||
Display names for the feature in billing UI and customer-facing components.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="singular" type="string | null" />
|
||||
<DynamicResponseField name="singular" type="string | null">
|
||||
Singular form for UI display (e.g., 'API call', 'seat').
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="plural" type="string | null" />
|
||||
<DynamicResponseField name="plural" type="string | null">
|
||||
Plural form for UI display (e.g., 'API calls', 'seats').
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="archived" type="boolean" />
|
||||
<DynamicResponseField name="archived" type="boolean">
|
||||
Whether the feature is archived and hidden from the dashboard.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
@@ -667,7 +689,7 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
|
||||
<DynamicResponseField name="tiers" type="object[]">
|
||||
Tiered pricing configuration if applicable.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="to" type="any" />
|
||||
<DynamicResponseField name="to" type="number" />
|
||||
|
||||
<DynamicResponseField name="amount" type="number" />
|
||||
|
||||
|
||||
@@ -550,35 +550,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
|
||||
<DynamicResponseField name="feature" type="object">
|
||||
The full feature object if expanded.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="id" type="string" />
|
||||
<DynamicResponseField name="id" type="string">
|
||||
The unique identifier for this feature, used in /check and /track calls.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="name" type="string" />
|
||||
<DynamicResponseField name="name" type="string">
|
||||
Human-readable name displayed in the dashboard and billing UI.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'" />
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'">
|
||||
Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="consumable" type="boolean" />
|
||||
<DynamicResponseField name="consumable" type="boolean">
|
||||
For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage).
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="event_names" type="string[]" />
|
||||
<DynamicResponseField name="event_names" type="string[]">
|
||||
Event names that trigger this feature's balance. Allows multiple features to respond to a single event.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_schema" type="object[]">
|
||||
For credit_system features: maps metered features to their credit costs.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="metered_feature_id" type="string" />
|
||||
<DynamicResponseField name="metered_feature_id" type="string">
|
||||
ID of the metered feature that draws from this credit system.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_cost" type="number" />
|
||||
<DynamicResponseField name="credit_cost" type="number">
|
||||
Credits consumed per unit of the metered feature.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="display" type="object">
|
||||
Display names for the feature in billing UI and customer-facing components.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="singular" type="string | null" />
|
||||
<DynamicResponseField name="singular" type="string | null">
|
||||
Singular form for UI display (e.g., 'API call', 'seat').
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="plural" type="string | null" />
|
||||
<DynamicResponseField name="plural" type="string | null">
|
||||
Plural form for UI display (e.g., 'API calls', 'seats').
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="archived" type="boolean" />
|
||||
<DynamicResponseField name="archived" type="boolean">
|
||||
Whether the feature is archived and hidden from the dashboard.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
@@ -559,35 +559,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
|
||||
<DynamicResponseField name="feature" type="object">
|
||||
The full feature object if expanded.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="id" type="string" />
|
||||
<DynamicResponseField name="id" type="string">
|
||||
The unique identifier for this feature, used in /check and /track calls.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="name" type="string" />
|
||||
<DynamicResponseField name="name" type="string">
|
||||
Human-readable name displayed in the dashboard and billing UI.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'" />
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'">
|
||||
Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="consumable" type="boolean" />
|
||||
<DynamicResponseField name="consumable" type="boolean">
|
||||
For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage).
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="event_names" type="string[]" />
|
||||
<DynamicResponseField name="event_names" type="string[]">
|
||||
Event names that trigger this feature's balance. Allows multiple features to respond to a single event.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_schema" type="object[]">
|
||||
For credit_system features: maps metered features to their credit costs.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="metered_feature_id" type="string" />
|
||||
<DynamicResponseField name="metered_feature_id" type="string">
|
||||
ID of the metered feature that draws from this credit system.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_cost" type="number" />
|
||||
<DynamicResponseField name="credit_cost" type="number">
|
||||
Credits consumed per unit of the metered feature.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="display" type="object">
|
||||
Display names for the feature in billing UI and customer-facing components.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="singular" type="string | null" />
|
||||
<DynamicResponseField name="singular" type="string | null">
|
||||
Singular form for UI display (e.g., 'API call', 'seat').
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="plural" type="string | null" />
|
||||
<DynamicResponseField name="plural" type="string | null">
|
||||
Plural form for UI display (e.g., 'API calls', 'seats').
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="archived" type="boolean" />
|
||||
<DynamicResponseField name="archived" type="boolean">
|
||||
Whether the feature is archived and hidden from the dashboard.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
@@ -513,35 +513,57 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx
|
||||
<DynamicResponseField name="feature" type="object">
|
||||
The full feature object if expanded.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="id" type="string" />
|
||||
<DynamicResponseField name="id" type="string">
|
||||
The unique identifier for this feature, used in /check and /track calls.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="name" type="string" />
|
||||
<DynamicResponseField name="name" type="string">
|
||||
Human-readable name displayed in the dashboard and billing UI.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'" />
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'">
|
||||
Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="consumable" type="boolean" />
|
||||
<DynamicResponseField name="consumable" type="boolean">
|
||||
For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage).
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="event_names" type="string[]" />
|
||||
<DynamicResponseField name="event_names" type="string[]">
|
||||
Event names that trigger this feature's balance. Allows multiple features to respond to a single event.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_schema" type="object[]">
|
||||
For credit_system features: maps metered features to their credit costs.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="metered_feature_id" type="string" />
|
||||
<DynamicResponseField name="metered_feature_id" type="string">
|
||||
ID of the metered feature that draws from this credit system.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_cost" type="number" />
|
||||
<DynamicResponseField name="credit_cost" type="number">
|
||||
Credits consumed per unit of the metered feature.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="display" type="object">
|
||||
Display names for the feature in billing UI and customer-facing components.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="singular" type="string | null" />
|
||||
<DynamicResponseField name="singular" type="string | null">
|
||||
Singular form for UI display (e.g., 'API call', 'seat').
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="plural" type="string | null" />
|
||||
<DynamicResponseField name="plural" type="string | null">
|
||||
Plural form for UI display (e.g., 'API calls', 'seats').
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="archived" type="boolean" />
|
||||
<DynamicResponseField name="archived" type="boolean">
|
||||
Whether the feature is archived and hidden from the dashboard.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
---
|
||||
title: "Create Balance"
|
||||
openapi: "openapi-1.2.0 POST /balances/create"
|
||||
---
|
||||
@@ -1,6 +0,0 @@
|
||||
---
|
||||
title: "Create Feature"
|
||||
openapi: "openapi-1.2.0 POST /features"
|
||||
---
|
||||
|
||||
|
||||
120
apps/docs/mintlify/api-reference/features/createFeature.mdx
Normal file
120
apps/docs/mintlify/api-reference/features/createFeature.mdx
Normal file
@@ -0,0 +1,120 @@
|
||||
---
|
||||
title: "Create Feature"
|
||||
openapi: "openapi POST /v1/features.create"
|
||||
---
|
||||
|
||||
import { DynamicParamField } from "/components/dynamic-param-field.jsx";
|
||||
import { DynamicResponseField } from "/components/dynamic-response-field.jsx";
|
||||
import { DynamicResponseExample } from "/components/dynamic-response-example.jsx";
|
||||
|
||||
### Body Parameters
|
||||
|
||||
<DynamicParamField body="name" type="string" required>
|
||||
The name of the feature.
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="type" type="'boolean' | 'metered' | 'credit_system'" required>
|
||||
The type of the feature. 'single_use' features are consumed, like API calls, tokens, or messages. 'continuous_use' features are allocated, like seats, workspaces, or projects. 'credit_system' features are schemas that unify multiple 'single_use' features into a single credit system.
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="consumable" type="boolean">
|
||||
Whether this feature is consumable. A consumable feature is one that periodically resets and is consumed rather than allocated (like credits, API requests, etc.). Applicable only for 'metered' features.
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="display" type="object">
|
||||
Singular and plural display names for the feature in your user interface.
|
||||
<Expandable title="properties">
|
||||
<DynamicParamField body="singular" type="string" required />
|
||||
|
||||
<DynamicParamField body="plural" type="string" required />
|
||||
|
||||
</Expandable>
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="credit_schema" type="object[]">
|
||||
A schema that maps 'single_use' feature IDs to credit costs. Applicable only for 'credit_system' features.
|
||||
<Expandable title="properties">
|
||||
<DynamicParamField body="metered_feature_id" type="string" required />
|
||||
|
||||
<DynamicParamField body="credit_cost" type="number" required />
|
||||
|
||||
</Expandable>
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="event_names" type="string[]" />
|
||||
|
||||
<DynamicParamField body="feature_id" type="string" required>
|
||||
The ID of the feature to create.
|
||||
</DynamicParamField>
|
||||
|
||||
|
||||
### Response
|
||||
|
||||
<DynamicResponseField name="id" type="string">
|
||||
The unique identifier for this feature, used in /check and /track calls.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="name" type="string">
|
||||
Human-readable name displayed in the dashboard and billing UI.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'">
|
||||
Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="consumable" type="boolean">
|
||||
For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage).
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="event_names" type="string[]">
|
||||
Event names that trigger this feature's balance. Allows multiple features to respond to a single event.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_schema" type="object[]">
|
||||
For credit_system features: maps metered features to their credit costs.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="metered_feature_id" type="string">
|
||||
ID of the metered feature that draws from this credit system.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_cost" type="number">
|
||||
Credits consumed per unit of the metered feature.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="display" type="object">
|
||||
Display names for the feature in billing UI and customer-facing components.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="singular" type="string | null">
|
||||
Singular form for UI display (e.g., 'API call', 'seat').
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="plural" type="string | null">
|
||||
Plural form for UI display (e.g., 'API calls', 'seats').
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="archived" type="boolean">
|
||||
Whether the feature is archived and hidden from the dashboard.
|
||||
</DynamicResponseField>
|
||||
|
||||
|
||||
<ResponseExample>
|
||||
```json 200
|
||||
{
|
||||
"id": "api-calls",
|
||||
"name": "API Calls",
|
||||
"type": "metered",
|
||||
"consumable": true,
|
||||
"archived": false,
|
||||
"display": {
|
||||
"singular": "API call",
|
||||
"plural": "API calls"
|
||||
}
|
||||
}
|
||||
```
|
||||
</ResponseExample>
|
||||
@@ -1,10 +0,0 @@
|
||||
---
|
||||
title: "Delete Feature"
|
||||
openapi: "openapi-1.2.0 DELETE /features/{feature_id}"
|
||||
---
|
||||
|
||||
<Warning>
|
||||
If the feature belongs to a product or credit system, it cannot be deleted and must be archived instead. Use the [Update Feature](/api-reference/features/update-feature) endpoint to set the `archived` field to `true`.
|
||||
</Warning>
|
||||
|
||||
|
||||
28
apps/docs/mintlify/api-reference/features/deleteFeature.mdx
Normal file
28
apps/docs/mintlify/api-reference/features/deleteFeature.mdx
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: "Delete Feature"
|
||||
openapi: "openapi POST /v1/features.delete"
|
||||
---
|
||||
|
||||
import { DynamicParamField } from "/components/dynamic-param-field.jsx";
|
||||
import { DynamicResponseField } from "/components/dynamic-response-field.jsx";
|
||||
import { DynamicResponseExample } from "/components/dynamic-response-example.jsx";
|
||||
|
||||
### Body Parameters
|
||||
|
||||
<DynamicParamField body="feature_id" type="string" required>
|
||||
The ID of the feature to delete.
|
||||
</DynamicParamField>
|
||||
|
||||
|
||||
### Response
|
||||
|
||||
<DynamicResponseField name="success" type="boolean" />
|
||||
|
||||
|
||||
<ResponseExample>
|
||||
```json 200
|
||||
{
|
||||
"success": true
|
||||
}
|
||||
```
|
||||
</ResponseExample>
|
||||
@@ -1,4 +0,0 @@
|
||||
---
|
||||
title: "Get Feature"
|
||||
openapi: "openapi-1.2.0 GET /features/{feature_id}"
|
||||
---
|
||||
86
apps/docs/mintlify/api-reference/features/getFeature.mdx
Normal file
86
apps/docs/mintlify/api-reference/features/getFeature.mdx
Normal file
@@ -0,0 +1,86 @@
|
||||
---
|
||||
title: "Get Feature"
|
||||
openapi: "openapi POST /v1/features.get"
|
||||
---
|
||||
|
||||
import { DynamicParamField } from "/components/dynamic-param-field.jsx";
|
||||
import { DynamicResponseField } from "/components/dynamic-response-field.jsx";
|
||||
import { DynamicResponseExample } from "/components/dynamic-response-example.jsx";
|
||||
|
||||
### Body Parameters
|
||||
|
||||
<DynamicParamField body="feature_id" type="string" required>
|
||||
The ID of the feature.
|
||||
</DynamicParamField>
|
||||
|
||||
|
||||
### Response
|
||||
|
||||
<DynamicResponseField name="id" type="string">
|
||||
The unique identifier for this feature, used in /check and /track calls.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="name" type="string">
|
||||
Human-readable name displayed in the dashboard and billing UI.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'">
|
||||
Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="consumable" type="boolean">
|
||||
For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage).
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="event_names" type="string[]">
|
||||
Event names that trigger this feature's balance. Allows multiple features to respond to a single event.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_schema" type="object[]">
|
||||
For credit_system features: maps metered features to their credit costs.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="metered_feature_id" type="string">
|
||||
ID of the metered feature that draws from this credit system.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_cost" type="number">
|
||||
Credits consumed per unit of the metered feature.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="display" type="object">
|
||||
Display names for the feature in billing UI and customer-facing components.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="singular" type="string | null">
|
||||
Singular form for UI display (e.g., 'API call', 'seat').
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="plural" type="string | null">
|
||||
Plural form for UI display (e.g., 'API calls', 'seats').
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="archived" type="boolean">
|
||||
Whether the feature is archived and hidden from the dashboard.
|
||||
</DynamicResponseField>
|
||||
|
||||
|
||||
<ResponseExample>
|
||||
```json 200
|
||||
{
|
||||
"id": "api-calls",
|
||||
"name": "API Calls",
|
||||
"type": "metered",
|
||||
"consumable": true,
|
||||
"archived": false,
|
||||
"display": {
|
||||
"singular": "API call",
|
||||
"plural": "API calls"
|
||||
}
|
||||
}
|
||||
```
|
||||
</ResponseExample>
|
||||
@@ -1,4 +0,0 @@
|
||||
---
|
||||
title: "List Features"
|
||||
openapi: "openapi-1.2.0 GET /features"
|
||||
---
|
||||
110
apps/docs/mintlify/api-reference/features/listFeatures.mdx
Normal file
110
apps/docs/mintlify/api-reference/features/listFeatures.mdx
Normal file
@@ -0,0 +1,110 @@
|
||||
---
|
||||
title: "List Features"
|
||||
openapi: "openapi POST /v1/features.list"
|
||||
---
|
||||
|
||||
import { DynamicParamField } from "/components/dynamic-param-field.jsx";
|
||||
import { DynamicResponseField } from "/components/dynamic-response-field.jsx";
|
||||
import { DynamicResponseExample } from "/components/dynamic-response-example.jsx";
|
||||
|
||||
|
||||
### Response
|
||||
|
||||
<DynamicResponseField name="list" type="object[]">
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="id" type="string">
|
||||
The unique identifier for this feature, used in /check and /track calls.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="name" type="string">
|
||||
Human-readable name displayed in the dashboard and billing UI.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'">
|
||||
Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="consumable" type="boolean">
|
||||
For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage).
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="event_names" type="string[]">
|
||||
Event names that trigger this feature's balance. Allows multiple features to respond to a single event.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_schema" type="object[]">
|
||||
For credit_system features: maps metered features to their credit costs.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="metered_feature_id" type="string">
|
||||
ID of the metered feature that draws from this credit system.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_cost" type="number">
|
||||
Credits consumed per unit of the metered feature.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="display" type="object">
|
||||
Display names for the feature in billing UI and customer-facing components.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="singular" type="string | null">
|
||||
Singular form for UI display (e.g., 'API call', 'seat').
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="plural" type="string | null">
|
||||
Plural form for UI display (e.g., 'API calls', 'seats').
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="archived" type="boolean">
|
||||
Whether the feature is archived and hidden from the dashboard.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
|
||||
<ResponseExample>
|
||||
```json 200
|
||||
{
|
||||
"list": [
|
||||
{
|
||||
"id": "api-calls",
|
||||
"name": "API Calls",
|
||||
"type": "metered",
|
||||
"consumable": true,
|
||||
"archived": false,
|
||||
"display": {
|
||||
"singular": "API call",
|
||||
"plural": "API calls"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "credits",
|
||||
"name": "Credits",
|
||||
"type": "credit_system",
|
||||
"consumable": true,
|
||||
"archived": false,
|
||||
"credit_schema": [
|
||||
{
|
||||
"metered_feature_id": "api-calls",
|
||||
"credit_cost": 1
|
||||
},
|
||||
{
|
||||
"metered_feature_id": "image-generations",
|
||||
"credit_cost": 10
|
||||
}
|
||||
],
|
||||
"display": {
|
||||
"singular": "credit",
|
||||
"plural": "credits"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</ResponseExample>
|
||||
@@ -1,4 +0,0 @@
|
||||
---
|
||||
title: "Set Feature Balance"
|
||||
openapi: "openapi-1.2.0 POST /customers/{customer_id}/balances"
|
||||
---
|
||||
@@ -1,4 +0,0 @@
|
||||
---
|
||||
title: "Set Feature Usage"
|
||||
openapi: "openapi-1.2.0 POST /usage"
|
||||
---
|
||||
@@ -1,4 +0,0 @@
|
||||
---
|
||||
title: "Update Feature"
|
||||
openapi: "openapi-1.2.0 POST /features/{feature_id}"
|
||||
---
|
||||
128
apps/docs/mintlify/api-reference/features/updateFeature.mdx
Normal file
128
apps/docs/mintlify/api-reference/features/updateFeature.mdx
Normal file
@@ -0,0 +1,128 @@
|
||||
---
|
||||
title: "Update Feature"
|
||||
openapi: "openapi POST /v1/features.update"
|
||||
---
|
||||
|
||||
import { DynamicParamField } from "/components/dynamic-param-field.jsx";
|
||||
import { DynamicResponseField } from "/components/dynamic-response-field.jsx";
|
||||
import { DynamicResponseExample } from "/components/dynamic-response-example.jsx";
|
||||
|
||||
### Body Parameters
|
||||
|
||||
<DynamicParamField body="name" type="string">
|
||||
The name of the feature.
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="type" type="'boolean' | 'metered' | 'credit_system'">
|
||||
The type of the feature. 'single_use' features are consumed, like API calls, tokens, or messages. 'continuous_use' features are allocated, like seats, workspaces, or projects. 'credit_system' features are schemas that unify multiple 'single_use' features into a single credit system.
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="consumable" type="boolean">
|
||||
Whether this feature is consumable. A consumable feature is one that periodically resets and is consumed rather than allocated (like credits, API requests, etc.). Applicable only for 'metered' features.
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="display" type="object">
|
||||
Singular and plural display names for the feature in your user interface.
|
||||
<Expandable title="properties">
|
||||
<DynamicParamField body="singular" type="string" required />
|
||||
|
||||
<DynamicParamField body="plural" type="string" required />
|
||||
|
||||
</Expandable>
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="credit_schema" type="object[]">
|
||||
A schema that maps 'single_use' feature IDs to credit costs. Applicable only for 'credit_system' features.
|
||||
<Expandable title="properties">
|
||||
<DynamicParamField body="metered_feature_id" type="string" required />
|
||||
|
||||
<DynamicParamField body="credit_cost" type="number" required />
|
||||
|
||||
</Expandable>
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="event_names" type="string[]" />
|
||||
|
||||
<DynamicParamField body="archived" type="boolean">
|
||||
Whether the feature is archived. Archived features are hidden from the dashboard.
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="feature_id" type="string" required>
|
||||
The ID of the feature to update.
|
||||
</DynamicParamField>
|
||||
|
||||
<DynamicParamField body="new_feature_id" type="string">
|
||||
The new ID of the feature. Feature ID can only be updated if it's not being used by any customers.
|
||||
</DynamicParamField>
|
||||
|
||||
|
||||
### Response
|
||||
|
||||
<DynamicResponseField name="id" type="string">
|
||||
The unique identifier for this feature, used in /check and /track calls.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="name" type="string">
|
||||
Human-readable name displayed in the dashboard and billing UI.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system'">
|
||||
Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="consumable" type="boolean">
|
||||
For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage).
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="event_names" type="string[]">
|
||||
Event names that trigger this feature's balance. Allows multiple features to respond to a single event.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_schema" type="object[]">
|
||||
For credit_system features: maps metered features to their credit costs.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="metered_feature_id" type="string">
|
||||
ID of the metered feature that draws from this credit system.
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="credit_cost" type="number">
|
||||
Credits consumed per unit of the metered feature.
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="display" type="object">
|
||||
Display names for the feature in billing UI and customer-facing components.
|
||||
<Expandable title="properties">
|
||||
<DynamicResponseField name="singular" type="string | null">
|
||||
Singular form for UI display (e.g., 'API call', 'seat').
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="plural" type="string | null">
|
||||
Plural form for UI display (e.g., 'API calls', 'seats').
|
||||
</DynamicResponseField>
|
||||
|
||||
</Expandable>
|
||||
</DynamicResponseField>
|
||||
|
||||
<DynamicResponseField name="archived" type="boolean">
|
||||
Whether the feature is archived and hidden from the dashboard.
|
||||
</DynamicResponseField>
|
||||
|
||||
|
||||
<ResponseExample>
|
||||
```json 200
|
||||
{
|
||||
"id": "api-calls",
|
||||
"name": "API Calls",
|
||||
"type": "metered",
|
||||
"consumable": true,
|
||||
"archived": false,
|
||||
"display": {
|
||||
"singular": "API call",
|
||||
"plural": "API calls"
|
||||
}
|
||||
}
|
||||
```
|
||||
</ResponseExample>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -173,6 +173,16 @@
|
||||
"api-reference/entities/deleteEntity"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Features",
|
||||
"pages": [
|
||||
"api-reference/features/getFeature",
|
||||
"api-reference/features/listFeatures",
|
||||
"api-reference/features/createFeature",
|
||||
"api-reference/features/updateFeature",
|
||||
"api-reference/features/deleteFeature"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Referrals",
|
||||
"pages": [
|
||||
@@ -185,19 +195,6 @@
|
||||
"pages": ["api-reference/billing/setupPayment"]
|
||||
},
|
||||
|
||||
{
|
||||
"group": "Features",
|
||||
"pages": [
|
||||
"api-reference/features/get-feature",
|
||||
"api-reference/features/list-features",
|
||||
"api-reference/features/create-feature",
|
||||
"api-reference/features/update-feature",
|
||||
"api-reference/features/delete-feature",
|
||||
"api-reference/features/set-feature-usage",
|
||||
"api-reference/features/set-feature-balances",
|
||||
"api-reference/features/create-balance"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Products",
|
||||
"pages": [
|
||||
|
||||
@@ -168,11 +168,11 @@ export default function UseAutumnScenarioPage() {
|
||||
|
||||
<DebugCard title="Actions">
|
||||
{/* Tabs */}
|
||||
<div className="flex gap-1 border-b border-zinc-200 mb-4">
|
||||
<div className="mb-4 flex gap-1 border-b border-zinc-200">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setActiveTab("attach")}
|
||||
className={`px-3 py-1.5 text-sm font-medium border-b-2 -mb-px transition-colors ${
|
||||
className={`-mb-px border-b-2 px-3 py-1.5 text-sm font-medium transition-colors ${
|
||||
activeTab === "attach"
|
||||
? "border-zinc-900 text-zinc-900"
|
||||
: "border-transparent text-zinc-500 hover:text-zinc-700"
|
||||
@@ -183,7 +183,7 @@ export default function UseAutumnScenarioPage() {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setActiveTab("check")}
|
||||
className={`px-3 py-1.5 text-sm font-medium border-b-2 -mb-px transition-colors ${
|
||||
className={`-mb-px border-b-2 px-3 py-1.5 text-sm font-medium transition-colors ${
|
||||
activeTab === "check"
|
||||
? "border-zinc-900 text-zinc-900"
|
||||
: "border-transparent text-zinc-500 hover:text-zinc-700"
|
||||
@@ -194,7 +194,7 @@ export default function UseAutumnScenarioPage() {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setActiveTab("openCustomerPortal")}
|
||||
className={`px-3 py-1.5 text-sm font-medium border-b-2 -mb-px transition-colors ${
|
||||
className={`-mb-px border-b-2 px-3 py-1.5 text-sm font-medium transition-colors ${
|
||||
activeTab === "openCustomerPortal"
|
||||
? "border-zinc-900 text-zinc-900"
|
||||
: "border-transparent text-zinc-500 hover:text-zinc-700"
|
||||
@@ -297,7 +297,7 @@ export default function UseAutumnScenarioPage() {
|
||||
onChange={(e) => setPortalReturnUrl(e.target.value)}
|
||||
className="h-8 text-sm"
|
||||
/>
|
||||
<p className="text-[11px] text-zinc-500 leading-tight">
|
||||
<p className="text-[11px] leading-tight text-zinc-500">
|
||||
Defaults to the current page URL when left empty.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
404
apps/sdk-test/app/scenarios/core/use-events/page.tsx
Normal file
404
apps/sdk-test/app/scenarios/core/use-events/page.tsx
Normal file
@@ -0,0 +1,404 @@
|
||||
"use client";
|
||||
|
||||
import { useAggregateEvents, useListEvents } from "autumn-js/react";
|
||||
import { useId, useState } from "react";
|
||||
import { DataViewer } from "@/components/debug/DataViewer";
|
||||
import { DebugCard } from "@/components/debug/DebugCard";
|
||||
import { HookStatePanel } from "@/components/debug/HookStatePanel";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
|
||||
export default function UseEventsScenarioPage() {
|
||||
const [lastUpdatedAt, setLastUpdatedAt] = useState<string | null>(null);
|
||||
|
||||
const [eventsFeatureId, setEventsFeatureId] = useState("");
|
||||
const [eventsLimit, setEventsLimit] = useState("25");
|
||||
const [eventsStart, setEventsStart] = useState("");
|
||||
const [eventsEnd, setEventsEnd] = useState("");
|
||||
const [eventsPageInput, setEventsPageInput] = useState("1");
|
||||
|
||||
const [aggregateFeatureId, setAggregateFeatureId] = useState("");
|
||||
const [aggregateRange, setAggregateRange] = useState("7d");
|
||||
const [aggregateBinSize, setAggregateBinSize] = useState("day");
|
||||
const [aggregateGroupBy, setAggregateGroupBy] = useState("");
|
||||
const [aggregateStart, setAggregateStart] = useState("");
|
||||
const [aggregateEnd, setAggregateEnd] = useState("");
|
||||
|
||||
const eventsFeatureIdInputId = useId();
|
||||
const eventsLimitInputId = useId();
|
||||
const eventsStartInputId = useId();
|
||||
const eventsEndInputId = useId();
|
||||
const eventsPageInputId = useId();
|
||||
const aggregateFeatureIdInputId = useId();
|
||||
const aggregateRangeInputId = useId();
|
||||
const aggregateBinSizeInputId = useId();
|
||||
const aggregateGroupByInputId = useId();
|
||||
const aggregateStartInputId = useId();
|
||||
const aggregateEndInputId = useId();
|
||||
|
||||
const parsedEventsLimit = eventsLimit ? parseInt(eventsLimit, 10) : undefined;
|
||||
const safeEventsLimit =
|
||||
Number.isFinite(parsedEventsLimit) && parsedEventsLimit !== undefined
|
||||
? parsedEventsLimit
|
||||
: 25;
|
||||
|
||||
const listEvents = useListEvents({
|
||||
featureId: eventsFeatureId || undefined,
|
||||
limit: safeEventsLimit,
|
||||
customRange:
|
||||
eventsStart || eventsEnd
|
||||
? {
|
||||
start: eventsStart ? parseInt(eventsStart, 10) : undefined,
|
||||
end: eventsEnd ? parseInt(eventsEnd, 10) : undefined,
|
||||
}
|
||||
: undefined,
|
||||
});
|
||||
|
||||
const aggregateEvents = useAggregateEvents({
|
||||
featureId: aggregateFeatureId,
|
||||
range: aggregateRange || undefined,
|
||||
binSize: aggregateBinSize || undefined,
|
||||
groupBy: aggregateGroupBy || undefined,
|
||||
customRange:
|
||||
aggregateStart && aggregateEnd
|
||||
? {
|
||||
start: parseInt(aggregateStart, 10),
|
||||
end: parseInt(aggregateEnd, 10),
|
||||
}
|
||||
: undefined,
|
||||
queryOptions: {
|
||||
enabled: !!aggregateFeatureId,
|
||||
},
|
||||
});
|
||||
|
||||
const onRefreshBoth = async () => {
|
||||
await Promise.all([listEvents.refetch(), aggregateEvents.refetch()]);
|
||||
setLastUpdatedAt(new Date().toISOString());
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<DebugCard
|
||||
title="Hooks State"
|
||||
actions={
|
||||
<Button variant="outline" size="sm" onClick={onRefreshBoth}>
|
||||
Refresh both
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
<HookStatePanel
|
||||
isLoading={listEvents.isLoading}
|
||||
error={listEvents.error}
|
||||
lastUpdatedAt={lastUpdatedAt}
|
||||
/>
|
||||
<HookStatePanel
|
||||
isLoading={aggregateEvents.isLoading}
|
||||
error={aggregateEvents.error}
|
||||
lastUpdatedAt={lastUpdatedAt}
|
||||
/>
|
||||
</div>
|
||||
</DebugCard>
|
||||
|
||||
<DebugCard title="List Events">
|
||||
<div className="space-y-3">
|
||||
<div className="grid grid-cols-1 gap-2 md:grid-cols-2">
|
||||
<div className="space-y-1.5">
|
||||
<Label
|
||||
htmlFor={eventsFeatureIdInputId}
|
||||
className="text-xs text-zinc-500"
|
||||
>
|
||||
Feature ID (optional)
|
||||
</Label>
|
||||
<Input
|
||||
id={eventsFeatureIdInputId}
|
||||
placeholder="api_calls"
|
||||
value={eventsFeatureId}
|
||||
onChange={(e) => setEventsFeatureId(e.target.value)}
|
||||
className="h-8 text-sm"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label
|
||||
htmlFor={eventsLimitInputId}
|
||||
className="text-xs text-zinc-500"
|
||||
>
|
||||
Limit
|
||||
</Label>
|
||||
<Input
|
||||
id={eventsLimitInputId}
|
||||
type="number"
|
||||
min={1}
|
||||
max={1000}
|
||||
value={eventsLimit}
|
||||
onChange={(e) => setEventsLimit(e.target.value)}
|
||||
className="h-8 text-sm"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label
|
||||
htmlFor={eventsStartInputId}
|
||||
className="text-xs text-zinc-500"
|
||||
>
|
||||
Range Start (epoch ms)
|
||||
</Label>
|
||||
<Input
|
||||
id={eventsStartInputId}
|
||||
type="number"
|
||||
placeholder="1704067200000"
|
||||
value={eventsStart}
|
||||
onChange={(e) => setEventsStart(e.target.value)}
|
||||
className="h-8 text-sm"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label
|
||||
htmlFor={eventsEndInputId}
|
||||
className="text-xs text-zinc-500"
|
||||
>
|
||||
Range End (epoch ms)
|
||||
</Label>
|
||||
<Input
|
||||
id={eventsEndInputId}
|
||||
type="number"
|
||||
placeholder="1706745600000"
|
||||
value={eventsEnd}
|
||||
onChange={(e) => setEventsEnd(e.target.value)}
|
||||
className="h-8 text-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => listEvents.refetch()}
|
||||
disabled={listEvents.isFetching}
|
||||
>
|
||||
{listEvents.isFetching ? "Refreshing..." : "Refresh"}
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={listEvents.prevPage}
|
||||
disabled={!listEvents.hasPrevious || listEvents.isFetching}
|
||||
>
|
||||
Prev
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={listEvents.nextPage}
|
||||
disabled={!listEvents.hasMore || listEvents.isFetching}
|
||||
>
|
||||
Next
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={listEvents.resetPagination}
|
||||
disabled={listEvents.page === 0 || listEvents.isFetching}
|
||||
>
|
||||
Reset Page
|
||||
</Button>
|
||||
<div className="flex items-center gap-1">
|
||||
<Label
|
||||
htmlFor={eventsPageInputId}
|
||||
className="text-xs text-zinc-500"
|
||||
>
|
||||
Go to
|
||||
</Label>
|
||||
<Input
|
||||
id={eventsPageInputId}
|
||||
type="number"
|
||||
min={1}
|
||||
value={eventsPageInput}
|
||||
onChange={(e) => setEventsPageInput(e.target.value)}
|
||||
className="h-8 w-20 text-sm"
|
||||
/>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() =>
|
||||
listEvents.goToPage({
|
||||
pageNum: Math.max(
|
||||
0,
|
||||
(parseInt(eventsPageInput, 10) || 1) - 1,
|
||||
),
|
||||
})
|
||||
}
|
||||
disabled={listEvents.isFetching}
|
||||
>
|
||||
Go
|
||||
</Button>
|
||||
</div>
|
||||
<span className="text-xs text-zinc-500">
|
||||
Page {listEvents.page + 1} • Offset{" "}
|
||||
{(listEvents.data?.offset ?? 0).toString()} • Has more:{" "}
|
||||
{listEvents.hasMore ? "yes" : "no"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</DebugCard>
|
||||
|
||||
<DebugCard title="Aggregate Events">
|
||||
<div className="space-y-3">
|
||||
<div className="grid grid-cols-1 gap-2 md:grid-cols-2">
|
||||
<div className="space-y-1.5">
|
||||
<Label
|
||||
htmlFor={aggregateFeatureIdInputId}
|
||||
className="text-xs text-zinc-500"
|
||||
>
|
||||
Feature ID
|
||||
</Label>
|
||||
<Input
|
||||
id={aggregateFeatureIdInputId}
|
||||
placeholder="api_calls"
|
||||
value={aggregateFeatureId}
|
||||
onChange={(e) => setAggregateFeatureId(e.target.value)}
|
||||
className="h-8 text-sm"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label
|
||||
htmlFor={aggregateRangeInputId}
|
||||
className="text-xs text-zinc-500"
|
||||
>
|
||||
Range
|
||||
</Label>
|
||||
<Input
|
||||
id={aggregateRangeInputId}
|
||||
placeholder="7d | 30d | 24h"
|
||||
value={aggregateRange}
|
||||
onChange={(e) => setAggregateRange(e.target.value)}
|
||||
className="h-8 text-sm"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label
|
||||
htmlFor={aggregateBinSizeInputId}
|
||||
className="text-xs text-zinc-500"
|
||||
>
|
||||
Bin Size
|
||||
</Label>
|
||||
<Input
|
||||
id={aggregateBinSizeInputId}
|
||||
placeholder="day | hour | month"
|
||||
value={aggregateBinSize}
|
||||
onChange={(e) => setAggregateBinSize(e.target.value)}
|
||||
className="h-8 text-sm"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label
|
||||
htmlFor={aggregateGroupByInputId}
|
||||
className="text-xs text-zinc-500"
|
||||
>
|
||||
Group By (optional)
|
||||
</Label>
|
||||
<Input
|
||||
id={aggregateGroupByInputId}
|
||||
placeholder="properties.model"
|
||||
value={aggregateGroupBy}
|
||||
onChange={(e) => setAggregateGroupBy(e.target.value)}
|
||||
className="h-8 text-sm"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label
|
||||
htmlFor={aggregateStartInputId}
|
||||
className="text-xs text-zinc-500"
|
||||
>
|
||||
Custom Start (epoch ms)
|
||||
</Label>
|
||||
<Input
|
||||
id={aggregateStartInputId}
|
||||
type="number"
|
||||
placeholder="1704067200000"
|
||||
value={aggregateStart}
|
||||
onChange={(e) => setAggregateStart(e.target.value)}
|
||||
className="h-8 text-sm"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label
|
||||
htmlFor={aggregateEndInputId}
|
||||
className="text-xs text-zinc-500"
|
||||
>
|
||||
Custom End (epoch ms)
|
||||
</Label>
|
||||
<Input
|
||||
id={aggregateEndInputId}
|
||||
type="number"
|
||||
placeholder="1706745600000"
|
||||
value={aggregateEnd}
|
||||
onChange={(e) => setAggregateEnd(e.target.value)}
|
||||
className="h-8 text-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => aggregateEvents.refetch()}
|
||||
disabled={!aggregateFeatureId || aggregateEvents.isFetching}
|
||||
>
|
||||
{aggregateEvents.isFetching ? "Refreshing..." : "Refresh"}
|
||||
</Button>
|
||||
<span className="text-xs text-zinc-500">
|
||||
{aggregateFeatureId
|
||||
? "Runs with current params"
|
||||
: "Feature ID required"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</DebugCard>
|
||||
|
||||
<div className="grid gap-4 lg:grid-cols-2">
|
||||
<DataViewer
|
||||
title="List Events Result"
|
||||
value={listEvents.data ?? null}
|
||||
defaultExpandedDepth={2}
|
||||
/>
|
||||
<DataViewer
|
||||
title="Aggregate Events Result"
|
||||
value={aggregateEvents.data ?? null}
|
||||
defaultExpandedDepth={2}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-4 lg:grid-cols-2">
|
||||
<DataViewer
|
||||
title="List Events Error"
|
||||
value={
|
||||
listEvents.error
|
||||
? {
|
||||
message: listEvents.error.message,
|
||||
code: listEvents.error.code,
|
||||
statusCode: listEvents.error.statusCode,
|
||||
}
|
||||
: null
|
||||
}
|
||||
defaultExpandedDepth={2}
|
||||
/>
|
||||
<DataViewer
|
||||
title="Aggregate Events Error"
|
||||
value={
|
||||
aggregateEvents.error
|
||||
? {
|
||||
message: aggregateEvents.error.message,
|
||||
code: aggregateEvents.error.code,
|
||||
statusCode: aggregateEvents.error.statusCode,
|
||||
}
|
||||
: null
|
||||
}
|
||||
defaultExpandedDepth={2}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import type {
|
||||
ClientCreateReferralCodeParams,
|
||||
ClientRedeemReferralCodeParams,
|
||||
} from "autumn-js/react";
|
||||
import { useCustomer } from "autumn-js/react";
|
||||
import type { ClientRedeemReferralCodeParams } from "autumn-js/react";
|
||||
import { useReferrals } from "autumn-js/react";
|
||||
import { useId, useState } from "react";
|
||||
import { DataViewer } from "@/components/debug/DataViewer";
|
||||
import { DebugCard } from "@/components/debug/DebugCard";
|
||||
@@ -47,11 +44,6 @@ const toErrorPayload = ({ error }: { error: unknown }) => {
|
||||
};
|
||||
|
||||
export default function UseReferralsScenarioPage() {
|
||||
const { isLoading, error, refetch, createReferralCode, redeemReferralCode } =
|
||||
useCustomer({
|
||||
errorOnNotFound: false,
|
||||
});
|
||||
|
||||
const [lastUpdatedAt, setLastUpdatedAt] = useState<string | null>(null);
|
||||
const [isRunning, setIsRunning] = useState(false);
|
||||
const [lastAction, setLastAction] = useState<LastActionState>(null);
|
||||
@@ -60,6 +52,11 @@ export default function UseReferralsScenarioPage() {
|
||||
const [programId, setProgramId] = useState("");
|
||||
const [referralCode, setReferralCode] = useState("");
|
||||
|
||||
const { data, isLoading, isFetching, error, refetch, redeemCode } =
|
||||
useReferrals({
|
||||
programId,
|
||||
});
|
||||
|
||||
const programIdInputId = useId();
|
||||
const referralCodeInputId = useId();
|
||||
|
||||
@@ -103,14 +100,16 @@ export default function UseReferralsScenarioPage() {
|
||||
const handleCreateReferralCode = () => {
|
||||
if (!programId) return;
|
||||
|
||||
const params: ClientCreateReferralCodeParams = {
|
||||
programId,
|
||||
};
|
||||
|
||||
runAction({
|
||||
name: "createReferralCode",
|
||||
params,
|
||||
execute: () => createReferralCode(params),
|
||||
params: { programId },
|
||||
execute: async () => {
|
||||
const result = await refetch();
|
||||
if (result.error) {
|
||||
throw result.error;
|
||||
}
|
||||
return result.data ?? null;
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -124,7 +123,7 @@ export default function UseReferralsScenarioPage() {
|
||||
runAction({
|
||||
name: "redeemReferralCode",
|
||||
params,
|
||||
execute: () => redeemReferralCode(params),
|
||||
execute: () => redeemCode(params),
|
||||
});
|
||||
};
|
||||
|
||||
@@ -139,7 +138,7 @@ export default function UseReferralsScenarioPage() {
|
||||
}
|
||||
>
|
||||
<HookStatePanel
|
||||
isLoading={isLoading}
|
||||
isLoading={isLoading || isFetching}
|
||||
error={error}
|
||||
lastUpdatedAt={lastUpdatedAt}
|
||||
/>
|
||||
@@ -227,25 +226,31 @@ export default function UseReferralsScenarioPage() {
|
||||
</DebugCard>
|
||||
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<DataViewer
|
||||
title="createReferralCode.data"
|
||||
value={data ?? null}
|
||||
defaultExpandedDepth={3}
|
||||
/>
|
||||
<DataViewer
|
||||
title="lastAction"
|
||||
value={lastAction}
|
||||
defaultExpandedDepth={3}
|
||||
/>
|
||||
<DataViewer
|
||||
title="error"
|
||||
value={
|
||||
error
|
||||
? {
|
||||
message: error.message,
|
||||
code: error.code,
|
||||
statusCode: error.statusCode,
|
||||
}
|
||||
: null
|
||||
}
|
||||
defaultExpandedDepth={2}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<DataViewer
|
||||
title="error"
|
||||
value={
|
||||
error
|
||||
? {
|
||||
message: error.message,
|
||||
code: error.code,
|
||||
statusCode: error.statusCode,
|
||||
}
|
||||
: (lastAction?.error ?? null)
|
||||
}
|
||||
defaultExpandedDepth={2}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,13 @@ export const scenarioSections: Array<ScenarioSection> = [
|
||||
description: "Inspect plans list and payloads.",
|
||||
status: "ready",
|
||||
},
|
||||
{
|
||||
id: "use-events",
|
||||
title: "useEvents",
|
||||
href: "/scenarios/core/use-events",
|
||||
description: "Inspect list/aggregate events hooks and pagination.",
|
||||
status: "ready",
|
||||
},
|
||||
{
|
||||
id: "use-autumn",
|
||||
title: "useAutumn",
|
||||
|
||||
@@ -9,9 +9,9 @@ const autumn = new Autumn({
|
||||
secretKey: process.env.AUTUMN_SECRET_KEY,
|
||||
});
|
||||
|
||||
const res = await autumn.events.aggregate({
|
||||
customerId: "john",
|
||||
const res = await autumn.features.update({
|
||||
featureId: "messages",
|
||||
name: "Messages",
|
||||
});
|
||||
|
||||
console.log(JSON.stringify(res, null, 2));
|
||||
|
||||
2
bun.lock
2
bun.lock
@@ -168,7 +168,7 @@
|
||||
},
|
||||
"packages/sdk": {
|
||||
"name": "@useautumn/sdk",
|
||||
"version": "0.10.4",
|
||||
"version": "0.10.8",
|
||||
"dependencies": {
|
||||
"zod": "^3.25.65 || ^4.0.0",
|
||||
},
|
||||
|
||||
@@ -337,6 +337,99 @@ actions:
|
||||
|
||||
res = autumn.events.list(offset=0, limit=50, customer_id="cus_123")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
- target: $["paths"]["/v1/features.create"]["post"]
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: python
|
||||
label: Python (SDK)
|
||||
source: |-
|
||||
from autumn_sdk import Autumn
|
||||
|
||||
|
||||
with Autumn(
|
||||
x_api_version="2.1",
|
||||
secret_key="<YOUR_BEARER_TOKEN_HERE>",
|
||||
) as autumn:
|
||||
|
||||
res = autumn.features.create(name="API Calls", type_="metered", feature_id="api-calls", consumable=True)
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
- target: $["paths"]["/v1/features.delete"]["post"]
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: python
|
||||
label: Python (SDK)
|
||||
source: |-
|
||||
from autumn_sdk import Autumn
|
||||
|
||||
|
||||
with Autumn(
|
||||
x_api_version="2.1",
|
||||
secret_key="<YOUR_BEARER_TOKEN_HERE>",
|
||||
) as autumn:
|
||||
|
||||
res = autumn.features.delete(feature_id="old-feature")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
- target: $["paths"]["/v1/features.get"]["post"]
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: python
|
||||
label: Python (SDK)
|
||||
source: |-
|
||||
from autumn_sdk import Autumn
|
||||
|
||||
|
||||
with Autumn(
|
||||
x_api_version="2.1",
|
||||
secret_key="<YOUR_BEARER_TOKEN_HERE>",
|
||||
) as autumn:
|
||||
|
||||
res = autumn.features.get(feature_id="api-calls")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
- target: $["paths"]["/v1/features.list"]["post"]
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: python
|
||||
label: Python (SDK)
|
||||
source: |-
|
||||
from autumn_sdk import Autumn
|
||||
|
||||
|
||||
with Autumn(
|
||||
x_api_version="2.1",
|
||||
secret_key="<YOUR_BEARER_TOKEN_HERE>",
|
||||
) as autumn:
|
||||
|
||||
res = autumn.features.list()
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
- target: $["paths"]["/v1/features.update"]["post"]
|
||||
update:
|
||||
x-codeSamples:
|
||||
- lang: python
|
||||
label: Python (SDK)
|
||||
source: |-
|
||||
from autumn_sdk import Autumn
|
||||
|
||||
|
||||
with Autumn(
|
||||
x_api_version="2.1",
|
||||
secret_key="<YOUR_BEARER_TOKEN_HERE>",
|
||||
) as autumn:
|
||||
|
||||
res = autumn.features.update(feature_id="api-calls", name="API Requests", display={
|
||||
"singular": "API request",
|
||||
"plural": "API requests",
|
||||
})
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
- target: $["paths"]["/v1/plans.list"]["post"]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,7 @@ generation:
|
||||
generateNewTests: true
|
||||
skipResponseBodyAssertions: false
|
||||
python:
|
||||
version: 0.4.4
|
||||
version: 0.4.8
|
||||
additionalDependencies:
|
||||
dev: {}
|
||||
main: {}
|
||||
|
||||
@@ -207,10 +207,10 @@ Use this to gate access before a feature action. Enable sendEvent when you want
|
||||
|
||||
Use this after an action happens to decrement usage, or send a negative value to credit balance back.
|
||||
|
||||
### [Balances](docs/sdks/balancessdk/README.md)
|
||||
### [Balances](docs/sdks/balances/README.md)
|
||||
|
||||
* [create](docs/sdks/balancessdk/README.md#create) - Create a balance for a customer feature.
|
||||
* [update](docs/sdks/balancessdk/README.md#update) - Update a customer balance.
|
||||
* [create](docs/sdks/balances/README.md#create) - Create a balance for a customer feature.
|
||||
* [update](docs/sdks/balances/README.md#update) - Update a customer balance.
|
||||
|
||||
### [Billing](docs/sdks/billing/README.md)
|
||||
|
||||
@@ -242,7 +242,7 @@ Use this as the primary entrypoint before billing operations so the customer rec
|
||||
* [create](docs/sdks/entities/README.md#create) - Creates an entity for a customer and feature, then returns the entity with balances and subscriptions.
|
||||
|
||||
Use entities when usage and access must be scoped to sub-resources (for example seats, projects, or workspaces) instead of only the customer.
|
||||
* [get](docs/sdks/entities/README.md#get) - Fetches a single entity by entity ID.
|
||||
* [get](docs/sdks/entities/README.md#get) - Fetches an entity by its ID.
|
||||
|
||||
Use this to read one entity's current state. Pass customerId when you want to scope the lookup to a specific customer.
|
||||
* [delete](docs/sdks/entities/README.md#delete) - Deletes an entity by entity ID.
|
||||
@@ -254,6 +254,24 @@ Use this when the underlying resource is removed and you no longer want entity-s
|
||||
* [list](docs/sdks/events/README.md#list) - List usage events for your organization. Filter by customer, feature, or time range.
|
||||
* [aggregate](docs/sdks/events/README.md#aggregate) - Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property.
|
||||
|
||||
### [Features](docs/sdks/features/README.md)
|
||||
|
||||
* [create](docs/sdks/features/README.md#create) - Creates a new feature.
|
||||
|
||||
Use this to programmatically create features for metering usage, managing access, or building credit systems.
|
||||
* [get](docs/sdks/features/README.md#get) - Retrieves a single feature by its ID.
|
||||
|
||||
Use this when you need to fetch the details of a specific feature.
|
||||
* [list](docs/sdks/features/README.md#list) - Lists all features in the current environment.
|
||||
|
||||
Use this to retrieve all features configured for your organization to display in dashboards or for feature management.
|
||||
* [update](docs/sdks/features/README.md#update) - Updates an existing feature.
|
||||
|
||||
Use this to modify feature properties like name, display settings, or to archive a feature.
|
||||
* [delete](docs/sdks/features/README.md#delete) - Deletes a feature by its ID.
|
||||
|
||||
Use this to permanently remove a feature. Note: features that are used in products cannot be deleted - archive them instead.
|
||||
|
||||
### [Plans](docs/sdks/plans/README.md)
|
||||
|
||||
* [list](docs/sdks/plans/README.md#list) - List all plans
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Balances
|
||||
# Balance
|
||||
|
||||
|
||||
## Fields
|
||||
@@ -6,7 +6,7 @@
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
|
||||
| `feature_id` | *str* | :heavy_check_mark: | The feature ID this balance is for. |
|
||||
| `feature` | [Optional[models.CustomerFeature]](../models/customerfeature.md) | :heavy_minus_sign: | The full feature object if expanded. |
|
||||
| `feature` | [Optional[models.BalanceFeature]](../models/balancefeature.md) | :heavy_minus_sign: | The full feature object if expanded. |
|
||||
| `granted` | *float* | :heavy_check_mark: | Total balance granted (included + prepaid). |
|
||||
| `remaining` | *float* | :heavy_check_mark: | Remaining balance available for use. |
|
||||
| `usage` | *float* | :heavy_check_mark: | Total usage consumed in the current period. |
|
||||
@@ -15,4 +15,4 @@
|
||||
| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | Maximum quantity that can be purchased as a top-up, or null for unlimited. |
|
||||
| `next_reset_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the balance will reset, or null for no reset. |
|
||||
| `breakdown` | List[[models.Breakdown](../models/breakdown.md)] | :heavy_minus_sign: | Detailed breakdown of balance sources when stacking multiple plans or grants. |
|
||||
| `rollovers` | List[[models.CustomerRollover](../models/customerrollover.md)] | :heavy_minus_sign: | Rollover balances carried over from previous periods. |
|
||||
| `rollovers` | List[[models.BalanceRollover](../models/balancerollover.md)] | :heavy_minus_sign: | Rollover balances carried over from previous periods. |
|
||||
@@ -1,4 +1,4 @@
|
||||
# CheckBillingMethod
|
||||
# BalanceBillingMethod
|
||||
|
||||
Whether usage is prepaid or billed pay-per-use.
|
||||
|
||||
9
others/python-sdk/docs/models/balancecreditschema.md
Normal file
9
others/python-sdk/docs/models/balancecreditschema.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# BalanceCreditSchema
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- |
|
||||
| `metered_feature_id` | *str* | :heavy_check_mark: | ID of the metered feature that draws from this credit system. |
|
||||
| `credit_cost` | *float* | :heavy_check_mark: | Credits consumed per unit of the metered feature. |
|
||||
11
others/python-sdk/docs/models/balancedisplay.md
Normal file
11
others/python-sdk/docs/models/balancedisplay.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# BalanceDisplay
|
||||
|
||||
Display names for the feature in billing UI and customer-facing components.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
|
||||
| `singular` | *OptionalNullable[str]* | :heavy_minus_sign: | Singular form for UI display (e.g., 'API call', 'seat'). |
|
||||
| `plural` | *OptionalNullable[str]* | :heavy_minus_sign: | Plural form for UI display (e.g., 'API calls', 'seats'). |
|
||||
17
others/python-sdk/docs/models/balancefeature.md
Normal file
17
others/python-sdk/docs/models/balancefeature.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# BalanceFeature
|
||||
|
||||
The full feature object if expanded.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `id` | *str* | :heavy_check_mark: | The unique identifier for this feature, used in /check and /track calls. |
|
||||
| `name` | *str* | :heavy_check_mark: | Human-readable name displayed in the dashboard and billing UI. |
|
||||
| `type` | [models.BalanceType](../models/balancetype.md) | :heavy_check_mark: | Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools. |
|
||||
| `consumable` | *bool* | :heavy_check_mark: | For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage). |
|
||||
| `event_names` | List[*str*] | :heavy_minus_sign: | Event names that trigger this feature's balance. Allows multiple features to respond to a single event. |
|
||||
| `credit_schema` | List[[models.BalanceCreditSchema](../models/balancecreditschema.md)] | :heavy_minus_sign: | For credit_system features: maps metered features to their credit costs. |
|
||||
| `display` | [Optional[models.BalanceDisplay]](../models/balancedisplay.md) | :heavy_minus_sign: | Display names for the feature in billing UI and customer-facing components. |
|
||||
| `archived` | *bool* | :heavy_check_mark: | Whether the feature is archived and hidden from the dashboard. |
|
||||
@@ -1,4 +1,4 @@
|
||||
# CustomerIntervalEnum
|
||||
# BalanceIntervalEnum
|
||||
|
||||
|
||||
## Values
|
||||
12
others/python-sdk/docs/models/balanceprice.md
Normal file
12
others/python-sdk/docs/models/balanceprice.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# BalancePrice
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
|
||||
| `amount` | *Optional[float]* | :heavy_minus_sign: | The per-unit price amount. |
|
||||
| `tiers` | List[[models.BalanceTier](../models/balancetier.md)] | :heavy_minus_sign: | Tiered pricing configuration if applicable. |
|
||||
| `billing_units` | *float* | :heavy_check_mark: | The number of units per billing increment (eg. $9 / 250 units). |
|
||||
| `billing_method` | [models.BalanceBillingMethod](../models/balancebillingmethod.md) | :heavy_check_mark: | Whether usage is prepaid or billed pay-per-use. |
|
||||
| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | Maximum quantity that can be purchased, or null for unlimited. |
|
||||
@@ -1,10 +1,10 @@
|
||||
# CheckReset
|
||||
# BalanceReset
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
||||
| `interval` | [models.CheckIntervalUnion](../models/checkintervalunion.md) | :heavy_check_mark: | The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. |
|
||||
| `interval` | [models.Interval](../models/interval.md) | :heavy_check_mark: | The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. |
|
||||
| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals between resets (eg. 2 for bi-monthly). |
|
||||
| `resets_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the balance will next reset. |
|
||||
@@ -1,4 +1,4 @@
|
||||
# CustomerRollover
|
||||
# BalanceRollover
|
||||
|
||||
|
||||
## Fields
|
||||
9
others/python-sdk/docs/models/balancetier.md
Normal file
9
others/python-sdk/docs/models/balancetier.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# BalanceTier
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ |
|
||||
| `to` | [models.BalanceTo](../models/balanceto.md) | :heavy_check_mark: | N/A |
|
||||
| `amount` | *float* | :heavy_check_mark: | N/A |
|
||||
@@ -1,4 +1,4 @@
|
||||
# CustomerTo
|
||||
# BalanceTo
|
||||
|
||||
|
||||
## Supported Types
|
||||
@@ -1,4 +1,6 @@
|
||||
# CustomerBalancesType
|
||||
# BalanceType
|
||||
|
||||
Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
|
||||
|
||||
|
||||
## Values
|
||||
@@ -12,6 +12,6 @@
|
||||
| `remaining` | *float* | :heavy_check_mark: | Remaining balance available for use. |
|
||||
| `usage` | *float* | :heavy_check_mark: | Amount consumed in the current period. |
|
||||
| `unlimited` | *bool* | :heavy_check_mark: | Whether this balance has unlimited usage. |
|
||||
| `reset` | [Nullable[models.CustomerReset]](../models/customerreset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. |
|
||||
| `price` | [Nullable[models.CustomerPrice]](../models/customerprice.md) | :heavy_check_mark: | Pricing configuration if this balance has usage-based pricing. |
|
||||
| `reset` | [Nullable[models.BalanceReset]](../models/balancereset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. |
|
||||
| `price` | [Nullable[models.BalancePrice]](../models/balanceprice.md) | :heavy_check_mark: | Pricing configuration if this balance has usage-based pricing. |
|
||||
| `expires_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when this balance expires, or null for no expiration. |
|
||||
@@ -1,18 +0,0 @@
|
||||
# CheckBalance
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
|
||||
| `feature_id` | *str* | :heavy_check_mark: | The feature ID this balance is for. |
|
||||
| `feature` | [Optional[models.CheckFeature]](../models/checkfeature.md) | :heavy_minus_sign: | The full feature object if expanded. |
|
||||
| `granted` | *float* | :heavy_check_mark: | Total balance granted (included + prepaid). |
|
||||
| `remaining` | *float* | :heavy_check_mark: | Remaining balance available for use. |
|
||||
| `usage` | *float* | :heavy_check_mark: | Total usage consumed in the current period. |
|
||||
| `unlimited` | *bool* | :heavy_check_mark: | Whether this feature has unlimited usage. |
|
||||
| `overage_allowed` | *bool* | :heavy_check_mark: | Whether usage beyond the granted balance is allowed (with overage charges). |
|
||||
| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | Maximum quantity that can be purchased as a top-up, or null for unlimited. |
|
||||
| `next_reset_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the balance will reset, or null for no reset. |
|
||||
| `breakdown` | List[[models.CheckBreakdown](../models/checkbreakdown.md)] | :heavy_minus_sign: | Detailed breakdown of balance sources when stacking multiple plans or grants. |
|
||||
| `rollovers` | List[[models.CheckBalanceRollover](../models/checkbalancerollover.md)] | :heavy_minus_sign: | Rollover balances carried over from previous periods. |
|
||||
@@ -1,9 +0,0 @@
|
||||
# CheckBalanceDisplay
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------- | ----------------------- | ----------------------- | ----------------------- |
|
||||
| `singular` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `plural` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,16 +0,0 @@
|
||||
# CheckBalanceIntervalEnum
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------- | ------------- |
|
||||
| `ONE_OFF` | one_off |
|
||||
| `MINUTE` | minute |
|
||||
| `HOUR` | hour |
|
||||
| `DAY` | day |
|
||||
| `WEEK` | week |
|
||||
| `MONTH` | month |
|
||||
| `QUARTER` | quarter |
|
||||
| `SEMI_ANNUAL` | semi_annual |
|
||||
| `YEAR` | year |
|
||||
@@ -1,9 +0,0 @@
|
||||
# CheckBalanceRollover
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- |
|
||||
| `balance` | *float* | :heavy_check_mark: | Amount of balance rolled over from a previous period. |
|
||||
| `expires_at` | *float* | :heavy_check_mark: | Timestamp when the rollover balance expires. |
|
||||
@@ -1,17 +0,0 @@
|
||||
# CheckBalanceTo
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `float`
|
||||
|
||||
```python
|
||||
value: float = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
# CheckBreakdown
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
||||
| `id` | *Optional[str]* | :heavy_minus_sign: | The unique identifier for this balance breakdown. |
|
||||
| `plan_id` | *Nullable[str]* | :heavy_check_mark: | The plan ID this balance originates from, or null for standalone balances. |
|
||||
| `included_grant` | *float* | :heavy_check_mark: | Amount granted from the plan's included usage. |
|
||||
| `prepaid_grant` | *float* | :heavy_check_mark: | Amount granted from prepaid purchases or top-ups. |
|
||||
| `remaining` | *float* | :heavy_check_mark: | Remaining balance available for use. |
|
||||
| `usage` | *float* | :heavy_check_mark: | Amount consumed in the current period. |
|
||||
| `unlimited` | *bool* | :heavy_check_mark: | Whether this balance has unlimited usage. |
|
||||
| `reset` | [Nullable[models.CheckReset]](../models/checkreset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. |
|
||||
| `price` | [Nullable[models.CheckPrice]](../models/checkprice.md) | :heavy_check_mark: | Pricing configuration if this balance has usage-based pricing. |
|
||||
| `expires_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when this balance expires, or null for no expiration. |
|
||||
@@ -1,4 +1,4 @@
|
||||
# ProductDisplay
|
||||
# CheckDisplay
|
||||
|
||||
|
||||
## Fields
|
||||
@@ -1,17 +0,0 @@
|
||||
# CheckFeature
|
||||
|
||||
The full feature object if expanded.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
|
||||
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||
| `name` | *str* | :heavy_check_mark: | N/A |
|
||||
| `type` | [models.CheckBalanceType](../models/checkbalancetype.md) | :heavy_check_mark: | N/A |
|
||||
| `consumable` | *bool* | :heavy_check_mark: | N/A |
|
||||
| `event_names` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
| `credit_schema` | List[[models.CheckCreditSchema](../models/checkcreditschema.md)] | :heavy_minus_sign: | N/A |
|
||||
| `display` | [Optional[models.CheckBalanceDisplay]](../models/checkbalancedisplay.md) | :heavy_minus_sign: | N/A |
|
||||
| `archived` | *bool* | :heavy_check_mark: | N/A |
|
||||
@@ -1,4 +1,4 @@
|
||||
# ProductInterval
|
||||
# CheckInterval
|
||||
|
||||
|
||||
## Values
|
||||
@@ -1,19 +0,0 @@
|
||||
# CheckIntervalUnion
|
||||
|
||||
The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `models.CheckBalanceIntervalEnum`
|
||||
|
||||
```python
|
||||
value: models.CheckBalanceIntervalEnum = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
@@ -7,11 +7,11 @@ Product item defining features and pricing within a product
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `type` | [OptionalNullable[models.ProductType]](../models/producttype.md) | :heavy_minus_sign: | The type of the product item |
|
||||
| `type` | [OptionalNullable[models.CheckType]](../models/checktype.md) | :heavy_minus_sign: | The type of the product item |
|
||||
| `feature_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The feature ID of the product item. If the item is a fixed price, should be `null` |
|
||||
| `feature_type` | [OptionalNullable[models.FeatureType]](../models/featuretype.md) | :heavy_minus_sign: | Single use features are used once and then depleted, like API calls or credits. Continuous use features are those being used on an ongoing-basis, like storage or seats. |
|
||||
| `included_usage` | [OptionalNullable[models.IncludedUsage]](../models/includedusage.md) | :heavy_minus_sign: | The amount of usage included for this feature. |
|
||||
| `interval` | [OptionalNullable[models.ProductInterval]](../models/productinterval.md) | :heavy_minus_sign: | The reset or billing interval of the product item. If null, feature will have no reset date, and if there's a price, it will be billed one-off. |
|
||||
| `interval` | [OptionalNullable[models.CheckInterval]](../models/checkinterval.md) | :heavy_minus_sign: | The reset or billing interval of the product item. If null, feature will have no reset date, and if there's a price, it will be billed one-off. |
|
||||
| `interval_count` | *OptionalNullable[float]* | :heavy_minus_sign: | The interval count of the product item. |
|
||||
| `price` | *OptionalNullable[float]* | :heavy_minus_sign: | The price of the product item. Should be `null` if tiered pricing is set. |
|
||||
| `tiers` | List[[models.Tiers](../models/tiers.md)] | :heavy_minus_sign: | Tiered pricing for the product item. Not applicable for fixed price items. |
|
||||
@@ -19,7 +19,7 @@ Product item defining features and pricing within a product
|
||||
| `billing_units` | *OptionalNullable[float]* | :heavy_minus_sign: | The amount per billing unit (eg. $9 / 250 units) |
|
||||
| `reset_usage_when_enabled` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether the usage should be reset when the product is enabled. |
|
||||
| `entity_feature_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The entity feature ID of the product item if applicable. |
|
||||
| `display` | [OptionalNullable[models.ProductDisplay]](../models/productdisplay.md) | :heavy_minus_sign: | The display of the product item. |
|
||||
| `display` | [OptionalNullable[models.CheckDisplay]](../models/checkdisplay.md) | :heavy_minus_sign: | The display of the product item. |
|
||||
| `quantity` | *OptionalNullable[float]* | :heavy_minus_sign: | Used in customer context. Quantity of the feature the customer has prepaid for. |
|
||||
| `next_cycle_quantity` | *OptionalNullable[float]* | :heavy_minus_sign: | Used in customer context. Quantity of the feature the customer will prepay for in the next cycle. |
|
||||
| `config` | [OptionalNullable[models.Config]](../models/config.md) | :heavy_minus_sign: | Configuration for rollover and proration behavior of the feature. |
|
||||
@@ -1,12 +0,0 @@
|
||||
# CheckPrice
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- |
|
||||
| `amount` | *Optional[float]* | :heavy_minus_sign: | The per-unit price amount. |
|
||||
| `tiers` | List[[models.CheckTier](../models/checktier.md)] | :heavy_minus_sign: | Tiered pricing configuration if applicable. |
|
||||
| `billing_units` | *float* | :heavy_check_mark: | The number of units per billing increment (eg. $9 / 250 units). |
|
||||
| `billing_method` | [models.CheckBillingMethod](../models/checkbillingmethod.md) | :heavy_check_mark: | Whether usage is prepaid or billed pay-per-use. |
|
||||
| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | Maximum quantity that can be purchased, or null for unlimited. |
|
||||
@@ -11,5 +11,5 @@ OK
|
||||
| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer that was checked. | |
|
||||
| `entity_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The ID of the entity, if an entity-scoped check was performed. | |
|
||||
| `required_balance` | *Optional[float]* | :heavy_minus_sign: | The required balance that was checked against. | |
|
||||
| `balance` | [Nullable[models.CheckBalance]](../models/checkbalance.md) | :heavy_check_mark: | The customer's balance for this feature. Null if the customer has no balance for this feature. | {<br/>"feature_id": "messages",<br/>"granted": 100,<br/>"remaining": 72,<br/>"usage": 28,<br/>"unlimited": false,<br/>"overage_allowed": false,<br/>"max_purchase": null,<br/>"next_reset_at": 1773851121437,<br/>"breakdown": [<br/>{<br/>"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV",<br/>"plan_id": "pro_plan",<br/>"included_grant": 100,<br/>"prepaid_grant": 0,<br/>"remaining": 72,<br/>"usage": 28,<br/>"unlimited": false,<br/>"reset": {<br/>"interval": "month",<br/>"resets_at": 1773851121437<br/>},<br/>"price": null,<br/>"expires_at": null<br/>}<br/>]<br/>} |
|
||||
| `balance` | [Nullable[models.Balance]](../models/balance.md) | :heavy_check_mark: | The customer's balance for this feature. Null if the customer has no balance for this feature. | {<br/>"feature_id": "messages",<br/>"granted": 100,<br/>"remaining": 72,<br/>"usage": 28,<br/>"unlimited": false,<br/>"overage_allowed": false,<br/>"max_purchase": null,<br/>"next_reset_at": 1773851121437,<br/>"breakdown": [<br/>{<br/>"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV",<br/>"plan_id": "pro_plan",<br/>"included_grant": 100,<br/>"prepaid_grant": 0,<br/>"remaining": 72,<br/>"usage": 28,<br/>"unlimited": false,<br/>"reset": {<br/>"interval": "month",<br/>"resets_at": 1773851121437<br/>},<br/>"price": null,<br/>"expires_at": null<br/>}<br/>]<br/>} |
|
||||
| `preview` | [Optional[models.Preview]](../models/preview.md) | :heavy_minus_sign: | Upgrade/upsell information when access is denied. Only present if with_preview was true and allowed is false. | |
|
||||
@@ -1,4 +1,4 @@
|
||||
# ConfigRollover
|
||||
# CheckRollover
|
||||
|
||||
|
||||
## Fields
|
||||
@@ -1,9 +0,0 @@
|
||||
# CheckTier
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- |
|
||||
| `to` | [models.CheckBalanceTo](../models/checkbalanceto.md) | :heavy_check_mark: | N/A |
|
||||
| `amount` | *float* | :heavy_check_mark: | N/A |
|
||||
@@ -1,4 +1,4 @@
|
||||
# TiersTo
|
||||
# CheckTo
|
||||
|
||||
The maximum amount of usage for this tier.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# ProductType
|
||||
# CheckType
|
||||
|
||||
|
||||
## Values
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
|
||||
| `rollover` | [OptionalNullable[models.ConfigRollover]](../models/configrollover.md) | :heavy_minus_sign: | N/A |
|
||||
| `rollover` | [OptionalNullable[models.CheckRollover]](../models/checkrollover.md) | :heavy_minus_sign: | N/A |
|
||||
| `on_increase` | [OptionalNullable[models.CheckOnIncrease]](../models/checkonincrease.md) | :heavy_minus_sign: | N/A |
|
||||
| `on_decrease` | [OptionalNullable[models.CheckOnDecrease]](../models/checkondecrease.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -11,5 +11,4 @@
|
||||
| `included` | *Optional[float]* | :heavy_minus_sign: | The initial balance amount to grant. For metered features, this is the number of units the customer can use. |
|
||||
| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | If true, the balance has unlimited usage. Cannot be combined with 'included'. |
|
||||
| `reset` | [Optional[models.CreateBalanceReset]](../models/createbalancereset.md) | :heavy_minus_sign: | Reset configuration for the balance. If not provided, the balance is a one-time grant that never resets. |
|
||||
| `expires_at` | *Optional[float]* | :heavy_minus_sign: | Unix timestamp (milliseconds) when the balance expires. Mutually exclusive with reset. |
|
||||
| `granted_balance` | *Optional[float]* | :heavy_minus_sign: | N/A |
|
||||
| `expires_at` | *Optional[float]* | :heavy_minus_sign: | Unix timestamp (milliseconds) when the balance expires. Mutually exclusive with reset. |
|
||||
@@ -1,18 +0,0 @@
|
||||
# CreateEntityBalances
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
|
||||
| `feature_id` | *str* | :heavy_check_mark: | The feature ID this balance is for. |
|
||||
| `feature` | [Optional[models.CreateEntityFeature]](../models/createentityfeature.md) | :heavy_minus_sign: | The full feature object if expanded. |
|
||||
| `granted` | *float* | :heavy_check_mark: | Total balance granted (included + prepaid). |
|
||||
| `remaining` | *float* | :heavy_check_mark: | Remaining balance available for use. |
|
||||
| `usage` | *float* | :heavy_check_mark: | Total usage consumed in the current period. |
|
||||
| `unlimited` | *bool* | :heavy_check_mark: | Whether this feature has unlimited usage. |
|
||||
| `overage_allowed` | *bool* | :heavy_check_mark: | Whether usage beyond the granted balance is allowed (with overage charges). |
|
||||
| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | Maximum quantity that can be purchased as a top-up, or null for unlimited. |
|
||||
| `next_reset_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the balance will reset, or null for no reset. |
|
||||
| `breakdown` | List[[models.CreateEntityBreakdown](../models/createentitybreakdown.md)] | :heavy_minus_sign: | Detailed breakdown of balance sources when stacking multiple plans or grants. |
|
||||
| `rollovers` | List[[models.CreateEntityRollover](../models/createentityrollover.md)] | :heavy_minus_sign: | Rollover balances carried over from previous periods. |
|
||||
@@ -1,11 +0,0 @@
|
||||
# CreateEntityBillingMethod
|
||||
|
||||
Whether usage is prepaid or billed pay-per-use.
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------- | ------------- |
|
||||
| `PREPAID` | prepaid |
|
||||
| `USAGE_BASED` | usage_based |
|
||||
@@ -1,17 +0,0 @@
|
||||
# CreateEntityBreakdown
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
||||
| `id` | *Optional[str]* | :heavy_minus_sign: | The unique identifier for this balance breakdown. |
|
||||
| `plan_id` | *Nullable[str]* | :heavy_check_mark: | The plan ID this balance originates from, or null for standalone balances. |
|
||||
| `included_grant` | *float* | :heavy_check_mark: | Amount granted from the plan's included usage. |
|
||||
| `prepaid_grant` | *float* | :heavy_check_mark: | Amount granted from prepaid purchases or top-ups. |
|
||||
| `remaining` | *float* | :heavy_check_mark: | Remaining balance available for use. |
|
||||
| `usage` | *float* | :heavy_check_mark: | Amount consumed in the current period. |
|
||||
| `unlimited` | *bool* | :heavy_check_mark: | Whether this balance has unlimited usage. |
|
||||
| `reset` | [Nullable[models.CreateEntityReset]](../models/createentityreset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. |
|
||||
| `price` | [Nullable[models.CreateEntityPrice]](../models/createentityprice.md) | :heavy_check_mark: | Pricing configuration if this balance has usage-based pricing. |
|
||||
| `expires_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when this balance expires, or null for no expiration. |
|
||||
@@ -1,9 +0,0 @@
|
||||
# CreateEntityCreditSchema
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------- | -------------------- | -------------------- | -------------------- |
|
||||
| `metered_feature_id` | *str* | :heavy_check_mark: | N/A |
|
||||
| `credit_cost` | *float* | :heavy_check_mark: | N/A |
|
||||
@@ -1,9 +0,0 @@
|
||||
# CreateEntityDisplay
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------- | ----------------------- | ----------------------- | ----------------------- |
|
||||
| `singular` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `plural` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,17 +0,0 @@
|
||||
# CreateEntityFeature
|
||||
|
||||
The full feature object if expanded.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
|
||||
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||
| `name` | *str* | :heavy_check_mark: | N/A |
|
||||
| `type` | [models.CreateEntityType](../models/createentitytype.md) | :heavy_check_mark: | N/A |
|
||||
| `consumable` | *bool* | :heavy_check_mark: | N/A |
|
||||
| `event_names` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
| `credit_schema` | List[[models.CreateEntityCreditSchema](../models/createentitycreditschema.md)] | :heavy_minus_sign: | N/A |
|
||||
| `display` | [Optional[models.CreateEntityDisplay]](../models/createentitydisplay.md) | :heavy_minus_sign: | N/A |
|
||||
| `archived` | *bool* | :heavy_check_mark: | N/A |
|
||||
@@ -1,16 +0,0 @@
|
||||
# CreateEntityIntervalEnum
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------- | ------------- |
|
||||
| `ONE_OFF` | one_off |
|
||||
| `MINUTE` | minute |
|
||||
| `HOUR` | hour |
|
||||
| `DAY` | day |
|
||||
| `WEEK` | week |
|
||||
| `MONTH` | month |
|
||||
| `QUARTER` | quarter |
|
||||
| `SEMI_ANNUAL` | semi_annual |
|
||||
| `YEAR` | year |
|
||||
@@ -1,19 +0,0 @@
|
||||
# CreateEntityIntervalUnion
|
||||
|
||||
The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `models.CreateEntityIntervalEnum`
|
||||
|
||||
```python
|
||||
value: models.CreateEntityIntervalEnum = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# CreateEntityPrice
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
||||
| `amount` | *Optional[float]* | :heavy_minus_sign: | The per-unit price amount. |
|
||||
| `tiers` | List[[models.CreateEntityTier](../models/createentitytier.md)] | :heavy_minus_sign: | Tiered pricing configuration if applicable. |
|
||||
| `billing_units` | *float* | :heavy_check_mark: | The number of units per billing increment (eg. $9 / 250 units). |
|
||||
| `billing_method` | [models.CreateEntityBillingMethod](../models/createentitybillingmethod.md) | :heavy_check_mark: | Whether usage is prepaid or billed pay-per-use. |
|
||||
| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | Maximum quantity that can be purchased, or null for unlimited. |
|
||||
@@ -1,10 +0,0 @@
|
||||
# CreateEntityReset
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
||||
| `interval` | [models.CreateEntityIntervalUnion](../models/createentityintervalunion.md) | :heavy_check_mark: | The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. |
|
||||
| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals between resets (eg. 2 for bi-monthly). |
|
||||
| `resets_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the balance will next reset. |
|
||||
@@ -16,5 +16,5 @@ OK
|
||||
| `env` | [models.CreateEntityEnv](../models/createentityenv.md) | :heavy_check_mark: | The environment (sandbox/live) |
|
||||
| `subscriptions` | List[[models.CreateEntitySubscription](../models/createentitysubscription.md)] | :heavy_check_mark: | N/A |
|
||||
| `purchases` | List[[models.CreateEntityPurchase](../models/createentitypurchase.md)] | :heavy_check_mark: | N/A |
|
||||
| `balances` | Dict[str, [models.CreateEntityBalances](../models/createentitybalances.md)] | :heavy_check_mark: | N/A |
|
||||
| `balances` | Dict[str, [models.Balance](../models/balance.md)] | :heavy_check_mark: | N/A |
|
||||
| `invoices` | List[[models.CreateEntityInvoice](../models/createentityinvoice.md)] | :heavy_minus_sign: | Invoices for this entity (only included when expand=invoices) |
|
||||
@@ -1,9 +0,0 @@
|
||||
# CreateEntityRollover
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- |
|
||||
| `balance` | *float* | :heavy_check_mark: | Amount of balance rolled over from a previous period. |
|
||||
| `expires_at` | *float* | :heavy_check_mark: | Timestamp when the rollover balance expires. |
|
||||
@@ -1,9 +0,0 @@
|
||||
# CreateEntityTier
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- |
|
||||
| `to` | [models.CreateEntityTo](../models/createentityto.md) | :heavy_check_mark: | N/A |
|
||||
| `amount` | *float* | :heavy_check_mark: | N/A |
|
||||
@@ -1,17 +0,0 @@
|
||||
# CreateEntityTo
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `float`
|
||||
|
||||
```python
|
||||
value: float = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# CustomerCreditSchema
|
||||
# CreateFeatureCreditSchemaRequest
|
||||
|
||||
|
||||
## Fields
|
||||
@@ -0,0 +1,9 @@
|
||||
# CreateFeatureCreditSchemaResponse
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- |
|
||||
| `metered_feature_id` | *str* | :heavy_check_mark: | ID of the metered feature that draws from this credit system. |
|
||||
| `credit_cost` | *float* | :heavy_check_mark: | Credits consumed per unit of the metered feature. |
|
||||
11
others/python-sdk/docs/models/createfeaturedisplayrequest.md
Normal file
11
others/python-sdk/docs/models/createfeaturedisplayrequest.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# CreateFeatureDisplayRequest
|
||||
|
||||
Singular and plural display names for the feature in your user interface.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `singular` | *str* | :heavy_check_mark: | N/A |
|
||||
| `plural` | *str* | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,11 @@
|
||||
# CreateFeatureDisplayResponse
|
||||
|
||||
Display names for the feature in billing UI and customer-facing components.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
|
||||
| `singular` | *OptionalNullable[str]* | :heavy_minus_sign: | Singular form for UI display (e.g., 'API call', 'seat'). |
|
||||
| `plural` | *OptionalNullable[str]* | :heavy_minus_sign: | Plural form for UI display (e.g., 'API calls', 'seats'). |
|
||||
@@ -1,9 +1,8 @@
|
||||
# ListCustomersTier
|
||||
# CreateFeatureGlobals
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `to` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `amount` | *float* | :heavy_check_mark: | N/A |
|
||||
| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
14
others/python-sdk/docs/models/createfeatureparams.md
Normal file
14
others/python-sdk/docs/models/createfeatureparams.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# CreateFeatureParams
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `name` | *str* | :heavy_check_mark: | The name of the feature. |
|
||||
| `type` | [models.CreateFeatureTypeRequest](../models/createfeaturetyperequest.md) | :heavy_check_mark: | The type of the feature. 'single_use' features are consumed, like API calls, tokens, or messages. 'continuous_use' features are allocated, like seats, workspaces, or projects. 'credit_system' features are schemas that unify multiple 'single_use' features into a single credit system. |
|
||||
| `consumable` | *Optional[bool]* | :heavy_minus_sign: | Whether this feature is consumable. A consumable feature is one that periodically resets and is consumed rather than allocated (like credits, API requests, etc.). Applicable only for 'metered' features. |
|
||||
| `display` | [Optional[models.CreateFeatureDisplayRequest]](../models/createfeaturedisplayrequest.md) | :heavy_minus_sign: | Singular and plural display names for the feature in your user interface. |
|
||||
| `credit_schema` | List[[models.CreateFeatureCreditSchemaRequest](../models/createfeaturecreditschemarequest.md)] | :heavy_minus_sign: | A schema that maps 'single_use' feature IDs to credit costs. Applicable only for 'credit_system' features. |
|
||||
| `event_names` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature to create. |
|
||||
17
others/python-sdk/docs/models/createfeatureresponse.md
Normal file
17
others/python-sdk/docs/models/createfeatureresponse.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# CreateFeatureResponse
|
||||
|
||||
OK
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `id` | *str* | :heavy_check_mark: | The unique identifier for this feature, used in /check and /track calls. |
|
||||
| `name` | *str* | :heavy_check_mark: | Human-readable name displayed in the dashboard and billing UI. |
|
||||
| `type` | [models.CreateFeatureTypeResponse](../models/createfeaturetyperesponse.md) | :heavy_check_mark: | Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools. |
|
||||
| `consumable` | *bool* | :heavy_check_mark: | For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage). |
|
||||
| `event_names` | List[*str*] | :heavy_minus_sign: | Event names that trigger this feature's balance. Allows multiple features to respond to a single event. |
|
||||
| `credit_schema` | List[[models.CreateFeatureCreditSchemaResponse](../models/createfeaturecreditschemaresponse.md)] | :heavy_minus_sign: | For credit_system features: maps metered features to their credit costs. |
|
||||
| `display` | [Optional[models.CreateFeatureDisplayResponse]](../models/createfeaturedisplayresponse.md) | :heavy_minus_sign: | Display names for the feature in billing UI and customer-facing components. |
|
||||
| `archived` | *bool* | :heavy_check_mark: | Whether the feature is archived and hidden from the dashboard. |
|
||||
12
others/python-sdk/docs/models/createfeaturetyperequest.md
Normal file
12
others/python-sdk/docs/models/createfeaturetyperequest.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# CreateFeatureTypeRequest
|
||||
|
||||
The type of the feature. 'single_use' features are consumed, like API calls, tokens, or messages. 'continuous_use' features are allocated, like seats, workspaces, or projects. 'credit_system' features are schemas that unify multiple 'single_use' features into a single credit system.
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| --------------- | --------------- |
|
||||
| `BOOLEAN` | boolean |
|
||||
| `METERED` | metered |
|
||||
| `CREDIT_SYSTEM` | credit_system |
|
||||
@@ -1,4 +1,6 @@
|
||||
# CheckBalanceType
|
||||
# CreateFeatureTypeResponse
|
||||
|
||||
Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
|
||||
|
||||
|
||||
## Values
|
||||
@@ -16,7 +16,7 @@
|
||||
| `send_email_receipts` | *bool* | :heavy_check_mark: | Whether to send email receipts to the customer. |
|
||||
| `subscriptions` | List[[models.Subscription](../models/subscription.md)] | :heavy_check_mark: | Active and scheduled recurring plans that this customer has attached. |
|
||||
| `purchases` | List[[models.Purchase](../models/purchase.md)] | :heavy_check_mark: | One-time purchases made by the customer. |
|
||||
| `balances` | Dict[str, [models.Balances](../models/balances.md)] | :heavy_check_mark: | Feature balances keyed by feature ID, showing usage limits and remaining amounts. |
|
||||
| `balances` | Dict[str, [models.Balance](../models/balance.md)] | :heavy_check_mark: | Feature balances keyed by feature ID, showing usage limits and remaining amounts. |
|
||||
| `invoices` | List[[models.Invoice](../models/invoice.md)] | :heavy_minus_sign: | N/A |
|
||||
| `entities` | List[[models.Entity](../models/entity.md)] | :heavy_minus_sign: | N/A |
|
||||
| `trials_used` | List[[models.TrialsUsed](../models/trialsused.md)] | :heavy_minus_sign: | N/A |
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# CustomerBillingMethod
|
||||
|
||||
Whether usage is prepaid or billed pay-per-use.
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------- | ------------- |
|
||||
| `PREPAID` | prepaid |
|
||||
| `USAGE_BASED` | usage_based |
|
||||
@@ -1,9 +0,0 @@
|
||||
# CustomerDisplay
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------- | ----------------------- | ----------------------- | ----------------------- |
|
||||
| `singular` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `plural` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,17 +0,0 @@
|
||||
# CustomerFeature
|
||||
|
||||
The full feature object if expanded.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- |
|
||||
| `id` | *str* | :heavy_check_mark: | N/A |
|
||||
| `name` | *str* | :heavy_check_mark: | N/A |
|
||||
| `type` | [models.CustomerBalancesType](../models/customerbalancestype.md) | :heavy_check_mark: | N/A |
|
||||
| `consumable` | *bool* | :heavy_check_mark: | N/A |
|
||||
| `event_names` | List[*str*] | :heavy_minus_sign: | N/A |
|
||||
| `credit_schema` | List[[models.CustomerCreditSchema](../models/customercreditschema.md)] | :heavy_minus_sign: | N/A |
|
||||
| `display` | [Optional[models.CustomerDisplay]](../models/customerdisplay.md) | :heavy_minus_sign: | N/A |
|
||||
| `archived` | *bool* | :heavy_check_mark: | N/A |
|
||||
@@ -1,10 +0,0 @@
|
||||
# CustomerReset
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
||||
| `interval` | [models.CustomerIntervalUnion](../models/customerintervalunion.md) | :heavy_check_mark: | The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. |
|
||||
| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals between resets (eg. 2 for bi-monthly). |
|
||||
| `resets_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the balance will next reset. |
|
||||
@@ -1,9 +0,0 @@
|
||||
# CustomerTier
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- |
|
||||
| `to` | [models.CustomerTo](../models/customerto.md) | :heavy_check_mark: | N/A |
|
||||
| `amount` | *float* | :heavy_check_mark: | N/A |
|
||||
@@ -1,4 +1,4 @@
|
||||
# RewardsType
|
||||
# CustomerType
|
||||
|
||||
The type of reward
|
||||
|
||||
8
others/python-sdk/docs/models/deletefeatureglobals.md
Normal file
8
others/python-sdk/docs/models/deletefeatureglobals.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# DeleteFeatureGlobals
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
8
others/python-sdk/docs/models/deletefeatureparams.md
Normal file
8
others/python-sdk/docs/models/deletefeatureparams.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# DeleteFeatureParams
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- |
|
||||
| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature to delete. |
|
||||
10
others/python-sdk/docs/models/deletefeatureresponse.md
Normal file
10
others/python-sdk/docs/models/deletefeatureresponse.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# DeleteFeatureResponse
|
||||
|
||||
OK
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `success` | *bool* | :heavy_check_mark: | N/A |
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user