diff --git a/.claude/commands/add-to-autumn-js.md b/.claude/commands/add-to-autumn-js.md new file mode 100644 index 000000000..35744b62b --- /dev/null +++ b/.claude/commands/add-to-autumn-js.md @@ -0,0 +1,84 @@ +--- +description: Add a new Autumn API endpoint into autumn-js (backend route, generated schemas, better-auth plugin, React hooks, docs, and sdk-test UI) +argument-hint: [endpoint-name] [sdk-namespace.method] +--- + +# Add to Autumn JS + +Add a new endpoint end-to-end in `packages/autumn-js` following existing patterns (especially billing attach/open portal). + +## Inputs you need + +- Endpoint route name in autumn-js (example: `openCustomerPortal`) +- SDK method path (example: `autumn.billing.openCustomerPortal(args)`) +- SDK model file in `packages/sdk/src/models` (example: `open-customer-portal-op.ts`) +- Whether frontend helper needs redirect behavior (`openInNewTab`) and default URL behavior + +## Required implementation checklist + +1. Update backend route names and route config: +- `packages/autumn-js/src/backend/core/types/routeTypes.ts` + - Add to `ROUTE_NAMES` +- `packages/autumn-js/src/backend/core/routes/routeConfigs.ts` + - Add route entry with `route`, `sdkMethod`, and `bodySchema` + - Import schema from `packages/autumn-js/src/generated` + +2. Update schema generation for better-auth body validation: +- `packages/openapi/utils/zodSchemaGeneration.ts` + - Add `SCHEMA_SOURCES` entry for the SDK model file +- Ensure generated schema file exists in `packages/autumn-js/src/generated/` + - If not generated yet, add it manually using the same style as existing generated files +- Export it from `packages/autumn-js/src/generated/index.ts` + +3. Update better-auth plugin endpoint map: +- `packages/autumn-js/src/better-auth/index.ts` + - Add `createAutumnEndpoint("", handleRoute)` + +4. Update client and types: +- `packages/autumn-js/src/types/params.ts` + - Add client params type (usually omit protected fields, add `openInNewTab?` when redirecting) +- `packages/autumn-js/src/types/index.ts` + - Re-export alias +- `packages/autumn-js/src/react/index.ts` + - Export the new client params type +- `packages/autumn-js/src/react/client/IAutumnClient.ts` + - Add interface method +- `packages/autumn-js/src/react/client/AutumnClient.ts` + - Add HTTP route call + +5. Update hook actions and docs: +- `packages/autumn-js/src/react/hooks/internal/useCustomerActions.ts` + - Add method implementation + - If redirect flow: support `openInNewTab` and default `returnUrl` to `window.location.href` +- `packages/autumn-js/src/react/hooks/useCustomer.ts` + - Add method to `UseCustomerResult` + - Add concise JSDoc for the method and update return summary + +6. Add sdk-test scenario controls: +- `apps/sdk-test/app/scenarios/core/use-autumn/page.tsx` + - Add new action tab/button + - Add compact input(s) for required params (for billing portal include `returnUrl`) + - Wire action through `runAction` + +## Billing endpoint specifics + +For billing endpoints with redirect URLs: +- Add `openInNewTab?: boolean` to frontend client params type +- In `useCustomerActions`, default `returnUrl` to `window.location.href` when missing +- Reuse the existing `redirectToUrl` helper pattern from `attach` + +## Validation checklist + +- Run scoped Biome checks only on touched files: +`bunx biome check ` +- If formatting/import issues appear, run: +`bunx biome check --write ` +- Avoid running `dev` or `build` commands. + +## Done criteria + +- Route works in backend core handler and better-auth endpoints +- Generated schema is available and imported in route config +- React client + hook exposes the new action +- `useCustomer` type/JSDoc includes it +- sdk-test page has a working action button and inputs diff --git a/apps/docs/CLAUDE.md b/apps/docs/CLAUDE.md index eb9f55270..662145f1c 100644 --- a/apps/docs/CLAUDE.md +++ b/apps/docs/CLAUDE.md @@ -1,5 +1,16 @@ When writing the docs, always make sure to add it to `docs.json` for it to appear +## Manual API Documentation + +Manual documentation (explanations, examples, use cases) should go in `api-reference-generator/` folder, NOT in `mintlify/api-reference/`. The generator merges manual content from `api-reference-generator/` with auto-generated body params and outputs the final result to `mintlify/api-reference/`. + +**Workflow:** +1. Create/edit manual docs in `apps/docs/api-reference-generator//.mdx` +2. Run the generator to merge with generated params +3. Output goes to `apps/docs/mintlify/api-reference//.mdx` + +**Never edit files directly in `mintlify/api-reference/`** - they will be overwritten by the generator. + ## DynamicParamField Component **Location:** `snippets/dynamic-param-field.jsx` diff --git a/apps/docs/api-reference-generator/billing/billingAttach.mdx b/apps/docs/api-reference-generator/billing/billingAttach.mdx new file mode 100644 index 000000000..42b64e01d --- /dev/null +++ b/apps/docs/api-reference-generator/billing/billingAttach.mdx @@ -0,0 +1,53 @@ +--- +title: "Attach" +openapi: "openapi POST /v1/billing.attach" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + + + The attach endpoint subscribes a customer to a plan. It handles new subscriptions, upgrades, and downgrades automatically. For modifying an existing subscription (like changing quantities or canceling), use [update](/api-reference/billing/billingUpdate) instead. + + +### Common Use Cases + + + +```typescript Subscribe to a plan +const response = await autumn.billing.attach({ + customerId: "cus_123", + planId: "pro_plan" +}); + +if (response.paymentUrl) { + // Redirect customer to checkout + window.location.href = response.paymentUrl; +} +``` + +```typescript Custom pricing +const response = await autumn.billing.attach({ + customerId: "cus_123", + planId: "enterprise_plan", + customize: { + price: { + amount: 99900, // $999.00 + interval: "month" + } + } +}); +``` + +```typescript Attach plan with prepaid quantities +const response = await autumn.billing.attach({ + customerId: "cus_123", + planId: "team_plan", + featureQuantities: [ + { featureId: "seats", quantity: 5 } + ] +}); +``` + + diff --git a/apps/docs/api-reference-generator/billing/billingUpdate.mdx b/apps/docs/api-reference-generator/billing/billingUpdate.mdx new file mode 100644 index 000000000..5caa4ec86 --- /dev/null +++ b/apps/docs/api-reference-generator/billing/billingUpdate.mdx @@ -0,0 +1,42 @@ +--- +title: "Update Subscription" +openapi: "openapi POST /v1/billing.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"; + + + The update endpoint modifies an existing subscription. Use this to change prepaid quantities, cancel subscriptions, or modify plan configuration. For subscribing to a new plan, use [attach](/api-reference/billing/billingAttach) instead. + + +### Common Use Cases + + + +```typescript Update prepaid quantity +const response = await autumn.billing.update({ + customerId: "cus_123", + planId: "pro_plan", + featureQuantities: [{ featureId: "seats", quantity: 10 }] +}); +``` + +```typescript Cancel at end of cycle +const response = await autumn.billing.update({ + customerId: "cus_123", + planId: "pro_plan", + cancelAction: "cancel_end_of_cycle" +}); +``` + +```typescript Uncancel subscription +const response = await autumn.billing.update({ + customerId: "cus_123", + planId: "pro_plan", + cancelAction: "uncancel" +}); +``` + + diff --git a/apps/docs/api-reference-generator/billing/update.mdx b/apps/docs/api-reference-generator/billing/update.mdx new file mode 100644 index 000000000..05be5fd59 --- /dev/null +++ b/apps/docs/api-reference-generator/billing/update.mdx @@ -0,0 +1,53 @@ +--- +title: "Update Subscription" +openapi: "openapi POST /v1/billing.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"; + + + The update endpoint modifies an existing subscription. Use this to change prepaid quantities, cancel subscriptions, or modify plan configuration. For subscribing to a new plan, use [attach](/api-reference/billing/attach) instead. + + +## Common Use Cases + + + + Change the quantity of a prepaid feature (like seats) on an existing subscription. + + ```typescript + const response = await autumn.billing.update({ + customerId: "cus_123", + planId: "pro_plan", + featureQuantities: [{ featureId: "seats", quantity: 10 }] + }); + ``` + + + + Schedule a subscription to cancel at the end of the current billing period. The customer retains access until then. + + ```typescript + const response = await autumn.billing.update({ + customerId: "cus_123", + planId: "pro_plan", + cancelAction: "cancel_end_of_cycle" + }); + ``` + + + + Reactivate a subscription that was scheduled for cancellation. + + ```typescript + const response = await autumn.billing.update({ + customerId: "cus_123", + planId: "pro_plan", + cancelAction: "uncancel" + }); + ``` + + + diff --git a/apps/docs/api-reference-generator/core/check.mdx b/apps/docs/api-reference-generator/core/check.mdx new file mode 100644 index 000000000..3a597e700 --- /dev/null +++ b/apps/docs/api-reference-generator/core/check.mdx @@ -0,0 +1,40 @@ +--- +title: "Check Permissions" +openapi: "openapi POST /v1/balances.check" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + + + Check determines if a customer has access to a feature based on their current balance. Returns `allowed: true` if they have sufficient balance, the feature is unlimited, or it's a boolean feature included in their plan. + + +### Common Use Cases + + + +```typescript Check feature access +const { allowed, balance } = await autumn.check({ + customerId: "cus_123", + featureId: "ai_messages" +}); + +if (!allowed) { + // Show upgrade prompt or paywall +} + +console.log(`You have ${balance.remaining} messages left`); +``` + +```typescript Check and track atomically +const { allowed } = await autumn.check({ + customerId: "cus_123", + featureId: "api_calls", + requiredBalance: 1, + sendEvent: true // Deducts usage if allowed +}); +``` + + diff --git a/apps/docs/api-reference-generator/core/track.mdx b/apps/docs/api-reference-generator/core/track.mdx new file mode 100644 index 000000000..de32a4d1e --- /dev/null +++ b/apps/docs/api-reference-generator/core/track.mdx @@ -0,0 +1,43 @@ +--- +title: "Track Usage" +openapi: "openapi POST /v1/balances.track" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + + + Track records usage events to decrement a customer's balance. Use this to meter feature consumption like API calls, messages sent, or credits used. + + +### Common Use Cases + + + +```typescript Track single usage +await autumn.track({ + customerId: "cus_123", + featureId: "ai_messages", + value: 1 +}); +``` + +```typescript Track with idempotency +await autumn.track({ + customerId: "cus_123", + featureId: "api_calls", + value: 1, + idempotencyKey: "request_abc123" // Prevents duplicate tracking on retry +}); +``` + +```typescript Credit balance (negative value) +await autumn.track({ + customerId: "cus_123", + featureId: "seats", + value: -1 // Increases balance when removing a seat +}); +``` + + diff --git a/apps/docs/api-reference-generator/events/aggregateEvents.mdx b/apps/docs/api-reference-generator/events/aggregateEvents.mdx new file mode 100644 index 000000000..1370dd031 --- /dev/null +++ b/apps/docs/api-reference-generator/events/aggregateEvents.mdx @@ -0,0 +1,95 @@ +--- +title: "Aggregate Events" +openapi: "openapi POST /v1/events.aggregate" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property. + +## Working with Properties + +When tracking events, you can attach custom properties that can later be used for grouping aggregations: + +```typescript +// Track an event with properties +await autumn.track({ + customerId: "cus_123", + featureId: "api_calls", + value: 1, + properties: { + model: "gpt-4", + source: "api", + region: "us-east" + } +}); +``` + +You can then aggregate events grouped by any property using the `group_by` parameter: + +```typescript +const result = await autumn.events.aggregate({ + customerId: "cus_123", + featureId: "api_calls", + range: "7d", + groupBy: "properties.model" // Group by the "model" property +}); +``` + +## Response Format + +The response structure changes based on whether `group_by` is provided: + +### Without `group_by` (Flat Response) + +When no grouping is specified, `values` contains the aggregated sum for each feature: + +```json +{ + "list": [ + { + "period": 1762905600000, + "values": { + "api_calls": 150, + "messages": 45 + } + } + ], + "total": { + "api_calls": { "count": 10, "sum": 150 }, + "messages": { "count": 5, "sum": 45 } + } +} +``` + +### With `group_by` (Grouped Response) + +When grouping is specified, `values` contains the total sum while `grouped_values` breaks down values by group: + +```json +{ + "list": [ + { + "period": 1762905600000, + "values": { + "api_calls": 150 + }, + "grouped_values": { + "api_calls": { + "gpt-4": 100, + "gpt-3.5": 50 + } + } + } + ], + "total": { + "api_calls": { "count": 10, "sum": 150 } + } +} +``` + + + The `grouped_values` field is only present when `group_by` is provided in the request. + diff --git a/apps/docs/mintlify/api-reference/balances/balancesTrack.mdx b/apps/docs/mintlify/api-reference/balances/balancesTrack.mdx deleted file mode 100644 index 099d394a1..000000000 --- a/apps/docs/mintlify/api-reference/balances/balancesTrack.mdx +++ /dev/null @@ -1,176 +0,0 @@ ---- -title: "Balances Track" -openapi: "openapi POST /v1/balances.track" ---- - -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 - - - ID which you provided when creating the customer - - - - ID of the feature to track usage for. Required if event_name is not provided. Use this for direct feature tracking. - - - - An [event name](/features/tracking-usage#using-event-names) can be used in place of feature_id. This can be used if multiple features are tracked in the same event. - - - - The amount of usage to record. Defaults to 1. Can be negative to increase the balance (e.g., when removing a seat). - - - - Additional properties to attach to this usage event. - - - - Unique key to prevent duplicate event recording. Use this to safely retry requests without creating duplicate usage records. - - - - If using [entity balances](/features/feature-entities) (eg, seats), the entity ID to track usage for. - - - -### Response - - - The ID of the customer - - - - The ID of the entity (if provided) - - - - The name of the event - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/apps/docs/mintlify/api-reference/balances/balancesCheck.mdx b/apps/docs/mintlify/api-reference/balances/check.mdx similarity index 63% rename from apps/docs/mintlify/api-reference/balances/balancesCheck.mdx rename to apps/docs/mintlify/api-reference/balances/check.mdx index a480621c4..e21aa976e 100644 --- a/apps/docs/mintlify/api-reference/balances/balancesCheck.mdx +++ b/apps/docs/mintlify/api-reference/balances/check.mdx @@ -1,5 +1,5 @@ --- -title: "Balances Check" +title: "Check Permissions" openapi: "openapi POST /v1/balances.check" --- @@ -7,50 +7,106 @@ import { DynamicParamField } from "/components/dynamic-param-field.jsx"; import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + + Check determines if a customer has access to a feature based on their current balance. Returns `allowed: true` if they have sufficient balance, the feature is unlimited, or it's a boolean feature included in their plan. + + +### Common Use Cases + + + +```typescript Check feature access +const { allowed, balance } = await autumn.balances.check({ + customerId: "cus_123", + featureId: "ai_messages" +}); + +if (!allowed) { + // Show upgrade prompt or paywall +} +``` + +```typescript Check and track atomically +const { allowed } = await autumn.balances.check({ + customerId: "cus_123", + featureId: "api_calls", + requiredBalance: 1, + sendEvent: true // Deducts usage if allowed +}); +``` + +```typescript Get upgrade options when denied +const { allowed, preview } = await autumn.balances.check({ + customerId: "cus_123", + featureId: "advanced_analytics", + withPreview: true +}); + +if (!allowed && preview) { + // Display preview.products as upgrade options +} +``` + + + ### Body Parameters - ID which you provided when creating the customer + The ID of the customer. - ID of the feature to check access to. + The ID of the feature. - If using entity balances (eg, seats), the entity ID to check access for. + The ID of the entity for entity-scoped balances (e.g., per-seat limits). - If you know the amount of the feature the end user is consuming in advance. If their balance is below this quantity, allowed will be false. + Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1. - + + Additional properties to attach to the usage event if send_event is true. + - If true, a usage event will be recorded together with checking access. The required_balance field will be used as the usage value. + If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. - If true, the response will include a preview object, which can be used to display information such as a paywall or upgrade confirmation. + If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. ### Response - + + Whether the customer is allowed to use the feature. True if they have sufficient balance or the feature is unlimited/boolean. + - + + The ID of the customer that was checked. + - + + The ID of the entity, if an entity-scoped check was performed. + - + + The required balance that was checked against. + + The customer's balance for this feature. Null if the customer has no balance for this feature. - + + The feature ID this balance is for. + + The full feature object if expanded. @@ -85,52 +141,92 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + Total balance granted (included + prepaid). + - + + Remaining balance available for use. + - + + Total usage consumed in the current period. + - + + Whether this feature has unlimited usage. + - + + Whether usage beyond the granted balance is allowed (with overage charges). + - + + Maximum quantity that can be purchased as a top-up, or null for unlimited. + - + + Timestamp when the balance will reset, or null for no reset. + + Detailed breakdown of balance sources when stacking multiple plans or grants. - + + The unique identifier for this balance breakdown. + - + + The plan ID this balance originates from, or null for standalone balances. + - + + Amount granted from the plan's included usage. + - + + Amount granted from prepaid purchases or top-ups. + - + + Remaining balance available for use. + - + + Amount consumed in the current period. + - + + Whether this balance has unlimited usage. + + Reset configuration for this balance, or null if no reset. - + + The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + - + + Number of intervals between resets (eg. 2 for bi-monthly). + - + + Timestamp when the balance will next reset. + + Pricing configuration if this balance has usage-based pricing. - + + The per-unit price amount. + + Tiered pricing configuration if applicable. @@ -139,25 +235,38 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + The number of units per billing increment (eg. $9 / 250 units). + - + + Whether usage is prepaid or billed pay-per-use. + - + + Maximum quantity that can be purchased, or null for unlimited. + - + + Timestamp when this balance expires, or null for no expiration. + + Rollover balances carried over from previous periods. - + + Amount of balance rolled over from a previous period. + - + + Timestamp when the rollover balance expires. + @@ -166,18 +275,30 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Upgrade/upsell information when access is denied. Only present if with_preview was true and allowed is false. - + + The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. + - + + A title suitable for displaying in a paywall or upgrade modal. + - + + A message explaining why access was denied. + - + + The ID of the feature that was checked. + - + + The display name of the feature. + + Products that would grant access to this feature. Use to display upgrade options. The ID of the product you set when creating the product @@ -382,3 +503,42 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + +```json 200 +{ + "allowed": true, + "customer_id": "cus_123", + "entity_id": null, + "required_balance": 1, + "balance": { + "feature_id": "messages", + "granted": 100, + "remaining": 72, + "usage": 28, + "unlimited": false, + "overage_allowed": false, + "max_purchase": null, + "next_reset_at": 1773851121437, + "breakdown": [ + { + "id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + "plan_id": "pro_plan", + "included_grant": 100, + "prepaid_grant": 0, + "remaining": 72, + "usage": 28, + "unlimited": false, + "reset": { + "interval": "month", + "resets_at": 1773851121437 + }, + "price": null, + "expires_at": null + } + ] + } +} +``` + diff --git a/apps/docs/mintlify/api-reference/balances/balancesCreate.mdx b/apps/docs/mintlify/api-reference/balances/createBalance.mdx similarity index 56% rename from apps/docs/mintlify/api-reference/balances/balancesCreate.mdx rename to apps/docs/mintlify/api-reference/balances/createBalance.mdx index 0375fcb1b..9c1f7fd6b 100644 --- a/apps/docs/mintlify/api-reference/balances/balancesCreate.mdx +++ b/apps/docs/mintlify/api-reference/balances/createBalance.mdx @@ -1,5 +1,5 @@ --- -title: "Balances Create" +title: "Create Balance" openapi: "openapi POST /v1/balances.create" --- @@ -9,38 +9,42 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx ### Body Parameters - - The feature ID to create the balance for + + The ID of the customer. - - The customer ID to assign the balance to + + The ID of the feature. - Entity ID for entity-scoped balances + The ID of the entity for entity-scoped balances (e.g., per-seat limits). - The initial balance amount to grant + The initial balance amount to grant. For metered features, this is the number of units the customer can use. - Whether the balance is unlimited + If true, the balance has unlimited usage. Cannot be combined with 'included'. - Reset configuration for the balance + Reset configuration for the balance. If not provided, the balance is a one-time grant that never resets. - + + The interval at which the balance resets (e.g., 'month', 'day', 'year'). + - + + Number of intervals between resets. Defaults to 1 (e.g., interval_count: 2 with interval: 'month' resets every 2 months). + - Unix timestamp (milliseconds) when the balance expires + Unix timestamp (milliseconds) when the balance expires. Mutually exclusive with reset. diff --git a/apps/docs/mintlify/api-reference/balances/track.mdx b/apps/docs/mintlify/api-reference/balances/track.mdx new file mode 100644 index 000000000..1715b933d --- /dev/null +++ b/apps/docs/mintlify/api-reference/balances/track.mdx @@ -0,0 +1,481 @@ +--- +title: "Track Usage" +openapi: "openapi POST /v1/balances.track" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + + + Track records usage events to decrement a customer's balance. Use this to meter feature consumption like API calls, messages sent, or credits used. + + +### Common Use Cases + + + +```typescript Track single usage +await autumn.balances.track({ + customerId: "cus_123", + featureId: "ai_messages", + value: 1 +}); +``` + +```typescript Track with idempotency +await autumn.balances.track({ + customerId: "cus_123", + featureId: "api_calls", + value: 1, + idempotencyKey: "request_abc123" // Prevents duplicate tracking on retry +}); +``` + +```typescript Credit balance (negative value) +await autumn.balances.track({ + customerId: "cus_123", + featureId: "seats", + value: -1 // Increases balance when removing a seat +}); +``` + + + +### Body Parameters + + + The ID of the customer. + + + + The ID of the feature to track usage for. Required if event_name is not provided. + + + + The ID of the entity for entity-scoped balances (e.g., per-seat limits). + + + + Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. + + + + The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). + + + + Additional properties to attach to this usage event. + + + + Unique key to prevent duplicate event recording. Safely retry requests without creating duplicate usage. + + + +### Response + + + The ID of the customer whose usage was tracked. + + + + The ID of the entity, if entity-scoped tracking was performed. + + + + The event name that was tracked, if event_name was used instead of feature_id. + + + + The amount of usage that was recorded. + + + + The updated balance for the tracked feature. Null if tracking by event_name that affects multiple features. + + + The feature ID this balance is for. + + + + The full feature object if expanded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Total balance granted (included + prepaid). + + + + Remaining balance available for use. + + + + Total usage consumed in the current period. + + + + Whether this feature has unlimited usage. + + + + Whether usage beyond the granted balance is allowed (with overage charges). + + + + Maximum quantity that can be purchased as a top-up, or null for unlimited. + + + + Timestamp when the balance will reset, or null for no reset. + + + + Detailed breakdown of balance sources when stacking multiple plans or grants. + + + The unique identifier for this balance breakdown. + + + + The plan ID this balance originates from, or null for standalone balances. + + + + Amount granted from the plan's included usage. + + + + Amount granted from prepaid purchases or top-ups. + + + + Remaining balance available for use. + + + + Amount consumed in the current period. + + + + Whether this balance has unlimited usage. + + + + Reset configuration for this balance, or null if no reset. + + + The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + + + Number of intervals between resets (eg. 2 for bi-monthly). + + + + Timestamp when the balance will next reset. + + + + + + + Pricing configuration if this balance has usage-based pricing. + + + The per-unit price amount. + + + + Tiered pricing configuration if applicable. + + + + + + + + + + The number of units per billing increment (eg. $9 / 250 units). + + + + Whether usage is prepaid or billed pay-per-use. + + + + Maximum quantity that can be purchased, or null for unlimited. + + + + + + + Timestamp when this balance expires, or null for no expiration. + + + + + + + Rollover balances carried over from previous periods. + + + Amount of balance rolled over from a previous period. + + + + Timestamp when the rollover balance expires. + + + + + + + + + + Map of feature_id to updated balance when tracking by event_name affects multiple features. + + + The feature ID this balance is for. + + + + The full feature object if expanded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Total balance granted (included + prepaid). + + + + Remaining balance available for use. + + + + Total usage consumed in the current period. + + + + Whether this feature has unlimited usage. + + + + Whether usage beyond the granted balance is allowed (with overage charges). + + + + Maximum quantity that can be purchased as a top-up, or null for unlimited. + + + + Timestamp when the balance will reset, or null for no reset. + + + + Detailed breakdown of balance sources when stacking multiple plans or grants. + + + The unique identifier for this balance breakdown. + + + + The plan ID this balance originates from, or null for standalone balances. + + + + Amount granted from the plan's included usage. + + + + Amount granted from prepaid purchases or top-ups. + + + + Remaining balance available for use. + + + + Amount consumed in the current period. + + + + Whether this balance has unlimited usage. + + + + Reset configuration for this balance, or null if no reset. + + + The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + + + Number of intervals between resets (eg. 2 for bi-monthly). + + + + Timestamp when the balance will next reset. + + + + + + + Pricing configuration if this balance has usage-based pricing. + + + The per-unit price amount. + + + + Tiered pricing configuration if applicable. + + + + + + + + + + The number of units per billing increment (eg. $9 / 250 units). + + + + Whether usage is prepaid or billed pay-per-use. + + + + Maximum quantity that can be purchased, or null for unlimited. + + + + + + + Timestamp when this balance expires, or null for no expiration. + + + + + + + Rollover balances carried over from previous periods. + + + Amount of balance rolled over from a previous period. + + + + Timestamp when the rollover balance expires. + + + + + + + + + + +```json 200 +{ + "customer_id": "cus_123", + "value": 1, + "balance": { + "feature_id": "messages", + "granted": 100, + "remaining": 72, + "usage": 28, + "unlimited": false, + "overage_allowed": false, + "max_purchase": null, + "next_reset_at": 1773851121437, + "breakdown": [ + { + "id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + "plan_id": "pro_plan", + "included_grant": 100, + "prepaid_grant": 0, + "remaining": 72, + "usage": 28, + "unlimited": false, + "reset": { + "interval": "month", + "resets_at": 1773851121437 + }, + "price": null, + "expires_at": null + } + ] + } +} +``` + diff --git a/apps/docs/mintlify/api-reference/balances/balancesUpdate.mdx b/apps/docs/mintlify/api-reference/balances/updateBalance.mdx similarity index 57% rename from apps/docs/mintlify/api-reference/balances/balancesUpdate.mdx rename to apps/docs/mintlify/api-reference/balances/updateBalance.mdx index f7ebeaf78..c116235e0 100644 --- a/apps/docs/mintlify/api-reference/balances/balancesUpdate.mdx +++ b/apps/docs/mintlify/api-reference/balances/updateBalance.mdx @@ -1,5 +1,5 @@ --- -title: "Balances Update" +title: "Update Balance" openapi: "openapi POST /v1/balances.update" --- @@ -13,32 +13,26 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The ID of the customer. - - The ID of the entity to update balance for (if using entity balances). - - - The ID of the feature to update balance for. + The ID of the feature. - - The new balance value to set. + + The ID of the entity for entity-scoped balances (e.g., per-seat limits). + + + + Set the remaining balance to this exact value. Cannot be combined with add_to_balance. + + + + Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance. - The interval to update balance for. + Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals. - - - - - - - - - - ### Response diff --git a/apps/docs/mintlify/api-reference/billing/attach.mdx b/apps/docs/mintlify/api-reference/billing/attach.mdx index 77253549c..64921cc49 100644 --- a/apps/docs/mintlify/api-reference/billing/attach.mdx +++ b/apps/docs/mintlify/api-reference/billing/attach.mdx @@ -1,6 +1,6 @@ --- title: "Attach" -openapi: "openapi POST /v1/attach" +openapi: "openapi POST /v1/billing.attach" --- import { DynamicParamField } from "/components/dynamic-param-field.jsx"; @@ -9,111 +9,138 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx ### Body Parameters - - - - - - The feature ID that this entity is associated with - - - - Name of the entity - - - + + The ID of the customer to attach the plan to. - + + The ID of the entity to attach the plan to. + + + + If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. - + - + + The version of the plan to attach. + - + - + - + + Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - - The type of the product item. - - - - The feature ID of the product item. Should be null for fixed price items. - - - - The amount of usage included for this feature (per interval). - - - - 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 of the feature. - - - - The feature ID of the entity (like seats) to track sub-balances for. - - - - Whether the feature should be prepaid upfront or billed for how much they use end of billing period. - - - - The price of the product item. Should be null if tiered pricing is set. - - - - Tiered pricing for the product item. Not applicable for fixed price items. + - - The maximum amount of usage for this tier. + + + + + + + + + + + + + + + + + + + + + + + + - - The price of the product item for this tier. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - The billing units of the product item (eg $1 for 30 credits). - + + - - Whether the usage should be reset when the product is enabled. - + + + + + + + + + - - - - - - - + @@ -125,8 +152,6 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - - ### Response @@ -159,3 +184,13 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + +```json 200 +{ + "customer_id": "cus_123", + "payment_url": null +} +``` + diff --git a/apps/docs/mintlify/api-reference/billing/billingAttach.mdx b/apps/docs/mintlify/api-reference/billing/billingAttach.mdx index 6d11e8f17..91b5b685b 100644 --- a/apps/docs/mintlify/api-reference/billing/billingAttach.mdx +++ b/apps/docs/mintlify/api-reference/billing/billingAttach.mdx @@ -1,5 +1,5 @@ --- -title: "Billing Attach" +title: "Attach" openapi: "openapi POST /v1/billing.attach" --- @@ -7,17 +7,66 @@ import { DynamicParamField } from "/components/dynamic-param-field.jsx"; import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + + The attach endpoint subscribes a customer to a plan. It handles new subscriptions, upgrades, and downgrades automatically. For modifying an existing subscription (like changing quantities or canceling), use [update](/api-reference/billing/billingUpdate) instead. + + +### Common Use Cases + + + +```typescript Subscribe to a plan +const response = await autumn.billing.attach({ + customerId: "cus_123", + planId: "pro_plan" +}); + +if (response.paymentUrl) { + // Redirect customer to checkout + window.location.href = response.paymentUrl; +} +``` + +```typescript Custom pricing +const response = await autumn.billing.attach({ + customerId: "cus_123", + planId: "enterprise_plan", + customize: { + price: { + amount: 99900, // $999.00 + interval: "month" + } + } +}); +``` + +```typescript Attach plan with prepaid quantities +const response = await autumn.billing.attach({ + customerId: "cus_123", + planId: "team_plan", + featureQuantities: [ + { featureId: "seats", quantity: 5 } + ] +}); +``` + + + ### Body Parameters The ID of the customer to attach the plan to. - + The ID of the entity to attach the plan to. - + + The ID of the plan. + + + If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. @@ -34,6 +83,7 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. @@ -127,60 +177,115 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - - + Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. - + + When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. + - + + If true, enables the plan immediately even though the invoice is not paid yet. + - + + If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. + - + + 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. + - + + List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + + + The ID of the reward to apply as a discount. + - + + The promotion code to apply as a discount. + - + + - + + URL to redirect to after successful checkout. + - + + Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + + + + When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + ### Response - + + The ID of the customer. + - + + The ID of the entity, if the plan was attached to an entity. + + Invoice details if an invoice was created. Only present when a charge was made. - + + The status of the invoice (e.g., 'paid', 'open', 'draft'). + - + + The Stripe invoice ID. + - + + The total amount of the invoice in cents. + - + + The three-letter ISO currency code (e.g., 'usd'). + - + + URL to the hosted invoice page where the customer can view and pay the invoice. + - + + URL to redirect the customer to complete payment. Null if no payment action is required. + + Details about any action required to complete the payment. Present when the payment could not be processed automatically. - + + The type of action required to complete the payment. + - + + A human-readable explanation of why this action is required. + + + + +```json 200 +{ + "customer_id": "cus_123", + "payment_url": "https://checkout.stripe.com/..." +} +``` + diff --git a/apps/docs/mintlify/api-reference/billing/billingUpdate.mdx b/apps/docs/mintlify/api-reference/billing/billingUpdate.mdx index e1d1d5ca9..21da6626b 100644 --- a/apps/docs/mintlify/api-reference/billing/billingUpdate.mdx +++ b/apps/docs/mintlify/api-reference/billing/billingUpdate.mdx @@ -1,5 +1,5 @@ --- -title: "Billing Update" +title: "Update Subscription" openapi: "openapi POST /v1/billing.update" --- @@ -7,17 +7,55 @@ import { DynamicParamField } from "/components/dynamic-param-field.jsx"; import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + + The update endpoint modifies an existing subscription. Use this to change prepaid quantities, cancel subscriptions, or modify plan configuration. For subscribing to a new plan, use [attach](/api-reference/billing/billingAttach) instead. + + +### Common Use Cases + + + +```typescript Update prepaid quantity +const response = await autumn.billing.update({ + customerId: "cus_123", + planId: "pro_plan", + featureQuantities: [{ featureId: "seats", quantity: 10 }] +}); +``` + +```typescript Cancel at end of cycle +const response = await autumn.billing.update({ + customerId: "cus_123", + planId: "pro_plan", + cancelAction: "cancel_end_of_cycle" +}); +``` + +```typescript Uncancel subscription +const response = await autumn.billing.update({ + customerId: "cus_123", + planId: "pro_plan", + cancelAction: "uncancel" +}); +``` + + + ### Body Parameters The ID of the customer to attach the plan to. - + The ID of the entity to attach the plan to. - + + The ID of the plan. + + + If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. @@ -34,6 +72,7 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. @@ -127,52 +166,100 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - - + Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. - + + When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. + - + + If true, enables the plan immediately even though the invoice is not paid yet. + - + + If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. + - + + 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. + - + + Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. + ### Response - + + The ID of the customer. + - + + The ID of the entity, if the plan was attached to an entity. + + Invoice details if an invoice was created. Only present when a charge was made. - + + The status of the invoice (e.g., 'paid', 'open', 'draft'). + - + + The Stripe invoice ID. + - + + The total amount of the invoice in cents. + - + + The three-letter ISO currency code (e.g., 'usd'). + - + + URL to the hosted invoice page where the customer can view and pay the invoice. + - + + URL to redirect the customer to complete payment. Null if no payment action is required. + + Details about any action required to complete the payment. Present when the payment could not be processed automatically. - + + The type of action required to complete the payment. + - + + A human-readable explanation of why this action is required. + + + + +```json 200 +{ + "customer_id": "cus_123", + "invoice": { + "status": "paid", + "stripe_id": "in_1234", + "total": 1500, + "currency": "usd", + "hosted_invoice_url": "https://invoice.stripe.com/..." + }, + "payment_url": null +} +``` + diff --git a/apps/docs/mintlify/api-reference/billing/openCustomerPortal.mdx b/apps/docs/mintlify/api-reference/billing/openCustomerPortal.mdx new file mode 100644 index 000000000..a49cff925 --- /dev/null +++ b/apps/docs/mintlify/api-reference/billing/openCustomerPortal.mdx @@ -0,0 +1,43 @@ +--- +title: "Open Customer Portal" +openapi: "openapi POST /v1/billing.open_customer_portal" +--- + +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 + + + The ID of the customer to open the billing portal for. + + + + Stripe billing portal configuration ID. Create configurations in your Stripe dashboard. + + + + URL to redirect to when back button is clicked in the billing portal + + + +### Response + + + The ID of the billing portal session + + + + URL to the billing portal + + + + +```json 200 +{ + "customer_id": "cus_123", + "url": "https://billing.stripe.com/session/..." +} +``` + diff --git a/apps/docs/mintlify/api-reference/billing/previewAttach.mdx b/apps/docs/mintlify/api-reference/billing/previewAttach.mdx new file mode 100644 index 000000000..20870474d --- /dev/null +++ b/apps/docs/mintlify/api-reference/billing/previewAttach.mdx @@ -0,0 +1,261 @@ +--- +title: "Preview Attach" +openapi: "openapi POST /v1/billing.preview_attach" +--- + +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 + + + The ID of the customer to attach the plan to. + + + + The ID of the entity to attach the plan to. + + + + The ID of the plan. + + + + If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. + + + + + + + + + + + + The version of the plan to attach. + + + + Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. + + + + + + + + + + + + Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + + + When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. + + + + If true, enables the plan immediately even though the invoice is not paid yet. + + + + If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. + + + + + + + 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. + + + + List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + + + The ID of the reward to apply as a discount. + + + + The promotion code to apply as a discount. + + + + + + + URL to redirect to after successful checkout. + + + + Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + + + + When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + + + +### Response + + + The ID of the customer. + + + + List of line items for the current billing period. + + + The title of the line item. + + + + A detailed description of the line item. + + + + The amount in cents for this line item. + + + + List of discounts applied to this line item. + + + + + + + + + + + + + + + + + The total amount in cents for the current billing period. + + + + The three-letter ISO currency code (e.g., 'usd'). + + + + Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. + + + Unix timestamp (milliseconds) when the next billing cycle starts. + + + + The total amount in cents for the next cycle. + + + + + + + +```json 200 +{ + "customerId": "charles", + "lineItems": [ + { + "title": "Pro seed", + "description": "Pro seed - Base Price (from 18 Feb 2026 to 18 Mar 2026)", + "amount": 20, + "discounts": [] + } + ], + "total": 20, + "currency": "usd" +} +``` + diff --git a/apps/docs/mintlify/api-reference/billing/billingPreviewUpdate.mdx b/apps/docs/mintlify/api-reference/billing/previewUpdate.mdx similarity index 64% rename from apps/docs/mintlify/api-reference/billing/billingPreviewUpdate.mdx rename to apps/docs/mintlify/api-reference/billing/previewUpdate.mdx index 89a09ed4c..951f98f00 100644 --- a/apps/docs/mintlify/api-reference/billing/billingPreviewUpdate.mdx +++ b/apps/docs/mintlify/api-reference/billing/previewUpdate.mdx @@ -1,5 +1,5 @@ --- -title: "Billing Preview Update" +title: "Preview Update" openapi: "openapi POST /v1/billing.preview_update" --- @@ -13,11 +13,15 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The ID of the customer to attach the plan to. - + The ID of the entity to attach the plan to. - + + The ID of the plan. + + + If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. @@ -34,6 +38,7 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. @@ -127,37 +132,56 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - - + Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. - + + When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. + - + + If true, enables the plan immediately even though the invoice is not paid yet. + - + + If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. + - + + 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. + - + + Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. + ### Response - + + The ID of the customer. + + List of line items for the current billing period. - + + The title of the line item. + - + + A detailed description of the line item. + - + + The amount in cents for this line item. + + List of discounts applied to this line item. @@ -170,84 +194,46 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - - - - - - - - - - - - - - - - - - - - + + The total amount in cents for the current billing period. + - - - - - + + The three-letter ISO currency code (e.g., 'usd'). + + Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. - + + Unix timestamp (milliseconds) when the next billing cycle starts. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + The total amount in cents for the next cycle. + + + +```json 200 +{ + "customerId": "charles", + "lineItems": [ + { + "title": "Pro seed", + "description": "Pro seed - Base Price (from 18 Feb 2026 to 18 Mar 2026)", + "amount": 20, + "discounts": [] + } + ], + "total": 20, + "currency": "usd" +} +``` + diff --git a/apps/docs/mintlify/api-reference/billing/billingSetupPayment.mdx b/apps/docs/mintlify/api-reference/billing/setupPayment.mdx similarity index 98% rename from apps/docs/mintlify/api-reference/billing/billingSetupPayment.mdx rename to apps/docs/mintlify/api-reference/billing/setupPayment.mdx index fb9b6cc8e..0c6d351c2 100644 --- a/apps/docs/mintlify/api-reference/billing/billingSetupPayment.mdx +++ b/apps/docs/mintlify/api-reference/billing/setupPayment.mdx @@ -1,5 +1,5 @@ --- -title: "Billing Setup Payment" +title: "Setup Payment" openapi: "openapi POST /v1/billing.setup_payment" --- diff --git a/apps/docs/mintlify/api-reference/core/attach.mdx b/apps/docs/mintlify/api-reference/core/attach.mdx deleted file mode 100644 index 9a7f80c75..000000000 --- a/apps/docs/mintlify/api-reference/core/attach.mdx +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: "Attach Product" -openapi: "coreapi POST /attach" ---- - -{/* If payment is required, a Stripe `checkout_url` will be returned. If the customer's card is already on file, any upgrade or downgrade logic will be handled by default, and a `success: true` response will be returned. */} - - - {" "} - If the `customer_id` you send doesn't already exist, Autumn will automatically - create a new customer. You can optionally set the properties of this new customer - through the `customer_data` field. - diff --git a/apps/docs/mintlify/api-reference/core/cancel.mdx b/apps/docs/mintlify/api-reference/core/cancel.mdx deleted file mode 100644 index 4ba2c77fb..000000000 --- a/apps/docs/mintlify/api-reference/core/cancel.mdx +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Cancel Product" -openapi: "coreapi POST /cancel" ---- - -{/* If payment is required, a Stripe `checkout_url` will be returned. If the customer's card is already on file, any upgrade or downgrade logic will be handled by default, and a `success: true` response will be returned. */} diff --git a/apps/docs/mintlify/api-reference/core/check.mdx b/apps/docs/mintlify/api-reference/core/check.mdx index 69491e67e..41205caf8 100644 --- a/apps/docs/mintlify/api-reference/core/check.mdx +++ b/apps/docs/mintlify/api-reference/core/check.mdx @@ -1,11 +1,534 @@ --- title: "Check Permissions" -openapi: "openapi-1.2.0 POST /check" +openapi: "openapi POST /v1/balances.check" --- - - {" "} - If the `customer_id` you send doesn't already exist, Autumn will automatically - create a new customer. You can optionally set the properties of this new customer - through the `customer_data` field. - +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + + + Check determines if a customer has access to a feature based on their current balance. Returns `allowed: true` if they have sufficient balance, the feature is unlimited, or it's a boolean feature included in their plan. + + +### Common Use Cases + + + +```typescript Check feature access +const { allowed, balance } = await autumn.check({ + customerId: "cus_123", + featureId: "ai_messages" +}); + +if (!allowed) { + // Show upgrade prompt or paywall +} + +console.log(`You have ${balance.remaining} messages left`); +``` + +```typescript Check and track atomically +const { allowed } = await autumn.check({ + customerId: "cus_123", + featureId: "api_calls", + requiredBalance: 1, + sendEvent: true // Deducts usage if allowed +}); +``` + + + +### Body Parameters + + + The ID of the customer. + + + + The ID of the feature. + + + + The ID of the entity for entity-scoped balances (e.g., per-seat limits). + + + + Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1. + + + + Additional properties to attach to the usage event if send_event is true. + + + + If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. + + + + If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. + + + +### Response + + + Whether the customer is allowed to use the feature. True if they have sufficient balance or the feature is unlimited/boolean. + + + + The ID of the customer that was checked. + + + + The ID of the entity, if an entity-scoped check was performed. + + + + The required balance that was checked against. + + + + The customer's balance for this feature. Null if the customer has no balance for this feature. + + + The feature ID this balance is for. + + + + The full feature object if expanded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Total balance granted (included + prepaid). + + + + Remaining balance available for use. + + + + Total usage consumed in the current period. + + + + Whether this feature has unlimited usage. + + + + Whether usage beyond the granted balance is allowed (with overage charges). + + + + Maximum quantity that can be purchased as a top-up, or null for unlimited. + + + + Timestamp when the balance will reset, or null for no reset. + + + + Detailed breakdown of balance sources when stacking multiple plans or grants. + + + The unique identifier for this balance breakdown. + + + + The plan ID this balance originates from, or null for standalone balances. + + + + Amount granted from the plan's included usage. + + + + Amount granted from prepaid purchases or top-ups. + + + + Remaining balance available for use. + + + + Amount consumed in the current period. + + + + Whether this balance has unlimited usage. + + + + Reset configuration for this balance, or null if no reset. + + + The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + + + Number of intervals between resets (eg. 2 for bi-monthly). + + + + Timestamp when the balance will next reset. + + + + + + + Pricing configuration if this balance has usage-based pricing. + + + The per-unit price amount. + + + + Tiered pricing configuration if applicable. + + + + + + + + + + The number of units per billing increment (eg. $9 / 250 units). + + + + Whether usage is prepaid or billed pay-per-use. + + + + Maximum quantity that can be purchased, or null for unlimited. + + + + + + + Timestamp when this balance expires, or null for no expiration. + + + + + + + Rollover balances carried over from previous periods. + + + Amount of balance rolled over from a previous period. + + + + Timestamp when the rollover balance expires. + + + + + + + + + + Upgrade/upsell information when access is denied. Only present if with_preview was true and allowed is false. + + + The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. + + + + A title suitable for displaying in a paywall or upgrade modal. + + + + A message explaining why access was denied. + + + + The ID of the feature that was checked. + + + + The display name of the feature. + + + + Products that would grant access to this feature. Use to display upgrade options. + + + The ID of the product you set when creating the product + + + + The name of the product + + + + Product group which this product belongs to + + + + The environment of the product + + + + Whether the product is an add-on and can be purchased alongside other products + + + + Whether the product is the default product + + + + Whether this product has been archived and is no longer available + + + + The current version of the product + + + + The timestamp of when the product was created in milliseconds since epoch + + + + Array of product items that define the product's features and pricing + + + The type of the product item + + + + The feature ID of the product item. If the item is a fixed price, should be `null` + + + + 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. + + + + The amount of usage included for this feature. + + + + 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. + + + + The interval count of the product item. + + + + The price of the product item. Should be `null` if tiered pricing is set. + + + + Tiered pricing for the product item. Not applicable for fixed price items. + + + The maximum amount of usage for this tier. + + + + The price of the product item for this tier. + + + + + + + Whether the feature should be prepaid upfront or billed for how much they use end of billing period. + + + + The amount per billing unit (eg. $9 / 250 units) + + + + Whether the usage should be reset when the product is enabled. + + + + The entity feature ID of the product item if applicable. + + + + The display of the product item. + + + + + + + + + + Used in customer context. Quantity of the feature the customer has prepaid for. + + + + Used in customer context. Quantity of the feature the customer will prepay for in the next cycle. + + + + Configuration for rollover and proration behavior of the feature. + + + + + + + + + + + + + + + + + + + + + + + + Free trial configuration for this product, if available + + + The duration type of the free trial + + + + The length of the duration type specified + + + + Whether the free trial is limited to one per customer fingerprint + + + + Whether the free trial requires a card. If false, the customer can attach the product without going through a checkout flow or having a card on file. + + + + Used in customer context. Whether the free trial is available for the customer if they were to attach the product. + + + + + + + ID of the base variant this product is derived from + + + + Scenario for when this product is used in attach flows + + + + + + True if the product has no base price or usage prices + + + + True if the product only contains a one-time price + + + + The billing interval group for recurring products (e.g., 'monthly', 'yearly') + + + + True if the product includes a free trial + + + + True if the product can be updated after creation (only applicable if there are prepaid recurring prices) + + + + + + + + + + + + + +```json 200 +{ + "allowed": true, + "customer_id": "cus_123", + "entity_id": null, + "required_balance": 1, + "balance": { + "feature_id": "messages", + "granted": 100, + "remaining": 72, + "usage": 28, + "unlimited": false, + "overage_allowed": false, + "max_purchase": null, + "next_reset_at": 1773851121437, + "breakdown": [ + { + "id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + "plan_id": "pro_plan", + "included_grant": 100, + "prepaid_grant": 0, + "remaining": 72, + "usage": 28, + "unlimited": false, + "reset": { + "interval": "month", + "resets_at": 1773851121437 + }, + "price": null, + "expires_at": null + } + ] + } +} +``` + diff --git a/apps/docs/mintlify/api-reference/core/checkout.mdx b/apps/docs/mintlify/api-reference/core/checkout.mdx deleted file mode 100644 index 0b2d2be3c..000000000 --- a/apps/docs/mintlify/api-reference/core/checkout.mdx +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: "Checkout" -openapi: "coreapi POST /checkout" ---- - -{/* If payment is required, a Stripe `checkout_url` will be returned. If the customer's card is already on file, any upgrade or downgrade logic will be handled by default, and a `success: true` response will be returned. */} - - - {" "} - If the `customer_id` you send doesn't already exist, Autumn will automatically - create a new customer. You can optionally set the properties of this new customer - through the `customer_data` field. - diff --git a/apps/docs/mintlify/api-reference/core/query.mdx b/apps/docs/mintlify/api-reference/core/query.mdx deleted file mode 100644 index c7c17a107..000000000 --- a/apps/docs/mintlify/api-reference/core/query.mdx +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: "Query Usage Data" -openapi: "coreapi POST /query" ---- - -This endpoint allows you to query usage data for specific features over various time ranges. It returns historical usage information that can be used for analytics, reporting, or displaying usage graphs to customers. - - - You can query usage for a single feature or multiple features in one request by passing an array of feature IDs. - - - -The response returns a list of objects. Each object includes a `period` timestamp and one key per requested feature ID with its usage value. - - -{/* -## Example Usage - -### Single Feature Query - -Query usage for the "messages" feature over the last 30 days: - -```javascript -const response = await autumn.query({ - customer_id: 'user_123', - feature_id: 'messages', - range: '30d' -}); - -console.log(response.list); -// [ -// { period: 1672531200000, messages: 45 }, -// { period: 1672617600000, messages: 32 }, -// { period: 1672704000000, messages: 18 } -// ] -``` - -### Multiple Features Query - -Query usage for both "credits" and "messages" features over the last 7 days: - -```javascript -const response = await autumn.query({ - customer_id: 'user_123', - feature_id: ['credits', 'messages'], - range: '7d' -}); - -console.log(response.list); -// [ -// { period: 1672531200000, credits: 20, messages: 45 }, -// { period: 1672617600000, credits: 15, messages: 32 }, -// { period: 1672704000000, credits: 30, messages: 18 } -// ] -``` */} diff --git a/apps/docs/mintlify/api-reference/core/track.mdx b/apps/docs/mintlify/api-reference/core/track.mdx index 64137e587..72031747c 100644 --- a/apps/docs/mintlify/api-reference/core/track.mdx +++ b/apps/docs/mintlify/api-reference/core/track.mdx @@ -1,13 +1,477 @@ --- title: "Track Usage" -openapi: "openapi-1.2.0 POST /track" +openapi: "openapi POST /v1/balances.track" --- -This endpoint is for tracking usage events in Autumn, so feature usage can be limited or billed for. +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; - - {" "} - If the `customer_id` you send doesn't already exist, Autumn will automatically - create a new customer. You can optionally set the properties of this new customer - through the `customer_data` field. - + + Track records usage events to decrement a customer's balance. Use this to meter feature consumption like API calls, messages sent, or credits used. + + +### Common Use Cases + + + +```typescript Track single usage +await autumn.track({ + customerId: "cus_123", + featureId: "ai_messages", + value: 1 +}); +``` + +```typescript Track with idempotency +await autumn.track({ + customerId: "cus_123", + featureId: "api_calls", + value: 1, + idempotencyKey: "request_abc123" // Prevents duplicate tracking on retry +}); +``` + +```typescript Credit balance (negative value) +await autumn.track({ + customerId: "cus_123", + featureId: "seats", + value: -1 // Increases balance when removing a seat +}); +``` + + + +### Body Parameters + + + The ID of the customer. + + + + The ID of the feature to track usage for. Required if event_name is not provided. + + + + The ID of the entity for entity-scoped balances (e.g., per-seat limits). + + + + Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. + + + + The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). + + + + Additional properties to attach to this usage event. + + + +### Response + + + The ID of the customer whose usage was tracked. + + + + The ID of the entity, if entity-scoped tracking was performed. + + + + The event name that was tracked, if event_name was used instead of feature_id. + + + + The amount of usage that was recorded. + + + + The updated balance for the tracked feature. Null if tracking by event_name that affects multiple features. + + + The feature ID this balance is for. + + + + The full feature object if expanded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Total balance granted (included + prepaid). + + + + Remaining balance available for use. + + + + Total usage consumed in the current period. + + + + Whether this feature has unlimited usage. + + + + Whether usage beyond the granted balance is allowed (with overage charges). + + + + Maximum quantity that can be purchased as a top-up, or null for unlimited. + + + + Timestamp when the balance will reset, or null for no reset. + + + + Detailed breakdown of balance sources when stacking multiple plans or grants. + + + The unique identifier for this balance breakdown. + + + + The plan ID this balance originates from, or null for standalone balances. + + + + Amount granted from the plan's included usage. + + + + Amount granted from prepaid purchases or top-ups. + + + + Remaining balance available for use. + + + + Amount consumed in the current period. + + + + Whether this balance has unlimited usage. + + + + Reset configuration for this balance, or null if no reset. + + + The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + + + Number of intervals between resets (eg. 2 for bi-monthly). + + + + Timestamp when the balance will next reset. + + + + + + + Pricing configuration if this balance has usage-based pricing. + + + The per-unit price amount. + + + + Tiered pricing configuration if applicable. + + + + + + + + + + The number of units per billing increment (eg. $9 / 250 units). + + + + Whether usage is prepaid or billed pay-per-use. + + + + Maximum quantity that can be purchased, or null for unlimited. + + + + + + + Timestamp when this balance expires, or null for no expiration. + + + + + + + Rollover balances carried over from previous periods. + + + Amount of balance rolled over from a previous period. + + + + Timestamp when the rollover balance expires. + + + + + + + + + + Map of feature_id to updated balance when tracking by event_name affects multiple features. + + + The feature ID this balance is for. + + + + The full feature object if expanded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Total balance granted (included + prepaid). + + + + Remaining balance available for use. + + + + Total usage consumed in the current period. + + + + Whether this feature has unlimited usage. + + + + Whether usage beyond the granted balance is allowed (with overage charges). + + + + Maximum quantity that can be purchased as a top-up, or null for unlimited. + + + + Timestamp when the balance will reset, or null for no reset. + + + + Detailed breakdown of balance sources when stacking multiple plans or grants. + + + The unique identifier for this balance breakdown. + + + + The plan ID this balance originates from, or null for standalone balances. + + + + Amount granted from the plan's included usage. + + + + Amount granted from prepaid purchases or top-ups. + + + + Remaining balance available for use. + + + + Amount consumed in the current period. + + + + Whether this balance has unlimited usage. + + + + Reset configuration for this balance, or null if no reset. + + + The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + + + Number of intervals between resets (eg. 2 for bi-monthly). + + + + Timestamp when the balance will next reset. + + + + + + + Pricing configuration if this balance has usage-based pricing. + + + The per-unit price amount. + + + + Tiered pricing configuration if applicable. + + + + + + + + + + The number of units per billing increment (eg. $9 / 250 units). + + + + Whether usage is prepaid or billed pay-per-use. + + + + Maximum quantity that can be purchased, or null for unlimited. + + + + + + + Timestamp when this balance expires, or null for no expiration. + + + + + + + Rollover balances carried over from previous periods. + + + Amount of balance rolled over from a previous period. + + + + Timestamp when the rollover balance expires. + + + + + + + + + + +```json 200 +{ + "customer_id": "cus_123", + "value": 1, + "balance": { + "feature_id": "messages", + "granted": 100, + "remaining": 72, + "usage": 28, + "unlimited": false, + "overage_allowed": false, + "max_purchase": null, + "next_reset_at": 1773851121437, + "breakdown": [ + { + "id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + "plan_id": "pro_plan", + "included_grant": 100, + "prepaid_grant": 0, + "remaining": 72, + "usage": 28, + "unlimited": false, + "reset": { + "interval": "month", + "resets_at": 1773851121437 + }, + "price": null, + "expires_at": null + } + ] + } +} +``` + diff --git a/apps/docs/mintlify/api-reference/customers/getOrCreateCustomer.mdx b/apps/docs/mintlify/api-reference/customers/getOrCreateCustomer.mdx index f64d184bf..e4f72fdf2 100644 --- a/apps/docs/mintlify/api-reference/customers/getOrCreateCustomer.mdx +++ b/apps/docs/mintlify/api-reference/customers/getOrCreateCustomer.mdx @@ -93,8 +93,10 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Active and scheduled recurring plans that this customer has attached. + The full plan object if expanded. @@ -285,36 +287,62 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + The unique identifier of the subscribed plan. + - + + Whether the plan was automatically enabled for the customer. + - + + Whether this is an add-on plan rather than a base subscription. + - + + Current status of the subscription. + - + + Whether the subscription has overdue payments. + - + + Timestamp when the subscription was canceled, or null if not canceled. + - + + Timestamp when the subscription will expire, or null if no expiry set. + - + + Timestamp when the trial period ends, or null if not on trial. + - + + Timestamp when the subscription started. + - + + Start timestamp of the current billing period. + - + + End timestamp of the current billing period. + - + + Number of units of this subscription (for per-seat plans). + + One-time purchases made by the customer. + The full plan object if expanded. @@ -505,18 +533,200 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + The unique identifier of the purchased plan. + - + + Timestamp when the purchase expires, or null for lifetime access. + - + + Timestamp when the purchase was made. + - + + Number of units purchased. + - + + Feature balances keyed by feature ID, showing usage limits and remaining amounts. + + + The feature ID this balance is for. + + + + The full feature object if expanded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Total balance granted (included + prepaid). + + + + Remaining balance available for use. + + + + Total usage consumed in the current period. + + + + Whether this feature has unlimited usage. + + + + Whether usage beyond the granted balance is allowed (with overage charges). + + + + Maximum quantity that can be purchased as a top-up, or null for unlimited. + + + + Timestamp when the balance will reset, or null for no reset. + + + + Detailed breakdown of balance sources when stacking multiple plans or grants. + + + The unique identifier for this balance breakdown. + + + + The plan ID this balance originates from, or null for standalone balances. + + + + Amount granted from the plan's included usage. + + + + Amount granted from prepaid purchases or top-ups. + + + + Remaining balance available for use. + + + + Amount consumed in the current period. + + + + Whether this balance has unlimited usage. + + + + Reset configuration for this balance, or null if no reset. + + + The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + + + Number of intervals between resets (eg. 2 for bi-monthly). + + + + Timestamp when the balance will next reset. + + + + + + + Pricing configuration if this balance has usage-based pricing. + + + The per-unit price amount. + + + + Tiered pricing configuration if applicable. + + + + + + + + + + The number of units per billing increment (eg. $9 / 250 units). + + + + Whether usage is prepaid or billed pay-per-use. + + + + Maximum quantity that can be purchased, or null for unlimited. + + + + + + + Timestamp when this balance expires, or null for no expiration. + + + + + + + Rollover balances carried over from previous periods. + + + Amount of balance rolled over from a previous period. + + + + Timestamp when the rollover balance expires. + + + + + + + @@ -676,33 +886,59 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx ```json 200 { - "id": "cus_123", - "created_at": 1717000000, - "name": "John Doe", - "email": "john@example.com", - "fingerprint": "1234567890", - "stripe_id": "cus_123", + "id": "2ee25a41-0d81-4ad2-8451-ec1aadaefe58", + "name": "Patrick", + "email": "patrick@useautumn.com", + "createdAt": 1771409161016, + "fingerprint": null, + "stripeId": "cus_U0BKxpq1mFhuJO", "env": "sandbox", "metadata": {}, + "sendEmailReceipts": false, "subscriptions": [ { - "id": "sub_123", - "created_at": 1717000000, - "plan_id": "plan_123", + "planId": "pro_plan", + "autoEnable": true, + "addOn": false, "status": "active", - "quantity": 1, - "interval": "month", - "interval_count": 1 + "pastDue": false, + "canceledAt": null, + "expiresAt": null, + "trialEndsAt": null, + "startedAt": 1771431921437, + "currentPeriodStart": 1771431921437, + "currentPeriodEnd": 1771999921437, + "quantity": 1 } ], "purchases": [], "balances": { - "balance_1": { - "id": "balance_1", - "amount": 100, - "currency": "USD", - "created_at": 1717000000, - "updated_at": 1717000000 + "messages": { + "featureId": "messages", + "granted": 100, + "remaining": 0, + "usage": 100, + "unlimited": false, + "overageAllowed": false, + "maxPurchase": null, + "nextResetAt": 1773851121437, + "breakdown": [ + { + "id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + "planId": "pro_plan", + "includedGrant": 100, + "prepaidGrant": 0, + "remaining": 0, + "usage": 100, + "unlimited": false, + "reset": { + "interval": "month", + "resetsAt": 1773851121437 + }, + "price": null, + "expiresAt": null + } + ] } } } diff --git a/apps/docs/mintlify/api-reference/customers/listCustomers.mdx b/apps/docs/mintlify/api-reference/customers/listCustomers.mdx index 4602764cd..80ff3d4c0 100644 --- a/apps/docs/mintlify/api-reference/customers/listCustomers.mdx +++ b/apps/docs/mintlify/api-reference/customers/listCustomers.mdx @@ -78,8 +78,10 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Active and scheduled recurring plans that this customer has attached. + The full plan object if expanded. @@ -270,36 +272,62 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + The unique identifier of the subscribed plan. + - + + Whether the plan was automatically enabled for the customer. + - + + Whether this is an add-on plan rather than a base subscription. + - + + Current status of the subscription. + - + + Whether the subscription has overdue payments. + - + + Timestamp when the subscription was canceled, or null if not canceled. + - + + Timestamp when the subscription will expire, or null if no expiry set. + - + + Timestamp when the trial period ends, or null if not on trial. + - + + Timestamp when the subscription started. + - + + Start timestamp of the current billing period. + - + + End timestamp of the current billing period. + - + + Number of units of this subscription (for per-seat plans). + + One-time purchases made by the customer. + The full plan object if expanded. @@ -490,18 +518,200 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + The unique identifier of the purchased plan. + - + + Timestamp when the purchase expires, or null for lifetime access. + - + + Timestamp when the purchase was made. + - + + Number of units purchased. + - + + Feature balances keyed by feature ID, showing usage limits and remaining amounts. + + + The feature ID this balance is for. + + + + The full feature object if expanded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Total balance granted (included + prepaid). + + + + Remaining balance available for use. + + + + Total usage consumed in the current period. + + + + Whether this feature has unlimited usage. + + + + Whether usage beyond the granted balance is allowed (with overage charges). + + + + Maximum quantity that can be purchased as a top-up, or null for unlimited. + + + + Timestamp when the balance will reset, or null for no reset. + + + + Detailed breakdown of balance sources when stacking multiple plans or grants. + + + The unique identifier for this balance breakdown. + + + + The plan ID this balance originates from, or null for standalone balances. + + + + Amount granted from the plan's included usage. + + + + Amount granted from prepaid purchases or top-ups. + + + + Remaining balance available for use. + + + + Amount consumed in the current period. + + + + Whether this balance has unlimited usage. + + + + Reset configuration for this balance, or null if no reset. + + + The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + + + Number of intervals between resets (eg. 2 for bi-monthly). + + + + Timestamp when the balance will next reset. + + + + + + + Pricing configuration if this balance has usage-based pricing. + + + The per-unit price amount. + + + + Tiered pricing configuration if applicable. + + + + + + + + + + The number of units per billing increment (eg. $9 / 250 units). + + + + Whether usage is prepaid or billed pay-per-use. + + + + Maximum quantity that can be purchased, or null for unlimited. + + + + + + + Timestamp when this balance expires, or null for no expiration. + + + + + + + Rollover balances carried over from previous periods. + + + Amount of balance rolled over from a previous period. + + + + Timestamp when the rollover balance expires. + + + + + + + @@ -521,3 +731,74 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx Total number of items returned in the current page + + + +```json 200 +{ + "list": [ + { + "id": "2ee25a41-0d81-4ad2-8451-ec1aadaefe58", + "name": "Patrick", + "email": "patrick@useautumn.com", + "createdAt": 1771409161016, + "fingerprint": null, + "stripeId": "cus_U0BKxpq1mFhuJO", + "env": "sandbox", + "metadata": {}, + "sendEmailReceipts": false, + "subscriptions": [ + { + "planId": "pro_plan", + "autoEnable": true, + "addOn": false, + "status": "active", + "pastDue": false, + "canceledAt": null, + "expiresAt": null, + "trialEndsAt": null, + "startedAt": 1771431921437, + "currentPeriodStart": 1771431921437, + "currentPeriodEnd": 1771999921437, + "quantity": 1 + } + ], + "purchases": [], + "balances": { + "messages": { + "featureId": "messages", + "granted": 100, + "remaining": 0, + "usage": 100, + "unlimited": false, + "overageAllowed": false, + "maxPurchase": null, + "nextResetAt": 1773851121437, + "breakdown": [ + { + "id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + "planId": "pro_plan", + "includedGrant": 100, + "prepaidGrant": 0, + "remaining": 0, + "usage": 100, + "unlimited": false, + "reset": { + "interval": "month", + "resetsAt": 1773851121437 + }, + "price": null, + "expiresAt": null + } + ] + } + } + } + ], + "has_more": false, + "offset": 0, + "total": 1, + "limit": 10 +} +``` + diff --git a/apps/docs/mintlify/api-reference/customers/updateCustomer.mdx b/apps/docs/mintlify/api-reference/customers/updateCustomer.mdx index e4125b295..34735a3a8 100644 --- a/apps/docs/mintlify/api-reference/customers/updateCustomer.mdx +++ b/apps/docs/mintlify/api-reference/customers/updateCustomer.mdx @@ -81,8 +81,10 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + Active and scheduled recurring plans that this customer has attached. + The full plan object if expanded. @@ -273,36 +275,62 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + The unique identifier of the subscribed plan. + - + + Whether the plan was automatically enabled for the customer. + - + + Whether this is an add-on plan rather than a base subscription. + - + + Current status of the subscription. + - + + Whether the subscription has overdue payments. + - + + Timestamp when the subscription was canceled, or null if not canceled. + - + + Timestamp when the subscription will expire, or null if no expiry set. + - + + Timestamp when the trial period ends, or null if not on trial. + - + + Timestamp when the subscription started. + - + + Start timestamp of the current billing period. + - + + End timestamp of the current billing period. + - + + Number of units of this subscription (for per-seat plans). + + One-time purchases made by the customer. + The full plan object if expanded. @@ -493,15 +521,260 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - + + The unique identifier of the purchased plan. + - + + Timestamp when the purchase expires, or null for lifetime access. + - + + Timestamp when the purchase was made. + - + + Number of units purchased. + - + + Feature balances keyed by feature ID, showing usage limits and remaining amounts. + + + The feature ID this balance is for. + + + + The full feature object if expanded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Total balance granted (included + prepaid). + + + + Remaining balance available for use. + + + + Total usage consumed in the current period. + + + + Whether this feature has unlimited usage. + + + + Whether usage beyond the granted balance is allowed (with overage charges). + + + + Maximum quantity that can be purchased as a top-up, or null for unlimited. + + + + Timestamp when the balance will reset, or null for no reset. + + + + Detailed breakdown of balance sources when stacking multiple plans or grants. + + + The unique identifier for this balance breakdown. + + + + The plan ID this balance originates from, or null for standalone balances. + + + + Amount granted from the plan's included usage. + + + + Amount granted from prepaid purchases or top-ups. + + + + Remaining balance available for use. + + + + Amount consumed in the current period. + + + + Whether this balance has unlimited usage. + + + + Reset configuration for this balance, or null if no reset. + + + The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + + + Number of intervals between resets (eg. 2 for bi-monthly). + + + + Timestamp when the balance will next reset. + + + + + + + Pricing configuration if this balance has usage-based pricing. + + + The per-unit price amount. + + + + Tiered pricing configuration if applicable. + + + + + + + + + + The number of units per billing increment (eg. $9 / 250 units). + + + + Whether usage is prepaid or billed pay-per-use. + + + + Maximum quantity that can be purchased, or null for unlimited. + + + + + + + Timestamp when this balance expires, or null for no expiration. + + + + + + + Rollover balances carried over from previous periods. + + + Amount of balance rolled over from a previous period. + + + + Timestamp when the rollover balance expires. + + + + + + + + + + +```json 200 +{ + "id": "2ee25a41-0d81-4ad2-8451-ec1aadaefe58", + "name": "Patrick", + "email": "patrick@useautumn.com", + "createdAt": 1771409161016, + "fingerprint": null, + "stripeId": "cus_U0BKxpq1mFhuJO", + "env": "sandbox", + "metadata": {}, + "sendEmailReceipts": false, + "subscriptions": [ + { + "planId": "pro_plan", + "autoEnable": true, + "addOn": false, + "status": "active", + "pastDue": false, + "canceledAt": null, + "expiresAt": null, + "trialEndsAt": null, + "startedAt": 1771431921437, + "currentPeriodStart": 1771431921437, + "currentPeriodEnd": 1771999921437, + "quantity": 1 + } + ], + "purchases": [], + "balances": { + "messages": { + "featureId": "messages", + "granted": 100, + "remaining": 0, + "usage": 100, + "unlimited": false, + "overageAllowed": false, + "maxPurchase": null, + "nextResetAt": 1773851121437, + "breakdown": [ + { + "id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + "planId": "pro_plan", + "includedGrant": 100, + "prepaidGrant": 0, + "remaining": 0, + "usage": 100, + "unlimited": false, + "reset": { + "interval": "month", + "resetsAt": 1773851121437 + }, + "price": null, + "expiresAt": null + } + ] + } + } +} +``` + diff --git a/apps/docs/mintlify/api-reference/entities/create-entity.mdx b/apps/docs/mintlify/api-reference/entities/create-entity.mdx deleted file mode 100644 index 7e6ca3b13..000000000 --- a/apps/docs/mintlify/api-reference/entities/create-entity.mdx +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Create an entity" -openapi: "openapi-1.2.0 POST /customers/{customer_id}/entities" ---- - - - You can create multiple entities at once by passing an array of entities. - diff --git a/apps/docs/mintlify/api-reference/entities/createEntity.mdx b/apps/docs/mintlify/api-reference/entities/createEntity.mdx new file mode 100644 index 000000000..272264a85 --- /dev/null +++ b/apps/docs/mintlify/api-reference/entities/createEntity.mdx @@ -0,0 +1,821 @@ +--- +title: "Create Entity" +openapi: "openapi POST /v1/entities.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 + + + The name of the entity + + + + The ID of the feature this entity is associated with + + + + Customer attributes used to resolve the customer when customer_id is not provided. + + + Customer's name + + + + Customer's email address + + + + Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse + + + + Additional metadata for the customer + + + + Stripe customer ID if you already have one + + + + Whether to create the customer in Stripe + + + + The ID of the free plan to auto-enable for the customer + + + + Whether to send email receipts to this customer + + + + + + + The ID of the customer to create the entity for. + + + + The ID of the entity. + + + +### Response + + + + + The unique identifier of the entity + + + + The name of the entity + + + + The customer ID this entity belongs to + + + + The feature ID this entity belongs to + + + + Unix timestamp when the entity was created + + + + The environment (sandbox/live) + + + + + + The full plan object if expanded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The unique identifier of the subscribed plan. + + + + Whether the plan was automatically enabled for the customer. + + + + Whether this is an add-on plan rather than a base subscription. + + + + Current status of the subscription. + + + + Whether the subscription has overdue payments. + + + + Timestamp when the subscription was canceled, or null if not canceled. + + + + Timestamp when the subscription will expire, or null if no expiry set. + + + + Timestamp when the trial period ends, or null if not on trial. + + + + Timestamp when the subscription started. + + + + Start timestamp of the current billing period. + + + + End timestamp of the current billing period. + + + + Number of units of this subscription (for per-seat plans). + + + + + + + + + The full plan object if expanded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The unique identifier of the purchased plan. + + + + Timestamp when the purchase expires, or null for lifetime access. + + + + Timestamp when the purchase was made. + + + + Number of units purchased. + + + + + + + + + The feature ID this balance is for. + + + + The full feature object if expanded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Total balance granted (included + prepaid). + + + + Remaining balance available for use. + + + + Total usage consumed in the current period. + + + + Whether this feature has unlimited usage. + + + + Whether usage beyond the granted balance is allowed (with overage charges). + + + + Maximum quantity that can be purchased as a top-up, or null for unlimited. + + + + Timestamp when the balance will reset, or null for no reset. + + + + Detailed breakdown of balance sources when stacking multiple plans or grants. + + + The unique identifier for this balance breakdown. + + + + The plan ID this balance originates from, or null for standalone balances. + + + + Amount granted from the plan's included usage. + + + + Amount granted from prepaid purchases or top-ups. + + + + Remaining balance available for use. + + + + Amount consumed in the current period. + + + + Whether this balance has unlimited usage. + + + + Reset configuration for this balance, or null if no reset. + + + The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + + + Number of intervals between resets (eg. 2 for bi-monthly). + + + + Timestamp when the balance will next reset. + + + + + + + Pricing configuration if this balance has usage-based pricing. + + + The per-unit price amount. + + + + Tiered pricing configuration if applicable. + + + + + + + + + + The number of units per billing increment (eg. $9 / 250 units). + + + + Whether usage is prepaid or billed pay-per-use. + + + + Maximum quantity that can be purchased, or null for unlimited. + + + + + + + Timestamp when this balance expires, or null for no expiration. + + + + + + + Rollover balances carried over from previous periods. + + + Amount of balance rolled over from a previous period. + + + + Timestamp when the rollover balance expires. + + + + + + + + + + Invoices for this entity (only included when expand=invoices) + + + Array of plan IDs included in this invoice + + + + The Stripe invoice ID + + + + The status of the invoice + + + + The total amount of the invoice + + + + The currency code for the invoice + + + + Timestamp when the invoice was created + + + + URL to the Stripe-hosted invoice page + + + + + + + +```json 200 +{ + "id": "seat_42", + "name": "Seat 42", + "customer_id": "cus_123", + "feature_id": "seats", + "created_at": 1771409161016, + "env": "sandbox", + "subscriptions": [ + { + "plan_id": "pro_plan", + "auto_enable": true, + "add_on": false, + "status": "active", + "past_due": false, + "canceled_at": null, + "expires_at": null, + "trial_ends_at": null, + "started_at": 1771431921437, + "current_period_start": 1771431921437, + "current_period_end": 1771999921437, + "quantity": 1 + } + ], + "purchases": [], + "balances": { + "messages": { + "feature_id": "messages", + "granted": 100, + "remaining": 72, + "usage": 28, + "unlimited": false, + "overage_allowed": false, + "max_purchase": null, + "next_reset_at": 1773851121437, + "breakdown": [ + { + "id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + "plan_id": "pro_plan", + "included_grant": 100, + "prepaid_grant": 0, + "remaining": 72, + "usage": 28, + "unlimited": false, + "reset": { + "interval": "month", + "resets_at": 1773851121437 + }, + "price": null, + "expires_at": null + } + ] + } + }, + "invoices": [] +} +``` + diff --git a/apps/docs/mintlify/api-reference/entities/delete-entity.mdx b/apps/docs/mintlify/api-reference/entities/delete-entity.mdx deleted file mode 100644 index f1378da28..000000000 --- a/apps/docs/mintlify/api-reference/entities/delete-entity.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: "Delete an entity" -openapi: "openapi-1.2.0 DELETE /customers/{customer_id}/entities/{entity_id}" ---- diff --git a/apps/docs/mintlify/api-reference/entities/deleteEntity.mdx b/apps/docs/mintlify/api-reference/entities/deleteEntity.mdx new file mode 100644 index 000000000..671a1c9e4 --- /dev/null +++ b/apps/docs/mintlify/api-reference/entities/deleteEntity.mdx @@ -0,0 +1,32 @@ +--- +title: "Delete Entity" +openapi: "openapi POST /v1/entities.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 + + + The ID of the customer. + + + + The ID of the entity. + + + +### Response + + + + + +```json 200 +{ + "success": true +} +``` + diff --git a/apps/docs/mintlify/api-reference/entities/get-entity.mdx b/apps/docs/mintlify/api-reference/entities/get-entity.mdx deleted file mode 100644 index 8fba958c8..000000000 --- a/apps/docs/mintlify/api-reference/entities/get-entity.mdx +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Get Entity" -openapi: "openapi-1.2.0 GET /customers/{customer_id}/entities/{entity_id}" ---- - - - To get additional data in the entity object, you can use the `expand` parameter to fetch data like invoices. - \ No newline at end of file diff --git a/apps/docs/mintlify/api-reference/billing/billingPreviewAttach.mdx b/apps/docs/mintlify/api-reference/entities/getEntity.mdx similarity index 58% rename from apps/docs/mintlify/api-reference/billing/billingPreviewAttach.mdx rename to apps/docs/mintlify/api-reference/entities/getEntity.mdx index 0149eaa1a..958fac036 100644 --- a/apps/docs/mintlify/api-reference/billing/billingPreviewAttach.mdx +++ b/apps/docs/mintlify/api-reference/entities/getEntity.mdx @@ -1,6 +1,6 @@ --- -title: "Billing Preview Attach" -openapi: "openapi POST /v1/billing.preview_attach" +title: "Get Entity" +openapi: "openapi POST /v1/entities.get" --- import { DynamicParamField } from "/components/dynamic-param-field.jsx"; @@ -9,260 +9,47 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx ### Body Parameters - - The ID of the customer to attach the plan to. + + The ID of the customer to create the entity for. - - The ID of the entity to attach the plan to. + + The ID of the entity. - - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. - - - - - - - - - - - - The version of the plan to attach. - - - - - - - - - - - - - - - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ### Response - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + The unique identifier of the entity - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + The name of the entity - + + The customer ID this entity belongs to + + + + The feature ID this entity belongs to + + + + Unix timestamp when the entity was created + + + + The environment (sandbox/live) + + + + The full plan object if expanded. @@ -453,27 +240,61 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - - - - - - - + + The unique identifier of the subscribed plan. - + + Whether the plan was automatically enabled for the customer. + - + + Whether this is an add-on plan rather than a base subscription. + - + + Current status of the subscription. + + + + Whether the subscription has overdue payments. + + + + Timestamp when the subscription was canceled, or null if not canceled. + + + + Timestamp when the subscription will expire, or null if no expiry set. + + + + Timestamp when the trial period ends, or null if not on trial. + + + + Timestamp when the subscription started. + + + + Start timestamp of the current billing period. + + + + End timestamp of the current billing period. + + + + Number of units of this subscription (for per-seat plans). + - + + The full plan object if expanded. @@ -664,22 +485,291 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx - - - - - - - + + The unique identifier of the purchased plan. - + + Timestamp when the purchase expires, or null for lifetime access. + - + + Timestamp when the purchase was made. + - + + Number of units purchased. + - + + + + The feature ID this balance is for. + + + + The full feature object if expanded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Total balance granted (included + prepaid). + + + + Remaining balance available for use. + + + + Total usage consumed in the current period. + + + + Whether this feature has unlimited usage. + + + + Whether usage beyond the granted balance is allowed (with overage charges). + + + + Maximum quantity that can be purchased as a top-up, or null for unlimited. + + + + Timestamp when the balance will reset, or null for no reset. + + + + Detailed breakdown of balance sources when stacking multiple plans or grants. + + + The unique identifier for this balance breakdown. + + + + The plan ID this balance originates from, or null for standalone balances. + + + + Amount granted from the plan's included usage. + + + + Amount granted from prepaid purchases or top-ups. + + + + Remaining balance available for use. + + + + Amount consumed in the current period. + + + + Whether this balance has unlimited usage. + + + + Reset configuration for this balance, or null if no reset. + + + The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + + + Number of intervals between resets (eg. 2 for bi-monthly). + + + + Timestamp when the balance will next reset. + + + + + + + Pricing configuration if this balance has usage-based pricing. + + + The per-unit price amount. + + + + Tiered pricing configuration if applicable. + + + + + + + + + + The number of units per billing increment (eg. $9 / 250 units). + + + + Whether usage is prepaid or billed pay-per-use. + + + + Maximum quantity that can be purchased, or null for unlimited. + + + + + + + Timestamp when this balance expires, or null for no expiration. + + + + + + + Rollover balances carried over from previous periods. + + + Amount of balance rolled over from a previous period. + + + + Timestamp when the rollover balance expires. + + + + + + + + + + Invoices for this entity (only included when expand=invoices) + + + Array of plan IDs included in this invoice + + + + The Stripe invoice ID + + + + The status of the invoice + + + + The total amount of the invoice + + + + The currency code for the invoice + + + + Timestamp when the invoice was created + + + + URL to the Stripe-hosted invoice page + + + + + + + +```json 200 +{ + "id": "seat_42", + "name": "Seat 42", + "customer_id": "cus_123", + "feature_id": "seats", + "created_at": 1771409161016, + "env": "sandbox", + "subscriptions": [ + { + "plan_id": "pro_plan", + "auto_enable": true, + "add_on": false, + "status": "active", + "past_due": false, + "canceled_at": null, + "expires_at": null, + "trial_ends_at": null, + "started_at": 1771431921437, + "current_period_start": 1771431921437, + "current_period_end": 1771999921437, + "quantity": 1 + } + ], + "purchases": [], + "balances": { + "messages": { + "feature_id": "messages", + "granted": 100, + "remaining": 72, + "usage": 28, + "unlimited": false, + "overage_allowed": false, + "max_purchase": null, + "next_reset_at": 1773851121437, + "breakdown": [ + { + "id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + "plan_id": "pro_plan", + "included_grant": 100, + "prepaid_grant": 0, + "remaining": 72, + "usage": 28, + "unlimited": false, + "reset": { + "interval": "month", + "resets_at": 1773851121437 + }, + "price": null, + "expires_at": null + } + ] + } + }, + "invoices": [] +} +``` + diff --git a/apps/docs/mintlify/api-reference/events/aggregate-events.mdx b/apps/docs/mintlify/api-reference/events/aggregate-events.mdx deleted file mode 100644 index 93c6c1adb..000000000 --- a/apps/docs/mintlify/api-reference/events/aggregate-events.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: "Aggregate Events" -openapi: "openapi-1.2.0 POST /events/aggregate" ---- diff --git a/apps/docs/mintlify/api-reference/events/aggregateEvents.mdx b/apps/docs/mintlify/api-reference/events/aggregateEvents.mdx new file mode 100644 index 000000000..8c19f423e --- /dev/null +++ b/apps/docs/mintlify/api-reference/events/aggregateEvents.mdx @@ -0,0 +1,200 @@ +--- +title: "Aggregate Events" +openapi: "openapi POST /v1/events.aggregate" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property. + +## Working with Properties + +When tracking events, you can attach custom properties that can later be used for grouping aggregations: + +```typescript +// Track an event with properties +await autumn.track({ + customerId: "cus_123", + featureId: "api_calls", + value: 1, + properties: { + model: "gpt-4", + source: "api", + region: "us-east" + } +}); +``` + +You can then aggregate events grouped by any property using the `group_by` parameter: + +```typescript +const result = await autumn.events.aggregate({ + customerId: "cus_123", + featureId: "api_calls", + range: "7d", + groupBy: "properties.model" // Group by the "model" property +}); +``` + +## Response Format + +The response structure changes based on whether `group_by` is provided: + +### Without `group_by` (Flat Response) + +When no grouping is specified, `values` contains the aggregated sum for each feature: + +```json +{ + "list": [ + { + "period": 1762905600000, + "values": { + "api_calls": 150, + "messages": 45 + } + } + ], + "total": { + "api_calls": { "count": 10, "sum": 150 }, + "messages": { "count": 5, "sum": 45 } + } +} +``` + +### With `group_by` (Grouped Response) + +When grouping is specified, `values` contains the total sum while `grouped_values` breaks down values by group: + +```json +{ + "list": [ + { + "period": 1762905600000, + "values": { + "api_calls": 150 + }, + "grouped_values": { + "api_calls": { + "gpt-4": 100, + "gpt-3.5": 50 + } + } + } + ], + "total": { + "api_calls": { "count": 10, "sum": 150 } + } +} +``` + + + The `grouped_values` field is only present when `group_by` is provided in the request. + + +### Body Parameters + + + Customer ID to aggregate events for + + + + Feature ID(s) to aggregate events for + + + + Property to group events by. If provided, each key in the response will be an object with distinct groups as the keys + + + + Time range to aggregate events for. Either range or custom_range must be provided + + + + Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day + + + + Custom time range to aggregate events for. If provided, range must not be provided + + + + + + + + + +### Response + + + Array of time periods with aggregated values + + + Unix timestamp (epoch ms) for this time period + + + + Aggregated values per feature: \{ [featureId]: number \} + + + + Values broken down by group (only present when group_by is used): \{ [featureId]: \{ [groupValue]: number \} \} + + + + + + + + + + + Total aggregations per feature. Keys are feature IDs, values contain count and sum. + + + Number of events for this feature + + + + Sum of event values for this feature + + + + + + + +```json 200 +{ + "list": [ + { + "period": 1762905600000, + "values": { + "messages": 10, + "sessions": 3 + } + }, + { + "period": 1762992000000, + "values": { + "messages": 3, + "sessions": 12 + } + } + ], + "total": { + "messages": { + "count": 2, + "sum": 13 + }, + "sessions": { + "count": 2, + "sum": 15 + } + } +} +``` + diff --git a/apps/docs/mintlify/api-reference/events/list-events.mdx b/apps/docs/mintlify/api-reference/events/list-events.mdx deleted file mode 100644 index 8ff8b00da..000000000 --- a/apps/docs/mintlify/api-reference/events/list-events.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: "List Events" -openapi: "openapi-1.2.0 POST /events/list" ---- diff --git a/apps/docs/mintlify/api-reference/events/listEvents.mdx b/apps/docs/mintlify/api-reference/events/listEvents.mdx new file mode 100644 index 000000000..d7320ecfe --- /dev/null +++ b/apps/docs/mintlify/api-reference/events/listEvents.mdx @@ -0,0 +1,119 @@ +--- +title: "List Events" +openapi: "openapi POST /v1/events.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"; + +### Body Parameters + + + Number of items to skip + + + + Number of items to return. Default 100, max 1000. + + + + Filter events by customer ID + + + + Filter by specific feature ID(s) + + + + Filter events by time range + + + Filter events after this timestamp (epoch milliseconds) + + + + Filter events before this timestamp (epoch milliseconds) + + + + + + +### Response + + + Array of items for current page + + + Event ID (KSUID) + + + + Event timestamp (epoch milliseconds) + + + + ID of the feature that the event belongs to + + + + Customer identifier + + + + Event value/count + + + + Event properties (JSONB) + + + + + + + Whether more results exist after this page + + + + Current offset position + + + + Limit passed in the request + + + + Total number of items returned in the current page + + + + +```json 200 +{ + "list": [ + { + "id": "evt_36xpk2TmuQX5zVPPQ8tCtnR5Weg", + "timestamp": 1765958215459, + "feature_id": "credits", + "customer_id": "0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx", + "value": 30, + "properties": {} + }, + { + "id": "evt_36xmHxxjAkqxufDf9yHAPNfRrLM", + "timestamp": 1765956512057, + "feature_id": "credits", + "customer_id": "0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx", + "value": 49, + "properties": {} + } + ], + "total": 2, + "has_more": false, + "offset": 0, + "limit": 100 +} +``` + diff --git a/apps/docs/mintlify/api-reference/referrals/createReferralCode.mdx b/apps/docs/mintlify/api-reference/referrals/createReferralCode.mdx new file mode 100644 index 000000000..729c843c2 --- /dev/null +++ b/apps/docs/mintlify/api-reference/referrals/createReferralCode.mdx @@ -0,0 +1,44 @@ +--- +title: "Create Referral Code" +openapi: "openapi POST /v1/referrals.create_code" +--- + +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 + + + The unique identifier of the customer + + + + ID of your referral program + + + +### Response + + + The referral code that can be shared with customers + + + + Your unique identifier for the customer + + + + The timestamp of when the referral code was created + + + + +```json 200 +{ + "code": "", + "customer_id": "", + "created_at": 123 +} +``` + diff --git a/apps/docs/mintlify/api-reference/referrals/redeemReferralCode.mdx b/apps/docs/mintlify/api-reference/referrals/redeemReferralCode.mdx new file mode 100644 index 000000000..8b65a386a --- /dev/null +++ b/apps/docs/mintlify/api-reference/referrals/redeemReferralCode.mdx @@ -0,0 +1,44 @@ +--- +title: "Redeem Referral Code" +openapi: "openapi POST /v1/referrals.redeem_code" +--- + +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 + + + The referral code to redeem + + + + The unique identifier of the customer redeeming the code + + + +### Response + + + The ID of the redemption event + + + + Your unique identifier for the customer + + + + The ID of the reward that will be granted + + + + +```json 200 +{ + "id": "", + "customer_id": "", + "reward_id": "" +} +``` + diff --git a/apps/docs/mintlify/api-reference/referrals/referral-code.mdx b/apps/docs/mintlify/api-reference/referrals/referral-code.mdx deleted file mode 100644 index 3eccf2005..000000000 --- a/apps/docs/mintlify/api-reference/referrals/referral-code.mdx +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: "Create a referral code" -openapi: "productsapi POST /referrals/code" ---- - -This endpoint creates or retrieves a unique referral code for a customer within a specific referral program. - - - A referral code is unique per customer within each program. On the first call, a new code is created, but subsequent calls will return the same existing code for that customer and program combination. - - - - The `program_id` parameter refers to the referral program ID that you define when creating a referral program in the Autumn dashboard. Each program can have different rewards and rules. - - -{/* ## How it works - -1. **First call**: Creates a new unique referral code for the customer -2. **Subsequent calls**: Returns the existing code for that customer/program pair -3. **Code sharing**: Customers can share their referral code with others -4. **Redemption**: Other customers can redeem the code using the [redeem endpoint](/api-reference/products/referral-redeem) - -## Use Cases - -This endpoint is useful for: - -- **Customer referral programs**: Allow customers to generate codes to share with friends -- **Affiliate marketing**: Create tracking codes for affiliate partners -- **Loyalty programs**: Generate codes tied to specific promotional campaigns -- **User dashboards**: Display referral codes in customer account pages */} diff --git a/apps/docs/mintlify/api-reference/referrals/referral-redeem.mdx b/apps/docs/mintlify/api-reference/referrals/referral-redeem.mdx deleted file mode 100644 index 746c480a7..000000000 --- a/apps/docs/mintlify/api-reference/referrals/referral-redeem.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: "Redeem a referral code" -openapi: "productsapi POST /referrals/redeem" ---- diff --git a/apps/docs/mintlify/api/openapi.yml b/apps/docs/mintlify/api/openapi.yml index af2eb915a..83b7a3c8a 100644 --- a/apps/docs/mintlify/api/openapi.yml +++ b/apps/docs/mintlify/api/openapi.yml @@ -119,43 +119,57 @@ components: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the subscribed plan. auto_enable: type: boolean + description: Whether the plan was automatically enabled for the customer. add_on: type: boolean + description: Whether this is an add-on plan rather than a base subscription. status: enum: - active - scheduled - - expired + description: Current status of the subscription. past_due: type: boolean + description: Whether the subscription has overdue payments. canceled_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription was canceled, or null if not + canceled. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry + set. trial_ends_at: anyOf: - type: number - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. started_at: type: number + description: Timestamp when the subscription started. current_period_start: anyOf: - type: number - type: "null" + description: Start timestamp of the current billing period. current_period_end: anyOf: - type: number - type: "null" + description: End timestamp of the current billing period. quantity: type: number + description: Number of units of this subscription (for per-seat plans). required: - plan_id - auto_enable @@ -169,6 +183,7 @@ components: - current_period_start - current_period_end - quantity + description: Active and scheduled recurring plans that this customer has attached. purchases: type: array items: @@ -176,21 +191,27 @@ components: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the purchased plan. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. started_at: type: number + description: Timestamp when the purchase was made. quantity: type: number + description: Number of units purchased. required: - plan_id - expires_at - started_at - quantity + description: One-time purchases made by the customer. balances: type: object propertyNames: @@ -200,6 +221,7 @@ components: properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -249,25 +271,35 @@ components: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -276,20 +308,28 @@ components: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -307,22 +347,28 @@ components: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -337,25 +383,31 @@ components: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -366,6 +418,8 @@ components: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -373,11 +427,14 @@ components: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -387,6 +444,30 @@ components: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + description: Feature balances keyed by feature ID, showing usage limits and + remaining amounts. invoices: type: array items: @@ -602,30 +683,52 @@ components: - balances examples: - &a2 - id: cus_123 - created_at: 1717000000 - name: John Doe - email: john@example.com - fingerprint: "1234567890" - stripe_id: cus_123 + id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58 + name: Patrick + email: patrick@useautumn.com + createdAt: 1771409161016 + fingerprint: null + stripeId: cus_U0BKxpq1mFhuJO env: sandbox metadata: {} + sendEmailReceipts: false subscriptions: - - id: sub_123 - created_at: 1717000000 - plan_id: plan_123 + - planId: pro_plan + autoEnable: true + addOn: false status: active + pastDue: false + canceledAt: null + expiresAt: null + trialEndsAt: null + startedAt: 1771431921437 + currentPeriodStart: 1771431921437 + currentPeriodEnd: 1771999921437 quantity: 1 - interval: month - interval_count: 1 purchases: [] balances: - balance_1: - id: balance_1 - amount: 100 - currency: USD - created_at: 1717000000 - updated_at: 1717000000 + messages: + featureId: messages + granted: 100 + remaining: 0 + usage: 100 + unlimited: false + overageAllowed: false + maxPurchase: null + nextResetAt: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + planId: pro_plan + includedGrant: 100 + prepaidGrant: 0 + remaining: 0 + usage: 100 + unlimited: false + reset: + interval: month + resetsAt: 1773851121437 + price: null + expiresAt: null Plan: type: object properties: @@ -1161,43 +1264,57 @@ paths: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the subscribed plan. auto_enable: type: boolean + description: Whether the plan was automatically enabled for the customer. add_on: type: boolean + description: Whether this is an add-on plan rather than a base subscription. status: enum: - active - scheduled - - expired + description: Current status of the subscription. past_due: type: boolean + description: Whether the subscription has overdue payments. canceled_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription was canceled, or null if not + canceled. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry + set. trial_ends_at: anyOf: - type: number - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. started_at: type: number + description: Timestamp when the subscription started. current_period_start: anyOf: - type: number - type: "null" + description: Start timestamp of the current billing period. current_period_end: anyOf: - type: number - type: "null" + description: End timestamp of the current billing period. quantity: type: number + description: Number of units of this subscription (for per-seat plans). required: - plan_id - auto_enable @@ -1211,6 +1328,8 @@ paths: - current_period_start - current_period_end - quantity + description: Active and scheduled recurring plans that this customer has + attached. purchases: type: array items: @@ -1218,21 +1337,27 @@ paths: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the purchased plan. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. started_at: type: number + description: Timestamp when the purchase was made. quantity: type: number + description: Number of units purchased. required: - plan_id - expires_at - started_at - quantity + description: One-time purchases made by the customer. balances: type: object propertyNames: @@ -1242,6 +1367,7 @@ paths: properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -1291,25 +1417,35 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -1318,20 +1454,28 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -1349,22 +1493,29 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different + intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -1378,25 +1529,31 @@ paths: type: number required: - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -1407,6 +1564,8 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -1414,11 +1573,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -1428,6 +1590,30 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + description: Feature balances keyed by feature ID, showing usage limits and + remaining amounts. required: - id - name @@ -1441,6 +1627,53 @@ paths: - subscriptions - purchases - balances + examples: + - id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58 + name: Patrick + email: patrick@useautumn.com + createdAt: 1771409161016 + fingerprint: null + stripeId: cus_U0BKxpq1mFhuJO + env: sandbox + metadata: {} + sendEmailReceipts: false + subscriptions: + - planId: pro_plan + autoEnable: true + addOn: false + status: active + pastDue: false + canceledAt: null + expiresAt: null + trialEndsAt: null + startedAt: 1771431921437 + currentPeriodStart: 1771431921437 + currentPeriodEnd: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + featureId: messages + granted: 100 + remaining: 0 + usage: 100 + unlimited: false + overageAllowed: false + maxPurchase: null + nextResetAt: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + planId: pro_plan + includedGrant: 100 + prepaidGrant: 0 + remaining: 0 + usage: 100 + unlimited: false + reset: + interval: month + resetsAt: 1773851121437 + price: null + expiresAt: null description: Array of items for current page has_more: type: boolean @@ -1460,6 +1693,60 @@ paths: - offset - limit - total + examples: + - &a4 + list: + - id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58 + name: Patrick + email: patrick@useautumn.com + createdAt: 1771409161016 + fingerprint: null + stripeId: cus_U0BKxpq1mFhuJO + env: sandbox + metadata: {} + sendEmailReceipts: false + subscriptions: + - planId: pro_plan + autoEnable: true + addOn: false + status: active + pastDue: false + canceledAt: null + expiresAt: null + trialEndsAt: null + startedAt: 1771431921437 + currentPeriodStart: 1771431921437 + currentPeriodEnd: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + featureId: messages + granted: 100 + remaining: 0 + usage: 100 + unlimited: false + overageAllowed: false + maxPurchase: null + nextResetAt: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + planId: pro_plan + includedGrant: 100 + prepaidGrant: 0 + remaining: 0 + usage: 100 + unlimited: false + reset: + interval: month + resetsAt: 1773851121437 + price: null + expiresAt: null + has_more: false + offset: 0 + total: 1 + limit: 10 + example: *a4 x-speakeasy-name-override: list parameters: - name: x-api-version @@ -1543,11 +1830,11 @@ paths: - customer_id title: UpdateCustomerParams examples: - - &a4 + - &a5 customer_id: cus_123 name: Jane Doe email: jane@example.com - example: *a4 + example: *a5 responses: "200": description: OK @@ -1605,43 +1892,57 @@ paths: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the subscribed plan. auto_enable: type: boolean + description: Whether the plan was automatically enabled for the customer. add_on: type: boolean + description: Whether this is an add-on plan rather than a base subscription. status: enum: - active - scheduled - - expired + description: Current status of the subscription. past_due: type: boolean + description: Whether the subscription has overdue payments. canceled_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription was canceled, or null if not + canceled. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry + set. trial_ends_at: anyOf: - type: number - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. started_at: type: number + description: Timestamp when the subscription started. current_period_start: anyOf: - type: number - type: "null" + description: Start timestamp of the current billing period. current_period_end: anyOf: - type: number - type: "null" + description: End timestamp of the current billing period. quantity: type: number + description: Number of units of this subscription (for per-seat plans). required: - plan_id - auto_enable @@ -1655,6 +1956,8 @@ paths: - current_period_start - current_period_end - quantity + description: Active and scheduled recurring plans that this customer has + attached. purchases: type: array items: @@ -1662,21 +1965,27 @@ paths: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the purchased plan. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. started_at: type: number + description: Timestamp when the purchase was made. quantity: type: number + description: Number of units purchased. required: - plan_id - expires_at - started_at - quantity + description: One-time purchases made by the customer. balances: type: object propertyNames: @@ -1686,6 +1995,7 @@ paths: properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -1735,25 +2045,35 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -1762,20 +2082,28 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -1793,22 +2121,28 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -1823,25 +2157,31 @@ paths: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -1852,6 +2192,8 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -1859,11 +2201,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -1873,6 +2218,30 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + description: Feature balances keyed by feature ID, showing usage limits and + remaining amounts. required: - id - name @@ -1886,6 +2255,55 @@ paths: - subscriptions - purchases - balances + examples: + - &a6 + id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58 + name: Patrick + email: patrick@useautumn.com + createdAt: 1771409161016 + fingerprint: null + stripeId: cus_U0BKxpq1mFhuJO + env: sandbox + metadata: {} + sendEmailReceipts: false + subscriptions: + - planId: pro_plan + autoEnable: true + addOn: false + status: active + pastDue: false + canceledAt: null + expiresAt: null + trialEndsAt: null + startedAt: 1771431921437 + currentPeriodStart: 1771431921437 + currentPeriodEnd: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + featureId: messages + granted: 100 + remaining: 0 + usage: 100 + unlimited: false + overageAllowed: false + maxPurchase: null + nextResetAt: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + planId: pro_plan + includedGrant: 100 + prepaidGrant: 0 + remaining: 0 + usage: 100 + unlimited: false + reset: + interval: month + resetsAt: 1773851121437 + price: null + expiresAt: null + example: *a6 x-speakeasy-name-override: update parameters: - name: x-api-version @@ -1945,10 +2363,10 @@ paths: - customer_id title: DeleteCustomerParams examples: - - &a5 + - &a7 customer_id: cus_123 delete_in_stripe: false - example: *a5 + example: *a7 responses: "200": description: OK @@ -2054,8 +2472,13 @@ paths: /v1/billing.attach: post: operationId: billingAttach - description: Attaches a plan to a customer. Handles new subscriptions, upgrades - and downgrades. + description: >- + Attaches a plan to a customer. Handles new subscriptions, upgrades and + downgrades. + + + Use this endpoint to subscribe a customer to a plan, upgrade/downgrade + between plans, or add an add-on product. tags: - billing requestBody: @@ -2069,26 +2492,25 @@ paths: type: string description: The ID of the customer to attach the plan to. entity_id: - anyOf: - - type: string - - type: "null" + type: string description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: The ID of the plan. feature_quantities: - anyOf: - - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - minimum: 0 - adjustable: - type: boolean - required: - - feature_id - - type: "null" + type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + minimum: 0 + adjustable: + type: boolean + required: + - feature_id description: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting @@ -2114,6 +2536,8 @@ paths: required: - duration_length - type: "null" + description: Override the plan's default free trial. Pass an object to set a + custom trial, or null to remove the trial entirely. customize: type: object properties: @@ -2244,21 +2668,37 @@ paths: - feature_id description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - plan_id: - type: string invoice_mode: type: object properties: enabled: type: boolean + description: When true, creates an invoice and sends it to the customer instead + of charging their card immediately. Uses Stripe's + send_invoice collection method. enable_plan_immediately: type: boolean default: false + description: If true, enables the plan immediately even though the invoice is + not paid yet. finalize: type: boolean default: true + description: If true, finalizes the invoice so it can be sent to the customer. + If false, keeps it as a draft for manual review. required: - enabled + description: Invoice mode creates a draft or open invoice and sends it to the + customer, instead of charging their card immediately. This + uses Stripe's send_invoice collection method. + billing_behavior: + enum: + - prorate_immediately + - next_cycle_only + description: 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. discounts: type: array items: @@ -2267,35 +2707,44 @@ paths: properties: reward_id: type: string + description: The ID of the reward to apply as a discount. required: - reward_id - type: object properties: promotion_code: type: string + description: The promotion code to apply as a discount. required: - promotion_code - redirect_mode: - enum: - - always - - if_required - - never - default: always + description: A discount to apply. Can be either a reward ID or a promotion code. + description: List of discounts to apply. Each discount can be an Autumn reward + ID, Stripe coupon ID, or Stripe promotion code. success_url: type: string + description: URL to redirect to after successful checkout. new_billing_subscription: type: boolean + description: Only applicable when the customer has an existing Stripe + subscription. If true, creates a new separate subscription + instead of merging into the existing one. plan_schedule: enum: - immediate - end_of_cycle - billing_behavior: - enum: - - prorate_immediately - - next_cycle_only + description: When the plan change should take effect. 'immediate' applies now, + 'end_of_cycle' schedules for the end of the current billing + cycle. By default, upgrades are immediate and downgrades are + scheduled. required: - customer_id - plan_id + title: AttachParams + examples: + - &a8 + customer_id: cus_123 + plan_id: pro_plan + example: *a8 responses: "200": description: OK @@ -2306,8 +2755,10 @@ paths: properties: customer_id: type: string + description: The ID of the customer. entity_id: type: string + description: The ID of the entity, if the plan was attached to an entity. invoice: type: object properties: @@ -2315,26 +2766,36 @@ paths: anyOf: - type: string - type: "null" + description: The status of the invoice (e.g., 'paid', 'open', 'draft'). stripe_id: type: string + description: The Stripe invoice ID. total: type: number + description: The total amount of the invoice in cents. currency: type: string + description: The three-letter ISO currency code (e.g., 'usd'). hosted_invoice_url: anyOf: - type: string - type: "null" + description: URL to the hosted invoice page where the customer can view and pay + the invoice. required: - status - stripe_id - total - currency - hosted_invoice_url + description: Invoice details if an invoice was created. Only present when a + charge was made. payment_url: anyOf: - type: string - type: "null" + description: URL to redirect the customer to complete payment. Null if no + payment action is required. required_action: type: object properties: @@ -2343,14 +2804,23 @@ paths: - 3ds_required - payment_method_required - payment_failed + description: The type of action required to complete the payment. reason: type: string + description: A human-readable explanation of why this action is required. required: - code - reason + description: Details about any action required to complete the payment. Present + when the payment could not be processed automatically. required: - customer_id - payment_url + examples: + - &a9 + customer_id: cus_123 + payment_url: https://checkout.stripe.com/... + example: *a9 x-speakeasy-name-override: attach parameters: - name: x-api-version @@ -2369,8 +2839,8 @@ paths: const autumn = new Autumn() const result = await autumn.billing.attach({ - customerId: "", - planId: "", + customerId: "cus_123", + planId: "pro_plan", }); - lang: python label: Python (SDK) @@ -2380,14 +2850,19 @@ paths: autumn = Autumn(secret_key="am_sk_test...") res = autumn.billing.attach( - customer_id="", - plan_id="", - redirect_mode="always", + customer_id="cus_123", + plan_id="pro_plan", ) /v1/billing.preview_attach: post: - operationId: billingPreviewAttach - description: Preview billing changes before attaching a plan. + operationId: previewAttach + description: >- + Previews the billing changes that would occur when attaching a plan, + without actually making any changes. + + + Use this endpoint to show customers what they will be charged before + confirming a subscription change. tags: - billing requestBody: @@ -2401,26 +2876,25 @@ paths: type: string description: The ID of the customer to attach the plan to. entity_id: - anyOf: - - type: string - - type: "null" + type: string description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: The ID of the plan. feature_quantities: - anyOf: - - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - minimum: 0 - adjustable: - type: boolean - required: - - feature_id - - type: "null" + type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + minimum: 0 + adjustable: + type: boolean + required: + - feature_id description: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting @@ -2446,6 +2920,8 @@ paths: required: - duration_length - type: "null" + description: Override the plan's default free trial. Pass an object to set a + custom trial, or null to remove the trial entirely. customize: type: object properties: @@ -2576,21 +3052,37 @@ paths: - feature_id description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - plan_id: - type: string invoice_mode: type: object properties: enabled: type: boolean + description: When true, creates an invoice and sends it to the customer instead + of charging their card immediately. Uses Stripe's + send_invoice collection method. enable_plan_immediately: type: boolean default: false + description: If true, enables the plan immediately even though the invoice is + not paid yet. finalize: type: boolean default: true + description: If true, finalizes the invoice so it can be sent to the customer. + If false, keeps it as a draft for manual review. required: - enabled + description: Invoice mode creates a draft or open invoice and sends it to the + customer, instead of charging their card immediately. This + uses Stripe's send_invoice collection method. + billing_behavior: + enum: + - prorate_immediately + - next_cycle_only + description: 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. discounts: type: array items: @@ -2599,35 +3091,44 @@ paths: properties: reward_id: type: string + description: The ID of the reward to apply as a discount. required: - reward_id - type: object properties: promotion_code: type: string + description: The promotion code to apply as a discount. required: - promotion_code - redirect_mode: - enum: - - always - - if_required - - never - default: always + description: A discount to apply. Can be either a reward ID or a promotion code. + description: List of discounts to apply. Each discount can be an Autumn reward + ID, Stripe coupon ID, or Stripe promotion code. success_url: type: string + description: URL to redirect to after successful checkout. new_billing_subscription: type: boolean + description: Only applicable when the customer has an existing Stripe + subscription. If true, creates a new separate subscription + instead of merging into the existing one. plan_schedule: enum: - immediate - end_of_cycle - billing_behavior: - enum: - - prorate_immediately - - next_cycle_only + description: When the plan change should take effect. 'immediate' applies now, + 'end_of_cycle' schedules for the end of the current billing + cycle. By default, upgrades are immediate and downgrades are + scheduled. required: - customer_id - plan_id + title: PreviewAttachParams + examples: + - &a10 + customer_id: cus_123 + plan_id: pro_plan + example: *a10 responses: "200": description: OK @@ -2638,6 +3139,7 @@ paths: properties: customer_id: type: string + description: The ID of the customer. line_items: type: array items: @@ -2645,10 +3147,13 @@ paths: properties: title: type: string + description: The title of the line item. description: type: string + description: A detailed description of the line item. amount: type: number + description: The amount in cents for this line item. discounts: type: array items: @@ -2665,564 +3170,48 @@ paths: required: - amountOff default: [] - plan_id: - type: string - total_quantity: - type: number - paid_quantity: - type: number - deferred_for_trial: - type: boolean - effective_period: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - is_base: - type: boolean + description: List of discounts applied to this line item. required: - title - description - amount - - plan_id - - total_quantity - - paid_quantity + description: List of line items for the current billing period. total: type: number + description: The total amount in cents for the current billing period. currency: type: string - period_start: - type: number - period_end: - type: number + description: The three-letter ISO currency code (e.g., 'usd'). next_cycle: type: object properties: starts_at: type: number + description: Unix timestamp (milliseconds) when the next billing cycle starts. total: type: number - line_items: - type: array - items: - type: object - properties: - title: - type: string - description: - type: string - amount: - type: number - discounts: - type: array - items: - type: object - properties: - amountOff: - type: number - percentOff: - type: number - stripeCouponId: - type: string - couponName: - type: string - required: - - amountOff - default: [] - plan_id: - type: string - total_quantity: - type: number - paid_quantity: - type: number - deferred_for_trial: - type: boolean - effective_period: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - is_base: - type: boolean - required: - - title - - description - - amount - - plan_id - - total_quantity - - paid_quantity + description: The total amount in cents for the next cycle. required: - starts_at - total - - line_items - incoming: - type: array - items: - type: object - properties: - plan: - $ref: "#/components/schemas/Plan" - feature_quantities: - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - required: - - feature_id - - quantity - balances: - type: object - propertyNames: - type: string - additionalProperties: - type: object - properties: - feature_id: - type: string - feature: - type: object - properties: - id: - type: string - name: - type: string - type: - enum: - - boolean - - metered - - credit_system - consumable: - type: boolean - event_names: - type: array - items: - type: string - credit_schema: - type: array - items: - type: object - properties: - metered_feature_id: - type: string - credit_cost: - type: number - required: - - metered_feature_id - - credit_cost - display: - type: object - properties: - singular: - anyOf: - - type: string - - type: "null" - plural: - anyOf: - - type: string - - type: "null" - archived: - type: boolean - required: - - id - - name - - type - - consumable - - archived - granted: - type: number - remaining: - type: number - minimum: 0 - usage: - type: number - unlimited: - type: boolean - overage_allowed: - type: boolean - max_purchase: - anyOf: - - type: number - - type: "null" - next_reset_at: - anyOf: - - type: number - - type: "null" - breakdown: - type: array - items: - type: object - properties: - id: - type: string - default: "" - plan_id: - anyOf: - - type: string - - type: "null" - included_grant: - type: number - prepaid_grant: - type: number - remaining: - type: number - usage: - type: number - unlimited: - type: boolean - reset: - anyOf: - - type: object - properties: - interval: - anyOf: - - enum: - - one_off - - minute - - hour - - day - - week - - month - - quarter - - semi_annual - - year - - const: multiple - interval_count: - type: number - resets_at: - anyOf: - - type: number - - type: "null" - required: - - interval - - resets_at - - type: "null" - price: - anyOf: - - type: object - properties: - amount: - type: number - tiers: - type: array - items: - type: object - properties: - to: - anyOf: - - {} - - {} - amount: - type: number - required: - - amount - billing_units: - type: number - billing_method: - enum: - - prepaid - - usage_based - max_purchase: - anyOf: - - type: number - - type: "null" - required: - - billing_units - - billing_method - - max_purchase - - type: "null" - expires_at: - anyOf: - - type: number - - type: "null" - required: - - plan_id - - included_grant - - prepaid_grant - - remaining - - usage - - unlimited - - reset - - price - - expires_at - rollovers: - type: array - items: - type: object - properties: - balance: - type: number - expires_at: - type: number - required: - - balance - - expires_at - required: - - feature_id - - granted - - remaining - - usage - - unlimited - - overage_allowed - - max_purchase - - next_reset_at - period_start: - type: number - period_end: - type: number - required: - - plan - - feature_quantities - - balances - outgoing: - type: array - items: - type: object - properties: - plan: - $ref: "#/components/schemas/Plan" - feature_quantities: - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - required: - - feature_id - - quantity - balances: - type: object - propertyNames: - type: string - additionalProperties: - type: object - properties: - feature_id: - type: string - feature: - type: object - properties: - id: - type: string - name: - type: string - type: - enum: - - boolean - - metered - - credit_system - consumable: - type: boolean - event_names: - type: array - items: - type: string - credit_schema: - type: array - items: - type: object - properties: - metered_feature_id: - type: string - credit_cost: - type: number - required: - - metered_feature_id - - credit_cost - display: - type: object - properties: - singular: - anyOf: - - type: string - - type: "null" - plural: - anyOf: - - type: string - - type: "null" - archived: - type: boolean - required: - - id - - name - - type - - consumable - - archived - granted: - type: number - remaining: - type: number - minimum: 0 - usage: - type: number - unlimited: - type: boolean - overage_allowed: - type: boolean - max_purchase: - anyOf: - - type: number - - type: "null" - next_reset_at: - anyOf: - - type: number - - type: "null" - breakdown: - type: array - items: - type: object - properties: - id: - type: string - default: "" - plan_id: - anyOf: - - type: string - - type: "null" - included_grant: - type: number - prepaid_grant: - type: number - remaining: - type: number - usage: - type: number - unlimited: - type: boolean - reset: - anyOf: - - type: object - properties: - interval: - anyOf: - - enum: - - one_off - - minute - - hour - - day - - week - - month - - quarter - - semi_annual - - year - - const: multiple - interval_count: - type: number - resets_at: - anyOf: - - type: number - - type: "null" - required: - - interval - - resets_at - - type: "null" - price: - anyOf: - - type: object - properties: - amount: - type: number - tiers: - type: array - items: - type: object - properties: - to: - anyOf: - - {} - - {} - amount: - type: number - required: - - amount - billing_units: - type: number - billing_method: - enum: - - prepaid - - usage_based - max_purchase: - anyOf: - - type: number - - type: "null" - required: - - billing_units - - billing_method - - max_purchase - - type: "null" - expires_at: - anyOf: - - type: number - - type: "null" - required: - - plan_id - - included_grant - - prepaid_grant - - remaining - - usage - - unlimited - - reset - - price - - expires_at - rollovers: - type: array - items: - type: object - properties: - balance: - type: number - expires_at: - type: number - required: - - balance - - expires_at - required: - - feature_id - - granted - - remaining - - usage - - unlimited - - overage_allowed - - max_purchase - - next_reset_at - period_start: - type: number - period_end: - type: number - required: - - plan - - feature_quantities - - balances - redirect_type: - anyOf: - - enum: - - stripe_checkout - - autumn_checkout - - type: "null" + description: Preview of the next billing cycle, if applicable. This shows what + the customer will be charged in subsequent cycles. required: - customer_id - line_items - total - currency - - incoming - - outgoing - - redirect_type + examples: + - &a11 + customerId: charles + lineItems: + - title: Pro seed + description: Pro seed - Base Price (from 18 Feb 2026 to 18 Mar 2026) + amount: 20 + discounts: [] + total: 20 + currency: usd + example: *a11 x-speakeasy-name-override: previewAttach parameters: - name: x-api-version @@ -3241,8 +3230,8 @@ paths: const autumn = new Autumn() const result = await autumn.billing.previewAttach({ - customerId: "", - planId: "", + customerId: "cus_123", + planId: "pro_plan", }); - lang: python label: Python (SDK) @@ -3252,14 +3241,19 @@ paths: autumn = Autumn(secret_key="am_sk_test...") res = autumn.billing.preview_attach( - customer_id="", - plan_id="", - redirect_mode="always", + customer_id="cus_123", + plan_id="pro_plan", ) /v1/billing.update: post: operationId: billingUpdate - description: Update an existing subscription. + description: >- + Updates an existing subscription. Use to modify feature quantities, + cancel, or change plan configuration. + + + Use this endpoint to update prepaid quantities, cancel a subscription + (immediately or at end of cycle), or modify subscription settings. tags: - billing requestBody: @@ -3273,26 +3267,25 @@ paths: type: string description: The ID of the customer to attach the plan to. entity_id: - anyOf: - - type: string - - type: "null" + type: string description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: The ID of the plan. feature_quantities: - anyOf: - - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - minimum: 0 - adjustable: - type: boolean - required: - - feature_id - - type: "null" + type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + minimum: 0 + adjustable: + type: boolean + required: + - feature_id description: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting @@ -3318,6 +3311,8 @@ paths: required: - duration_length - type: "null" + description: Override the plan's default free trial. Pass an object to set a + custom trial, or null to remove the trial entirely. customize: type: object properties: @@ -3448,32 +3443,57 @@ paths: - feature_id description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - plan_id: - type: string invoice_mode: type: object properties: enabled: type: boolean + description: When true, creates an invoice and sends it to the customer instead + of charging their card immediately. Uses Stripe's + send_invoice collection method. enable_plan_immediately: type: boolean default: false + description: If true, enables the plan immediately even though the invoice is + not paid yet. finalize: type: boolean default: true + description: If true, finalizes the invoice so it can be sent to the customer. + If false, keeps it as a draft for manual review. required: - enabled + description: Invoice mode creates a draft or open invoice and sends it to the + customer, instead of charging their card immediately. This + uses Stripe's send_invoice collection method. + billing_behavior: + enum: + - prorate_immediately + - next_cycle_only + description: 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. cancel_action: enum: - cancel_immediately - cancel_end_of_cycle - uncancel - billing_behavior: - enum: - - prorate_immediately - - next_cycle_only + description: Action to perform for cancellation. 'cancel_immediately' cancels + now with prorated refund, 'cancel_end_of_cycle' cancels at + period end, 'uncancel' reverses a pending cancellation. required: - customer_id + - plan_id + title: UpdateSubscriptionParams + examples: + - &a12 + customer_id: cus_123 + plan_id: pro_plan + feature_quantities: + - feature_id: seats + quantity: 10 + example: *a12 responses: "200": description: OK @@ -3484,8 +3504,10 @@ paths: properties: customer_id: type: string + description: The ID of the customer. entity_id: type: string + description: The ID of the entity, if the plan was attached to an entity. invoice: type: object properties: @@ -3493,26 +3515,36 @@ paths: anyOf: - type: string - type: "null" + description: The status of the invoice (e.g., 'paid', 'open', 'draft'). stripe_id: type: string + description: The Stripe invoice ID. total: type: number + description: The total amount of the invoice in cents. currency: type: string + description: The three-letter ISO currency code (e.g., 'usd'). hosted_invoice_url: anyOf: - type: string - type: "null" + description: URL to the hosted invoice page where the customer can view and pay + the invoice. required: - status - stripe_id - total - currency - hosted_invoice_url + description: Invoice details if an invoice was created. Only present when a + charge was made. payment_url: anyOf: - type: string - type: "null" + description: URL to redirect the customer to complete payment. Null if no + payment action is required. required_action: type: object properties: @@ -3521,14 +3553,29 @@ paths: - 3ds_required - payment_method_required - payment_failed + description: The type of action required to complete the payment. reason: type: string + description: A human-readable explanation of why this action is required. required: - code - reason + description: Details about any action required to complete the payment. Present + when the payment could not be processed automatically. required: - customer_id - payment_url + examples: + - &a13 + customer_id: cus_123 + invoice: + status: paid + stripe_id: in_1234 + total: 1500 + currency: usd + hosted_invoice_url: https://invoice.stripe.com/... + payment_url: null + example: *a13 x-speakeasy-name-override: update parameters: - name: x-api-version @@ -3547,7 +3594,14 @@ paths: const autumn = new Autumn() const result = await autumn.billing.update({ - customerId: "", + customerId: "cus_123", + planId: "pro_plan", + featureQuantities: [ + { + featureId: "seats", + quantity: 10, + }, + ], }); - lang: python label: Python (SDK) @@ -3556,11 +3610,26 @@ paths: autumn = Autumn(secret_key="am_sk_test...") - res = autumn.billing.update(customer_id="") + res = autumn.billing.update( + customer_id="cus_123", + plan_id="pro_plan", + feature_quantities=[ + { + "feature_id": "seats", + "quantity": 10, + }, + ], + ) /v1/billing.preview_update: post: - operationId: billingPreviewUpdate - description: Preview billing changes before updating a subscription. + operationId: previewUpdate + description: >- + Previews the billing changes that would occur when updating a + subscription, without actually making any changes. + + + Use this endpoint to show customers prorated charges or refunds before + confirming subscription modifications. tags: - billing requestBody: @@ -3574,26 +3643,25 @@ paths: type: string description: The ID of the customer to attach the plan to. entity_id: - anyOf: - - type: string - - type: "null" + type: string description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: The ID of the plan. feature_quantities: - anyOf: - - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - minimum: 0 - adjustable: - type: boolean - required: - - feature_id - - type: "null" + type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + minimum: 0 + adjustable: + type: boolean + required: + - feature_id description: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting @@ -3619,6 +3687,8 @@ paths: required: - duration_length - type: "null" + description: Override the plan's default free trial. Pass an object to set a + custom trial, or null to remove the trial entirely. customize: type: object properties: @@ -3749,32 +3819,57 @@ paths: - feature_id description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - plan_id: - type: string invoice_mode: type: object properties: enabled: type: boolean + description: When true, creates an invoice and sends it to the customer instead + of charging their card immediately. Uses Stripe's + send_invoice collection method. enable_plan_immediately: type: boolean default: false + description: If true, enables the plan immediately even though the invoice is + not paid yet. finalize: type: boolean default: true + description: If true, finalizes the invoice so it can be sent to the customer. + If false, keeps it as a draft for manual review. required: - enabled + description: Invoice mode creates a draft or open invoice and sends it to the + customer, instead of charging their card immediately. This + uses Stripe's send_invoice collection method. + billing_behavior: + enum: + - prorate_immediately + - next_cycle_only + description: 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. cancel_action: enum: - cancel_immediately - cancel_end_of_cycle - uncancel - billing_behavior: - enum: - - prorate_immediately - - next_cycle_only + description: Action to perform for cancellation. 'cancel_immediately' cancels + now with prorated refund, 'cancel_end_of_cycle' cancels at + period end, 'uncancel' reverses a pending cancellation. required: - customer_id + - plan_id + title: PreviewUpdateParams + examples: + - &a14 + customer_id: cus_123 + plan_id: pro_plan + feature_quantities: + - feature_id: seats + quantity: 15 + example: *a14 responses: "200": description: OK @@ -3785,6 +3880,7 @@ paths: properties: customer_id: type: string + description: The ID of the customer. line_items: type: array items: @@ -3792,10 +3888,13 @@ paths: properties: title: type: string + description: The title of the line item. description: type: string + description: A detailed description of the line item. amount: type: number + description: The amount in cents for this line item. discounts: type: array items: @@ -3812,111 +3911,48 @@ paths: required: - amountOff default: [] - plan_id: - type: string - total_quantity: - type: number - paid_quantity: - type: number - deferred_for_trial: - type: boolean - effective_period: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - is_base: - type: boolean + description: List of discounts applied to this line item. required: - title - description - amount - - plan_id - - total_quantity - - paid_quantity + description: List of line items for the current billing period. total: type: number + description: The total amount in cents for the current billing period. currency: type: string - period_start: - type: number - period_end: - type: number + description: The three-letter ISO currency code (e.g., 'usd'). next_cycle: type: object properties: starts_at: type: number + description: Unix timestamp (milliseconds) when the next billing cycle starts. total: type: number - line_items: - type: array - items: - type: object - properties: - title: - type: string - description: - type: string - amount: - type: number - discounts: - type: array - items: - type: object - properties: - amountOff: - type: number - percentOff: - type: number - stripeCouponId: - type: string - couponName: - type: string - required: - - amountOff - default: [] - plan_id: - type: string - total_quantity: - type: number - paid_quantity: - type: number - deferred_for_trial: - type: boolean - effective_period: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - is_base: - type: boolean - required: - - title - - description - - amount - - plan_id - - total_quantity - - paid_quantity + description: The total amount in cents for the next cycle. required: - starts_at - total - - line_items + description: Preview of the next billing cycle, if applicable. This shows what + the customer will be charged in subsequent cycles. required: - customer_id - line_items - total - currency + examples: + - &a15 + customerId: charles + lineItems: + - title: Pro seed + description: Pro seed - Base Price (from 18 Feb 2026 to 18 Mar 2026) + amount: 20 + discounts: [] + total: 20 + currency: usd + example: *a15 x-speakeasy-name-override: previewUpdate parameters: - name: x-api-version @@ -3935,7 +3971,14 @@ paths: const autumn = new Autumn() const result = await autumn.billing.previewUpdate({ - customerId: "", + customerId: "cus_123", + planId: "pro_plan", + featureQuantities: [ + { + featureId: "seats", + quantity: 15, + }, + ], }); - lang: python label: Python (SDK) @@ -3944,11 +3987,21 @@ paths: autumn = Autumn(secret_key="am_sk_test...") - res = autumn.billing.preview_update(customer_id="") - /v1/billing.setup_payment: + res = autumn.billing.preview_update( + customer_id="cus_123", + plan_id="pro_plan", + feature_quantities=[ + { + "feature_id": "seats", + "quantity": 15, + }, + ], + ) + /v1/billing.open_customer_portal: post: - operationId: billingSetupPayment - description: Create a setup payment session for a customer. + operationId: openCustomerPortal + description: Create a billing portal session for a customer to manage their + subscription. tags: - billing requestBody: @@ -3960,21 +4013,23 @@ paths: properties: customer_id: type: string - description: The ID of the customer - success_url: + description: The ID of the customer to open the billing portal for. + configuration_id: type: string - description: URL to redirect to after successful payment setup. Must start with - either http:// or https:// - customer_data: - $ref: "#/components/schemas/CustomerData" - checkout_session_params: - type: object - propertyNames: - type: string - additionalProperties: {} - description: Additional parameters for the checkout session + description: Stripe billing portal configuration ID. Create configurations in + your Stripe dashboard. + return_url: + type: string + description: URL to redirect to when back button is clicked in the billing + portal required: - customer_id + title: OpenCustomerPortalParams + examples: + - &a16 + customer_id: cus_123 + return_url: https://useautumn.com + example: *a16 responses: "200": description: OK @@ -3985,14 +4040,19 @@ paths: properties: customer_id: type: string - description: The ID of the customer + description: The ID of the billing portal session url: type: string - description: URL to the payment setup page + description: URL to the billing portal required: - customer_id - url - x-speakeasy-name-override: setupPayment + examples: + - &a17 + customer_id: cus_123 + url: https://billing.stripe.com/session/... + example: *a17 + x-speakeasy-name-override: openCustomerPortal parameters: - name: x-api-version in: header @@ -4009,8 +4069,9 @@ paths: const autumn = new Autumn() - const result = await autumn.billing.setupPayment({ - customerId: "", + const result = await autumn.billing.openCustomerPortal({ + customerId: "cus_123", + returnUrl: "https://useautumn.com", }); - lang: python label: Python (SDK) @@ -4019,10 +4080,13 @@ paths: autumn = Autumn(secret_key="am_sk_test...") - res = autumn.billing.setup_payment(customer_id="") + res = autumn.billing.open_customer_portal( + customer_id="cus_123", + return_url="https://useautumn.com", + ) /v1/balances.create: post: - operationId: balancesCreate + operationId: createBalance description: Create a balance for a customer feature. tags: - balances @@ -4033,21 +4097,24 @@ paths: schema: type: object properties: - feature_id: - type: string - description: The feature ID to create the balance for customer_id: type: string - description: The customer ID to assign the balance to + description: The ID of the customer. + feature_id: + type: string + description: The ID of the feature. entity_id: type: string - description: Entity ID for entity-scoped balances + description: The ID of the entity for entity-scoped balances (e.g., per-seat + limits). included: type: number - description: The initial balance amount to grant + description: The initial balance amount to grant. For metered features, this is + the number of units the customer can use. unlimited: type: boolean - description: Whether the balance is unlimited + description: If true, the balance has unlimited usage. Cannot be combined with + 'included'. reset: type: object properties: @@ -4062,19 +4129,35 @@ paths: - quarter - semi_annual - year + description: The interval at which the balance resets (e.g., 'month', 'day', + 'year'). interval_count: type: number + description: "Number of intervals between resets. Defaults to 1 (e.g., + interval_count: 2 with interval: 'month' resets every 2 + months)." required: - interval - description: Reset configuration for the balance + description: Reset configuration for the balance. If not provided, the balance + is a one-time grant that never resets. expires_at: type: number - description: Unix timestamp (milliseconds) when the balance expires + description: Unix timestamp (milliseconds) when the balance expires. Mutually + exclusive with reset. granted_balance: type: number required: - - feature_id - customer_id + - feature_id + title: CreateBalanceParams + examples: + - &a18 + customer_id: cus_123 + feature_id: api_calls + included: 1000 + reset: + interval: month + example: *a18 responses: "200": description: OK @@ -4105,8 +4188,12 @@ paths: const autumn = new Autumn() const result = await autumn.balances.create({ - featureId: "", - customerId: "", + customerId: "cus_123", + featureId: "api_calls", + included: 1000, + reset: { + interval: "month", + }, }); - lang: python label: Python (SDK) @@ -4116,12 +4203,16 @@ paths: autumn = Autumn(secret_key="am_sk_test...") res = autumn.balances.create( - feature_id="", - customer_id="", + customer_id="cus_123", + feature_id="api_calls", + included=1000, + reset={ + "interval": "month", + }, ) /v1/balances.update: post: - operationId: balancesUpdate + operationId: updateBalance description: Update a customer balance. tags: - balances @@ -4135,16 +4226,21 @@ paths: customer_id: type: string description: The ID of the customer. - entity_id: - type: string - description: The ID of the entity to update balance for (if using entity - balances). feature_id: type: string - description: The ID of the feature to update balance for. - current_balance: + description: The ID of the feature. + entity_id: + type: string + description: The ID of the entity for entity-scoped balances (e.g., per-seat + limits). + remaining: type: number - description: The new balance value to set. + description: Set the remaining balance to this exact value. Cannot be combined + with add_to_balance. + add_to_balance: + type: number + description: Add this amount to the current balance. Use negative values to + subtract. Cannot be combined with current_balance. interval: enum: - one_off @@ -4156,20 +4252,19 @@ paths: - quarter - semi_annual - year - description: The interval to update balance for. - granted_balance: - type: number - usage: - type: number - customer_entitlement_id: - type: string - next_reset_at: - type: number - add_to_balance: - type: number + description: Target a specific balance by its reset interval. Use when the + customer has multiple balances for the same feature with + different reset intervals. required: - customer_id - feature_id + title: UpdateBalanceParams + examples: + - &a19 + customer_id: cus_123 + feature_id: api_calls + remaining: 5 + example: *a19 responses: "200": description: OK @@ -4200,8 +4295,9 @@ paths: const autumn = new Autumn() const result = await autumn.balances.update({ - customerId: "", - featureId: "", + customerId: "cus_123", + featureId: "api_calls", + remaining: 5, }); - lang: python label: Python (SDK) @@ -4211,15 +4307,19 @@ paths: autumn = Autumn(secret_key="am_sk_test...") res = autumn.balances.update( - customer_id="", - feature_id="", + customer_id="cus_123", + feature_id="api_calls", + remaining=5, ) /v1/balances.check: post: - operationId: balancesCheck - description: Check whether usage is allowed for a customer feature. - tags: - - balances + operationId: check + description: >- + Checks whether a customer currently has enough balance to use a feature. + + + Use this to gate access before a feature action. Enable sendEvent when + you want to check and consume balance atomically in one request. requestBody: required: true content: @@ -4229,37 +4329,47 @@ paths: properties: customer_id: type: string - description: ID which you provided when creating the customer + description: The ID of the customer. feature_id: type: string - description: ID of the feature to check access to. + description: The ID of the feature. entity_id: type: string - description: If using entity balances (eg, seats), the entity ID to check access - for. + description: The ID of the entity for entity-scoped balances (e.g., per-seat + limits). required_balance: type: number - description: If you know the amount of the feature the end user is consuming in - advance. If their balance is below this quantity, allowed - will be false. + description: "Minimum balance required for access. Returns allowed: false if the + customer's balance is below this value. Defaults to 1." properties: type: object propertyNames: type: string additionalProperties: {} + description: Additional properties to attach to the usage event if send_event is + true. send_event: type: boolean - description: If true, a usage event will be recorded together with checking - access. The required_balance field will be used as the usage - value. + description: If true, atomically records a usage event while checking access. + The required_balance value is used as the usage amount. + Combines check + track in one call. with_preview: type: boolean - description: If true, the response will include a preview object, which can be - used to display information such as a paywall or upgrade - confirmation. + description: If true, includes upgrade/upsell information in the response when + access is denied. Useful for displaying paywalls. required: - customer_id - feature_id + title: CheckParams + examples: + - &a20 + customer_id: cus_123 + feature_id: messages + - customer_id: cus_123 + feature_id: messages + required_balance: 3 + send_event: true + example: *a20 responses: "200": description: OK @@ -4270,20 +4380,27 @@ paths: properties: allowed: type: boolean + description: Whether the customer is allowed to use the feature. True if they + have sufficient balance or the feature is + unlimited/boolean. customer_id: type: string + description: The ID of the customer that was checked. entity_id: anyOf: - type: string - type: "null" + description: The ID of the entity, if an entity-scoped check was performed. required_balance: type: number + description: The required balance that was checked against. balance: anyOf: - type: object properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -4333,25 +4450,35 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -4360,20 +4487,28 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -4391,22 +4526,28 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -4421,25 +4562,31 @@ paths: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -4450,6 +4597,8 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -4457,11 +4606,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -4471,7 +4623,31 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null - type: "null" + description: The customer's balance for this feature. Null if the customer has + no balance for this feature. preview: type: object properties: @@ -4479,14 +4655,21 @@ paths: enum: - usage_limit - feature_flag + description: The reason access was denied. 'usage_limit' means the customer + exceeded their balance, 'feature_flag' means the + feature is not included in their plan. title: type: string + description: A title suitable for displaying in a paywall or upgrade modal. message: type: string + description: A message explaining why access was denied. feature_id: type: string + description: The ID of the feature that was checked. feature_name: type: string + description: The display name of the feature. products: type: array items: @@ -4799,6 +4982,8 @@ paths: - items - free_trial - base_variant_id + description: Products that would grant access to this feature. Use to display + upgrade options. required: - scenario - title @@ -4806,10 +4991,41 @@ paths: - feature_id - feature_name - products + description: Upgrade/upsell information when access is denied. Only present if + with_preview was true and allowed is false. required: - allowed - customer_id - balance + examples: + - &a21 + allowed: true + customer_id: cus_123 + entity_id: null + required_balance: 1 + balance: + feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + example: *a21 x-speakeasy-name-override: check parameters: - name: x-api-version @@ -4827,9 +5043,9 @@ paths: const autumn = new Autumn() - const result = await autumn.balances.check({ - customerId: "", - featureId: "", + const result = await autumn.check({ + customerId: "cus_123", + featureId: "messages", }); - lang: python label: Python (SDK) @@ -4838,16 +5054,19 @@ paths: autumn = Autumn(secret_key="am_sk_test...") - res = autumn.balances.check( - customer_id="", - feature_id="", + res = autumn.check( + customer_id="cus_123", + feature_id="messages", ) /v1/balances.track: post: - operationId: balancesTrack - description: Track usage for a customer feature. - tags: - - balances + operationId: track + description: >- + Records usage for a customer feature and returns updated balances. + + + Use this after an action happens to decrement usage, or send a negative + value to credit balance back. requestBody: required: true content: @@ -4857,38 +5076,39 @@ paths: properties: customer_id: type: string - minLength: 1 - description: ID which you provided when creating the customer + description: The ID of the customer. feature_id: type: string - description: ID of the feature to track usage for. Required if event_name is not - provided. Use this for direct feature tracking. + description: The ID of the feature to track usage for. Required if event_name is + not provided. + entity_id: + type: string + description: The ID of the entity for entity-scoped balances (e.g., per-seat + limits). event_name: type: string minLength: 1 - description: An [event name](/features/tracking-usage#using-event-names) can be - used in place of feature_id. This can be used if multiple - features are tracked in the same event. + description: Event name to track usage for. Use instead of feature_id when + multiple features should be tracked from a single event. value: type: number - description: The amount of usage to record. Defaults to 1. Can be negative to - increase the balance (e.g., when removing a seat). + description: The amount of usage to record. Defaults to 1. Use negative values + to credit balance (e.g., when removing a seat). properties: type: object propertyNames: type: string additionalProperties: {} description: Additional properties to attach to this usage event. - idempotency_key: - type: string - description: Unique key to prevent duplicate event recording. Use this to safely - retry requests without creating duplicate usage records. - entity_id: - type: string - description: If using [entity balances](/features/feature-entities) (eg, seats), - the entity ID to track usage for. required: - customer_id + title: TrackParams + examples: + - &a22 + customer_id: cus_123 + feature_id: messages + value: 1 + example: *a22 responses: "200": description: OK @@ -4899,21 +5119,24 @@ paths: properties: customer_id: type: string - description: The ID of the customer + description: The ID of the customer whose usage was tracked. entity_id: type: string - description: The ID of the entity (if provided) + description: The ID of the entity, if entity-scoped tracking was performed. event_name: type: string - description: The name of the event + description: The event name that was tracked, if event_name was used instead of + feature_id. value: type: number + description: The amount of usage that was recorded. balance: anyOf: - type: object properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -4963,25 +5186,35 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -4990,20 +5223,28 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -5021,22 +5262,28 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -5051,25 +5298,31 @@ paths: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -5080,6 +5333,8 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -5087,11 +5342,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -5101,7 +5359,31 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null - type: "null" + description: The updated balance for the tracked feature. Null if tracking by + event_name that affects multiple features. balances: type: object propertyNames: @@ -5111,6 +5393,7 @@ paths: properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -5160,25 +5443,35 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -5187,20 +5480,28 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -5218,22 +5519,28 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -5248,25 +5555,31 @@ paths: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -5277,6 +5590,8 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -5284,11 +5599,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -5298,10 +5616,61 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + description: Map of feature_id to updated balance when tracking by event_name + affects multiple features. required: - customer_id - value - balance + examples: + - &a23 + customer_id: cus_123 + value: 1 + balance: + feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + example: *a23 x-speakeasy-name-override: track parameters: - name: x-api-version @@ -5319,8 +5688,10 @@ paths: const autumn = new Autumn() - const result = await autumn.balances.track({ - customerId: "", + const result = await autumn.track({ + customerId: "cus_123", + featureId: "messages", + value: 1, }); - lang: python label: Python (SDK) @@ -5329,7 +5700,1769 @@ paths: autumn = Autumn(secret_key="am_sk_test...") - res = autumn.balances.track(customer_id="") + res = autumn.track( + customer_id="cus_123", + feature_id="messages", + value=1, + ) + /v1/events.list: + post: + operationId: listEvents + description: List usage events for your organization. Filter by customer, + feature, or time range. + tags: + - events + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + offset: + type: integer + minimum: 0 + maximum: 9007199254740991 + default: 0 + description: Number of items to skip + limit: + type: integer + minimum: 1 + maximum: 1000 + default: 100 + description: Number of items to return. Default 100, max 1000. + customer_id: + type: string + description: Filter events by customer ID + feature_id: + anyOf: + - type: string + minLength: 1 + - type: array + items: + type: string + minLength: 1 + description: Filter by specific feature ID(s) + custom_range: + type: object + properties: + start: + type: number + description: Filter events after this timestamp (epoch milliseconds) + end: + type: number + description: Filter events before this timestamp (epoch milliseconds) + description: Filter events by time range + title: EventsListParams + examples: + - &a24 + customer_id: cus_123 + limit: 50 + - feature_id: api_calls + custom_range: + start: 1704067200000 + end: 1706745600000 + example: *a24 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + list: + type: array + items: + type: object + properties: + id: + type: string + description: Event ID (KSUID) + timestamp: + type: number + description: Event timestamp (epoch milliseconds) + feature_id: + type: string + description: ID of the feature that the event belongs to + customer_id: + type: string + description: Customer identifier + value: + type: number + description: Event value/count + properties: + type: object + description: Event properties (JSONB) + required: + - id + - timestamp + - feature_id + - customer_id + - value + - properties + description: Array of items for current page + has_more: + type: boolean + description: Whether more results exist after this page + offset: + type: number + description: Current offset position + limit: + type: number + description: Limit passed in the request + total: + type: number + description: Total number of items returned in the current page + required: + - list + - has_more + - offset + - limit + - total + examples: + - &a25 + list: + - id: evt_36xpk2TmuQX5zVPPQ8tCtnR5Weg + timestamp: 1765958215459 + feature_id: credits + customer_id: 0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx + value: 30 + properties: {} + - id: evt_36xmHxxjAkqxufDf9yHAPNfRrLM + timestamp: 1765956512057 + feature_id: credits + customer_id: 0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx + value: 49 + properties: {} + total: 2 + has_more: false + offset: 0 + limit: 100 + example: *a25 + x-speakeasy-name-override: list + parameters: + - name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from 'autumn-js' + + const autumn = new Autumn() + + const result = await autumn.events.list({ + limit: 50, + customerId: "cus_123", + }); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.events.list( + offset=0, + limit=50, + customer_id="cus_123", + ) + /v1/events.aggregate: + post: + operationId: aggregateEvents + description: Aggregate usage events by time period. Returns usage totals grouped + by feature and optionally by a custom property. + tags: + - events + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + minLength: 1 + description: Customer ID to aggregate events for + feature_id: + anyOf: + - type: string + minLength: 1 + - type: array + items: + type: string + minLength: 1 + description: Feature ID(s) to aggregate events for + group_by: + type: string + pattern: ^properties\..* + description: Property to group events by. If provided, each key in the response + will be an object with distinct groups as the keys + range: + enum: + - 24h + - 7d + - 30d + - 90d + - last_cycle + - 1bc + - 3bc + description: Time range to aggregate events for. Either range or custom_range + must be provided + bin_size: + enum: + - day + - hour + - month + default: day + description: Size of the time bins to aggregate events for. Defaults to hour if + range is 24h, otherwise day + custom_range: + type: object + properties: + start: + type: number + end: + type: number + required: + - start + - end + description: Custom time range to aggregate events for. If provided, range must + not be provided + required: + - customer_id + - feature_id + title: EventsAggregateParams + examples: + - &a26 + customer_id: cus_123 + feature_id: api_calls + range: 30d + bin_size: day + - customer_id: cus_123 + feature_id: + - api_calls + - messages + range: 7d + group_by: properties.model + example: *a26 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + list: + type: array + items: + type: object + properties: + period: + type: number + description: Unix timestamp (epoch ms) for this time period + values: + type: object + propertyNames: + type: string + additionalProperties: + type: number + description: "Aggregated values per feature: { [featureId]: number }" + grouped_values: + type: object + propertyNames: + type: string + additionalProperties: + type: object + propertyNames: + type: string + additionalProperties: + type: number + description: "Values broken down by group (only present when group_by is used): + { [featureId]: { [groupValue]: number } }" + required: + - period + - values + description: Array of time periods with aggregated values + total: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + count: + type: number + description: Number of events for this feature + sum: + type: number + description: Sum of event values for this feature + required: + - count + - sum + description: Total aggregations per feature. Keys are feature IDs, values + contain count and sum. + required: + - list + - total + examples: + - &a27 + list: + - period: 1762905600000 + values: + messages: 10 + sessions: 3 + - period: 1762992000000 + values: + messages: 3 + sessions: 12 + total: + messages: + count: 2 + sum: 13 + sessions: + count: 2 + sum: 15 + - list: + - period: 1762905600000 + values: + messages: 10 + sessions: 3 + grouped_values: + messages: + api: 5 + web: 5 + sessions: + api: 2 + web: 1 + - period: 1762992000000 + values: + messages: 3 + sessions: 12 + grouped_values: + messages: + api: 1 + web: 2 + sessions: + api: 10 + web: 2 + total: + messages: + count: 2 + sum: 13 + sessions: + count: 2 + sum: 15 + example: *a27 + x-speakeasy-name-override: aggregate + parameters: + - name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from 'autumn-js' + + const autumn = new Autumn() + + const result = await autumn.events.aggregate({ + customerId: "cus_123", + featureId: "api_calls", + range: "30d", + }); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.events.aggregate( + customer_id="cus_123", + feature_id="api_calls", + range="30d", + bin_size="day", + ) + /v1/entities.create: + post: + operationId: createEntity + description: >- + 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. + tags: + - entities + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + anyOf: + - type: string + - type: "null" + description: The name of the entity + feature_id: + type: string + description: The ID of the feature this entity is associated with + customer_data: + $ref: "#/components/schemas/CustomerData" + description: Customer attributes used to resolve the customer when customer_id + is not provided. + customer_id: + type: string + description: The ID of the customer to create the entity for. + entity_id: + type: string + description: The ID of the entity. + required: + - feature_id + - customer_id + - entity_id + title: CreateEntityParams + examples: + - &a28 + customer_id: cus_123 + entity_id: seat_42 + feature_id: seats + name: Seat 42 + example: *a28 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + autumn_id: + type: string + id: + anyOf: + - type: string + - type: "null" + description: The unique identifier of the entity + name: + anyOf: + - type: string + - type: "null" + description: The name of the entity + customer_id: + anyOf: + - type: string + - type: "null" + description: The customer ID this entity belongs to + feature_id: + anyOf: + - type: string + - type: "null" + description: The feature ID this entity belongs to + created_at: + type: number + description: Unix timestamp when the entity was created + env: + enum: + - sandbox + - live + description: The environment (sandbox/live) + subscriptions: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. + plan_id: + type: string + description: The unique identifier of the subscribed plan. + auto_enable: + type: boolean + description: Whether the plan was automatically enabled for the customer. + add_on: + type: boolean + description: Whether this is an add-on plan rather than a base subscription. + status: + enum: + - active + - scheduled + description: Current status of the subscription. + past_due: + type: boolean + description: Whether the subscription has overdue payments. + canceled_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the subscription was canceled, or null if not + canceled. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry + set. + trial_ends_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. + started_at: + type: number + description: Timestamp when the subscription started. + current_period_start: + anyOf: + - type: number + - type: "null" + description: Start timestamp of the current billing period. + current_period_end: + anyOf: + - type: number + - type: "null" + description: End timestamp of the current billing period. + quantity: + type: number + description: Number of units of this subscription (for per-seat plans). + required: + - plan_id + - auto_enable + - add_on + - status + - past_due + - canceled_at + - expires_at + - trial_ends_at + - started_at + - current_period_start + - current_period_end + - quantity + purchases: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. + plan_id: + type: string + description: The unique identifier of the purchased plan. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. + started_at: + type: number + description: Timestamp when the purchase was made. + quantity: + type: number + description: Number of units purchased. + required: + - plan_id + - expires_at + - started_at + - quantity + balances: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + feature_id: + type: string + description: The feature ID this balance is for. + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived + description: The full feature object if expanded. + granted: + type: number + description: Total balance granted (included + prepaid). + remaining: + type: number + minimum: 0 + description: Remaining balance available for use. + usage: + type: number + description: Total usage consumed in the current period. + unlimited: + type: boolean + description: Whether this feature has unlimited usage. + overage_allowed: + type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. + next_reset_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the balance will reset, or null for no reset. + breakdown: + type: array + items: + type: object + properties: + id: + type: string + default: "" + description: The unique identifier for this balance breakdown. + plan_id: + anyOf: + - type: string + - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. + included_grant: + type: number + description: Amount granted from the plan's included usage. + prepaid_grant: + type: number + description: Amount granted from prepaid purchases or top-ups. + remaining: + type: number + description: Remaining balance available for use. + usage: + type: number + description: Amount consumed in the current period. + unlimited: + type: boolean + description: Whether this balance has unlimited usage. + reset: + anyOf: + - type: object + properties: + interval: + anyOf: + - enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. + interval_count: + type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). + resets_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the balance will next reset. + required: + - interval + - resets_at + - type: "null" + description: Reset configuration for this balance, or null if no reset. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: The per-unit price amount. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration if applicable. + billing_units: + type: number + description: The number of units per billing increment (eg. $9 / 250 units). + billing_method: + enum: + - prepaid + - usage_based + description: Whether usage is prepaid or billed pay-per-use. + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. + required: + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration if this balance has usage-based pricing. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when this balance expires, or null for no expiration. + required: + - plan_id + - included_grant + - prepaid_grant + - remaining + - usage + - unlimited + - reset + - price + - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. + rollovers: + type: array + items: + type: object + properties: + balance: + type: number + description: Amount of balance rolled over from a previous period. + expires_at: + type: number + description: Timestamp when the rollover balance expires. + required: + - balance + - expires_at + description: Rollover balances carried over from previous periods. + required: + - feature_id + - granted + - remaining + - usage + - unlimited + - overage_allowed + - max_purchase + - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + invoices: + type: array + items: + type: object + properties: + plan_ids: + type: array + items: + type: string + description: Array of plan IDs included in this invoice + stripe_id: + type: string + description: The Stripe invoice ID + status: + type: string + description: The status of the invoice + total: + type: number + description: The total amount of the invoice + currency: + type: string + description: The currency code for the invoice + created_at: + type: number + description: Timestamp when the invoice was created + hosted_invoice_url: + anyOf: + - type: string + - type: "null" + description: URL to the Stripe-hosted invoice page + required: + - plan_ids + - stripe_id + - status + - total + - currency + - created_at + description: Invoices for this entity (only included when expand=invoices) + required: + - id + - name + - created_at + - env + - subscriptions + - purchases + - balances + examples: + - &a29 + id: seat_42 + name: Seat 42 + customer_id: cus_123 + feature_id: seats + created_at: 1771409161016 + env: sandbox + subscriptions: + - plan_id: pro_plan + auto_enable: true + add_on: false + status: active + past_due: false + canceled_at: null + expires_at: null + trial_ends_at: null + started_at: 1771431921437 + current_period_start: 1771431921437 + current_period_end: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + invoices: [] + example: *a29 + x-speakeasy-name-override: create + parameters: + - name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from 'autumn-js' + + const autumn = new Autumn() + + const result = await autumn.entities.create({ + name: "Seat 42", + featureId: "seats", + customerId: "cus_123", + entityId: "seat_42", + }); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.entities.create( + feature_id="seats", + customer_id="cus_123", + entity_id="seat_42", + name="Seat 42", + ) + /v1/entities.get: + post: + operationId: getEntity + description: >- + Fetches a single entity by entity ID. + + + Use this to read one entity's current state. Pass customerId when you + want to scope the lookup to a specific customer. + tags: + - entities + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer to create the entity for. + entity_id: + type: string + description: The ID of the entity. + required: + - entity_id + title: GetEntityParams + examples: + - &a30 + entity_id: seat_42 + - customer_id: cus_123 + entity_id: seat_42 + example: *a30 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + autumn_id: + type: string + id: + anyOf: + - type: string + - type: "null" + description: The unique identifier of the entity + name: + anyOf: + - type: string + - type: "null" + description: The name of the entity + customer_id: + anyOf: + - type: string + - type: "null" + description: The customer ID this entity belongs to + feature_id: + anyOf: + - type: string + - type: "null" + description: The feature ID this entity belongs to + created_at: + type: number + description: Unix timestamp when the entity was created + env: + enum: + - sandbox + - live + description: The environment (sandbox/live) + subscriptions: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. + plan_id: + type: string + description: The unique identifier of the subscribed plan. + auto_enable: + type: boolean + description: Whether the plan was automatically enabled for the customer. + add_on: + type: boolean + description: Whether this is an add-on plan rather than a base subscription. + status: + enum: + - active + - scheduled + description: Current status of the subscription. + past_due: + type: boolean + description: Whether the subscription has overdue payments. + canceled_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the subscription was canceled, or null if not + canceled. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry + set. + trial_ends_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. + started_at: + type: number + description: Timestamp when the subscription started. + current_period_start: + anyOf: + - type: number + - type: "null" + description: Start timestamp of the current billing period. + current_period_end: + anyOf: + - type: number + - type: "null" + description: End timestamp of the current billing period. + quantity: + type: number + description: Number of units of this subscription (for per-seat plans). + required: + - plan_id + - auto_enable + - add_on + - status + - past_due + - canceled_at + - expires_at + - trial_ends_at + - started_at + - current_period_start + - current_period_end + - quantity + purchases: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. + plan_id: + type: string + description: The unique identifier of the purchased plan. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. + started_at: + type: number + description: Timestamp when the purchase was made. + quantity: + type: number + description: Number of units purchased. + required: + - plan_id + - expires_at + - started_at + - quantity + balances: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + feature_id: + type: string + description: The feature ID this balance is for. + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived + description: The full feature object if expanded. + granted: + type: number + description: Total balance granted (included + prepaid). + remaining: + type: number + minimum: 0 + description: Remaining balance available for use. + usage: + type: number + description: Total usage consumed in the current period. + unlimited: + type: boolean + description: Whether this feature has unlimited usage. + overage_allowed: + type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. + next_reset_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the balance will reset, or null for no reset. + breakdown: + type: array + items: + type: object + properties: + id: + type: string + default: "" + description: The unique identifier for this balance breakdown. + plan_id: + anyOf: + - type: string + - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. + included_grant: + type: number + description: Amount granted from the plan's included usage. + prepaid_grant: + type: number + description: Amount granted from prepaid purchases or top-ups. + remaining: + type: number + description: Remaining balance available for use. + usage: + type: number + description: Amount consumed in the current period. + unlimited: + type: boolean + description: Whether this balance has unlimited usage. + reset: + anyOf: + - type: object + properties: + interval: + anyOf: + - enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. + interval_count: + type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). + resets_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the balance will next reset. + required: + - interval + - resets_at + - type: "null" + description: Reset configuration for this balance, or null if no reset. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: The per-unit price amount. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration if applicable. + billing_units: + type: number + description: The number of units per billing increment (eg. $9 / 250 units). + billing_method: + enum: + - prepaid + - usage_based + description: Whether usage is prepaid or billed pay-per-use. + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. + required: + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration if this balance has usage-based pricing. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when this balance expires, or null for no expiration. + required: + - plan_id + - included_grant + - prepaid_grant + - remaining + - usage + - unlimited + - reset + - price + - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. + rollovers: + type: array + items: + type: object + properties: + balance: + type: number + description: Amount of balance rolled over from a previous period. + expires_at: + type: number + description: Timestamp when the rollover balance expires. + required: + - balance + - expires_at + description: Rollover balances carried over from previous periods. + required: + - feature_id + - granted + - remaining + - usage + - unlimited + - overage_allowed + - max_purchase + - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + invoices: + type: array + items: + type: object + properties: + plan_ids: + type: array + items: + type: string + description: Array of plan IDs included in this invoice + stripe_id: + type: string + description: The Stripe invoice ID + status: + type: string + description: The status of the invoice + total: + type: number + description: The total amount of the invoice + currency: + type: string + description: The currency code for the invoice + created_at: + type: number + description: Timestamp when the invoice was created + hosted_invoice_url: + anyOf: + - type: string + - type: "null" + description: URL to the Stripe-hosted invoice page + required: + - plan_ids + - stripe_id + - status + - total + - currency + - created_at + description: Invoices for this entity (only included when expand=invoices) + required: + - id + - name + - created_at + - env + - subscriptions + - purchases + - balances + examples: + - &a31 + id: seat_42 + name: Seat 42 + customer_id: cus_123 + feature_id: seats + created_at: 1771409161016 + env: sandbox + subscriptions: + - plan_id: pro_plan + auto_enable: true + add_on: false + status: active + past_due: false + canceled_at: null + expires_at: null + trial_ends_at: null + started_at: 1771431921437 + current_period_start: 1771431921437 + current_period_end: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + invoices: [] + example: *a31 + x-speakeasy-name-override: get + parameters: + - name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from 'autumn-js' + + const autumn = new Autumn() + + const result = await autumn.entities.get({ + entityId: "seat_42", + }); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.entities.get(entity_id="seat_42") + /v1/entities.delete: + post: + operationId: deleteEntity + description: >- + Deletes an entity by entity ID. + + + Use this when the underlying resource is removed and you no longer want + entity-scoped balances or subscriptions tracked for it. + tags: + - entities + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer. + entity_id: + type: string + description: The ID of the entity. + required: + - entity_id + title: DeleteEntityParams + examples: + - &a32 + customer_id: cus_123 + entity_id: seat_42 + example: *a32 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + required: + - success + examples: + - &a33 + success: true + example: *a33 + x-speakeasy-name-override: delete + parameters: + - name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from 'autumn-js' + + const autumn = new Autumn() + + const result = await autumn.entities.delete({ + customerId: "cus_123", + entityId: "seat_42", + }); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.entities.delete( + entity_id="seat_42", + customer_id="cus_123", + ) + /v1/referrals.create_code: + post: + operationId: createReferralCode + description: Create or fetch a referral code for a customer in a referral program. + tags: + - referrals + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The unique identifier of the customer + program_id: + type: string + description: ID of your referral program + required: + - customer_id + - program_id + title: CreateReferralCodeParams + examples: + - &a34 + customer_id: cus_123 + program_id: prog_123 + example: *a34 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + code: + type: string + description: The referral code that can be shared with customers + customer_id: + type: string + description: Your unique identifier for the customer + created_at: + type: number + description: The timestamp of when the referral code was created + required: + - code + - customer_id + - created_at + examples: + - &a35 + code: + customer_id: + created_at: 123 + example: *a35 + x-speakeasy-name-override: createCode + parameters: + - name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from 'autumn-js' + + const autumn = new Autumn() + + const result = await autumn.referrals.createCode({ + customerId: "cus_123", + programId: "prog_123", + }); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.referrals.create_code( + customer_id="cus_123", + program_id="prog_123", + ) + /v1/referrals.redeem_code: + post: + operationId: redeemReferralCode + description: Redeem a referral code for a customer. + tags: + - referrals + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + code: + type: string + description: The referral code to redeem + customer_id: + type: string + description: The unique identifier of the customer redeeming the code + required: + - code + - customer_id + title: RedeemReferralCodeParams + examples: + - &a36 + code: REF123 + customer_id: cus_456 + example: *a36 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The ID of the redemption event + customer_id: + type: string + description: Your unique identifier for the customer + reward_id: + type: string + description: The ID of the reward that will be granted + required: + - id + - customer_id + - reward_id + examples: + - &a37 + id: + customer_id: + reward_id: + example: *a37 + x-speakeasy-name-override: redeemCode + parameters: + - name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from 'autumn-js' + + const autumn = new Autumn() + + const result = await autumn.referrals.redeemCode({ + code: "REF123", + customerId: "cus_456", + }); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.referrals.redeem_code( + code="REF123", + customer_id="cus_456", + ) security: - secretKey: [] x-speakeasy-globals: diff --git a/apps/docs/mintlify/docs.json b/apps/docs/mintlify/docs.json index 5478680e2..f349083b0 100644 --- a/apps/docs/mintlify/docs.json +++ b/apps/docs/mintlify/docs.json @@ -129,16 +129,24 @@ { "tab": "API Reference", "icon": "rectangle-terminal", - "openapi": "api/openapi.yml", "groups": [ { - "group": "Core", + "group": "Billing", + "pages": [ + "api-reference/billing/billingAttach", + "api-reference/billing/billingUpdate", + "api-reference/billing/previewAttach", + "api-reference/billing/previewUpdate", + "api-reference/billing/openCustomerPortal" + ] + }, + { + "group": "Balances", "pages": [ - "api-reference/core/checkout", - "api-reference/core/attach", "api-reference/core/check", "api-reference/core/track", - "api-reference/core/cancel" + "api-reference/balances/createBalance", + "api-reference/balances/updateBalance" ] }, { @@ -147,25 +155,36 @@ "api-reference/customers/getOrCreateCustomer", "api-reference/customers/listCustomers", "api-reference/customers/updateCustomer", - "api-reference/customers/deleteCustomer", - "api-reference/customers/open-billing-portal" + "api-reference/customers/deleteCustomer" ] }, { "group": "Events", "pages": [ - "api-reference/events/list-events", - "api-reference/events/aggregate-events" + "api-reference/events/listEvents", + "api-reference/events/aggregateEvents" ] }, { "group": "Entities", "pages": [ - "api-reference/entities/get-entity", - "api-reference/entities/create-entity", - "api-reference/entities/delete-entity" + "api-reference/entities/getEntity", + "api-reference/entities/createEntity", + "api-reference/entities/deleteEntity" ] }, + { + "group": "Referrals", + "pages": [ + "api-reference/referrals/createReferralCode", + "api-reference/referrals/redeemReferralCode" + ] + }, + { + "group": "TODO", + "pages": ["api-reference/billing/setupPayment"] + }, + { "group": "Features", "pages": [ @@ -189,18 +208,7 @@ "api-reference/products/delete-product" ] }, - { - "group": "Referrals", - "pages": [ - "api-reference/referrals/referral-code", - "api-reference/referrals/referral-redeem" - ] - }, - { - "group": "CLI", - "pages": ["api-reference/cli/config"] - }, { "group": "Platform (Beta)", "pages": [ diff --git a/apps/docs/package.json b/apps/docs/package.json index 97e649de3..5951a6750 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -3,7 +3,7 @@ "private": true, "scripts": { "pull": "bun scripts/pull.ts", - "dev": "cd mintlify && mint dev -p 3003", + "dev": "cd mintlify && mint dev --port 3003", "build": "cd mintlify && mint build", "start": "cd mintlify && mint dev" }, diff --git a/apps/sdk-test/app/scenarios/core/use-autumn/page.tsx b/apps/sdk-test/app/scenarios/core/use-autumn/page.tsx index 0e1dafd0a..cf5b4ed55 100644 --- a/apps/sdk-test/app/scenarios/core/use-autumn/page.tsx +++ b/apps/sdk-test/app/scenarios/core/use-autumn/page.tsx @@ -1,6 +1,9 @@ "use client"; -import type { ClientAttachParams } from "autumn-js/react"; +import type { + ClientAttachParams, + ClientOpenCustomerPortalParams, +} from "autumn-js/react"; import { useCustomer } from "autumn-js/react"; import { useId, useState } from "react"; import { DataViewer } from "@/components/debug/DataViewer"; @@ -10,7 +13,7 @@ import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; -type ActionTab = "attach" | "check"; +type ActionTab = "attach" | "check" | "openCustomerPortal"; type LastActionState = { name: string; @@ -43,16 +46,10 @@ const toErrorPayload = ({ error }: { error: unknown }) => { }; export default function UseAutumnScenarioPage() { - const { - data: customer, - isLoading, - error, - refetch, - attach, - check, - } = useCustomer({ - errorOnNotFound: false, - }); + const { isLoading, error, refetch, attach, check, openCustomerPortal } = + useCustomer({ + errorOnNotFound: false, + }); const [lastUpdatedAt, setLastUpdatedAt] = useState(null); const [isRunning, setIsRunning] = useState(false); @@ -66,11 +63,13 @@ export default function UseAutumnScenarioPage() { const [featureId, setFeatureId] = useState(""); const [requiredBalance, setRequiredBalance] = useState(""); const [openInNewTab, setOpenInNewTab] = useState(false); + const [portalReturnUrl, setPortalReturnUrl] = useState(""); // Form element IDs const planIdInputId = useId(); const featureIdInputId = useId(); const requiredBalanceInputId = useId(); + const portalReturnUrlInputId = useId(); const runAction = async ({ name, @@ -138,6 +137,18 @@ export default function UseAutumnScenarioPage() { }); }; + const handleOpenCustomerPortal = () => { + const params: ClientOpenCustomerPortalParams = { + returnUrl: portalReturnUrl || undefined, + openInNewTab, + }; + runAction({ + name: "openCustomerPortal", + params, + execute: () => openCustomerPortal(params), + }); + }; + return (
Check +
{/* Tab content */} @@ -258,6 +280,45 @@ export default function UseAutumnScenarioPage() { )} + + {activeTab === "openCustomerPortal" && ( +
+
+ + setPortalReturnUrl(e.target.value)} + className="h-8 text-sm" + /> +

+ Defaults to the current page URL when left empty. +

+
+ + +
+ )}
diff --git a/apps/sdk-test/app/scenarios/core/use-referrals/page.tsx b/apps/sdk-test/app/scenarios/core/use-referrals/page.tsx new file mode 100644 index 000000000..51c870c50 --- /dev/null +++ b/apps/sdk-test/app/scenarios/core/use-referrals/page.tsx @@ -0,0 +1,251 @@ +"use client"; + +import type { + ClientCreateReferralCodeParams, + ClientRedeemReferralCodeParams, +} from "autumn-js/react"; +import { useCustomer } 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"; + +type ActionTab = "createReferralCode" | "redeemReferralCode"; + +type LastActionState = { + name: string; + params: unknown; + result: unknown; + error: unknown; + executedAt: string; +} | null; + +const toErrorPayload = ({ error }: { error: unknown }) => { + if (error instanceof Error) { + const typed = error as Error & { + code?: string; + statusCode?: number; + details?: unknown; + }; + + return { + message: typed.message, + code: typed.code ?? null, + statusCode: typed.statusCode ?? null, + details: typed.details ?? null, + name: typed.name, + }; + } + + return { + message: "Unknown error", + raw: error, + }; +}; + +export default function UseReferralsScenarioPage() { + const { isLoading, error, refetch, createReferralCode, redeemReferralCode } = + useCustomer({ + errorOnNotFound: false, + }); + + const [lastUpdatedAt, setLastUpdatedAt] = useState(null); + const [isRunning, setIsRunning] = useState(false); + const [lastAction, setLastAction] = useState(null); + const [activeTab, setActiveTab] = useState("createReferralCode"); + + const [programId, setProgramId] = useState(""); + const [referralCode, setReferralCode] = useState(""); + + const programIdInputId = useId(); + const referralCodeInputId = useId(); + + const runAction = async ({ + name, + params, + execute, + }: { + name: string; + params: unknown; + execute: () => Promise; + }) => { + setIsRunning(true); + try { + const result = await execute(); + setLastAction({ + name, + params, + result, + error: null, + executedAt: new Date().toISOString(), + }); + } catch (err) { + setLastAction({ + name, + params, + result: null, + error: toErrorPayload({ error: err }), + executedAt: new Date().toISOString(), + }); + } finally { + setIsRunning(false); + } + }; + + const onRefetch = async () => { + await refetch(); + setLastUpdatedAt(new Date().toISOString()); + }; + + const handleCreateReferralCode = () => { + if (!programId) return; + + const params: ClientCreateReferralCodeParams = { + programId, + }; + + runAction({ + name: "createReferralCode", + params, + execute: () => createReferralCode(params), + }); + }; + + const handleRedeemReferralCode = () => { + if (!referralCode) return; + + const params: ClientRedeemReferralCodeParams = { + code: referralCode, + }; + + runAction({ + name: "redeemReferralCode", + params, + execute: () => redeemReferralCode(params), + }); + }; + + return ( +
+ + Refetch + + } + > + + + + +
+ + +
+ + {activeTab === "createReferralCode" && ( +
+
+ + setProgramId(e.target.value)} + className="h-8 text-sm" + /> +
+ +
+ )} + + {activeTab === "redeemReferralCode" && ( +
+
+ + setReferralCode(e.target.value)} + className="h-8 text-sm" + /> +
+ +
+ )} +
+ +
+ + +
+
+ ); +} diff --git a/apps/sdk-test/lib/scenarios.ts b/apps/sdk-test/lib/scenarios.ts index b49d3522c..2a0527202 100644 --- a/apps/sdk-test/lib/scenarios.ts +++ b/apps/sdk-test/lib/scenarios.ts @@ -40,6 +40,13 @@ export const scenarioSections: Array = [ description: "Test attach/check action helpers and inspect payloads.", status: "ready", }, + { + id: "use-referrals", + title: "useReferrals", + href: "/scenarios/core/use-referrals", + description: "Test create/redeem referral code action helpers.", + status: "ready", + }, { id: "use-entity", title: "useEntity", diff --git a/apps/sdk-test/sdk.ts b/apps/sdk-test/sdk.ts index a874bcc39..e3cc23efc 100644 --- a/apps/sdk-test/sdk.ts +++ b/apps/sdk-test/sdk.ts @@ -9,15 +9,9 @@ const autumn = new Autumn({ secretKey: process.env.AUTUMN_SECRET_KEY, }); -const customer = await autumn.customers.getOrCreate({ - customerId: "123", +const res = await autumn.events.aggregate({ + customerId: "john", + featureId: "messages", }); -console.log("Customer:", customer); - -const attachResult = await autumn.billing.attach({ - customerId: customer.id ?? "", - planId: "pro_plan", -}); - -console.log("Attach result:", attachResult); +console.log(JSON.stringify(res, null, 2)); diff --git a/apps/sdk-test/tsconfig.check.json b/apps/sdk-test/tsconfig.check.json index 23badfeb1..ae8369093 100644 --- a/apps/sdk-test/tsconfig.check.json +++ b/apps/sdk-test/tsconfig.check.json @@ -2,8 +2,7 @@ "extends": "./tsconfig.json", "compilerOptions": { "paths": { - "@/*": ["./*"], - "@api/*": ["../../shared/api/*"] + "@/*": ["./*"] } }, "include": [ diff --git a/apps/sdk-test/tsconfig.json b/apps/sdk-test/tsconfig.json index 2d3684b70..fc1f1d571 100644 --- a/apps/sdk-test/tsconfig.json +++ b/apps/sdk-test/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "target": "ES2017", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, @@ -20,6 +19,7 @@ } ], "paths": { + "*": ["./*"], "@/*": ["./*", "../../packages/autumn-js/src/libraries/react/*"], "@/components/*": [ "./components/*", @@ -35,7 +35,6 @@ ], "@sdk": ["../../packages/autumn-js/src/sdk/index.ts"], "@sdk/*": ["../../packages/autumn-js/src/sdk/*"], - "@api/*": ["../../shared/api/*"], "@utils/*": ["../../packages/autumn-js/src/utils/*"], "autumn-js": ["../../packages/autumn-js/src/sdk/index.ts"], "autumn-js/react": ["../../packages/autumn-js/src/react/index.ts"], diff --git a/bun.lock b/bun.lock index 4941c5303..fc72b7936 100644 --- a/bun.lock +++ b/bun.lock @@ -168,7 +168,7 @@ }, "packages/sdk": { "name": "@useautumn/sdk", - "version": "0.8.27", + "version": "0.10.4", "dependencies": { "zod": "^3.25.65 || ^4.0.0", }, diff --git a/others/python-sdk/.speakeasy/code-samples.overlay.yaml b/others/python-sdk/.speakeasy/code-samples.overlay.yaml index d07c11eff..219b85641 100644 --- a/others/python-sdk/.speakeasy/code-samples.overlay.yaml +++ b/others/python-sdk/.speakeasy/code-samples.overlay.yaml @@ -17,7 +17,7 @@ actions: secret_key="", ) as autumn: - res = autumn.balances.check(customer_id="", feature_id="") + res = autumn.check(customer_id="cus_123", feature_id="messages") # Handle response print(res) @@ -35,7 +35,9 @@ actions: secret_key="", ) as autumn: - res = autumn.balances.create(feature_id="", customer_id="") + res = autumn.balances.create(customer_id="cus_123", feature_id="api_calls", included=1000, reset={ + "interval": "month", + }) # Handle response print(res) @@ -53,7 +55,7 @@ actions: secret_key="", ) as autumn: - res = autumn.balances.track(customer_id="") + res = autumn.track(customer_id="cus_123", feature_id="messages", value=1) # Handle response print(res) @@ -71,7 +73,7 @@ actions: secret_key="", ) as autumn: - res = autumn.balances.update(customer_id="", feature_id="") + res = autumn.balances.update(customer_id="cus_123", feature_id="api_calls", remaining=5) # Handle response print(res) @@ -89,7 +91,25 @@ actions: secret_key="", ) as autumn: - res = autumn.billing.attach(customer_id="", plan_id="", redirect_mode="always") + res = autumn.billing.attach(customer_id="cus_123", plan_id="pro_plan") + + # Handle response + print(res) + - target: $["paths"]["/v1/billing.open_customer_portal"]["post"] + update: + x-codeSamples: + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + + with Autumn( + x_api_version="2.1", + secret_key="", + ) as autumn: + + res = autumn.billing.open_customer_portal(customer_id="cus_123", return_url="https://useautumn.com") # Handle response print(res) @@ -107,7 +127,7 @@ actions: secret_key="", ) as autumn: - res = autumn.billing.preview_attach(customer_id="", plan_id="", redirect_mode="always") + res = autumn.billing.preview_attach(customer_id="cus_123", plan_id="pro_plan") # Handle response print(res) @@ -125,25 +145,12 @@ actions: secret_key="", ) as autumn: - res = autumn.billing.preview_update(customer_id="") - - # Handle response - print(res) - - target: $["paths"]["/v1/billing.setup_payment"]["post"] - update: - x-codeSamples: - - lang: python - label: Python (SDK) - source: |- - from autumn_sdk import Autumn - - - with Autumn( - x_api_version="2.1", - secret_key="", - ) as autumn: - - res = autumn.billing.setup_payment(customer_id="") + res = autumn.billing.preview_update(customer_id="cus_123", plan_id="pro_plan", feature_quantities=[ + { + "feature_id": "seats", + "quantity": 15, + }, + ]) # Handle response print(res) @@ -161,7 +168,12 @@ actions: secret_key="", ) as autumn: - res = autumn.billing.update(customer_id="") + res = autumn.billing.update(customer_id="cus_123", plan_id="pro_plan", feature_quantities=[ + { + "feature_id": "seats", + "quantity": 10, + }, + ]) # Handle response print(res) @@ -235,6 +247,96 @@ actions: res = autumn.customers.update(customer_id="cus_123", name="Jane Doe", email="jane@example.com") + # Handle response + print(res) + - target: $["paths"]["/v1/entities.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="", + ) as autumn: + + res = autumn.entities.create(feature_id="seats", customer_id="cus_123", entity_id="seat_42", name="Seat 42") + + # Handle response + print(res) + - target: $["paths"]["/v1/entities.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="", + ) as autumn: + + res = autumn.entities.delete(entity_id="seat_42", customer_id="cus_123") + + # Handle response + print(res) + - target: $["paths"]["/v1/entities.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="", + ) as autumn: + + res = autumn.entities.get(entity_id="seat_42") + + # Handle response + print(res) + - target: $["paths"]["/v1/events.aggregate"]["post"] + update: + x-codeSamples: + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + + with Autumn( + x_api_version="2.1", + secret_key="", + ) as autumn: + + res = autumn.events.aggregate(customer_id="cus_123", feature_id="api_calls", range="30d", bin_size="day") + + # Handle response + print(res) + - target: $["paths"]["/v1/events.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="", + ) as autumn: + + res = autumn.events.list(offset=0, limit=50, customer_id="cus_123") + # Handle response print(res) - target: $["paths"]["/v1/plans.list"]["post"] @@ -253,5 +355,41 @@ actions: res = autumn.plans.list() + # Handle response + print(res) + - target: $["paths"]["/v1/referrals.create_code"]["post"] + update: + x-codeSamples: + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + + with Autumn( + x_api_version="2.1", + secret_key="", + ) as autumn: + + res = autumn.referrals.create_code(customer_id="cus_123", program_id="prog_123") + + # Handle response + print(res) + - target: $["paths"]["/v1/referrals.redeem_code"]["post"] + update: + x-codeSamples: + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + + with Autumn( + x_api_version="2.1", + secret_key="", + ) as autumn: + + res = autumn.referrals.redeem_code(code="REF123", customer_id="cus_456") + # Handle response print(res) diff --git a/others/python-sdk/.speakeasy/gen.lock b/others/python-sdk/.speakeasy/gen.lock index 33293206f..5928f20ea 100644 --- a/others/python-sdk/.speakeasy/gen.lock +++ b/others/python-sdk/.speakeasy/gen.lock @@ -1,16 +1,16 @@ lockVersion: 2.0.0 id: 05940b80-1ef8-40f4-9878-822fb2792070 management: - docChecksum: fec27a570216b53ac684c105645b6173 + docChecksum: f11743afca7d126a92e9bf0323addd57 docVersion: 2.1.0 speakeasyVersion: 1.719.0 generationVersion: 2.824.1 - releaseVersion: 0.2.23 - configChecksum: b49d9388b24bfc90f604822ef8177d32 + releaseVersion: 0.4.4 + configChecksum: 1de9c492ce7585897a3edd041ed7410b persistentEdits: - generation_id: 7ec28ef9-de11-4ffe-a994-4a2d11fa4783 - pristine_commit_hash: 1cb483a63d6f596f6074489a6e9910875d391989 - pristine_tree_hash: 44c77d4ff8b12e187ee9387f45bb54d132266c56 + generation_id: d7165b81-c829-4004-85cb-4752d4091500 + pristine_commit_hash: aee13b21e95f4d440086b682031543803220f816 + pristine_tree_hash: 08d28518066dd3b241072af556490e0f35085e5f features: python: additionalDependencies: 1.0.0 @@ -45,292 +45,64 @@ trackedFiles: pristine_git_object: 8d79f0abb72526f1fb34a4c03e5bba612c6ba2ae USAGE.md: id: 3aed33ce6e6f - last_write_checksum: sha1:18592530e1b98bf3a258bc1f9fce53f93b26cd82 - pristine_git_object: d96fd08db8799cf32fd7d9fd6398e2741963a46d + last_write_checksum: sha1:b90d4c5be66a58cd4d5193eea652c1b609c5fe0f + pristine_git_object: 29eee34883817c578ab4b0f8e51e0215d61ad190 + docs/models/aggregateeventscustomrange.md: + id: 6bcfabf82b0c + last_write_checksum: sha1:db82c5b951354ad2d10f2346cf57b098402df524 + pristine_git_object: 5aedc005f66ca17947ebde16d256cabe4ec1df09 + docs/models/aggregateeventsfeatureid.md: + id: 5cf6f0406b33 + last_write_checksum: sha1:74728b701ba60e57cd8f8bf11ed7d9ed11949974 + pristine_git_object: 7afa32fe53dfff549a66f42768ec85f3a4041dfe + docs/models/aggregateeventsglobals.md: + id: cc7a5438ffad + last_write_checksum: sha1:f7735f0cf9cc76edf9651e316a1aa8457150f241 + pristine_git_object: 811ef147bd8df174d4b093eaaba24e44c5ce9dbe + docs/models/aggregateeventslist.md: + id: cd0c9fadbdf9 + last_write_checksum: sha1:8cdcca1016031d1bda4b21bfcba3e6222a472181 + pristine_git_object: 3885b7cfd4d9ccf6d062437825465152b877c8fb + docs/models/aggregateeventsresponse.md: + id: b597cfc651ae + last_write_checksum: sha1:641c0d27fe8e8242429da6d8083fe10ab70b570c + pristine_git_object: 2fd7b5fb0f426ec942cb43aa30d3a85287ef724a + docs/models/attachparams.md: + id: cc19aeb7efcc + last_write_checksum: sha1:8059b9c7160fe6c523655eee1c371a16e1915a16 + pristine_git_object: 4f6a50e700b4ff2e4c58499ab7ba0e99992f70d1 docs/models/balances.md: id: 2f042cf3d0aa - last_write_checksum: sha1:5a7d31f7d88c3d6ca511e0ddd363a00aafd64921 - pristine_git_object: dc522d990cda516e7fc7baa3cb5b6deffb27d23a - docs/models/balancescheckbalance.md: - id: 67cd143f2f2c - last_write_checksum: sha1:d3428c3665ae643c3402bc4d489e66b58aee813b - pristine_git_object: 198922a7dbe47148c3d770bcd53a7b9c17b7f85b - docs/models/balancescheckbalancedisplay.md: - id: 9ccc33ac3d73 - last_write_checksum: sha1:d5af38baace3f228c58c408599a57b4ca63a7f14 - pristine_git_object: 73dc4f82eb535ee8749a07ed62224e80087974ec - docs/models/balancescheckbalanceintervalenum.md: - id: be1c7da38560 - last_write_checksum: sha1:eaa64db0d97848b715b056d0777db80335b4a5eb - pristine_git_object: abb1f6fd6fdcf8778c0724d529cb4c6e85bac66c - docs/models/balancescheckbalancerollover.md: - id: 41c8761bac81 - last_write_checksum: sha1:33822f625cb106629390641647e5e672f78c129c - pristine_git_object: 31375269dc273940a9c09aefd5a28d856196f058 - docs/models/balancescheckbalanceto.md: - id: cac843413f54 - last_write_checksum: sha1:da3812bc953ae4db13d1131acfa9516279718ab0 - pristine_git_object: 7424bebbb3d3ef0ecfcb06b6afad61055f48b259 - docs/models/balancescheckbalancetype.md: - id: 4bd7c672a590 - last_write_checksum: sha1:760abcea070ecfa136c29837c3dbb6e2f4c55c75 - pristine_git_object: 417070a47f4029c2431cb051d31d563029ef36fb - docs/models/balancescheckbillingmethod.md: - id: 048b4bc31452 - last_write_checksum: sha1:2b98893463d020392ba5578d3ea0463f258b2ade - pristine_git_object: cacafefc749025661cd968f0ece01036198141fe - docs/models/balancescheckbreakdown.md: - id: b356123ea305 - last_write_checksum: sha1:19e00e3ae547b991bbcd4960c4ad32e83d40c6bc - pristine_git_object: 02feead42724bc5419411c2395f4e0558da731c4 - docs/models/balancescheckcreditschema.md: - id: 2a3aac12bb13 - last_write_checksum: sha1:42af6e104fb8d49e50bae327839dc8e5dafb09d5 - pristine_git_object: de7631ec81b723327c8c70abd7649ced80dccaf4 - docs/models/balancescheckenv.md: - id: 2ffe890b69f6 - last_write_checksum: sha1:9a11f0f6e1fc8fc4f0e213cd5274680325e493ee - pristine_git_object: 72a9f36856fffd2ac762e7d42b8a5b026b193623 - docs/models/balancescheckfeature.md: - id: 96241cd8a844 - last_write_checksum: sha1:e265b6840bb9a53f6cee80c8ebc818ca395a8824 - pristine_git_object: bd137f0a379ec7b089e533875087b3b98a064563 - docs/models/balancescheckfreetrial.md: - id: ac4eb9b07020 - last_write_checksum: sha1:c021493f0be15bc646200d7c18b766e54b9a4a25 - pristine_git_object: e11e94df0a7e2788f2fabde09e9264876d07149d - docs/models/balancescheckglobals.md: - id: 187810d7dc2b - last_write_checksum: sha1:55bec7c3ea0ead0558f392000278ab653aaab36c - pristine_git_object: c2be245a9e4d60ea74c18cb5b5aec7fef00b39d9 - docs/models/balancescheckintervalunion.md: - id: 3aaca92c9942 - last_write_checksum: sha1:4dc09c6daa9fed56ef68ac733c71db3cb3a3a81a - pristine_git_object: 826043c0ea9b8444452be6fd47e9edb8f48a9d06 - docs/models/balancescheckitem.md: - id: d632041b4a77 - last_write_checksum: sha1:52f1ca8c1517ab2652f54253fd7ad79319bb0cd2 - pristine_git_object: 28504eb15d8113becd5da5abff57df9268984ff0 - docs/models/balancescheckondecrease.md: - id: 792b2541fada - last_write_checksum: sha1:b941c63bbcaab5ec9da658f18e42619b2ad45027 - pristine_git_object: b57bea718ba4724af943fd58f0c54c95915e0ea3 - docs/models/balancescheckonincrease.md: - id: 13a73d46ccf3 - last_write_checksum: sha1:91b623ec83fa56330b6fb01220f0907fc9e888b5 - pristine_git_object: 3ebc6debbc663540d08a28dc8bffbcd9d69c079b - docs/models/balancescheckprice.md: - id: 31f896a219f1 - last_write_checksum: sha1:3fa32e8ba85bba40ecc18f8567abbeba07678da3 - pristine_git_object: 3e6f66868ff780f866d68fdd7875f51990446172 - docs/models/balancescheckrequest.md: - id: 3f58aa2a0e56 - last_write_checksum: sha1:631eddef8c414fc980bee9b676dced772c276e24 - pristine_git_object: 426327d989050aa71a9dc1d8e55f1e3b8bc9db4a - docs/models/balancescheckreset.md: - id: acd256151825 - last_write_checksum: sha1:aaeb8d3a138366e3c03c7e5c45c7adcb22062190 - pristine_git_object: e74c115894e2367560b2c5c9c5861735fb8096eb - docs/models/balancescheckresponse.md: - id: d90efa680ac4 - last_write_checksum: sha1:d27947c4f54c83ece28e2a9d76ca9d033e2abadf - pristine_git_object: cc3aae7cbe2a74eae322ca925889966608e6f12f - docs/models/balancescheckscenario.md: - id: f0ede8c89638 - last_write_checksum: sha1:9210d6cdb9f0e6c58b7b24ecfa130f368bbac2fc - pristine_git_object: a6effecf8e7b4a33cc120d0da6cbabde45008b6f - docs/models/balanceschecktier.md: - id: b139ac562bba - last_write_checksum: sha1:4f434b674fd0a2d162f91d9d4230d76f326369ac - pristine_git_object: 978e8b01ac1f9f6efa3d139c042f03fe7c7b8be8 - docs/models/balancescreateglobals.md: - id: bb739c126490 - last_write_checksum: sha1:f20e7b96197dc6a3a37bd8ff1fef6215d1b66cd0 - pristine_git_object: 81fe170dd7435a76b6c694bffb106ff0bcd9c44c - docs/models/balancescreateinterval.md: - id: 4c4e4c5aa7cc - last_write_checksum: sha1:ad556d990cea2189d00be0e904d27231dc539a30 - pristine_git_object: 21424f7608922e38cdccaa52f702f692256b8848 - docs/models/balancescreaterequest.md: - id: d781f00cc92b - last_write_checksum: sha1:29bf08e3356b70a04332985db14aaf0a38f5a491 - pristine_git_object: a8c77cb0e55fb76afff602bf6005942c06c7e63f - docs/models/balancescreatereset.md: - id: 07f6f615bf08 - last_write_checksum: sha1:b887e1e2768a35614d3231316e6755d9bbaa7c79 - pristine_git_object: 37dd46ea9659d84ef8b3f4362ecf1b0f6870ff8a - docs/models/balancescreateresponse.md: - id: 8127a48a0270 - last_write_checksum: sha1:646e8083496a14f56497f4a325c82c85611bce54 - pristine_git_object: 899743b48e88d217530425c2d13efa9254089097 - docs/models/balancestrackbalance.md: - id: 84f1cb5b442b - last_write_checksum: sha1:b91ce5901ec09e733153b7a2baf2759f374926be - pristine_git_object: 5b98b79bc86bab83c651b3cbadb0abbb0fc455ab - docs/models/balancestrackbalancebillingmethod.md: - id: 52c99621e59c - last_write_checksum: sha1:193549bcad64b7b94c968160ae3499a90af67d2d - pristine_git_object: ac9a442ee21b36f79a3fdf83443a674824d10e27 - docs/models/balancestrackbalancebreakdown.md: - id: 6adfe694fcc5 - last_write_checksum: sha1:28a9e2ca25b1cc62555e810d68d6ab64c33a70d9 - pristine_git_object: df781a50c329dee96db3a056264c89fde99c5232 - docs/models/balancestrackbalancecreditschema.md: - id: 68aad580e88d - last_write_checksum: sha1:1b7fcc2eab58f32c16928bb1f58c7e7f01b6f975 - pristine_git_object: 10edc51687c3f8c51a2a1489f1c3162fc1d4e77f - docs/models/balancestrackbalancedisplay.md: - id: 527686a73e77 - last_write_checksum: sha1:9de4f47418d0d104ba8f839c18923ca1473adf1f - pristine_git_object: b140610ae47a9931a481bb9a0749f6ce4fd7f645 - docs/models/balancestrackbalancefeature.md: - id: 1318c065f640 - last_write_checksum: sha1:35de6e37f94e18f9314153a76becebf271894bd9 - pristine_git_object: 25e9dc30226d5de209c9e4ae01b6a453a311e316 - docs/models/balancestrackbalanceintervalenum.md: - id: e17ab73980f9 - last_write_checksum: sha1:ba8a4f553053bfd170c8ffd749e56205344c0e70 - pristine_git_object: dd0df22dd4ea8ec90f8afb1d0f5d738270fc61f8 - docs/models/balancestrackbalanceintervalunion.md: - id: 690fb401c10e - last_write_checksum: sha1:5ea938c9e5b13e8e2e17f6c38a92e457a79e1c9f - pristine_git_object: e5aededfa9a5f0d00c5feb45946da292efea7245 - docs/models/balancestrackbalanceprice.md: - id: d31d2e4a1596 - last_write_checksum: sha1:aa3f1cc1d6ca0a9b285ad596acec161be7d1e215 - pristine_git_object: 229af6b05794fae94bfecb16b5703b6b126df448 - docs/models/balancestrackbalancereset.md: - id: 31baa46ed3d6 - last_write_checksum: sha1:546dc25ef662fb031bbed7d72e7144544d4c0c09 - pristine_git_object: 898dd4da313390ab7ba62a72e41964330f700b97 - docs/models/balancestrackbalancerollover.md: - id: f9e6e611f63a - last_write_checksum: sha1:c580fd7f5f13a755fdeccec8d14e31a2722e8e97 - pristine_git_object: 9bbb8583eb72bc22ee30fde586c75970fd4a7c31 - docs/models/balancestrackbalances.md: - id: 5154f97a33e4 - last_write_checksum: sha1:bd695cf140e2b4750dea2edfaec30e9c689d44d2 - pristine_git_object: ead243f65b9a1a1d3153ebe509b0b269e2aa7d69 - docs/models/balancestrackbalancetier.md: - id: c0a818ba961f - last_write_checksum: sha1:7cac695036039166f571beef7cc696da41e36bbd - pristine_git_object: 0247cd35f6cbfc1518eb2300e1b658061d228005 - docs/models/balancestrackbalanceto.md: - id: 615bd9ae0029 - last_write_checksum: sha1:24b7b7cdf9129b3e7a6a312054573e8b983fe329 - pristine_git_object: b169e69ab6b7264ad28e92896d3c6b14e594084f - docs/models/balancestrackbalancetype.md: - id: 80be91b53dd3 - last_write_checksum: sha1:2745f83ee7acd44e41cbfb3817f445b9eef1f71e - pristine_git_object: 0480a30dc6b59a95c14a4a249652962983cf1cf5 - docs/models/balancestrackbillingmethod.md: - id: 86aaa4a4fcd0 - last_write_checksum: sha1:b2e6f295717af63628eb89041f68889632ec6416 - pristine_git_object: f0836fdab98bbef00b977faea115a92f53d3eefe - docs/models/balancestrackbreakdown.md: - id: d20d3f5ff2ed - last_write_checksum: sha1:5af2320612691bacab63344f44f76b05b781e29a - pristine_git_object: 3e2417352e0478bbe8baf9e5d471e4c4fe2426fe - docs/models/balancestrackcreditschema.md: - id: 4e4ad0986fe1 - last_write_checksum: sha1:e4d2c7ff3b9864887b63da551466de40f3bd7b28 - pristine_git_object: 09df1cddc35b9b49309d7aed1d1290de7ed146b9 - docs/models/balancestrackdisplay.md: - id: a0774e1c408d - last_write_checksum: sha1:1808a9dc57ff68c04343d782b391339d69d4145f - pristine_git_object: eb33b7d72a8e55a87f9f3dac2d6520abf4df7f4d - docs/models/balancestrackfeature.md: - id: 975a5a0a3daf - last_write_checksum: sha1:6bef666da74e88701e2bcc0fde6fbcbd9cae8b84 - pristine_git_object: 0e3784c74e83f7d024cf1ec8de5201d6f3869011 - docs/models/balancestrackglobals.md: - id: 5267346d2b3d - last_write_checksum: sha1:b2777334892dc5c33a8b6d90d5d536cb97bf1e5f - pristine_git_object: 547fef9cd6ebba112923f410b937238da945755e - docs/models/balancestrackintervalenum.md: - id: 57819c9b4fae - last_write_checksum: sha1:2006eea0a9c4f0f71346fc9efb7b2276b2f9b813 - pristine_git_object: 977324a88f17a372763a73de4e4a18d3ea930888 - docs/models/balancestrackintervalunion.md: - id: ff865ceba89a - last_write_checksum: sha1:ed4d64a7a48da8aca975fe1422b55e6f14ed8a5c - pristine_git_object: 9e66d02e92ea9ab447fa9f686d31842d2d8251ef - docs/models/balancestrackprice.md: - id: 9f3c4eff35cc - last_write_checksum: sha1:906edec997c471f1fd86640d92914e6ce9cdc336 - pristine_git_object: 3019c14220bcfe6688ad92a562ba3871efabe5ac - docs/models/balancestrackrequest.md: - id: f1a9987b0c33 - last_write_checksum: sha1:d783619d192a362c46d8c50ac5fb70001c93552b - pristine_git_object: b8e9a30c332cebd9f61f06a136a840102602537d - docs/models/balancestrackreset.md: - id: 7678032be30e - last_write_checksum: sha1:444ee7dc79feb0528c63114a96937f4e4ce18b55 - pristine_git_object: 4e018a335add96e0723d2d537b5094a4ebd41deb - docs/models/balancestrackresponse.md: - id: 01095c39f4c5 - last_write_checksum: sha1:3430f810663791bbd4c7bced1c88e64b3d9f42e1 - pristine_git_object: 727590b14ba8d9a98769c7ba217300a7e2d462a8 - docs/models/balancestrackrollover.md: - id: 08a795fb5510 - last_write_checksum: sha1:1c182afb54b57716b0414e573e655cff98668582 - pristine_git_object: 28c88bd9e76dce16fcbede9cd535b0a7c1a8be79 - docs/models/balancestracktier.md: - id: 4b2122c4c749 - last_write_checksum: sha1:8c52c93c5126089af68bfc4a3dc41bf4185dae1d - pristine_git_object: 7ca7d8665c74813f0151682f6f07861a2ad41e46 - docs/models/balancestrackto.md: - id: e64f67c353b2 - last_write_checksum: sha1:539bdc73dede5c42106e82e8b0a1f54401a137dc - pristine_git_object: 75ea2c5c2f05bde07506ae9cebc70e8c3b43b0e2 - docs/models/balancestracktype.md: - id: f64f30ee95a1 - last_write_checksum: sha1:1cd06b01d5a96ae006194dfca8703284ff4d8300 - pristine_git_object: f0e4c544f744507e358ec42915a94e3325ac5840 - docs/models/balancesupdateglobals.md: - id: f782799adb3f - last_write_checksum: sha1:3fe6dff0963b823e5fde7b7e4fdfa27f40bae760 - pristine_git_object: 507415cb627d65644c893d811357f3860efda570 - docs/models/balancesupdateinterval.md: - id: c4021f222e75 - last_write_checksum: sha1:6cddcc823e47cd1497a8c4c829bb3f555d93c916 - pristine_git_object: 1f2b3138316ceda59bf41a7fe641777815a95e14 - docs/models/balancesupdaterequest.md: - id: 48ea7d8eb19b - last_write_checksum: sha1:98047542ce2009d866539632280561df7457aedd - pristine_git_object: 366ee3e76582826db76255eca34b3c3a869a4981 - docs/models/balancesupdateresponse.md: - id: c257feeaf90a - last_write_checksum: sha1:a9aac6acda12c91d2503016ed946ca404056f566 - pristine_git_object: c9c3d69ea40a3c490a5e4659781d46c0007be885 + last_write_checksum: sha1:d78aa856ac49678c05b3b75cd24dafe355c13896 + pristine_git_object: cf6ca23953f7ac8017cf1be137fce58c77a473df docs/models/billingattachbillingbehavior.md: id: 931c5fa3bac8 - last_write_checksum: sha1:f4047b81c2b856dcf35a0f9cc90eaf58305260cb - pristine_git_object: 1bf4fbb12434a6776628a6c5b7669bf65d9336e7 + last_write_checksum: sha1:7f63c7595c0eb8c5226d6a209efebde2b7408416 + pristine_git_object: 65926ef8f013057008c30089fbacd1982f32ee7c docs/models/billingattachbillingmethod.md: id: 7ad8ef9b29bf last_write_checksum: sha1:3383175a4afd03a1224c5fef2f9a3e060a7fb64a pristine_git_object: 1f193df28aa2b713fdc76464f428e1421bd89446 docs/models/billingattachcode.md: id: f8bd734cbf81 - last_write_checksum: sha1:9f948fe239fe3520a388296f4b513f429baff6a5 - pristine_git_object: 9c7a2e760e1781d0c9a1838fa0aea25ea05b11d9 + last_write_checksum: sha1:596cc379144fb4058cec3dcfdab10e8f944d873d + pristine_git_object: c6c73c53409e6d55025166aad9a579fb2cfb4093 docs/models/billingattachcustomize.md: id: f0ed3bf58bf5 last_write_checksum: sha1:830e81ca579c5bae1e63436fb86c86b5775d015a pristine_git_object: 2507b52175f3604c468ce3a2bf20c28874a861c8 docs/models/billingattachdiscount1.md: id: cfb5c217d943 - last_write_checksum: sha1:7268ecaa9fe5f2eca7b0ecec0e054011a66dca29 - pristine_git_object: cddb4200fc45390c41f8817e1060ca9fdd9bbdaf + last_write_checksum: sha1:c83b149490e4f662fa45a4c100402b4822b2a651 + pristine_git_object: b0b37a76ffcaf1e8194033f00d45e7bbd67e5d0a docs/models/billingattachdiscount2.md: id: 34b2293cd040 - last_write_checksum: sha1:cb569799741bca3d98374d7165da981ca387072e - pristine_git_object: a9ad82b8b0694f8070ab2a57c32eb250a96f242e + last_write_checksum: sha1:97a5b9702dba456a85a975fbba8853a14438e431 + pristine_git_object: d25dcb496bba52e77fc1fb500067eb230bdef93b docs/models/billingattachdiscountunion.md: id: f0db40ca7e3d - last_write_checksum: sha1:b5ec88e0c80d2c9f7ca70115b832372a22595d06 - pristine_git_object: fb376da54937a1ff775cfae1c41628201e539959 + last_write_checksum: sha1:6ef11a4fdc23086ba4a57a9940f91280124fa208 + pristine_git_object: 0dd81e2073cd70308bf8763db258d8f9ac49e625 docs/models/billingattachdurationtype.md: id: 423b10a9b2e9 last_write_checksum: sha1:771062ad742a99a1da9e3fc5faeb859f22c0fb40 @@ -339,10 +111,10 @@ trackedFiles: id: 24dc4cb9d4b8 last_write_checksum: sha1:8d412d026e4a835022e04b96c7a5a220eb2cc16f pristine_git_object: 05f095171b7259f3c7e76b5ac44d08171f3f9aef - docs/models/billingattachfeaturequantities.md: - id: 34e3a24b5e86 - last_write_checksum: sha1:63c36cc9d69eb020972494b30d233124d2e9917f - pristine_git_object: 3a3c926fdb6fc93778db3ea0966c6a0ca7226d67 + docs/models/billingattachfeaturequantity.md: + id: d90f6bb025f7 + last_write_checksum: sha1:a49720e8f06c3716251f3a2a91433c081dd39046 + pristine_git_object: 486e96a2cdae09c3370f46f77a94f50c0b3e3053 docs/models/billingattachfreetrial.md: id: 736b3640c65a last_write_checksum: sha1:ac79c07d3ef237c4694196fa533c568fb97d8222 @@ -353,12 +125,12 @@ trackedFiles: pristine_git_object: 66820bcc34ce8a7d6523b86c7e598b494a7f9c62 docs/models/billingattachinvoice.md: id: 538000e0b713 - last_write_checksum: sha1:0cdaaada0c3a53b877ee3d59439a24b868c8ccd0 - pristine_git_object: 07a1b788d005bb60b15619a4bcb97bd547611d0b + last_write_checksum: sha1:d629fd1a362c898fc5dfc2aee4d0c3d39bcf3c51 + pristine_git_object: b396a7b81d32bc570eac6c442be44d3dace064c5 docs/models/billingattachinvoicemode.md: id: 32474930a784 - last_write_checksum: sha1:48dcbb59cce9effcffd12f7d42b052d347f92b5d - pristine_git_object: 0b75ef8b013ffea53ac190da8c1c5cba7897f9ab + last_write_checksum: sha1:c5fadc0ff089142669c912629dfbe763fed30392 + pristine_git_object: 51e60356861b229b8e6d06b66c83addc54ad8d67 docs/models/billingattachitem.md: id: d843385ee259 last_write_checksum: sha1:c137dd6c71a0736bfc0f5529a62dc70b0062267d @@ -381,8 +153,8 @@ trackedFiles: pristine_git_object: 388a9c513dd970fdd67bcdf2132b9bf689a05358 docs/models/billingattachplanschedule.md: id: e84335661ec5 - last_write_checksum: sha1:e10bf3345d9d57ba83278a493de32d7e2a83a0b9 - pristine_git_object: 99e55f2bdc9c999c2e94060d987d79d31ff6779a + last_write_checksum: sha1:4ccc9f401c17e931428b8e5bb3584f3b362941cd + pristine_git_object: ae7e98ddb1c2f8a108c4443d13eaf208259b2896 docs/models/billingattachprice.md: id: df5b6c3b336d last_write_checksum: sha1:7f78242b077878f1e086ecefe7d6085efcfee80d @@ -395,18 +167,10 @@ trackedFiles: id: 645f794f4b6f last_write_checksum: sha1:ed2188c971ad23f75660d649df8a44c6fb2e3674 pristine_git_object: 8199d7165a7b38affb8a113a74bb0fba95a06271 - docs/models/billingattachredirectmode.md: - id: af71e3fed81e - last_write_checksum: sha1:c85126861a6e132305510ee10ed2d43fedba69d7 - pristine_git_object: 68d694191aea597dd44e36f2712507d5362e8594 - docs/models/billingattachrequest.md: - id: a887baeabd1e - last_write_checksum: sha1:d4ac203685d6c2ea2716c2a3988346b3367a967b - pristine_git_object: 8d69dbc298a471d0ac3f99340fa3be6da410594d docs/models/billingattachrequiredaction.md: id: 0f167f88f79b - last_write_checksum: sha1:de010cc362b545eaf8f63e26134a3c3735400ad6 - pristine_git_object: 75397cd8dd438c3162afc9fa17d5cc2aada45863 + last_write_checksum: sha1:ad9f1196709a837801063b080e51c6f919568126 + pristine_git_object: 5f3fb0c03a43b4eabda20825383b07aeee9b0851 docs/models/billingattachreset.md: id: 8954129e8688 last_write_checksum: sha1:eaee756fd6ff53282c7e36bbd70b8b67e66ac319 @@ -417,8 +181,8 @@ trackedFiles: pristine_git_object: fd1fcac8c7475335b59c3ee405e4e00ae19313bd docs/models/billingattachresponse.md: id: f869a9b1abfd - last_write_checksum: sha1:b801acc7343937fa1ea08a934ec1c5bdf76edc7a - pristine_git_object: bb33ae9b361bca9a8528188f1e2c9ba320b2fd47 + last_write_checksum: sha1:96dc9581930a325b5d1d9a01be7bf3f5e183a6d0 + pristine_git_object: 476b0cefe7948a33d7f761c8606162fd49901646 docs/models/billingattachrollover.md: id: dc8d51bff90f last_write_checksum: sha1:a8dd1548dad25df79a116e30ee5f5ea617ddbc4f @@ -431,306 +195,22 @@ trackedFiles: id: 85c3b486f689 last_write_checksum: sha1:a3e1f10fb2bd6d3d279f70a4ee64d8d885d17ed3 pristine_git_object: 71b0acda81003e7766e3e4401d45dc1247e527f5 - docs/models/billingpreviewattachbillingbehavior.md: - id: 56d952786a69 - last_write_checksum: sha1:825f978af26ee740881916f6414688cf577145ff - pristine_git_object: 285c5b2e6ceee4f21237442e4dff21b25f4b236a - docs/models/billingpreviewattachbillingmethodrequest.md: - id: 60e0707f7cba - last_write_checksum: sha1:f8a6c2d93674d7fd2dd120e0219ca2227ca53f5a - pristine_git_object: 2e87268eb495cd1cac5b996c2872243cacc78348 - docs/models/billingpreviewattachcustomize.md: - id: 51206fe14863 - last_write_checksum: sha1:38012b6ef4d9dd43e5222f52ef4c909557cfdc91 - pristine_git_object: 1de1e485af4fdda5f7319f418d6ed981d845aa32 - docs/models/billingpreviewattachcustomizereset.md: - id: e3109799f638 - last_write_checksum: sha1:1a19c258618776c3a8f1de6b5634b9aa9bba0b48 - pristine_git_object: ab851148623b8b7aa47cd934f3d1cd74f5b25ac5 - docs/models/billingpreviewattachdiscountrequest1.md: - id: ede063c18731 - last_write_checksum: sha1:218b4342aea3ffd8cbf094243bfb0c894a15ae61 - pristine_git_object: bf721b666025c5a7f820536c9cfcfed53d8996db - docs/models/billingpreviewattachdiscountrequest2.md: - id: c36863adfab2 - last_write_checksum: sha1:bc7cef6add7f8c7fd9e0f18b9bd2c3f450bfb9bb - pristine_git_object: 54c14a87bf69e67e6e1505ab7701332b5700b4be - docs/models/billingpreviewattachdiscountresponse.md: - id: 5932fa2b7f14 - last_write_checksum: sha1:9653963773e71cfdf6764f86576bb2c5ee38cb39 - pristine_git_object: ceeff606e1f6af3071e70bd98eec966d1a8b37a2 - docs/models/billingpreviewattachdiscountunion.md: - id: 9a5c441d9f72 - last_write_checksum: sha1:70916193fc58661c3463ebc923c7fdcd6a9992b3 - pristine_git_object: 0b9e534bb69590b616aa0a02be511694f06f3e20 - docs/models/billingpreviewattachdurationtype.md: - id: d2e42efcb5f0 - last_write_checksum: sha1:600909fd25c95e2a3892f4ab8d9abfb00d94068f - pristine_git_object: a105fd4ca333b2136a7c11d43ccd794d0d5239a5 - docs/models/billingpreviewattacheffectiveperiod.md: - id: 3e7570617ef2 - last_write_checksum: sha1:984e572a599723a106b53f76aab91aaca3f96c8f - pristine_git_object: 7e56c717af84d279a2aa0619930bd59c0c047b3d - docs/models/billingpreviewattachexpirydurationtype.md: - id: 0fde3833d2c5 - last_write_checksum: sha1:09eb532d3a84795455a9da31144d19ca6327d970 - pristine_git_object: fa4a03f9d602cad5e9f712d02c790a17998a59cf - docs/models/billingpreviewattachfeaturequantities.md: - id: a565b8dafbda - last_write_checksum: sha1:d6844cb4713c4c16cf6b2be5054d2f876acd4560 - pristine_git_object: 9cbf9b7aeb3c1a1147c270b6904187dcd29037b8 - docs/models/billingpreviewattachfreetrial.md: - id: f0250c9f5402 - last_write_checksum: sha1:e61dc68b46e17ed496bda88a81fbdc0ba837c403 - pristine_git_object: 7232ac27ce1d125b3ae178c31cd0c75f3ce9ef4a - docs/models/billingpreviewattachglobals.md: - id: 884f72ce667f - last_write_checksum: sha1:664020491a7084f812fb630844761c492a98f392 - pristine_git_object: 53bf1dc4dd5b27b61f6bacca3312be2055222c1f - docs/models/billingpreviewattachinvoicemode.md: - id: b4c7b46188b8 - last_write_checksum: sha1:a7ae35c1aa18f276c5fbcb72ab7b19ee372ae484 - pristine_git_object: f902b8353d3b72be1c29ebf26e7788261ab520a0 - docs/models/billingpreviewattachitem.md: - id: a90206919bca - last_write_checksum: sha1:ad70b97a01bad0196867416c7785d22ab352c5b3 - pristine_git_object: c1f7bed5e8abbdf8fb9965cb24313fe49e90f941 - docs/models/billingpreviewattachitemprice.md: - id: 145a2861413f - last_write_checksum: sha1:df4ec06f751ee0b961f17451f3b9a9d18e8005c9 - pristine_git_object: 3fa0e41822ed852213663d41f8a079aed48b4ce1 - docs/models/billingpreviewattachitempriceinterval.md: - id: d79ec9d1f327 - last_write_checksum: sha1:f4da34b6f1c3c031333c1a1a06c48a6766ba838f - pristine_git_object: ce1e431708d3c8427e71bd8a2d459b7d80c63fbc - docs/models/billingpreviewattachitemresetinterval.md: - id: a8bf43822878 - last_write_checksum: sha1:03bc63f8862ed6acbd3069d11f65777f87c36003 - pristine_git_object: 9d1304b37997d83326f892c92184d74e7a63656b - docs/models/billingpreviewattachlineitem.md: - id: b5e92ac7c452 - last_write_checksum: sha1:d32ae6786aa9f101e42c4f49f68dfee6699cb79f - pristine_git_object: aa563a5ea965c626b000724f53636b99beba008d - docs/models/billingpreviewattachnextcycle.md: - id: fe0c0a59ea2a - last_write_checksum: sha1:a8b00097ac5a03d8c24e342d815b22a84418852b - pristine_git_object: e053c1ef27af40c94cfd01311fb2e7255a64ae8e - docs/models/billingpreviewattachnextcyclediscount.md: - id: e6de05dfc33e - last_write_checksum: sha1:ee7016d56bbc277e3448779cf1ed06f26b5f75b9 - pristine_git_object: c7b9e6fbded8c5f61684b47be093af5fb895ace1 - docs/models/billingpreviewattachnextcycleeffectiveperiod.md: - id: 52e3ba8b69d0 - last_write_checksum: sha1:da7b983e151bf838ee4344bf03826294338c7492 - pristine_git_object: 774b61b32d5488ea73afe408f51685c9f60b71b7 - docs/models/billingpreviewattachnextcyclelineitem.md: - id: 331ffe23e389 - last_write_checksum: sha1:c4a5a0a0fac6ed182a1c48c846ca3b1bf0ae4dcb - pristine_git_object: 21ec8c900ae66175e3f6add701afa3259eb69d4f - docs/models/billingpreviewattachondecrease.md: - id: c362810a3dad - last_write_checksum: sha1:1bfdd3d1d821433b717e187fc00e92abc3478d27 - pristine_git_object: 215203f10ba56c91a280605f2306b8510ad4ea30 - docs/models/billingpreviewattachonincrease.md: - id: 4a53bbe72481 - last_write_checksum: sha1:d7a3c8be135dbe5587d1dff9439c6e1abc30752b - pristine_git_object: 3340da5391ca881340d7d87054159af855d76831 - docs/models/billingpreviewattachplanschedule.md: - id: 85b6135dcbe5 - last_write_checksum: sha1:003a46e94ac8433784d7bc1c45ddbfe32e4f87f0 - pristine_git_object: 8166539b361a4b3c4266fdfd7fd3b9a021b1d5ff - docs/models/billingpreviewattachpriceinterval.md: - id: 442e5a20db4b - last_write_checksum: sha1:ebb41210d9adfdca5832bca6c6d1b6be1f5811e4 - pristine_git_object: cad605ebd829e9da14e823d114739101a1b228ba - docs/models/billingpreviewattachpricerequest.md: - id: 84eccd21545b - last_write_checksum: sha1:90644053d5db34c64851935132839746e5527fc3 - pristine_git_object: dfe34aae087cdc741f1c6a79c9f3b8c3af6b3d59 - docs/models/billingpreviewattachproration.md: - id: aa7b4408b640 - last_write_checksum: sha1:f7caeacc7609d1162d6409984e429c342c02875e - pristine_git_object: cc692a111b810e5250f3181e5b48aa26964d8dd7 - docs/models/billingpreviewattachredirectmode.md: - id: 57032657738d - last_write_checksum: sha1:7ad84f5a3c06e012c5a4ede8341bf96eab691f5e - pristine_git_object: 54804abca51856a7f4684ed3543e8bfcd539ef8f - docs/models/billingpreviewattachrequest.md: - id: 1f2dd61b026f - last_write_checksum: sha1:90959db0e2b0198aa1a9c667363cfd3f3da3a20e - pristine_git_object: a27c3cb0d7af9b74af5a1f5b781ea2795c0bbd23 - docs/models/billingpreviewattachresponse.md: - id: 4e4b9c7363c4 - last_write_checksum: sha1:a02ca69bd7ff0b70b84d488d5fbf381bf140141e - pristine_git_object: 96a1ad2e7cfdb102f04539d20d004ea85418e86c - docs/models/billingpreviewattachrolloverrequest.md: - id: 23a0742b9b4c - last_write_checksum: sha1:6ccf67b51d45d1bf8f264f8646f01391e7d5f98f - pristine_git_object: 4feb602a2e432c8e5528ff1607ce2be77f48a66d - docs/models/billingpreviewattachtierrequest.md: - id: bfadcd2815ee - last_write_checksum: sha1:5355b758f30f7e426ac7f341e1891136c856b242 - pristine_git_object: 2f9d2c039395ffafc3ea27928d1b7d1ae2b0236b - docs/models/billingpreviewattachto.md: - id: f3f74e809ca3 - last_write_checksum: sha1:5068798dbac9632393ef5ba67f9298ac01ebda85 - pristine_git_object: b032a30639a332c07010024725a42e37b8c41df3 - docs/models/billingpreviewupdatebillingbehavior.md: - id: 122b5d83244c - last_write_checksum: sha1:aaba68fca416c387cf02cf26fcbd69c367b2faaa - pristine_git_object: 5fb6e8527055aefaab4554de940ccf62e82181c9 - docs/models/billingpreviewupdatebillingmethod.md: - id: 345e15fdc74c - last_write_checksum: sha1:9cd2b7d6905ae402d1d4e818a4853da48ed1d243 - pristine_git_object: 6b94ed4737de7597aad27818bac8dd1db8d4b930 - docs/models/billingpreviewupdatecancelaction.md: - id: 70cd01032cad - last_write_checksum: sha1:a9c144de8f1aebbe5b00eb366fb9606d2fa98dc1 - pristine_git_object: 3afae72aef451432e7c78bb7c7394535d105ea59 - docs/models/billingpreviewupdatecustomize.md: - id: 6d0760a5097f - last_write_checksum: sha1:c44b48a0cf71372a490a1289341275959086ba1a - pristine_git_object: bef2b01e8218636bd5e22e9fa705ee467b632031 - docs/models/billingpreviewupdatediscount.md: - id: 366af5958b3c - last_write_checksum: sha1:d72aac7de5460d788f6592fd05ea50a8c69072c0 - pristine_git_object: 5c8834286ba012d2dd14a0ff0222d158105b6895 - docs/models/billingpreviewupdatedurationtype.md: - id: 5c1bec42fc2d - last_write_checksum: sha1:722b6d3c936a4d6e8b1529e197100bf7b8837611 - pristine_git_object: bc9bf83991be55c92cdf7144f04eb5f0785e8d12 - docs/models/billingpreviewupdateeffectiveperiod.md: - id: 9d3756ff1bec - last_write_checksum: sha1:6c1797838544cfe39c53cce0dced96bd482a409f - pristine_git_object: 68822ab1a01789816c3a5f6695586ef92c3d465b - docs/models/billingpreviewupdateexpirydurationtype.md: - id: 8dab51e60e03 - last_write_checksum: sha1:5d9501ee0a900fee8b99d3d5579f7a95e95240cb - pristine_git_object: 791a80ecfd627db06070543a88a4d1fdf0231ba5 - docs/models/billingpreviewupdatefeaturequantities.md: - id: e694d99a07d7 - last_write_checksum: sha1:89a652db985787c3b477194c8505459bc1c8bf91 - pristine_git_object: a15e753cb1107951ed2e5bad45ed589226aec0b5 - docs/models/billingpreviewupdatefreetrial.md: - id: c9825b95dbc6 - last_write_checksum: sha1:fca3e68542f6577d2b6ec6afcab9b8976350412d - pristine_git_object: 9616912d5a846cefe4a9e40cf7129572c75da2f0 - docs/models/billingpreviewupdateglobals.md: - id: 1e69aef2422a - last_write_checksum: sha1:65af60ddda2bda90ed4e28794b8ac0f647d67552 - pristine_git_object: 8c960b0a555ca51cbfef7929d756690983131d62 - docs/models/billingpreviewupdateinvoicemode.md: - id: 8779c7cb4c43 - last_write_checksum: sha1:8062f1fd396255054e348cc1e4719083a86778c8 - pristine_git_object: bc1702520861ab67328dcc6143529b02b3d4fb7b - docs/models/billingpreviewupdateitem.md: - id: 5924aa9c88dc - last_write_checksum: sha1:5ed80781e674fbab34e3e45d15457822c40baa3a - pristine_git_object: fb5fe349edfe6c16e320cc742b5834db8ec74c87 - docs/models/billingpreviewupdateitemprice.md: - id: dd2c097c6ab5 - last_write_checksum: sha1:c0cd5cfd73415fcb9b5967e1f1dfd7510149c02c - pristine_git_object: ce8d7481a03620c4081a948149a41bc5b63eff2c - docs/models/billingpreviewupdateitempriceinterval.md: - id: b1106365fef6 - last_write_checksum: sha1:08e9bbfb366f6c97cf554c317785b10e8575f107 - pristine_git_object: 0b3f4d8ea8b513c5855c8255244d70b2e783fa29 - docs/models/billingpreviewupdatelineitem.md: - id: d07a69e933f5 - last_write_checksum: sha1:764b22ba15c8d1db1dd24dfbceffba2a017ee0c4 - pristine_git_object: 7c3eb9d1b16aab8d9e98eb96660d407456448e40 - docs/models/billingpreviewupdatenextcycle.md: - id: 34f560241cd2 - last_write_checksum: sha1:03ae47ebdcba09a991155370933c12aab90ade0c - pristine_git_object: eaf265b55b71899d6a8698587908f1c19a724b3d - docs/models/billingpreviewupdatenextcyclediscount.md: - id: da8d7dd0db79 - last_write_checksum: sha1:755cf93da9e0597140997eb7548b8543e99cdcdc - pristine_git_object: 287eab3b7a1b9e234bb951685a07942d5ff192f0 - docs/models/billingpreviewupdatenextcycleeffectiveperiod.md: - id: e5d4f9f903de - last_write_checksum: sha1:03ac9d240920f686b6ad1f47079ce6db2f8d8c13 - pristine_git_object: c76c451730c3b989eb6ef98e13042b35363556d7 - docs/models/billingpreviewupdatenextcyclelineitem.md: - id: 7df0f82636fb - last_write_checksum: sha1:7d4dbea698de24e8478a2438a0e580831c59172a - pristine_git_object: 810e17cab2def3c45d8b545b5967c97368d6ca24 - docs/models/billingpreviewupdateondecrease.md: - id: 469f4619189e - last_write_checksum: sha1:7b80d5b4ec4b87117f4c5bdd5cf83bc1b81e16f9 - pristine_git_object: 563a484998fc798e82e92529f44564fa05ad8fb1 - docs/models/billingpreviewupdateonincrease.md: - id: 17996618f0cc - last_write_checksum: sha1:deff399ad5c85f4e7323b5da337d5343e9c49891 - pristine_git_object: ce640196b7cac8765e4120a0f7e7127045bf008d - docs/models/billingpreviewupdateprice.md: - id: e5ce585dbde8 - last_write_checksum: sha1:a4b516d7eee66f5bb4812324686c90da7871ccca - pristine_git_object: f67aa52a63d536053e164b800ffbc01b85ac9311 - docs/models/billingpreviewupdatepriceinterval.md: - id: 78a8d1a3ed15 - last_write_checksum: sha1:e741a513d15b0934dae93acf95ff4dbb5d8ae4a1 - pristine_git_object: 9aae40a5550c54229d64160a954d7dd501f81c7a - docs/models/billingpreviewupdateproration.md: - id: c84bca732870 - last_write_checksum: sha1:91eb06eb3e006085b6fa2b2478fac2c7bbaa073d - pristine_git_object: 334f3ff9f6f77723acdad330a8e843354f470750 - docs/models/billingpreviewupdaterequest.md: - id: 28274cd59bdb - last_write_checksum: sha1:a10c8cca9441f7d548f2e50ef0802817137a2952 - pristine_git_object: e4399ce1fa4ff6a7b4bd7429f2a1e4267e62a5bf - docs/models/billingpreviewupdatereset.md: - id: 3b716976e1ad - last_write_checksum: sha1:7d88dfbeb9a2251ebf6c97a1fd4bef63f652fb04 - pristine_git_object: 4f8919a3fa4676cc0112c8ae31cdf0c68522297d - docs/models/billingpreviewupdateresetinterval.md: - id: 01016218ec76 - last_write_checksum: sha1:c5065144413ce7a60fbe9b3e518dd2c3b16b345c - pristine_git_object: 9311e90cdec0d2e80f825dcafad6a2cd9d36ff4d - docs/models/billingpreviewupdateresponse.md: - id: 4efe11aea734 - last_write_checksum: sha1:86091f438a902677c6db3b6dc56ca166392f396a - pristine_git_object: 8c8203a5decdc06a11132aa508b624a237dbe296 - docs/models/billingpreviewupdaterollover.md: - id: 708d0be263fb - last_write_checksum: sha1:bd277854e2cde4630c1a4f32f8a5548fafa94882 - pristine_git_object: 59947eefd768f9b9ac90aeb033aad655ca999da0 - docs/models/billingpreviewupdatetier.md: - id: e178ca9bb03f - last_write_checksum: sha1:13df3f4f17f42072ece717d424ddb25bed6d42f8 - pristine_git_object: cfc1eff48ef9514ce1c9ee1a2e56311bfdf8dcd0 - docs/models/billingpreviewupdateto.md: - id: f9c4a3123cf6 - last_write_checksum: sha1:bb8880d64c7e28501f75d169a68dc14eee93ff98 - pristine_git_object: a8d74c6619687320c214937f1207c3e4b35b1f8f - docs/models/billingsetuppaymentglobals.md: - id: 69a5ec4b368b - last_write_checksum: sha1:e3c9e2f5631ccd4f1efdfa7bccccd9f98ef21dcd - pristine_git_object: ddf2786801b8023c0fae450522258637854ec3c7 - docs/models/billingsetuppaymentrequest.md: - id: e258cc9a3fdc - last_write_checksum: sha1:35cc7cec94fdbde619d2e12cf25886b025850773 - pristine_git_object: dcf6362470f4e2be2478914b94caa48b5ce9eafa - docs/models/billingsetuppaymentresponse.md: - id: e9f7ff3e6c2d - last_write_checksum: sha1:30e9becd0f39431505489c5a79e9cdd9bc9fbdbe - pristine_git_object: 083221455503b33cfb4a0f9c3accae276c70673c docs/models/billingupdatebillingbehavior.md: id: 1f59cde41ae4 - last_write_checksum: sha1:e0a1a4b2bc2bf151b1e97b7884a5c3357489547e - pristine_git_object: a8bbbb43ef44e7a857fc4e9ca76cee9ca2ffee37 + last_write_checksum: sha1:2cf2d5690ce0906f67d76e3d392e39d3e2c0a85a + pristine_git_object: 6299d3db69544f12ee49122ebf8fd2b908ec03be docs/models/billingupdatebillingmethod.md: id: 12159f4a0d20 last_write_checksum: sha1:815c9662774de00037334f98fbd5b97c6597b175 pristine_git_object: e29001f5b402e9bd6b28c4586543f8c4131f9d8f docs/models/billingupdatecancelaction.md: id: db6ed95035d6 - last_write_checksum: sha1:119ab84dba826d405283429907ed8d75e7625d5f - pristine_git_object: 09b284914b728f73de57bc989158f0ed2ab8f745 + last_write_checksum: sha1:6781ff5f812623eb2d4c362ab478433515f16003 + pristine_git_object: 7e74a4b0dbbd3d2665ee3444031ca58e2f3262b9 docs/models/billingupdatecode.md: id: 9b4598eb634b - last_write_checksum: sha1:094aae8b85a9bbf87055c130e903807df6ef271b - pristine_git_object: 7d9a46a3e399d8e1c6be359bcfc5bfa76cccf5ed + last_write_checksum: sha1:58ca1664740b44d0eca145f2222d801423c9ed22 + pristine_git_object: ed6a76be783d37f8b7dab9629f4e4b24dd944d0c docs/models/billingupdatecustomize.md: id: 72b14fed6d26 last_write_checksum: sha1:591a140a3569291925c40bc799bc7a663b987ff6 @@ -743,10 +223,10 @@ trackedFiles: id: 53d2632a7c8a last_write_checksum: sha1:169c235d5787b866204d16f3b7c45bcb4495cfe7 pristine_git_object: 8519f37ac175e94c0d9fd1ab11e88c990cdfc4c2 - docs/models/billingupdatefeaturequantities.md: - id: 2dc7f7df5d9e - last_write_checksum: sha1:0bb9839dd05d7322abbc5c1f1a14a991e3b1a4d9 - pristine_git_object: bdb07ec267bb75b384db80e7d6207dff8f0908d4 + docs/models/billingupdatefeaturequantity.md: + id: e799ad33bb5a + last_write_checksum: sha1:e7a8868c59cd8c535cab4bc08fe8ec6773d29889 + pristine_git_object: 086cc66c36b49bdf3d6d1d83df35bd5ac6ccdcdb docs/models/billingupdatefreetrial.md: id: 8173d9088337 last_write_checksum: sha1:c18a80b725677c761f02d3bbab242b7918267082 @@ -757,12 +237,12 @@ trackedFiles: pristine_git_object: 0f1202c71c3c2d1ee807789de058c33831cc8aae docs/models/billingupdateinvoice.md: id: 0a9160e72785 - last_write_checksum: sha1:64a04a83f089bf2e88da967cd245262474ab5990 - pristine_git_object: a45dfb5d006af051350c98dea8bde07edf2b162a + last_write_checksum: sha1:c60c8f769dcad70aff1097765351f2fb13c516b8 + pristine_git_object: ff3ddb6e28c7e7fd6916f35142804b42bf997505 docs/models/billingupdateinvoicemode.md: id: fef42e5dba71 - last_write_checksum: sha1:bcb962cc3baf764b6eacfa107f6344e84d8a7b55 - pristine_git_object: 47fb7c47ee28c33e28299c0cc74f0aefea61954c + last_write_checksum: sha1:8aa45c3fbab57a2b86f4e634b59f8996b68a0233 + pristine_git_object: ccc987c410b54cdfd945b0a4c54020614b9d3e65 docs/models/billingupdateitem.md: id: 349869ec6344 last_write_checksum: sha1:3e73a7ce1b0a2d2dbef2d12afe0adf03dff08cf1 @@ -795,14 +275,10 @@ trackedFiles: id: ceef03cb88fe last_write_checksum: sha1:2d9da288535b8c4b16e23e6ef8a15c5ab36b3178 pristine_git_object: 11dce03528cff9a27a669b273f946187ca261dc9 - docs/models/billingupdaterequest.md: - id: 1737b2debc78 - last_write_checksum: sha1:d35b1b24957cf844bb611caf5b243e31d6f92b22 - pristine_git_object: 1840eb3fafe0dfb0573fd3f105b494c917ff0b01 docs/models/billingupdaterequiredaction.md: id: 3f84a7bd8718 - last_write_checksum: sha1:6b31a5534f5b48cc6e14775212e818f884642519 - pristine_git_object: 44e7fc4f66b41aac22449023f5cef3518119f14c + last_write_checksum: sha1:999727446d5c53ece4c816c145063ce6f0ab0ee0 + pristine_git_object: 7c207728963bae9712cd13ca975761d9af3ba0c2 docs/models/billingupdatereset.md: id: 6531ed562ed8 last_write_checksum: sha1:3330e53453711c977b09c535f50c4c832dfe9233 @@ -813,8 +289,8 @@ trackedFiles: pristine_git_object: f44056d4412a65824f5f615982f3483e0ebf3cbf docs/models/billingupdateresponse.md: id: 61961e78dc41 - last_write_checksum: sha1:2f96e7624e6f1cda2e4a42ac763dfb094210ab41 - pristine_git_object: 3da82cda07b02fb0026c7b2eee26396fe744263a + last_write_checksum: sha1:3c7a336951e5b2349ec5f69ff87fba2f894f98e2 + pristine_git_object: 1650d1362a2d40ee4a8cd4b42abfe98cad2463a2 docs/models/billingupdaterollover.md: id: f3584b1c04ac last_write_checksum: sha1:32d259dcce9070c8ad34c419cb015f6e1758f270 @@ -827,30 +303,250 @@ trackedFiles: id: 2dbc89773256 last_write_checksum: sha1:ac60ad0fd88dab5a347f21563cad039fdf8719c4 pristine_git_object: 1d40f1e0e3af491b7e67142f4d46d7e6bd68377d + docs/models/binsize.md: + id: 63f34acef7f6 + last_write_checksum: sha1:310b19b9bf005367f9bb9b8522f236b116d4c8de + pristine_git_object: a5d47c7f43395017abd9061c252a8ff8ed986985 docs/models/breakdown.md: id: 786823ab8ff0 - last_write_checksum: sha1:401b60b08fad424e843346063c2b66bcea20b64e - pristine_git_object: 849ebfe99854b2a88f8bf16004af1b22fcaf665f + last_write_checksum: sha1:5d00b5d87c39e440609c0a46174fddf5dae12e12 + pristine_git_object: ca1c6be000bc6f455cff510587c0eea6207f5043 + docs/models/checkbalance.md: + id: 0d373800dd17 + last_write_checksum: sha1:b4e3f0ec71a3122cd7d174283682c7fa8e00fc2b + pristine_git_object: 4653404596be1abaca57f4259839ebcb85921b4c + docs/models/checkbalancedisplay.md: + id: 9ac4f08fd925 + last_write_checksum: sha1:5cd31a972de4840336eaf7f96e267c48c6ccdeb8 + pristine_git_object: 4b891928f7fdb8a63c2705b26717d9276a1e89bb + docs/models/checkbalanceintervalenum.md: + id: 0ba8d8b437c7 + last_write_checksum: sha1:fc14b7c674481d1131219472d79a0e483ffdcfd6 + pristine_git_object: cb3be22c955520b9796447ad3cbb696e0b716e6c + docs/models/checkbalancerollover.md: + id: 3a4ed136df3b + last_write_checksum: sha1:88ffaef499b1628d224f2290f3357a4af2b61320 + pristine_git_object: e47cef89c459867b08b0e0019ee17d7423a35f60 + docs/models/checkbalanceto.md: + id: 3e8526323a99 + last_write_checksum: sha1:6f06c03ffa2189410a5e6b32cfe14de8058f1ae6 + pristine_git_object: 3e0c4375d84aef5ba71f37b2e94b0bfc7ef10526 + docs/models/checkbalancetype.md: + id: 9a138ad96e97 + last_write_checksum: sha1:52f04c9b6fc72a4b85b7b9ad62ee3c5dcac7664b + pristine_git_object: 49dea42169c12fb5cd497122a553d497e1da6bf1 + docs/models/checkbillingmethod.md: + id: a9cf85e1cfaf + last_write_checksum: sha1:e9c39d50386b5060dccb76d5c33fe88f35c6de97 + pristine_git_object: 32398968601e00460c9d877ff42755abb645e8f6 + docs/models/checkbreakdown.md: + id: ba36f479e67e + last_write_checksum: sha1:0948e4d18be193a60d3afc0aea91eec11864fb35 + pristine_git_object: 8e11a3e9d5524de0a8ffaddd8ba5d229e7660ecc + docs/models/checkcreditschema.md: + id: b573d5ff9854 + last_write_checksum: sha1:38ae853e3b313b7a6234c596dce1764c8fc87441 + pristine_git_object: 0e6b7402888eaf8208c8f9c27ca36c8e3f03fad7 + docs/models/checkenv.md: + id: badd8ba846d9 + last_write_checksum: sha1:0151f2e60f1949039194de96b878d440e0cbc7df + pristine_git_object: 063b53ed4d0dc95e2b45e40834f12b7da38014de + docs/models/checkfeature.md: + id: 578a088d181f + last_write_checksum: sha1:c3dfcd607099c789dd3abdb7a3b70c94411181da + pristine_git_object: d89127c83b07cc400ce734c0523cc9e939598d00 + docs/models/checkfreetrial.md: + id: 2620d97dc581 + last_write_checksum: sha1:c3c60a1a4e09486eb8b9a09efce7a665c1c9f60c + pristine_git_object: 90a109f36f6f38ddcc91151e8f090e28504160eb + docs/models/checkglobals.md: + id: e7912e7cd264 + last_write_checksum: sha1:799fadc8c10dcbf7d7ae72df4593789491e46da8 + pristine_git_object: db1b11678847be436d8d702b1dfe38fbadfc0b8c + docs/models/checkintervalunion.md: + id: fa9f42d21b59 + last_write_checksum: sha1:2d38937a7b70123fe47aa509edff1c85e511c06e + pristine_git_object: 52d72777c375be47754d1373b1314c84eb24e80a + docs/models/checkitem.md: + id: 17b1916ed078 + last_write_checksum: sha1:1847dfcb0cdbea0adb4726ae6975a710afa78aef + pristine_git_object: d04118b1eef1809f59851c630155e94eb4360619 + docs/models/checkondecrease.md: + id: 2c49735aaa4e + last_write_checksum: sha1:957ef5f0c483f390fab1bd6bb9ad1f21697d1898 + pristine_git_object: 924902d404be8c5cca46410e8bd6d16858feb14d + docs/models/checkonincrease.md: + id: 72e23013a321 + last_write_checksum: sha1:72f018b178859f870d47e4c482ad9f734591d2c6 + pristine_git_object: 188c047ce6cdf1f916ff0e22079a8fed3e3d8916 + docs/models/checkparams.md: + id: 41de438d57cd + last_write_checksum: sha1:f2aed28036cd5b17c20d62833aa62dc277fd32ce + pristine_git_object: 8efeab8cd364c0993690e157f38d92330e3c5ce3 + docs/models/checkprice.md: + id: 9849e6f24c29 + last_write_checksum: sha1:e384e495a9b8d0408919b1a888710317930bf469 + pristine_git_object: fbbe049bf827afc4ba1a1e00c84f5088f402ec5f + docs/models/checkproperties.md: + id: 2bf3cd652685 + last_write_checksum: sha1:32df3ad190735a35b8508139f9d1cc80f48451e6 + pristine_git_object: 882e7a94737e5abce878900ea8f2f2981a5c2344 + docs/models/checkreset.md: + id: cb3e71c72cee + last_write_checksum: sha1:34ae0a7008ff24514a5a2a4adb69cb62f2d52c73 + pristine_git_object: 208fc3703cc581fb721bcc0560f840f8953aa6b3 + docs/models/checkresponse.md: + id: b988b0f4b781 + last_write_checksum: sha1:1cd3b4362811d4b83569dd819a030baa3b557fff + pristine_git_object: a04088005a4d9a1c92c9c4fff9c0514fcf11e977 + docs/models/checkscenario.md: + id: fde16749bb87 + last_write_checksum: sha1:d3dfa18b96ba6404b5d8d27d7a5e6d24f8bf70bf + pristine_git_object: a3439416a51f558dfa38fa46e6b0c1083f30dafa + docs/models/checktier.md: + id: 69ded98d2eec + last_write_checksum: sha1:45d0067b429d1648fa838b5a321cf6ea0c95588e + pristine_git_object: 426e97b4b010ce085325650df59bb054f85e269a docs/models/config.md: id: bef254bf823c - last_write_checksum: sha1:5ed7380a4cbf25fc7ad0d51326330b3d7e57ce91 - pristine_git_object: 052a40331ceffbc45573fae35a80054c5dcff133 + last_write_checksum: sha1:ef78b5d614b7ae838269462e64171e96cbdb7f04 + pristine_git_object: 8129e4783364a073f08d5172285ca39162fbe799 docs/models/configrollover.md: id: 124e55bf1d7c last_write_checksum: sha1:294fc09b86564fdf91f451ef7a34bf14befb1559 pristine_git_object: 748da9682cf626fe0df9ba50eda9eb9d44e0f236 + docs/models/createbalanceglobals.md: + id: 92a7d147982a + last_write_checksum: sha1:93a44d051c48ea377fc342be3630df38a4c37694 + pristine_git_object: e6e79f4e93370dc83282c623a6f44d19c89819eb + docs/models/createbalanceinterval.md: + id: bc0616b97b83 + last_write_checksum: sha1:1f4c49bd045c70e1562b1316837856a62e07a93b + pristine_git_object: e335f5306f33da5881881ffe48510fbc90672b3b + docs/models/createbalanceparams.md: + id: 9091a9b23319 + last_write_checksum: sha1:d44386566da8b9b0a1f9ed13966482fc6d74f2ac + pristine_git_object: ca2751e1776b7d636556664a138c664be0069970 + docs/models/createbalancereset.md: + id: 6d77cbbec089 + last_write_checksum: sha1:667406e3cc2a369ca644f48079110761fc43b30b + pristine_git_object: 7c05e71c396ecf397038e80079fce3f821603944 + docs/models/createbalanceresponse.md: + id: 73aa7a3169fd + last_write_checksum: sha1:5498322197b183ddc9878ac9814e079539f0ec58 + pristine_git_object: 073f7e796daafe7be8710624ee76d22d7a8b7145 + docs/models/createentitybalances.md: + id: 494113cf87f2 + last_write_checksum: sha1:5103a75fa24c57ebff4037ff26f2f97b444023ef + pristine_git_object: 6fc103dc045fb940e23208677781eca2eb0b57cd + docs/models/createentitybillingmethod.md: + id: 50ef390ffe8f + last_write_checksum: sha1:f1e8e71f5950d01c142606f69b9ca296b25998d8 + pristine_git_object: 888ba83aeba217d77cb3d260c7627dbda58b7b1d + docs/models/createentitybreakdown.md: + id: 4007c5e7cbce + last_write_checksum: sha1:6a2a52355034ae2b60a7a5bcd1fc963f03f3c8ce + pristine_git_object: ede2f8e8e682c9c79d3a0d9e29e8a40e17c045ce + docs/models/createentitycreditschema.md: + id: be01ed32c75d + last_write_checksum: sha1:3c3fc090163e058cfb846dea8cd4b5161b04069f + pristine_git_object: 6aa1198977110c18c518040dcf343a5092766dea + docs/models/createentitydisplay.md: + id: 4bc2ac49a23b + last_write_checksum: sha1:12ad48a13f667cba66af4c77a80aa5e5755a45a9 + pristine_git_object: 13c83675006c5edda4cdf66c4f24f0735649c9cc + docs/models/createentityenv.md: + id: 542876d21db6 + last_write_checksum: sha1:b73f6dc451b4e5ec7c9f9c71cd8bb517c176ad52 + pristine_git_object: 32f81e68dc328b00f43653be74163dcf7053f555 + docs/models/createentityfeature.md: + id: e029c7ffe3b3 + last_write_checksum: sha1:e3b5d2ff3c5442af4a2948bacda06ee4aeba2240 + pristine_git_object: 5d414ba10f0c97745fd3acb8892647917eb38560 + docs/models/createentityglobals.md: + id: 6db038879a7e + last_write_checksum: sha1:a84f38c439e56e59dca4515c509e4b6a04b972b4 + pristine_git_object: a3deb7746fcda77172a9437d94fa435dda91ed19 + docs/models/createentityintervalenum.md: + id: 2923d1d06f56 + last_write_checksum: sha1:f7917c23d446fca22e371fdf32413c5d87ad344a + pristine_git_object: 12a5563b06b66722f5d52cab96115e5bf07fa7b8 + docs/models/createentityintervalunion.md: + id: aedf0a0eb359 + last_write_checksum: sha1:1f326504acf32eb55ab678a04b159b341fbeb6ac + pristine_git_object: 31ec44c3c01e538749b1b2ae394e67eea01bc452 + docs/models/createentityinvoice.md: + id: b69787a407d0 + last_write_checksum: sha1:e1af62107047f5fd299785dd989424c4ba948918 + pristine_git_object: 816cf0bf53b399eab0ea4e02dc66c36d0cc414b2 + docs/models/createentityparams.md: + id: 0a5069e94b48 + last_write_checksum: sha1:fffe12b1521cf0ebc67bc735f95dfeec983e92bb + pristine_git_object: d5c2fc59dbbb4b45919aae051aa013add0e49c29 + docs/models/createentityprice.md: + id: 93956a03b54f + last_write_checksum: sha1:3be00899f197f0e68dfc667b38387e7d70a5fd8d + pristine_git_object: 2794e2d43980e3074d759a6fa79f2759b008d8a9 + docs/models/createentitypurchase.md: + id: 79988cc65fd5 + last_write_checksum: sha1:2ea9c6788ba26ba4a8a4f6a3071a4069189d4eeb + pristine_git_object: 486d379d49b9915698f42727dd09a88131dd3f3c + docs/models/createentityreset.md: + id: e69f78587c92 + last_write_checksum: sha1:ddfb77957861c44d6e256e4480262554f4012b5b + pristine_git_object: 7f9c5f6ce2f0964b25236e1f6f10f60242db6254 + docs/models/createentityresponse.md: + id: 4f255b8a83de + last_write_checksum: sha1:0cbdc3e9259ac8441e7de126c41262c62ddb31eb + pristine_git_object: 35a8b88d6275a67414497fd6680fb9bea390a0f9 + docs/models/createentityrollover.md: + id: 58e448f5d066 + last_write_checksum: sha1:3e44fe6df8157e6e8b3796390a51817939c04160 + pristine_git_object: 0610426e0cd3e3a0786b1998b57531ea595ff4dd + docs/models/createentitystatus.md: + id: 145efa808359 + last_write_checksum: sha1:72bb5c58fea5e9dc436e93e1638e6817030ae3ce + pristine_git_object: 9a91415c612c744fbc62d49d23046320057421eb + docs/models/createentitysubscription.md: + id: 8aa96fa32fbf + last_write_checksum: sha1:d6080693d5d30378a392af4a517e4c8239ad2ed3 + pristine_git_object: cede3bc179b386a94e4eda9cc56f9a144969ac82 + docs/models/createentitytier.md: + id: de2bc4dee32f + last_write_checksum: sha1:b201f687904dab06861e574db286449d93130bff + pristine_git_object: c457c621e58d8d9f503b1f2410d60000da37a622 + docs/models/createentityto.md: + id: 62bead54808c + last_write_checksum: sha1:604f9b8bd115a5d53c28d04bc522c1be35a1a1f7 + pristine_git_object: 11f35e3c9a40d2a6ab32a906265ab4fffe387499 + docs/models/createentitytype.md: + id: 32635d8bbeec + last_write_checksum: sha1:93ef621c9fd378e1388b070f7735bdc66d9f8337 + pristine_git_object: 3312ce3a506b47a4a02fe1190cc270488c6c26b4 + docs/models/createreferralcodeglobals.md: + id: 368eaec7a9b4 + last_write_checksum: sha1:abfc0223ac79b4ce82dc286b7eaec9ee7003a10a + pristine_git_object: 8ce1edc5a0d9f298fb773f641586ecaae60c1279 + docs/models/createreferralcodeparams.md: + id: b815b8a11aef + last_write_checksum: sha1:3f618ec4e2610909ff6498c2a5093e8b1c12c203 + pristine_git_object: ccb0251be6f4f61832b866ab72aa65aa014a2ad4 + docs/models/createreferralcoderesponse.md: + id: b746d21856be + last_write_checksum: sha1:ef75b823c030983dfafcf82298a1ab67e8482682 + pristine_git_object: cef67b1f14cedbdbac9b0af23e05bd4fc0856294 docs/models/customer.md: id: 42ac97d31359 - last_write_checksum: sha1:d94186c1228cf23b24a693ec905b45ab5712d07d - pristine_git_object: 778515408b43c10667aca7ceace7799396c598c7 + last_write_checksum: sha1:f16eeeaaf42a8be0fa1f108b49c547350c571024 + pristine_git_object: b224be77d82a856daeace77f07a7e910ba215c5c docs/models/customerbalancestype.md: id: 936c2d1dae10 last_write_checksum: sha1:7484e0dc274edc9fa5ab86d5c4e3d4556005c481 pristine_git_object: 3a9f632084b8f0992adb1ac80384abd1204f0a23 docs/models/customerbillingmethod.md: id: 6c89219094a5 - last_write_checksum: sha1:794150f51d1174c921a5ad7208c2f30792b38acd - pristine_git_object: 0f5a43b73cc95444baa7a6111ad99750a0517c38 + last_write_checksum: sha1:a560f96484bc60d7d621197a1da1ed1ba763ad33 + pristine_git_object: b4338bc31c83d56c29b814682220e60260e8920a docs/models/customercreditschema.md: id: 5d9998b21933 last_write_checksum: sha1:a65580621d87c3d9094319522e2922354199caa8 @@ -881,28 +577,28 @@ trackedFiles: pristine_git_object: 59e884824c96f6bd19141d7db0fcf71b8a707d50 docs/models/customerfeature.md: id: e11a0acefe5f - last_write_checksum: sha1:12cba32177f0d938a4f6d2e7bfdd4e36f38c443b - pristine_git_object: 076eb6dc3637ad2ece8d43a083fa50682dee0717 + last_write_checksum: sha1:aba3d8481bc79bd307de05d740dac0a1d9da0363 + pristine_git_object: 2c73280fb514773fa459b4fdf1db3662715a0f82 docs/models/customerintervalenum.md: id: d28f10412e40 last_write_checksum: sha1:1aaf2650bc5bda39177e2dfe610910446000d3e9 pristine_git_object: 712415b49ff39f41707cbc2ccf31fb21c0069114 docs/models/customerintervalunion.md: id: a768da6bdb1a - last_write_checksum: sha1:ce8ae7573b3c4cbba7bdb45af75b651543fe51ea - pristine_git_object: 7e9dd6d8a0f7ec211ffe4ead73a958aceb0b9e1c + last_write_checksum: sha1:cd974456fe2a3ec196218eaf836d9425e97b2103 + pristine_git_object: 9d0c61d388306d18bee1456d79d81e42af1508c7 docs/models/customerprice.md: id: 14e62b292a06 - last_write_checksum: sha1:17aa0c3e56fbb0f98a1e285a3f76dbc4fb5b56ea - pristine_git_object: 88630fbeae2a7d8f4f71202bd941fde03a1a1f7b + last_write_checksum: sha1:02a1142050bbedbfcd5557705fd738ad9cb2acfc + pristine_git_object: bbb194fdbd0d6cca50edba586b43588a0c47f2fe docs/models/customerreset.md: id: 78338a885803 - last_write_checksum: sha1:0b5ac62bee2af5b1a46f2f6e052bbef53f7b7a37 - pristine_git_object: 49409b4c0990178e7c33dea86d8950338015e4e2 + last_write_checksum: sha1:c85b7b003cf9b2bb1f5e11f42fdedecd627a9cd4 + pristine_git_object: 61c5334d2b635fbcb22ec7b0c7bd74e58afe4500 docs/models/customerrollover.md: id: 9c4ad3a98d86 - last_write_checksum: sha1:a44ed6945bc97ee12a289bd286d4a76aa23935b0 - pristine_git_object: 8db9ac673ec170fc6bae016cf5ba93619c84197f + last_write_checksum: sha1:fb5f60eb02395e9bb6601ec1c53b20e668da016b + pristine_git_object: ea8a9ed811e3c46fbd34bca43fdd207a13c4ce7a docs/models/customertier.md: id: 08a259cc5760 last_write_checksum: sha1:6d85d922d5d530e7cad004e604e495976407616d @@ -923,6 +619,18 @@ trackedFiles: id: 5fed3824cc2e last_write_checksum: sha1:bece33e132360565546ca58d64e61793106a35cb pristine_git_object: 7ab2e8a024c5f4d2f8a00c4247adc14e1cbd0e41 + docs/models/deleteentityglobals.md: + id: 226c03e11f6c + last_write_checksum: sha1:6d3ed425e119ca26247a650732fb65b1b9a00f06 + pristine_git_object: c3a1c6527eb4f56eeface10b2074445a6b31544c + docs/models/deleteentityparams.md: + id: bd4aa69b4bb5 + last_write_checksum: sha1:0a72a1916512213b8d903b5fcedc2c17ec5a6610 + pristine_git_object: 39368a848552d14c1c612c4acb12fe35034f2c40 + docs/models/deleteentityresponse.md: + id: 2a13e65d40b5 + last_write_checksum: sha1:191d5901198133af188372bf5b659f4e049fa973 + pristine_git_object: 0f842e811009f71764ed48fb1d9f1a9f9dd3eb42 docs/models/discount.md: id: 003b28f6c8a6 last_write_checksum: sha1:b9dae9fc7bc9cfb592d5d6679d65739d15b65fb5 @@ -935,6 +643,14 @@ trackedFiles: id: 5c026cde1184 last_write_checksum: sha1:8a7e9be1424504f599c97ab269154498bc9c498a pristine_git_object: 4791ce7334f87c2857cfc98e758fa7623cbed062 + docs/models/eventsaggregateparams.md: + id: d82804f4b722 + last_write_checksum: sha1:6c9d3fb546aeb762a5d28b6333cdeb6010853f96 + pristine_git_object: 080822aa5479281ac5538bb65778d6f560b8cbec + docs/models/eventslistparams.md: + id: ab92b0ecc15c + last_write_checksum: sha1:ebf94aaace7dd8547406584823f1a99acc349563 + pristine_git_object: baeb7ce122c10f3d16f5095e2068aa1a57b7dc2a docs/models/expirydurationtype.md: id: 7ba992bf53cc last_write_checksum: sha1:012c3bc7b1084ca6f478f19b7606cb19479fcc27 @@ -951,6 +667,94 @@ trackedFiles: id: afd918f70308 last_write_checksum: sha1:55685a177c7e93c6a9806a7e7d0aa006276d9ac6 pristine_git_object: 94300d74e7fc30cbf84fd822357b2fa2b60d3d0d + docs/models/getentitybalances.md: + id: b2a917b7bb13 + last_write_checksum: sha1:71e7110662a99afe3dbd6e54054673cf286ed178 + pristine_git_object: 81f18b46728ac34b9be0ba40d11c241ed8cfb847 + docs/models/getentitybillingmethod.md: + id: 6d772c65a8f0 + last_write_checksum: sha1:91296f01014b4f2704ffa0305c137bac7fcfa3dd + pristine_git_object: 74e431015c09c5d471a3af66cdcdd2ca0b7c87bc + docs/models/getentitybreakdown.md: + id: 8e96db15ca62 + last_write_checksum: sha1:538a135d9f37c652fd30d2464244549210003523 + pristine_git_object: de4ed7f4b99b100bbeea6150ed12717097ff7631 + docs/models/getentitycreditschema.md: + id: 887b3eaf1c97 + last_write_checksum: sha1:066a7c14d35ff5aa02364b2447427b4bbd80df3b + pristine_git_object: c1f245948312914e1470a158f3683062c6ee3ebb + docs/models/getentitydisplay.md: + id: fda04c4166a9 + last_write_checksum: sha1:aa320e86861bab6cad802a5493b9483fb21bb508 + pristine_git_object: 46c3eec419649c04e396c267d8d65d106d7ba5c1 + docs/models/getentityenv.md: + id: 446f208bb477 + last_write_checksum: sha1:5c573af95d0443415d84736118217658388bc1bd + pristine_git_object: 63a901b4fbfb4df8bd9ecaa0da5c1a9c7ac69418 + docs/models/getentityfeature.md: + id: 70f61caa19f2 + last_write_checksum: sha1:3fb824f3c846438f1a78a859c550c386dce84cee + pristine_git_object: df28fd2e09074defca4423fe7839e709fec28c64 + docs/models/getentityglobals.md: + id: 913347eb82c1 + last_write_checksum: sha1:5a030fd4999feba6adb6e2de940142cdca062e2d + pristine_git_object: c56a206c0a6cfc7523d705cfff77bbe0462de772 + docs/models/getentityintervalenum.md: + id: af9b96850c60 + last_write_checksum: sha1:21d6b71c11bbce1d265915c083b92cf1f6060c42 + pristine_git_object: cf5173e5965ecd7ca88703079849755bef444787 + docs/models/getentityintervalunion.md: + id: 21f23cdaa139 + last_write_checksum: sha1:062149efd337cbfa2054ff2ec76c0afed28f6c2c + pristine_git_object: d3e6f0d7176a2fc464fd0ddd20bffd5072755c5e + docs/models/getentityinvoice.md: + id: 498d83441f95 + last_write_checksum: sha1:916aba4b5e81defac60da9b46c69e102d9b6b014 + pristine_git_object: 48ebfe08051bdf624b78dc0bc5f41e833784daa2 + docs/models/getentityparams.md: + id: 6f310540c7bb + last_write_checksum: sha1:6b6c74ef073079387a75d14c3493d02836e1ede7 + pristine_git_object: 6e33a8fe4648aab0b99ca3f6b6f351a43345058f + docs/models/getentityprice.md: + id: d3484a48e87c + last_write_checksum: sha1:3770bc8bf681eacc545073ac7c63aadb591508ea + pristine_git_object: 3706590534b1dfc1717d862e824baa5e3936548f + docs/models/getentitypurchase.md: + id: ce7162950983 + last_write_checksum: sha1:40d1e429c716d0c4ca6d035a2472cb166a0858f4 + pristine_git_object: 88e4c2669e74e7b963ee5d2ee509d0d3fa868eef + docs/models/getentityreset.md: + id: 567d7eb48c0f + last_write_checksum: sha1:32b6fadc3fce7b099bda32be62ce5cffcb629998 + pristine_git_object: 14e5995a848383d0296010fbe5bde3582f607e6a + docs/models/getentityresponse.md: + id: 2a260e19ff31 + last_write_checksum: sha1:707cbcc24ed737d9d5a5657c07f612bd35a9be78 + pristine_git_object: 4455851d29144038b6c3de2c9cedf1522b095545 + docs/models/getentityrollover.md: + id: 96fc86a3c6cd + last_write_checksum: sha1:b103aa87dc447eabf2ed0cd417d2bd17c450de24 + pristine_git_object: 7601f45a791e4ed45c20039242eaf22e336ba460 + docs/models/getentitystatus.md: + id: a9dc0fe0776b + last_write_checksum: sha1:0ef801e1509cec493b2185893c7ff7a6a8f071a9 + pristine_git_object: 9c9b61b2e49731c3618f2bba373b8c104d75e035 + docs/models/getentitysubscription.md: + id: 79bea398e954 + last_write_checksum: sha1:c1c70a6e63028f18499e7f2378b71541bc982f78 + pristine_git_object: f4ac67fd094a1a8fcb4e78c7f8e2b0ce1d00b3a7 + docs/models/getentitytier.md: + id: 4d5cb10f760a + last_write_checksum: sha1:13fb067fb9c30cdf604daf3cd649b63105cb3631 + pristine_git_object: b56df546a11cba7a4a16ddf42bd7ca5630e0ce4b + docs/models/getentityto.md: + id: 0444c03821e2 + last_write_checksum: sha1:8dc517045ce911f2abea0c41f63300ae40918353 + pristine_git_object: a21a2325241a94c675f3b57c74563abda8695673 + docs/models/getentitytype.md: + id: 18fa9d2e3acf + last_write_checksum: sha1:339b24b5cebb34717dd86ba52cf3d9ba39803401 + pristine_git_object: dc72cdd80e7bb5941c9c4d180e1cdb126610079e docs/models/getorcreatecustomerglobals.md: id: 1cab932654ad last_write_checksum: sha1:a98b6f0751961493a875cad885360ca4ab817955 @@ -963,74 +767,10 @@ trackedFiles: id: e844c6f90fe1 last_write_checksum: sha1:f45eadc2eb0f9f2543fcfd3b0d671c8fc9e1c5a8 pristine_git_object: 6af710e8393ec0d5bd29b7bc2969174b69548d55 - docs/models/incoming.md: - id: 440441d25a42 - last_write_checksum: sha1:467844c3a4eaec058da6ad543e655e6690ef5dc8 - pristine_git_object: 9486f06c25d9bb9934c8af2aa9a57112eabc27da - docs/models/incomingbalances.md: - id: 114d575c3450 - last_write_checksum: sha1:2aff9a53876680e96e530686971efcc8034879cd - pristine_git_object: 063c002b3e70637caf65a8770e5b61e402ff7f08 - docs/models/incomingbillingmethod.md: - id: 6efbce7dcaec - last_write_checksum: sha1:dfedb0e25d88780eca9d2d377e1ab45308a529eb - pristine_git_object: 625b2ea8ee3779af82d04f730a35bb6594e56aa2 - docs/models/incomingbreakdown.md: - id: 41169dd758b2 - last_write_checksum: sha1:fe1124b2ba2a1111ee42dae9d286ab26400a2e9d - pristine_git_object: 164b60da4e5fa3746849eca962053700ddfd0603 - docs/models/incomingcreditschema.md: - id: b2346aec35f4 - last_write_checksum: sha1:71dc6727d4d8561d8e61cb012f08fc6878e65913 - pristine_git_object: 93455777a5887ff171cdb9245a6d5c86b2315c00 - docs/models/incomingdisplay.md: - id: 2ff6df414159 - last_write_checksum: sha1:291d46d8782dd4dbff6800386927899398bac60a - pristine_git_object: b9af806bffa3118bb0655ddd623948468d6765ec - docs/models/incomingfeature.md: - id: cadffcccf6b0 - last_write_checksum: sha1:34e2b30bf116e88faac47505dc7a2b02e0b04a3a - pristine_git_object: cd9c74177e2dd2c2878bca3720ca16537dff92d5 - docs/models/incomingfeaturequantity.md: - id: ccfc63f61ce5 - last_write_checksum: sha1:5f96cdf983771b8da982b1461b170636f8bcc0df - pristine_git_object: 9df4947fd33e475d614bd624fc7b808e18902190 - docs/models/incomingintervalunion.md: - id: b3bd5fea81e7 - last_write_checksum: sha1:5eb3d581a13c0c2237bb5c732db88e34e72cef0c - pristine_git_object: e2a1778669737428cec1acf13831e43054ec62ba - docs/models/incomingprice.md: - id: c5a16bdf5098 - last_write_checksum: sha1:a19f31cadaeb7562b89bde3b8b9b585339f0ff28 - pristine_git_object: 605159dc454b9fa8e65f76ef79aa20a0cd815c35 - docs/models/incomingreset.md: - id: b42161f24818 - last_write_checksum: sha1:32f5f83f67938476f12ade2d13f14ede5fd34b87 - pristine_git_object: dd6be284194c3ff4029804ce1ad4c9f6b70f3001 - docs/models/incomingrollover.md: - id: 0dbc64fc27d5 - last_write_checksum: sha1:0c7d69a511ee9eaaebb6a1cfc899937a359bc3f1 - pristine_git_object: f113b1a9eeb89601a3a4869d6c1fa31241812b7e - docs/models/incomingtier.md: - id: ea676e9b9ec5 - last_write_checksum: sha1:1d4743415a30258af396b8f8f6e2140f45303319 - pristine_git_object: cf29e356f90e49b6fb135eb6a0004a100238ace1 - docs/models/incomingtype.md: - id: 2c9fd72132b5 - last_write_checksum: sha1:cbf961fcb04d167c257260529403077948a1cd65 - pristine_git_object: ae92c92431edc8fb6003e4df35fa0ae267acf1b7 docs/models/internal/globals.md: id: 9c173b87f41f last_write_checksum: sha1:f1b8e7ce642026cd3ca1df79e67c7a011f487fca pristine_git_object: b2f8dc32fc72edb1b050a6ff282c1498eaf928f4 - docs/models/intervalincomingenum.md: - id: 887de85be470 - last_write_checksum: sha1:9873d8a760bc8a73762bdd2bd50ad8881858f900 - pristine_git_object: a6eecf963d04986a0ef73b0bcf28db39344cf8bf - docs/models/intervaloutgoingenum.md: - id: 13b66784398f - last_write_checksum: sha1:4078b7e58b963aee7c03863521c5d2c7c73e80ec - pristine_git_object: 30fc02e79065b7a1bb93c30af666de80ab304a55 docs/models/invoice.md: id: 18e2034f11ad last_write_checksum: sha1:359475ecee43870f2eb2421cf1243cfbc38e45e7 @@ -1041,16 +781,16 @@ trackedFiles: pristine_git_object: 46f65fabed9a5a852350d4bce4f036f73fab0438 docs/models/listcustomersbalances.md: id: 03c5aa088096 - last_write_checksum: sha1:3da2493ee865dcc582bde8a3400fe381ab66d67d - pristine_git_object: 47ea1470231462f55c8236110fe1ccb66fe17fcb + last_write_checksum: sha1:f07f6fd8ee39155f25ddde79009f4a3445e68ab1 + pristine_git_object: f32c589b5df0e35e97980f731bd35489e5b1b187 docs/models/listcustomersbillingmethod.md: id: d21be11d928d - last_write_checksum: sha1:8dd920c7dfc528a02a386676e20da2f476fdc354 - pristine_git_object: d394f3fcb0d5f139d5ab0060b077fa005ee4a13b + last_write_checksum: sha1:d96ea8315011fc29bb7011fd309f4c78e727961a + pristine_git_object: efee8896552a85b04f545adadcead7b85febd258 docs/models/listcustomersbreakdown.md: id: 93bc1cdb1e37 - last_write_checksum: sha1:a25602ec22af2f2938b78a50bb00ef0dcd9b9a7d - pristine_git_object: b41b3d4339e2a75a0ec8058b0aa9ab06d74bbc1c + last_write_checksum: sha1:7b2683af9514d614e3ebf5d3e73d9660e75a1c1b + pristine_git_object: 2e7e509db5a2770abaa3e7bad74661392c8c2923 docs/models/listcustomerscreditschema.md: id: 233b13b5c3ec last_write_checksum: sha1:df3fc7455a099da412abdc9ff85f021b1de749ec @@ -1065,8 +805,8 @@ trackedFiles: pristine_git_object: 750e1fe57b24381eafec336a5d7d1a97980447b8 docs/models/listcustomersfeature.md: id: 0d1d6a29245e - last_write_checksum: sha1:cd517ede0cff21b702bd8a5235627ed2f6987309 - pristine_git_object: 7b61528e5fbf4db0951347f940b9ec1eca8d3f20 + last_write_checksum: sha1:f93515220aada9e57f984e1a08a05ca62faac2d2 + pristine_git_object: 9fc578f26daab2bd425f2aa877f73ffd96cb5886 docs/models/listcustomersglobals.md: id: be7050e3cb0c last_write_checksum: sha1:89763ac589ae615c58d37153e80a6b5bd0d703a3 @@ -1077,8 +817,12 @@ trackedFiles: pristine_git_object: 29ccd27c9ae8bdf671fa48899bbd7ff1f6717759 docs/models/listcustomersintervalunion.md: id: 69f4d6d8b38a - last_write_checksum: sha1:a619d6256a362c45d3a3b0047a352d75c8f26f80 - pristine_git_object: b2c4f91d3712a684a51013e6f60355f6452f7467 + last_write_checksum: sha1:b743a6c2bf885c6c0ebf4f84e0d322ff6dd473df + pristine_git_object: 72b3636e7662cd86ffc923afcaac9c781c126a0e + docs/models/listcustomerslist.md: + id: d71dda8a696c + last_write_checksum: sha1:b451587e668cc43a2c8bc37db12ae98625672c09 + pristine_git_object: 6962f767216bfce3b10ae2b286342f0613bd3d3e docs/models/listcustomersparams.md: id: 8ac823390bd3 last_write_checksum: sha1:df17db59b8245a4f9e9a952a659035219a40798f @@ -1089,32 +833,32 @@ trackedFiles: pristine_git_object: f2d4ab71e9ca08cd4f36405c0fe420be387947bb docs/models/listcustomersprice.md: id: 73b0691740ec - last_write_checksum: sha1:8b6b04a16ace81c7e6a6aac6aba342b8eb6891f3 - pristine_git_object: 11660aa4e54064f493084a0d15bc69e98fbb3444 + last_write_checksum: sha1:c4eb891c170d4ff060e0b7129205e0bc69cc0fcf + pristine_git_object: 8befe00850ec8cd5e5e512d5b5d0cef38e45ffa6 docs/models/listcustomerspurchase.md: id: b7fa1c1d2bae - last_write_checksum: sha1:ae695b6ce08eb0d24e7870ead438bdcbecd30739 - pristine_git_object: ba47d94a11c462f631ce7663ed93ad44fa50b885 + last_write_checksum: sha1:a450767d5e82f94f068d28de4010954f0dd5bcb2 + pristine_git_object: e2c10dcf58bccd8db5af1f91d21633f4aa026879 docs/models/listcustomersreset.md: id: 2706e5f5752f - last_write_checksum: sha1:7aa06844aedb12ef6d2a543fd61b18be01923eff - pristine_git_object: 032f8c8d4670b69d1978b8a2d0f5fb6d2fe3e510 + last_write_checksum: sha1:4ed7221286a9db2c91a762a4684d676ab0bb9f97 + pristine_git_object: 958fb5efc3394a237ff6f531dba8c8ed29de3d2c docs/models/listcustomersresponse.md: id: 8bcc0ece3648 - last_write_checksum: sha1:835ab42514fc904434f1442a812b381dc224480d - pristine_git_object: 4d7bbf3ef462d86a78a673d863fcc9097a8fd11e + last_write_checksum: sha1:094cdacd097c6ca9cb35761969ee42803b9dd85b + pristine_git_object: a9000e17d58b7a01d0082812ec8a6ca2863b41c8 docs/models/listcustomersrollover.md: id: 61a4472ee4a5 - last_write_checksum: sha1:996ae8fc5ceffa27e7bd3bd54fe9d2ef3e330ba1 - pristine_git_object: 01463f0ef7542838aa629469a6047bb59cf57039 + last_write_checksum: sha1:a9ca1b73b98837b17508bfc9e45a0a1824c15195 + pristine_git_object: 469e240882d55834850380c036c2e7feaac6c69a docs/models/listcustomersstatus.md: id: ef9a6bf44535 - last_write_checksum: sha1:0ebc78b5551470c5da47f9cfd779bb41c5d37d56 - pristine_git_object: 06b87554d48b5879195e4269b9e7749e8205fd04 + last_write_checksum: sha1:956f1e484cadbb76fe9bf2069fa624885e5dd2e3 + pristine_git_object: e11dcb9eae8b5df39a7f50c909eaf673d40984b4 docs/models/listcustomerssubscription.md: id: 563487abda41 - last_write_checksum: sha1:9edec9ebde2dbc4ec4aab348fbbe784e94ffec69 - pristine_git_object: 40294b3c65085310c201d48905a28c77fcbf473e + last_write_checksum: sha1:490218007b7e1f3fc1603fcebf486db48b5f5644 + pristine_git_object: 851b003d879d1b54333e3887d29344e1e7400ee8 docs/models/listcustomerstier.md: id: 366b5fd771c3 last_write_checksum: sha1:8e19d7b783ea39be2309bf2000da951cce5ea1f1 @@ -1123,6 +867,30 @@ trackedFiles: id: 431485f373da last_write_checksum: sha1:caf95398f6f9899c01bd2d347ef077e09155245a pristine_git_object: 7d759dbd6668f77587a13cf5f292c1fe96986d04 + docs/models/listeventscustomrange.md: + id: 7fe97412d600 + last_write_checksum: sha1:d9fe1ecd94b4360de822647bfc6d10319a6a11de + pristine_git_object: bfc9d8933411854d2f6fe8ba5b532ce2288b744c + docs/models/listeventsfeatureid.md: + id: 008f80a1696e + last_write_checksum: sha1:29d9f706f62233be978bab02d9ee0886111071bb + pristine_git_object: ddf59bdd882f32dba259f40a461bab21ac0a4ea8 + docs/models/listeventsglobals.md: + id: 8b5c7dce9a0a + last_write_checksum: sha1:e02c740f6e73529a4bb97334e42291f352b80caa + pristine_git_object: 6be5efa88697a54665134314c88507cffb232c6c + docs/models/listeventslist.md: + id: eca206ba0395 + last_write_checksum: sha1:32e6feb1024150f1233bbce4a54f429094bb30b5 + pristine_git_object: bee48b3d82a82bd8db1e4a93c1bdbf9085a61cd1 + docs/models/listeventsproperties.md: + id: 51d80b2e6d71 + last_write_checksum: sha1:f2168972ff3ea00826cb154dac7c4c252738b1d2 + pristine_git_object: 8f209af3fedcc839224ed2a77a4cc6f2f2900fc4 + docs/models/listeventsresponse.md: + id: 150f903b0ed9 + last_write_checksum: sha1:9eb8f98df1804fd7d9b0c1cedd5fad119992cb56 + pristine_git_object: 0350b288fb5d4c93b021b448add0415bb9d66556 docs/models/listplansglobals.md: id: 4f3f31fd5f30 last_write_checksum: sha1:d0a5b30f29ed4b26578d1ade3e8fb8e271021f66 @@ -1135,10 +903,6 @@ trackedFiles: id: 36b6e3fa6daa last_write_checksum: sha1:f7fe5c2aca78ca13ef988e37e35180e1c4a141d7 pristine_git_object: 35e5ec6c28f97b8551ceb9eb31b5b40894618ae4 - docs/models/listt.md: - id: c8af7ba36d41 - last_write_checksum: sha1:6464db5f78a17f16cd9edadc39cefd35cc04d383 - pristine_git_object: f9761f7589159e8ae61526b7b090daa9208c7467 docs/models/ondecrease.md: id: 64eee91e295e last_write_checksum: sha1:999ea60fe26a7b5c4e4156ec56df078b883168a1 @@ -1147,62 +911,18 @@ trackedFiles: id: 1c1351190e30 last_write_checksum: sha1:c42371e97c1eb94c4ce8c7b316f0a4eb33f06020 pristine_git_object: 39c4dc445027afe9bbb96efa1142f6eec8a90ebc - docs/models/outgoing.md: - id: 5ead4a3a13e9 - last_write_checksum: sha1:bdf3660750290604f657af1f2a485e54ee95f30d - pristine_git_object: 907e050584d9f3b0f7c762487a6b0173860a9d4c - docs/models/outgoingbalances.md: - id: db8d37650c6d - last_write_checksum: sha1:c53cce12e8819e6b23568d48414e601d2b7f6ac1 - pristine_git_object: 67b05200a6e8f80f4d28f7a73d1ccb22fd285093 - docs/models/outgoingbillingmethod.md: - id: a33118a126b5 - last_write_checksum: sha1:7918f2c6e81dce24bbd937d1a7c2315260e8927b - pristine_git_object: 0b62751cf559e85ffab0ede512890d8aee330ad4 - docs/models/outgoingbreakdown.md: - id: ad7069a9c33b - last_write_checksum: sha1:5e9854cbc79ee134b19ba3c30636f3c082e97db3 - pristine_git_object: 835417699951819fd14e9af7029e3c393080d8a8 - docs/models/outgoingcreditschema.md: - id: 1fde0b5cbf3d - last_write_checksum: sha1:641c8dc19d0ed31f0c81c69702c1b212cda09051 - pristine_git_object: 887de97a20883e3d67a52d106dc7f621fa47a11b - docs/models/outgoingdisplay.md: - id: 15546ab5c4df - last_write_checksum: sha1:b0b0d250e2bda764a644017f74e572f3fe4bc8b8 - pristine_git_object: 971fb78c54e8d52b51b308952ff61c0f3cc20541 - docs/models/outgoingfeature.md: - id: bfdc8af59ac4 - last_write_checksum: sha1:d84ec41d86b268204583711db295e3c24aa57112 - pristine_git_object: be19c88f876601d01ce88e9dde40b2323d109e07 - docs/models/outgoingfeaturequantity.md: - id: ddb853b5b580 - last_write_checksum: sha1:8b93b2b496dde64a5064e1901dfa7efd3db5fed9 - pristine_git_object: bf6ac796591658bc49cc3cb41801d30093a2cd20 - docs/models/outgoingintervalunion.md: - id: ce8227a83020 - last_write_checksum: sha1:b2592dfa6028ab5a49699f4bf48615d512b6a304 - pristine_git_object: 39506696dddd56554c4ee589375e7e965de20871 - docs/models/outgoingprice.md: - id: a2067bd881cb - last_write_checksum: sha1:e7e2c31d8062fd4adfba6263f30e22c9d9ab0517 - pristine_git_object: 672a1b6307ea5d4f8d8e31447d3aa430bb6774c8 - docs/models/outgoingreset.md: - id: 849df05e1d95 - last_write_checksum: sha1:4893e3bfbddd50ad2f73864a8b854a7627a806aa - pristine_git_object: e8c5d5a58d4ce5019118b56861b478847350c497 - docs/models/outgoingrollover.md: - id: e7ff6d52edcb - last_write_checksum: sha1:65f02dff4b6c8e78d9c5aaa083f4c66879d181c0 - pristine_git_object: 05c8274a30dd27ee7ed734b3c70935abc5aa3fa5 - docs/models/outgoingtier.md: - id: 4ccf54aa62c9 - last_write_checksum: sha1:78116063e0035116a6f510c80119ec582c429618 - pristine_git_object: 8442e7a75f0b81c8e11eda47f17816dedef86554 - docs/models/outgoingtype.md: - id: ad922b328326 - last_write_checksum: sha1:3da01c6e15153eff80161aea5f3167b1684db9bd - pristine_git_object: 041513176a3f1a5dcdc961434d53739f6fa0ce50 + docs/models/opencustomerportalglobals.md: + id: 9672e1095d8f + last_write_checksum: sha1:128710c47318a46258c878691506ae599d1b55e3 + pristine_git_object: eb21b29e8a835c23aaca48a0434288f1996d72cf + docs/models/opencustomerportalparams.md: + id: d14a4db1a37a + last_write_checksum: sha1:ee04f48101ed91ec2922f6c5e5c86d39919792ae + pristine_git_object: 4d1d005b85547bab648fe23b5adc5b397b98f830 + docs/models/opencustomerportalresponse.md: + id: 4e485c687a41 + last_write_checksum: sha1:b595ed400b0d689a292682908868d544474520e3 + pristine_git_object: e837aa4e197e0d89a5af163eb58863349124e4de docs/models/plan.md: id: 900c4149ef4b last_write_checksum: sha1:be5c12df8e68ea9d232716b1b2ee5010830f0051 @@ -1277,16 +997,252 @@ trackedFiles: pristine_git_object: cf233509e8cc1599a589dba1e68dda9e2d16400b docs/models/preview.md: id: ca71b601ef12 - last_write_checksum: sha1:da035b33fc2117687c7ede984429a3262b3b4e51 - pristine_git_object: 2ce7b1880e318c8968bf2cfa70cda63ced592755 + last_write_checksum: sha1:7f28aa6fa61d2909afea263220c1db6760e36683 + pristine_git_object: f1c2dbfbebc8e6e6637734d03a7c2afbde7f8c39 + docs/models/previewattachbillingbehavior.md: + id: 09c5ce0d8d6a + last_write_checksum: sha1:c8760159f7391b802a88614b3c02804ade44f538 + pristine_git_object: 939760d3cd9da80372692bc08c6b3ab4297249de + docs/models/previewattachbillingmethod.md: + id: 4fbccec2190f + last_write_checksum: sha1:db2792398eab54958aa78abf007fa72d8f89e1fb + pristine_git_object: c7a69be0d40aac6eb2465c1b06c4a7bb8542c512 + docs/models/previewattachcustomize.md: + id: dd921922e55d + last_write_checksum: sha1:c75797874cd1c1f49c76a300c872148c85381837 + pristine_git_object: 33454b3982a242461dcbe10930b66f4958a1a6d3 + docs/models/previewattachdiscountrequest1.md: + id: dfd133cd1558 + last_write_checksum: sha1:042f96266cb5bf94238a2be511780585abc2db24 + pristine_git_object: 3668fc69ce898a5303190984398bca3c0ab3d6d0 + docs/models/previewattachdiscountrequest2.md: + id: cd88426327a2 + last_write_checksum: sha1:0dd4cd2f5912f2b0121bae09fa133e9db16a6d44 + pristine_git_object: 2aec53384ae9306867ae516cc31427752b6730ab + docs/models/previewattachdiscountresponse.md: + id: 6b703ffd0068 + last_write_checksum: sha1:f019578e6e5f32e0c4499c763f648748de40c8d8 + pristine_git_object: 6d7254cdbf2419af5ac603cc58d41fb4258c31d2 + docs/models/previewattachdiscountunion.md: + id: 1682b70e0296 + last_write_checksum: sha1:677e1508e4d406852b3a271757dadedc0ee0c126 + pristine_git_object: 3a363e45f5bce3e2a6003110e064642c55c88a55 + docs/models/previewattachdurationtype.md: + id: b41ef967b1da + last_write_checksum: sha1:0895f81401758ecb3e44b109ef38b3a47ca597cc + pristine_git_object: a995bff9fde526220247a3fe1051e5f7acb698c6 + docs/models/previewattachexpirydurationtype.md: + id: 0cb588a15167 + last_write_checksum: sha1:c45dcada80fff7070f8dae33fb2dba41eb25527a + pristine_git_object: dcc75b0986beebc6228ffa55f0c9d2f3e30ad540 + docs/models/previewattachfeaturequantity.md: + id: 804680b3b212 + last_write_checksum: sha1:5dd6ad14c85d1ee911cd899b99665aad96fee7b0 + pristine_git_object: 0a07754963ad26331deb7b6f43700d2f4523f234 + docs/models/previewattachfreetrial.md: + id: be20be37a533 + last_write_checksum: sha1:8187497f3df0e0da0879aae8f5ec4907a76434fe + pristine_git_object: 54d2be4ee342262296121187af95a7b6632548de + docs/models/previewattachglobals.md: + id: 1d1254f22011 + last_write_checksum: sha1:af824b094366d657e9237154a259f003e33fcea7 + pristine_git_object: cb44702b2c3aa86727942ef1627f50a508365304 + docs/models/previewattachinvoicemode.md: + id: 78a526159f9b + last_write_checksum: sha1:83d57ed29d6c74b8f7c0e9a379700a98046fc5a8 + pristine_git_object: 52153f9fd9a587fd6e60b8ee15bbd9e661d7bb3c + docs/models/previewattachitem.md: + id: 6379edcacd70 + last_write_checksum: sha1:88dd1e97457ba09d8ea2ce38ab5d26ff55d6bfcc + pristine_git_object: ced5afb0b8d03ec950720422cf3ef24383f23fec + docs/models/previewattachitemprice.md: + id: 7b4a988d6e91 + last_write_checksum: sha1:82849c9fa903759fff6d95e26add943f7b873c3e + pristine_git_object: 09404c66b6d85e85e01343990f0486cd81465ce7 + docs/models/previewattachitempriceinterval.md: + id: 96eeb2602066 + last_write_checksum: sha1:aea5233836aef333631b9d072b971c6a8750625b + pristine_git_object: b258bbbcb635ff50af0ea0cd26c80bf9c2b6e5fe + docs/models/previewattachlineitem.md: + id: 3411ba3438a0 + last_write_checksum: sha1:73f694348074e295cd7da51fc35395861480b281 + pristine_git_object: 15eaac658d6f3b56c0afe8c2b4d8ba6433fe4900 + docs/models/previewattachnextcycle.md: + id: 3cc2f99c2ce3 + last_write_checksum: sha1:e1a3525d4f2ab7ea2978f0c5d96530c3a736377c + pristine_git_object: 4e08b05107b8054ee8f00d0b2d35355a48ff47dd + docs/models/previewattachondecrease.md: + id: c3d14ec84b6b + last_write_checksum: sha1:9b530aca7b1f6dd45da0531d6e65f6e95d36cdbe + pristine_git_object: e092b88fd5bf210acd613f92a6f0b14967a5596d + docs/models/previewattachonincrease.md: + id: 62e686313af6 + last_write_checksum: sha1:8640813c8a0aad7698ebd5099453d09aeede940c + pristine_git_object: eb0441c2db8ec4377d201ef9a09ce9cb1d4e45bb + docs/models/previewattachparams.md: + id: 3ba40d589e3d + last_write_checksum: sha1:28bea601bb1fffcd4b1fae63b31e72527e24f100 + pristine_git_object: 26735f11815675b6a6f8252e0ba1ffdd48bac7dc + docs/models/previewattachplanschedule.md: + id: 487cbb8bd9dc + last_write_checksum: sha1:d3b1ed2650f3c52cc1d9cd2e8b27b9d578e37904 + pristine_git_object: 7551150c582828b16198182257edd1605998c2b7 + docs/models/previewattachprice.md: + id: caa899534556 + last_write_checksum: sha1:72978279e5c185eef349fde7c7d17e38d3be0d48 + pristine_git_object: ccc415e76147573bc6d1109e6e7eafaf03c07b8e + docs/models/previewattachpriceinterval.md: + id: 922bda88e1d8 + last_write_checksum: sha1:1c10b919cc8232243d4c7b3ada3e31c8b3ae7dc3 + pristine_git_object: 9d9ee86de6685602a71bcf5ff62bbdd8e7a17961 + docs/models/previewattachproration.md: + id: 2d9f5cd09535 + last_write_checksum: sha1:1541a867d86e6862f4c14ded80b27804bfe0b571 + pristine_git_object: f7f7fb38bdba497658f9b9948b29ff3025bee260 + docs/models/previewattachreset.md: + id: 8a677b69d681 + last_write_checksum: sha1:92be47fbd32e9b9b099b82d5cf9dda04e483c020 + pristine_git_object: 2d89267d69b6333f2a858144fee9f236680102f7 + docs/models/previewattachresetinterval.md: + id: 62df338dbcd1 + last_write_checksum: sha1:6c8ee26b2e4dab12fe1946d30be5fae9d4d811d1 + pristine_git_object: 85e80bbd0e724b8c56351d5e8be8965e5e2b8066 + docs/models/previewattachresponse.md: + id: a678e8dbf94c + last_write_checksum: sha1:54a4284030d1a1049310d4f7572cc7466789097c + pristine_git_object: 4d5b7e88b2b41c7041dac45742625363b3ba2ac3 + docs/models/previewattachrollover.md: + id: 8ef3a1be0fed + last_write_checksum: sha1:638d479c86d684eb6a1f54a945b20e795b43a86b + pristine_git_object: 35b9addf8d56f461d1fd3e8872f88e8ee194a1c1 + docs/models/previewattachtier.md: + id: 00f2ee21bab6 + last_write_checksum: sha1:7e0040a68f65874b1590c0d2a7970904962cf86a + pristine_git_object: 014eb11094176ff7a0cba5a008601bcf71241c82 + docs/models/previewattachto.md: + id: 6eea2cad63db + last_write_checksum: sha1:f942419300ba675c7fe00f0675f5af3dab8e0eba + pristine_git_object: 90c95d6ef72958ecea08dce511385caca0711e01 + docs/models/previewupdatebillingbehavior.md: + id: 4c825497a1a0 + last_write_checksum: sha1:1ea205c3b54899d5fc15e7e28a7290f946c7b451 + pristine_git_object: 622030b6784036aedbcc08c688621e5abcedb33a + docs/models/previewupdatebillingmethod.md: + id: 1d817ab2aabc + last_write_checksum: sha1:a0391bbb82f4b2a5a0c91e4c7b88e8b82f1c880a + pristine_git_object: 07e5a9ad4b8847b5ece98d1a3826f1b1053bedc3 + docs/models/previewupdatecancelaction.md: + id: 1159f8f85008 + last_write_checksum: sha1:ad6cfa08615dffa789adb8e42f63ca30ea353582 + pristine_git_object: e5347d9975f47094bea63fad5e615812c2d8373e + docs/models/previewupdatecustomize.md: + id: f4f7d5f4d0a3 + last_write_checksum: sha1:801238e1a02ab3ac1a5a4520c9dcfcd5e6faf050 + pristine_git_object: dd1c31dcf03b50114ebd85c3a91c79f5fb3c7318 + docs/models/previewupdatediscount.md: + id: 0236831b0434 + last_write_checksum: sha1:8c40f0e097d26a5714b3b2da0f54932c5097d39a + pristine_git_object: b1b08d33b6d81b31a1dc6dbd5c237b62a7a00378 + docs/models/previewupdatedurationtype.md: + id: "791319033460" + last_write_checksum: sha1:a82bb2b832db4b07225e95cfd6d9dfe357813f6b + pristine_git_object: 260c788c7d32441e933229dced472b96e30eea09 + docs/models/previewupdateexpirydurationtype.md: + id: 6d5273579d32 + last_write_checksum: sha1:29f071ab93ba52a315e56fa0259223080321d188 + pristine_git_object: f48ebd5a75a921d97ae8176b070a4a4a08c4b3c4 + docs/models/previewupdatefeaturequantity.md: + id: 1a7b1eb62760 + last_write_checksum: sha1:993c835c3b52471406b06a537de9e4076fe3b28d + pristine_git_object: dbc2e272365a240b9a140615712c5f19aaa45fdc + docs/models/previewupdatefreetrial.md: + id: 19ddddb2bff7 + last_write_checksum: sha1:2294896c016b7003fb3cc8302d0afaaf29c887cb + pristine_git_object: 195d54bc5a4f58e9e028e77da8483d8272151bef + docs/models/previewupdateglobals.md: + id: a81a391378fa + last_write_checksum: sha1:f9b2ec90174de287754c0a935b4d90ec26e680b9 + pristine_git_object: a2643aff71680053edeb399aecdfd771e4ca4e07 + docs/models/previewupdateinvoicemode.md: + id: 171401d06f36 + last_write_checksum: sha1:b83b7ac6d353171470a200d0bbdc349eef937f72 + pristine_git_object: 7210d48c7d789b0e78753c7280072daccf611894 + docs/models/previewupdateitem.md: + id: bf05ff6a756e + last_write_checksum: sha1:1117e78ac52b0172e7c02cfb16f850d49e684bf3 + pristine_git_object: 1afdeceab788e4b9c3c64b50de99a97979d38fba + docs/models/previewupdateitemprice.md: + id: f033f2f9e545 + last_write_checksum: sha1:860aa0bbe3da1474286b0e0a48f07e5f450574f3 + pristine_git_object: f699b1b9cedd3ef83a62f0c02d4bd5f84e990bd7 + docs/models/previewupdateitempriceinterval.md: + id: 5317a2333cd5 + last_write_checksum: sha1:5e48e6a011f37bbfb72d1144020168fac923b7b9 + pristine_git_object: de9ace7df7b3578a41bcaaf34751543d3de77878 + docs/models/previewupdatelineitem.md: + id: 74e43e80addb + last_write_checksum: sha1:264d2395850ca74deaec3a20f3be08fe5f0a9343 + pristine_git_object: b281ea60c9d1bf8b8c5f6e0c90aac2fb667b6d92 + docs/models/previewupdatenextcycle.md: + id: df4d92d3f9ed + last_write_checksum: sha1:457071313ba76c06543d8142a89373143ef7ef32 + pristine_git_object: 5a571a97da6b7e13d6f9186ebaf35c99800239a9 + docs/models/previewupdateondecrease.md: + id: a9a3f1b4aa0b + last_write_checksum: sha1:a33575feeac05a2862a0501a43b1d0f89a1edc18 + pristine_git_object: 418b15cfe444ad6dd04cb07a510472afaea12207 + docs/models/previewupdateonincrease.md: + id: 391e207385c1 + last_write_checksum: sha1:fecb7d926d11dbb12b78f1ad9dd279748a338ada + pristine_git_object: e3e53e3b79050287f10c22d8570763e5604fdfc7 + docs/models/previewupdateparams.md: + id: cf952c2251de + last_write_checksum: sha1:bb62c866742031b9be3013e4e2d82effccaa8660 + pristine_git_object: 46a76e5aca764349abfeec343ca664f81e363da4 + docs/models/previewupdateprice.md: + id: 4f88cb79503d + last_write_checksum: sha1:1125a1f2206b2323601d8546e2d215b38ee4795b + pristine_git_object: a0c8b350a937439c4ab0bc614056f0ce832f840e + docs/models/previewupdatepriceinterval.md: + id: 300f908b2503 + last_write_checksum: sha1:0b78b7476af3057e4372b9080222b5e9d9b7f7c6 + pristine_git_object: 04ed4b0060ad5ff8b566ad20e121903c1e8e13bf + docs/models/previewupdateproration.md: + id: c3e1d3131ff9 + last_write_checksum: sha1:52260fe6aabfad18775567968330e2e6d9f10bdc + pristine_git_object: 36d19f6f8ae0c7961a90771c9a980e9decf85bde + docs/models/previewupdatereset.md: + id: 0575a09e5ac1 + last_write_checksum: sha1:ea66a4501813dab3a967f496f1956587ee7e042a + pristine_git_object: c77a0bf238d325dd862cfcade5d00c2478e9fd7f + docs/models/previewupdateresetinterval.md: + id: f23e968cc58e + last_write_checksum: sha1:9c6e22cdee88ec6dbfbe03fd019757636304bf3d + pristine_git_object: 3aaf15ff0898038541e34bab384d2e008cefe7b5 + docs/models/previewupdateresponse.md: + id: 4a657c603c51 + last_write_checksum: sha1:235329168519ddb257139112a0d0a0017344c1ac + pristine_git_object: 595be6d286ae96fed0d207295c60417719c14181 + docs/models/previewupdaterollover.md: + id: 269e4cea4344 + last_write_checksum: sha1:ff73c4c2bac34be7019549a3b6fdbf035dbd9abc + pristine_git_object: 2972f7cd1611c1539def1be074adf02d7b209318 + docs/models/previewupdatetier.md: + id: bf6c0c1ebd66 + last_write_checksum: sha1:60c8e93724c44400c7624b387c71f4e9e7eaf902 + pristine_git_object: 07811547b3ae812f20e84aa4f6973d36ea3d9f37 + docs/models/previewupdateto.md: + id: c8706fb2f15e + last_write_checksum: sha1:ee0c86ede67f157bc7d60c0dbe8c11567ee98418 + pristine_git_object: 95413264a179ecbac833d963498c1feeb4fb2d10 docs/models/pricedisplay.md: id: 3434a0ab11db last_write_checksum: sha1:589317957949aa94497a1aa6a3e3a557f6337973 pristine_git_object: 5af13ee5d38a23052ae3599b12021bccdedc9ef8 docs/models/product.md: id: c91436bbe13a - last_write_checksum: sha1:4a3b3f902ae882dd4ebb140a668610feb7d2acfe - pristine_git_object: 002e889664307ebf71f0451b47d1a4855c226e47 + last_write_checksum: sha1:278c24e7ce644e049412cff1e26cf98fd22b99b6 + pristine_git_object: 61d1809597c48e056e88cb6efc884085d09697c6 docs/models/productdisplay.md: id: b771ae8c7ea7 last_write_checksum: sha1:1c08ac7aff28d817c0a0f62a581c3d2de0d5f63e @@ -1303,22 +1259,30 @@ trackedFiles: id: 2c019befb41d last_write_checksum: sha1:3dfda58f5087dfee73766c1a24dbf64bcd18a6e7 pristine_git_object: ad0e92bda3041d17df41475adeca765b6cba81f2 - docs/models/properties.md: - id: 78b1b1d1b631 - last_write_checksum: sha1:05f671c654e750d3433fd757475bb830b2dcf0e8 - pristine_git_object: e0cb2a68e82dc623b85a3c61b3cc6e00d219512e docs/models/proration.md: id: ac1d089c0fd1 last_write_checksum: sha1:8e99d5a7e22633074b779591132d0894a750486f pristine_git_object: aebfc4cbff8307ee1e606db1b538d58f3312c6ba docs/models/purchase.md: id: f872769b6939 - last_write_checksum: sha1:af1a5ca0f4ec065db553dc337d2d02bc88ff9527 - pristine_git_object: f01a0bf062f43d599f7c0c96611a11391b0f2898 - docs/models/redirecttype.md: - id: e79370e2e6e7 - last_write_checksum: sha1:b34f195b85a1cb7959a10e291d5c7762f38e4f96 - pristine_git_object: 9dd413cda93d010329a494122d4d7fa4eb87c881 + last_write_checksum: sha1:b250603c69b08d953b6f2dde179eec8606d27ef9 + pristine_git_object: 133bec63c1dce6f39d3954909e188dae71f3e2af + docs/models/range.md: + id: 0cae0c76762e + last_write_checksum: sha1:617c58ce88db53abb0e38d60cf2027034fca69dc + pristine_git_object: 88e64b85535ba90767889f32db386fadd2d0b94b + docs/models/redeemreferralcodeglobals.md: + id: 5640df85921d + last_write_checksum: sha1:44f830b7a0730a261b0403ebb6a949d9ef7f1918 + pristine_git_object: b02075fdaf215564758ec75651976c2bbf1a960f + docs/models/redeemreferralcodeparams.md: + id: 0478de7307b4 + last_write_checksum: sha1:6caa20f29d46daf02814bce290d078a77babda49 + pristine_git_object: 0c211d6b39c239b6893d88189c17501f25a2f65f + docs/models/redeemreferralcoderesponse.md: + id: 50431d3adf83 + last_write_checksum: sha1:3043cfd1115e727d195512b3e8cfd899b9e0483c + pristine_git_object: 86a305301634b94d48578a51e9a840d322389f52 docs/models/referral.md: id: b58def2d8bbe last_write_checksum: sha1:530cc33b44fb8bca73dd423110f205a48e0e565e @@ -1349,12 +1313,12 @@ trackedFiles: pristine_git_object: a5c3adda6c609878c33600537edbd46c90aa1711 docs/models/status.md: id: 959cd204aadf - last_write_checksum: sha1:6b9d5a57cb48cdf0a343ce4ae8f3acf470ab508d - pristine_git_object: ea0eb8293ad6f96373b3e3934811a73c4837b628 + last_write_checksum: sha1:a475fcd3bc7f144921949a0d9bbb85529d986841 + pristine_git_object: cdb313f7b0aa0e01cbdcb28ed8d48e480fa9ddc6 docs/models/subscription.md: id: 4a200793e0f4 - last_write_checksum: sha1:985d78373197de378488e772fbcf7a62bdda47ae - pristine_git_object: e7c4060bc95b77c9df7f9f5f9bce7d0f4a3364c9 + last_write_checksum: sha1:5b40d418ff34e3778e4c6f749ddfbdfd7a44d4e0 + pristine_git_object: d8c7fa664de030875a2cf4bbf6997b55cdcd8f3d docs/models/subscriptionstatus.md: id: 5f08d32c769a last_write_checksum: sha1:3cfa48d8a7dff1b56bd411ce40c4286ca788de54 @@ -1367,22 +1331,166 @@ trackedFiles: id: ea99367b87b9 last_write_checksum: sha1:b340e3dcc15537d7f0f90230b3ea16df31e44633 pristine_git_object: 3ffa33e080e1a969e61f6bbda8a2b2a6655bfadf + docs/models/total.md: + id: f4060c3b4657 + last_write_checksum: sha1:08c2c14481fcae1bcc1c550d6e2c95f14bb1efb0 + pristine_git_object: 0ffbc190bacd9782b91444a81113d9249497800e + docs/models/trackbalance.md: + id: 9021ace68a9e + last_write_checksum: sha1:c83b0a068a9dfb588b55709af2538f0cc1f49f95 + pristine_git_object: 3aae6b7ae8e5a67898b22633d66385462a91da01 + docs/models/trackbalancebillingmethod.md: + id: 75c6448a9296 + last_write_checksum: sha1:d6990d4a2b0e2945b551a3fa5a677ecb1a8fdfd5 + pristine_git_object: 0d9c0dadd18fc8baa2ab595c7df6b91a0c26d8fd + docs/models/trackbalancebreakdown.md: + id: 828dd6352cb9 + last_write_checksum: sha1:9352f588256d2b2b9236df983bc2b5846c6cc4d3 + pristine_git_object: 7caf9da1c3b9af877765de60643fdd79f2446e47 + docs/models/trackbalancecreditschema.md: + id: 37ae3b047402 + last_write_checksum: sha1:2e91a94cc86e07c5c93e46e69f463158bc4b658c + pristine_git_object: 49ebdd26792d1c4ac808eada6e8156522569c99a + docs/models/trackbalancedisplay.md: + id: 30ad59847910 + last_write_checksum: sha1:20942f196e65b10f83608b3b4e1ae9b7c76dede1 + pristine_git_object: 8031124dd5ea973a30c14a0a886ecd674da07fcb + docs/models/trackbalancefeature.md: + id: 34bc595b21ec + last_write_checksum: sha1:511f75f41d795590021316e78bf145cc62c5294c + pristine_git_object: 05ca029a542e5d4765b8488c2056b4e7e8fb436e + docs/models/trackbalanceintervalenum.md: + id: cd0900b2c9dd + last_write_checksum: sha1:d961c59d79f4a1643435988c496b619dd5218312 + pristine_git_object: f094b09626435c4dc8aa431477143b46a1078a3f + docs/models/trackbalanceintervalunion.md: + id: 59e2b416cb6c + last_write_checksum: sha1:4f50239cc62ed647a3848bc8c8e4bea13c2497ec + pristine_git_object: 287b9be877b042bd735d1033393d46ff12658e7d + docs/models/trackbalanceprice.md: + id: b42c996687b4 + last_write_checksum: sha1:4fd44ea7a90122ef9d42332d046f44cd2e0fb20a + pristine_git_object: ed98307a0b26a542ed239ad93d97c050ba2fcf2c + docs/models/trackbalancereset.md: + id: 15db73a7d2f1 + last_write_checksum: sha1:edc3dfd85fe13a40c15504b64aadab558d82801b + pristine_git_object: 34b4f9baca206af9ef6aa11179458d2248cc2045 + docs/models/trackbalancerollover.md: + id: 27ad37d384dd + last_write_checksum: sha1:91efb0f34d0d50769f907ee903516fc96b86e2d4 + pristine_git_object: 16eca6cd2bddfd4aa2b5718a57c4757319abf02a + docs/models/trackbalances.md: + id: 969bb658e4e0 + last_write_checksum: sha1:86a4a444866a6f4fe0e56f8120c4974af3771557 + pristine_git_object: 5e2ec49e43441c4fe450759db5cb10bec373d20f + docs/models/trackbalancesbillingmethod.md: + id: 0cd04ca8021b + last_write_checksum: sha1:905783a5778846e7c17da544308608539a3b12cf + pristine_git_object: b76e5994bffe101980e24ea996c23107b5c4d224 + docs/models/trackbalancesbreakdown.md: + id: 8df37070319e + last_write_checksum: sha1:5acfaeb8a2479712b8fff1e0e81eb98642b1d280 + pristine_git_object: 76ad1869e886252434643339f4866234c37faddd + docs/models/trackbalancescreditschema.md: + id: 67c93dae4469 + last_write_checksum: sha1:f0453be421c6b4a8133218def3dcf053fc33d985 + pristine_git_object: 2b13798366293478e3f196b5e72f72858e71387e + docs/models/trackbalancesdisplay.md: + id: 45c21bdb7cad + last_write_checksum: sha1:ee1541f212223e3e56cd63b811d162913924e283 + pristine_git_object: 97e421e0cbbf5a0e9d9552b1b496ab46bacc003a + docs/models/trackbalancesfeature.md: + id: 36805913dca2 + last_write_checksum: sha1:c0d525e0f6143ef6b586555c2506dedc8f51e83f + pristine_git_object: dc74285dace938aa756f1d2567cc72c494a1d02f + docs/models/trackbalancesintervalunion.md: + id: 2ddb22f10abf + last_write_checksum: sha1:fab6eaa9d748777915b70e53afcce43bc09d931c + pristine_git_object: 19550d35289031a26f6929b59fa4d1d61592aa47 + docs/models/trackbalancesprice.md: + id: 2f54108e5264 + last_write_checksum: sha1:b20a6b122bc6c3da524e62369a7902cac7a2d407 + pristine_git_object: f613cc1fe9088c0dfb927be30feeab0c4587d1cb + docs/models/trackbalancesreset.md: + id: e3e4f08e2678 + last_write_checksum: sha1:8a07b1c3bf3c6c6968c598a7f174aaeb2136f71c + pristine_git_object: e95975ce176b3e25cee5bc21cb2856a5e7feaf37 + docs/models/trackbalancesrollover.md: + id: d32725bca5e4 + last_write_checksum: sha1:bd0e2050a305ae9d4cb542b2b3e47bcd1d5871a7 + pristine_git_object: a24bd1a9e684c6fcc3c7e611e901e738d3430fdf + docs/models/trackbalancestier.md: + id: f9bd68e70a07 + last_write_checksum: sha1:45eba7dadfa593f409202eb9fc8a39a1515217bc + pristine_git_object: 46979e6047e136aee3654dd46060b70b9eef20b2 + docs/models/trackbalancesto.md: + id: 6870e5dd1e31 + last_write_checksum: sha1:1a0450293dd040635c0a22351b47e675bb66eb14 + pristine_git_object: afcec8cee0828ce70ef01eeb4a16e2aa9597a44a + docs/models/trackbalancestype.md: + id: 3a88c76991f4 + last_write_checksum: sha1:b66bc24609281a634a2925ad59dd8674be0b1358 + pristine_git_object: ba67240af6b1b15580ccd57fdc37ac63a9324bb7 + docs/models/trackbalancetier.md: + id: e46fa09f256f + last_write_checksum: sha1:102d8f2bfa9ad7de240e78be7d0a06df24608f4a + pristine_git_object: 7441749ae5b30c29fe16b859b12ae14257b8d61a + docs/models/trackbalanceto.md: + id: c2b29ea6d43c + last_write_checksum: sha1:2bcd7730d39bcf5ad44d8eef9d4340e7ed49539a + pristine_git_object: 1936d602533b3d4fba237194472ae1e7b6d24747 + docs/models/trackbalancetype.md: + id: 6c2932a9edc9 + last_write_checksum: sha1:d362825dc16e21435e4172ccdb9724ea7801752f + pristine_git_object: d2295851409ca0d37bd73d589956fedea9aa3838 + docs/models/trackglobals.md: + id: b4e733cd9cda + last_write_checksum: sha1:70b3a0fc0755ff36e6d8e961d8ae4799535039d5 + pristine_git_object: 42d7bc2cf84f25facd8045ee8030db34a5140cbc + docs/models/trackintervalbalancesenum.md: + id: 0648139e00e5 + last_write_checksum: sha1:923542faeee29f2b01fbd8f3f90b726027ee879f + pristine_git_object: c67945668d9e0b5b9af8a24641318b948aae4f25 + docs/models/trackparams.md: + id: 516394b4d7e6 + last_write_checksum: sha1:9d27cf849db16ebac4834f29e6e5423d38da8f75 + pristine_git_object: 2ab698ddd29ad8e254eb9eb66cb487fc0934e402 + docs/models/trackresponse.md: + id: 0b465752b71b + last_write_checksum: sha1:d49ec0fd164bd83958db8bd42fd96a4cd7a47928 + pristine_git_object: 657524211623129a8dea588802cae2bc9cb545e2 docs/models/trialsused.md: id: d3a87e402a87 last_write_checksum: sha1:e94b335fde33fa867d83a085af54e56e003b468d pristine_git_object: 8eba6942218e21e379f0886cbcba182ceffed7b1 + docs/models/updatebalanceglobals.md: + id: 2b708959520d + last_write_checksum: sha1:8e2684c83a78b0c4f80d417d57f588b6e56afca4 + pristine_git_object: 7f44dc945c43a94cd7430babc830c88411354c6f + docs/models/updatebalanceinterval.md: + id: 1d9c4657f238 + last_write_checksum: sha1:147408360253aa9509de87d41c391d60c8862ed4 + pristine_git_object: b4afc96b118bffa16de417ced419af3984696a68 + docs/models/updatebalanceparams.md: + id: 8bb20f144794 + last_write_checksum: sha1:235b42a1b577099ff5f3c483bed29f6693082176 + pristine_git_object: 9bc0da110f4ca28ed6fcea4455975f65fc9a0f9b + docs/models/updatebalanceresponse.md: + id: 5ed7899bff80 + last_write_checksum: sha1:05b5eb2ab6aab3e89139f8faf25fd28c8e8d0554 + pristine_git_object: e2df03126ca9aa71027bcd8f9e8def06b4a6e612 docs/models/updatecustomerbalances.md: id: 7f44136e5175 - last_write_checksum: sha1:696b17d9bcd4d1d65d8f41f2561ec021cfb8a4bf - pristine_git_object: 273486f9eb4b226358403ffb268329d5fbc4e490 + last_write_checksum: sha1:dad1af9c628395759f33eb8b5b45b17ec45ec14e + pristine_git_object: 109ef75bcc972ae249e668360514c6bce7805999 docs/models/updatecustomerbillingmethod.md: id: b251b4090471 - last_write_checksum: sha1:70e36e639090894ce5504b8c055b2962eaae9cef - pristine_git_object: 175ceae8f0d83ab07d5bae5ac485566024ad8dc9 + last_write_checksum: sha1:89dea40c229bf8328914ae20a8ad18c93aaaa959 + pristine_git_object: f28881233ae947dcbba10151fc24db5be0d6cc87 docs/models/updatecustomerbreakdown.md: id: 2f3a2d8f745a - last_write_checksum: sha1:c2627d2fcfe7de7de50035c345212162658c9331 - pristine_git_object: 0a5f6661217832605789fa1f1011f3eab80a1631 + last_write_checksum: sha1:d588966b1b322472697223e7ba77c7c24585649d + pristine_git_object: fd5ecf56efa816adc60353c4f100d6959e81f3d4 docs/models/updatecustomercreditschema.md: id: 9ed2810c66f9 last_write_checksum: sha1:874cea697b072edd41ebe61d3435422261c5025c @@ -1397,8 +1505,8 @@ trackedFiles: pristine_git_object: 93eb528d888c1d94f2f243e20d732466bff2d175 docs/models/updatecustomerfeature.md: id: fea7c9019bce - last_write_checksum: sha1:0dc46a132b2f50b90de3dd54f71136982ca82c3f - pristine_git_object: 773fbeb9e5aaf9c663855b7231d074f2dc45a0cd + last_write_checksum: sha1:c5ef2baa6b39c67b5dd7129f2d2630877157b20e + pristine_git_object: 38a41c5480d66085184d2bc27030dbf07227f298 docs/models/updatecustomerglobals.md: id: f8ba9d61dfdf last_write_checksum: sha1:188bd01790d033d4f2d2613242e1261d79e064db @@ -1409,40 +1517,40 @@ trackedFiles: pristine_git_object: 691fcd18ccc76ad1f43e5f8fd4c2ec9dae0a862b docs/models/updatecustomerintervalunion.md: id: 3fe83fda021e - last_write_checksum: sha1:d269abd012fb2b6a036b9521ddfe7b5910e80b68 - pristine_git_object: c47a47e06bc6f99871ea264c6882610c66c23a5a + last_write_checksum: sha1:13d8bbaa61ff403c47c3ec35d2f040ea48d19740 + pristine_git_object: d2e8f08d8219e8700f357a916f0788099a23a1c9 docs/models/updatecustomerparams.md: id: 4015e931c04e last_write_checksum: sha1:3af6fa7dd0bbd7ba38bc5d74f938f812c5ce1301 pristine_git_object: 9f4d5f96ff6ca1038a911b0b0e7574b1cf418b2c docs/models/updatecustomerprice.md: id: 513c804d07a1 - last_write_checksum: sha1:96a9383f2f0bd922065dc4bc9526724b9c860b5a - pristine_git_object: 073a0ccc1dda80a6e0fbb2f2bef0bf85efa2294a + last_write_checksum: sha1:a006eb61d1be4386536a403c965787e2263b62b2 + pristine_git_object: 106c34e090b196ffc664c99a92d710416384c782 docs/models/updatecustomerpurchase.md: id: 392cb675471e - last_write_checksum: sha1:fd7e3007aa279068b3930d25018f6b520208feb5 - pristine_git_object: 0e7ac3b22c74ee248b8d62ae6341b10a435bf8bc + last_write_checksum: sha1:00c1dc351b93935b60328fd25590f3e2e788aecb + pristine_git_object: 6870656edf32967bf223d43aec5397c272e9cb41 docs/models/updatecustomerreset.md: id: 595cf5edf31c - last_write_checksum: sha1:2438fff669e242b1509f0e3098be4c6f686b5ee4 - pristine_git_object: ff27d3a15e5f9c11427d9c5e5c477b7ab9464f39 + last_write_checksum: sha1:39cbb1c1c9fcabf69ada5109540fa628d2b3110c + pristine_git_object: 0084e341aa58bbb7d58f4dbfb0e4c85b20da7713 docs/models/updatecustomerresponse.md: id: b8e414267f76 - last_write_checksum: sha1:b67b8e3a982dee5b7c7228dd1131ce1616038909 - pristine_git_object: 655453dd0873183ba39647c3d4814fa128a57018 + last_write_checksum: sha1:58f77acf6042269cd6bfa0523f0d65226a944d54 + pristine_git_object: b0df4e916186b9360b9c9514ff660441c8e63066 docs/models/updatecustomerrollover.md: id: 7045f542beda - last_write_checksum: sha1:e083870d58c92ea86c7a13159d12ba8bed720b25 - pristine_git_object: af07f81be4a9e35d5908d47b7a72353094698a3f + last_write_checksum: sha1:879e3531fa05a239ba94e10c35c91b1b2b8a80a0 + pristine_git_object: 5e6872ef32006e54abef41f7d4082a481a7462c1 docs/models/updatecustomerstatus.md: id: 12e6ef4fbad5 - last_write_checksum: sha1:d227dc20a02ff503cb02e5182646bd2251b8b257 - pristine_git_object: 09097d659bb8d9800dc7c24702909638d49930ea + last_write_checksum: sha1:f2aa61050f39ca17d657955339d3f6b81c9b1bc7 + pristine_git_object: 991481f1ae5a7c363ae39cd5f46672548fdde0c7 docs/models/updatecustomersubscription.md: id: 23620d1508c4 - last_write_checksum: sha1:aa7783238dd7ad6a442d28a9fc1fc221110d460b - pristine_git_object: a09e306f9d4ac8a9902a8dec21d2f2b09be8dc9a + last_write_checksum: sha1:8b711766303e62168245f6441dc9b720ca400aa3 + pristine_git_object: 4161afdc33ec71e47263ac0303097d794354fd41 docs/models/updatecustomertier.md: id: cc94a2a8f513 last_write_checksum: sha1:cabb8309cb750260b5d55c59296b603e05662260 @@ -1455,6 +1563,10 @@ trackedFiles: id: ade4d76bc6b0 last_write_checksum: sha1:e3f073958b22e5da59bd2e5bca8c6c0244ea4cdd pristine_git_object: 67da276b5945364b84454143074dffd3fc5a067c + docs/models/updatesubscriptionparams.md: + id: df1b06618f8b + last_write_checksum: sha1:0928a7b478ac515995525f205b559fcd67c4b94e + pristine_git_object: 0c2a3d3020e8661b85e771375e10925372653186 docs/models/usagemodel.md: id: 1e12a2a8fc52 last_write_checksum: sha1:6e6803b39c0b8d88be49568c7a1bbcf8b4dba4c1 @@ -1463,34 +1575,50 @@ trackedFiles: id: 4343ac43161c last_write_checksum: sha1:562c0f21e308ad10c27f85f75704c15592c6929d pristine_git_object: 69dd549ec7f5f885101d08dd502e25748183aebf + docs/sdks/autumn/README.md: + id: d27c9292a1a3 + last_write_checksum: sha1:e1d3c9b4a3b03ebd42af4c0f815adf4ab4a7693b + pristine_git_object: e71ec2951397e3d106e2edc7ee83fecab2a6765e docs/sdks/balancessdk/README.md: id: 2484f934be2e - last_write_checksum: sha1:a8dd55b3787ac362deacf763b0a211900a767e93 - pristine_git_object: 7afb196a0fe5d64bbc8f5754febdc70e891f9783 + last_write_checksum: sha1:dfc6742bdd0201a76112b44597ccc249f7007989 + pristine_git_object: 53904f7fb7ed66ccf094b209ab1007b29a3e9960 docs/sdks/billing/README.md: id: dc915331dd9d - last_write_checksum: sha1:e3669a666eb87cb510f80973d756454cb5124433 - pristine_git_object: a611692843021852aef4456cd2781bf13ca2320b + last_write_checksum: sha1:1cde36ee81d42c2a80bd6f15831d74a0fb4405db + pristine_git_object: 0ee824016ad54411965b2205e96873ea2a464b5a docs/sdks/customers/README.md: id: 9332759cffc2 last_write_checksum: sha1:13ccde8e19cf24ebf4afdac645940c09a642d652 pristine_git_object: 5a0ecd06512612fccb199f8b444e6e020d757724 + docs/sdks/entities/README.md: + id: a140ac5181b9 + last_write_checksum: sha1:ba7c2fc1506d5d4deedf55c8e5c2f0441ebe8388 + pristine_git_object: cfb79812b50bc10d393d76f33445202aaddb3db5 + docs/sdks/events/README.md: + id: cf45a4390b9b + last_write_checksum: sha1:899ccf79b6c93e43763a56e6e3d60e1d2ca4a43d + pristine_git_object: e450e815a3d52cad75cd940ab6870d64ecff4fb7 docs/sdks/plans/README.md: id: 2d8c741fff57 last_write_checksum: sha1:6fc3e8fbf866ad15f3c3ea27a43c05321ce0c336 pristine_git_object: 298f2d957925a4892ebb388df3ae2b0d5521648e + docs/sdks/referrals/README.md: + id: 50b71f597f20 + last_write_checksum: sha1:f85c411ffbff1df16003de60ae49061351081c68 + pristine_git_object: 1420a21b25150cda829a3182a72e1c10ffb527f5 py.typed: id: 258c3ed47ae4 last_write_checksum: sha1:8efc425ffe830805ffcc0f3055871bdcdc542c60 pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pylintrc: id: 7ce8b9f946e6 - last_write_checksum: sha1:5f1685061a0bb3b651795382827dea4d988f8522 - pristine_git_object: f13c2fb5532a06cfe87f594097bfbf72e8fc04a1 + last_write_checksum: sha1:df60ab94013c483f71ff98c51f349a016c15a117 + pristine_git_object: 5650f49e06066f8a1338afdbc0e155f5277152df pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:014fd5de1df29b5f35e76f1c635c021ad9a7a03b - pristine_git_object: 724b12dd08709c8cddac0a78d200b08ec654fc01 + last_write_checksum: sha1:170b6d192103b924b9d7d50b7cd7cb3dc9106329 + pristine_git_object: 7a93ba2a4e63aee712a1a32bc27d94733952b4c8 scripts/publish.sh: id: fe273b08f514 last_write_checksum: sha1:adc9b741c12ad1591ab4870eabe20f0d0a86cd1a @@ -1513,24 +1641,28 @@ trackedFiles: pristine_git_object: 3e604651c1eae73d815b276806e73b2f1334bb79 src/autumn_sdk/_version.py: id: a98babfdf4fc - last_write_checksum: sha1:587361ce6cbd0c8f082cc3835fe408873429de3b - pristine_git_object: 657096928db179a673873a7c2970bc56d0134bd9 + last_write_checksum: sha1:53a81bcd468a1cb6d83a27d8f628d8f602939304 + pristine_git_object: 7bdbc74365b68f76fb8376584dcadc8992529590 src/autumn_sdk/balances_sdk.py: id: a24aee6f517f - last_write_checksum: sha1:92e60f2fca39931ac13bd2e9b76048c307a8393a - pristine_git_object: 10dad75191da7d12379beb6db1bce3a49a21361d + last_write_checksum: sha1:95503fdf068bf1b5c9503cb50ac50d2137c8bf57 + pristine_git_object: a077a5f1c49121cec5ec6d3edb461ad4d0e91a99 src/autumn_sdk/basesdk.py: id: 8c9c35fe744d last_write_checksum: sha1:5d6abacbd251bd806538b19ab9662994bbfc6e24 pristine_git_object: b8da96bd89ddafaedb32f4ecac64c27027fcca79 src/autumn_sdk/billing.py: id: e6cffdbf2221 - last_write_checksum: sha1:38548fcf0aa8327a013b62eb7af52f92e3ebe3f0 - pristine_git_object: 1c2d8ce6f2bf9fe297f8247803a63e442ac07cc8 + last_write_checksum: sha1:c9f2a0db3c1f6a53da5b5e7162d44f4db1c74b50 + pristine_git_object: bb52c0bb506b7296224d56e0f0dedbd48582b636 src/autumn_sdk/customers.py: id: 5c5a0a07a433 last_write_checksum: sha1:d34a9c1215e7685f15ef88c049e707d9c47163e7 pristine_git_object: 657b53759d5a299f9ac250937931dab947404483 + src/autumn_sdk/entities.py: + id: 32ba2aa0874c + last_write_checksum: sha1:b2e85d0f3b55d41bde92b1d2512ed227ae06c5ca + pristine_git_object: b05b028408101c4ad78f7e1de00ac57e0a5f6861 src/autumn_sdk/errors/__init__.py: id: 242853123cf2 last_write_checksum: sha1:3185fbf12ed61a9845f94127cb110bce8f7f8f66 @@ -1551,54 +1683,50 @@ trackedFiles: id: 8343146a8667 last_write_checksum: sha1:77aa85827ae606d2dcbd9a91056038d696d4eae7 pristine_git_object: 1efa993593b78b8f93587adf8a12ce2efbb11002 + src/autumn_sdk/events.py: + id: 3421eef7bbd5 + last_write_checksum: sha1:c4600d52d246481d03d054f82a270e00a8956d4f + pristine_git_object: 7cda6a979244b198fe8d1b6b899fdec541f0882c src/autumn_sdk/httpclient.py: id: d09fa60cf82e last_write_checksum: sha1:5e55338d6ee9f01ab648cad4380201a8a3da7dd7 pristine_git_object: 89560b566073785535643e694c112bedbd3db13d src/autumn_sdk/models/__init__.py: id: bcf3802243ff - last_write_checksum: sha1:db5e90a5656586b67697c5372dc42301bae6791c - pristine_git_object: ef0446c2af1fb073acd7d9dbded6b04bfad1d0dd - src/autumn_sdk/models/balancescheckop.py: - id: 27ed9e0d5743 - last_write_checksum: sha1:4c29af4c515b7d7248cb2bac03299483be523d7f - pristine_git_object: 23ee9fc6c157d5ed56a335112a7da96dfcee325c - src/autumn_sdk/models/balancescreateop.py: - id: 8509fb57571f - last_write_checksum: sha1:406d57f4df7fb4eba2a7c8f906cf64ff0b31eb2c - pristine_git_object: cfec2c9f9d44dbefea6defe63e38060da77c8f3a - src/autumn_sdk/models/balancestrackop.py: - id: 625fc102f754 - last_write_checksum: sha1:e9cee0c262ea63eb9d18a01c233a0d028ef1af1f - pristine_git_object: 84737f2b49c04c2a5f8e353cc8b7985071c22ddb - src/autumn_sdk/models/balancesupdateop.py: - id: ee8c7b782105 - last_write_checksum: sha1:ae0bd050783e21c60d12ef799df2419f1377943f - pristine_git_object: 10c472b900d590fb9e9606b88470080d1603e0b8 + last_write_checksum: sha1:b20e76831088069882cad2722ff2f62f2d6584e2 + pristine_git_object: a42e1620a2acd09b981cbbbdd8de99c0d19e1e64 + src/autumn_sdk/models/aggregateeventsop.py: + id: 01321099f2a5 + last_write_checksum: sha1:2adb01a9d319cd46833411082c88c0a49910546d + pristine_git_object: 0cfe4b5890b74130e863be0f965edb838b324a7f src/autumn_sdk/models/billingattachop.py: id: a3c4907bef48 - last_write_checksum: sha1:4dbcb3d447f8a10d00939fe1f2d25a66e43b4f11 - pristine_git_object: aba5fb54b2bff0e09635ccc907cfa5dc2fe83020 - src/autumn_sdk/models/billingpreviewattachop.py: - id: 14515cbff2fc - last_write_checksum: sha1:af2411f945bbc8c50bbd80c697859b2ed8b7fb6a - pristine_git_object: f20d47336ce4656e50cceb847ae313cce23f6845 - src/autumn_sdk/models/billingpreviewupdateop.py: - id: 6a2eed94753c - last_write_checksum: sha1:1e15bd6e2ac1bdeb2b395e23ae67aade89acdb80 - pristine_git_object: bf3fa23cdd78a550f2659718bc3ae8bdd1b02236 - src/autumn_sdk/models/billingsetuppaymentop.py: - id: 7d8176dc1930 - last_write_checksum: sha1:8c2b325016fd7853cb927fec39103eda60be9dd3 - pristine_git_object: a9b4b8fb0c61cd28d65d6cc3d816498666374a76 + last_write_checksum: sha1:4df8e0be4793f1c9d5a1799271646e5333495630 + pristine_git_object: c1b7c3ceea3c59706dcc9d28b7ef8fe5d5d0f92b src/autumn_sdk/models/billingupdateop.py: id: a2f17c75cfd3 - last_write_checksum: sha1:ded13980e77ae9dfe7dbd80186e74636c98dbfd9 - pristine_git_object: 04c0e11b2d5eab19b1588fe69dcb6259fbd21d57 + last_write_checksum: sha1:843c71d8d48b0b820f27d24a462aaca25f5f79e6 + pristine_git_object: c96d4631e7b2fc37ec87b763234743c979f4e058 + src/autumn_sdk/models/checkop.py: + id: 31c2f84723c6 + last_write_checksum: sha1:566b61ad58543c52a60fa8d3f6fdf4c250cd5ac3 + pristine_git_object: 10f0044f5e6667905b51bbef9aed9d7c5ff2f84b + src/autumn_sdk/models/createbalanceop.py: + id: 27daf4da75bf + last_write_checksum: sha1:650afc71dff1f9e54fc407f6133955c5b5e49aca + pristine_git_object: e600cfde95b6d46e32340c11922453cf1aaeae47 + src/autumn_sdk/models/createentityop.py: + id: bf9521c0cfec + last_write_checksum: sha1:bda4efb6ff07fc402bc01191eaccd1605ce00a1a + pristine_git_object: 8823595c00cb36124528e6c0ef5702f7dde38beb + src/autumn_sdk/models/createreferralcodeop.py: + id: 2f5f7b136c39 + last_write_checksum: sha1:d0038bf28487af519cea4610bd34ba21cd8f99c1 + pristine_git_object: 7f399161d022cd4cc67cd840c136a298bbaa70e6 src/autumn_sdk/models/customer.py: id: 8ed0174f7272 - last_write_checksum: sha1:cd7f48270a61401129aae29732d82a9756ca577e - pristine_git_object: 91ead7f8055ef16c5ab02c2af75812a29c791747 + last_write_checksum: sha1:01188d9ff462e7f264643fd3af69cf5ab3c81292 + pristine_git_object: 4d42f73bfb9dfef9cb49849730363fec6a224542 src/autumn_sdk/models/customerdata.py: id: 9d88118f2123 last_write_checksum: sha1:d056db70a7859d2f55a16c961035578f0aa95c06 @@ -1611,6 +1739,14 @@ trackedFiles: id: dc7a1e2cc90b last_write_checksum: sha1:0eb2e63afaa85cc828468d6359883eeeecde9f31 pristine_git_object: 71f6b0b765026846da6f55ab567eb2f085991947 + src/autumn_sdk/models/deleteentityop.py: + id: f875e07e0401 + last_write_checksum: sha1:a2bb7bde1ccdd1f0e917121d5dacb072a41674a1 + pristine_git_object: 39acecf3f578c92c6957075be1d7f9f15712a092 + src/autumn_sdk/models/getentityop.py: + id: 6a624594b41f + last_write_checksum: sha1:3593bdeae2efc0ba0127189145c135a0146a64f1 + pristine_git_object: f6c0396508d16669282297f4d12722868feb147d src/autumn_sdk/models/getorcreatecustomerop.py: id: acfac0d7be14 last_write_checksum: sha1:033c7bd619e40b85d9f5823c78021bec66206c6e @@ -1625,24 +1761,52 @@ trackedFiles: pristine_git_object: e6ef4341edccbf10916d0f08d7f2717c65c5f8ee src/autumn_sdk/models/listcustomersop.py: id: d7074740b8b0 - last_write_checksum: sha1:c160f55fb72cad9b7aee32728dff44f9184ebd94 - pristine_git_object: 7be0ab37eb525c710505120585dc57199a164277 + last_write_checksum: sha1:9ef516f1bb8afb5438665cb5f42f2d4460901fe2 + pristine_git_object: 3f5f64f507ec48d8ffa6c614a8044e4ca65f3b8f + src/autumn_sdk/models/listeventsop.py: + id: 751b0200d91d + last_write_checksum: sha1:b77963f3745c7c94822033f2d41863eeefb5812f + pristine_git_object: 0cacf2f517d42d6df4ac06b97c753b6a694e9ac4 src/autumn_sdk/models/listplansop.py: id: fdf892c403f4 last_write_checksum: sha1:d478ba4edd01b7a9b6871eb072e8df7718263202 pristine_git_object: 1a0a5ec5f0cefac2fa8264613b9bf32bdfe21e88 + src/autumn_sdk/models/opencustomerportalop.py: + id: 004cc9a6466f + last_write_checksum: sha1:0252fea07d0b1fae1817d49a5c187490c49b47ac + pristine_git_object: b27e54cf4c5b3923a03e1d3338c548d5ce8a0f95 src/autumn_sdk/models/plan.py: id: f85c4e07540d last_write_checksum: sha1:22e2a922bb7932e1981bcda22043c0e750b12a96 pristine_git_object: 19eb173553ba62bf0262e8f7922f6ded23e6252a + src/autumn_sdk/models/previewattachop.py: + id: 2b361be4bfa8 + last_write_checksum: sha1:da36e77a7dc9dec683800420cc51dad4fc61f807 + pristine_git_object: 56792db8f47793b1d0c1a0e65de5be431ae1e381 + src/autumn_sdk/models/previewupdateop.py: + id: 081d5f08508d + last_write_checksum: sha1:a7146365befbb6fd12b412e70cffa0356a5e0e63 + pristine_git_object: a313a711b72ed15f33177596211fde79370575bd + src/autumn_sdk/models/redeemreferralcodeop.py: + id: 0abd7bfae718 + last_write_checksum: sha1:9096caecd5e39572e409302b99c6c89be0ae9add + pristine_git_object: be1f39aba48788107083a225562bf2e8fe49acfa src/autumn_sdk/models/security.py: id: 27d01b755fbe last_write_checksum: sha1:e5ac2e52ed9c2db46d4989c4744c230dd12bdf01 pristine_git_object: aa686dd6f85ae1e27450392fcfe02527adfe8e61 + src/autumn_sdk/models/trackop.py: + id: 2a744315e781 + last_write_checksum: sha1:dd262b547bfd2ef08e2d0a73edf3cca0ebbbcf9c + pristine_git_object: b5c5283160ae6731144911763c049f2f00f66737 + src/autumn_sdk/models/updatebalanceop.py: + id: cd80d90d4cae + last_write_checksum: sha1:92a2e3567d9e5051240e77ee550ac000c19955e9 + pristine_git_object: 7f7e115039d939900fd38ca00484f71c5a51e030 src/autumn_sdk/models/updatecustomerop.py: id: 28b9d5b59bae - last_write_checksum: sha1:022834e9c5108ba7d729b458f0ac20f8101e784e - pristine_git_object: b501c3f8b48871b8ff4206911abb63d720704656 + last_write_checksum: sha1:18cd5289331e17dbb64b28877eb946ffe8b26d3a + pristine_git_object: 26ab15e1c0a1252a2fd4a5ed63f2aaaba7f549c1 src/autumn_sdk/plans.py: id: cf1ebabb687c last_write_checksum: sha1:73164e47a6348eff5882dee9e65092e6687a18e8 @@ -1651,10 +1815,14 @@ trackedFiles: id: 9b75cee1c007 last_write_checksum: sha1:8efc425ffe830805ffcc0f3055871bdcdc542c60 pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 + src/autumn_sdk/referrals.py: + id: fb7e9ff59ffd + last_write_checksum: sha1:7f93c868f3c5f38fdf8f11439397ff530a3ef37f + pristine_git_object: 4fde94822b61d8a600b721fcbda99116c0e7a6ad src/autumn_sdk/sdk.py: id: 9e733b372628 - last_write_checksum: sha1:1f69da465bd542a3413b411dcfe6520287378aad - pristine_git_object: ad4354785e23ff1732e0e210ba72ba641a2d77ad + last_write_checksum: sha1:993cb0746bcbd98b6e471f8f62afacc97bf389f6 + pristine_git_object: 5434a6158a447b74b6b9e52da55a597a13eea8a3 src/autumn_sdk/sdkconfiguration.py: id: e65df2e44fc0 last_write_checksum: sha1:9cd4e2b7d75cbc01d6c7d1c9e676a48ea85c5c22 @@ -1760,10 +1928,10 @@ examples: header: x-api-version: "2.1" requestBody: - application/json: {"product_id": "", "redirect_mode": "always"} + application/json: {"customer_id": "cus_123", "plan_id": "pro_plan", "redirect_mode": "always"} responses: "200": - application/json: {"customer_id": "", "payment_url": null} + application/json: {"customer_id": "cus_123", "payment_url": null} getOrCreateCustomer: speakeasy-default-get-or-create-customer: parameters: @@ -1773,7 +1941,7 @@ examples: application/json: {"customer_id": "cus_123", "name": "John Doe", "email": "john@example.com"} responses: "200": - application/json: {"id": "cus_123", "name": "John Doe", "email": "john@example.com", "created_at": 1717000000, "fingerprint": "1234567890", "stripe_id": "cus_123", "env": "sandbox", "metadata": {}, "send_email_receipts": false, "subscriptions": [{"plan_id": "plan_123", "auto_enable": false, "add_on": false, "status": "active", "past_due": false, "canceled_at": 1395.23, "expires_at": 455.92, "trial_ends_at": 875.56, "started_at": 3418.9, "current_period_start": 8321.34, "current_period_end": null, "quantity": 1}], "purchases": [], "balances": {"balance_1": {"feature_id": "", "granted": 8589.77, "remaining": 2642.5, "usage": 145.7, "unlimited": true, "overage_allowed": false, "max_purchase": 8214.93, "next_reset_at": 5618.81}}} + application/json: {"id": "2ee25a41-0d81-4ad2-8451-ec1aadaefe58", "name": "Patrick", "email": "patrick@useautumn.com", "created_at": 1717000000, "fingerprint": null, "stripe_id": "cus_123", "env": "sandbox", "metadata": {}, "send_email_receipts": false, "subscriptions": [{"plan_id": "plan_123", "auto_enable": false, "add_on": false, "status": "active", "past_due": false, "canceled_at": 1395.23, "expires_at": 455.92, "trial_ends_at": 875.56, "started_at": 3418.9, "current_period_start": 8321.34, "current_period_end": null, "quantity": 1}], "purchases": [], "balances": {"messages": {"feature_id": "", "granted": 100, "remaining": 0, "usage": 100, "unlimited": false, "overage_allowed": false, "max_purchase": 9758.06, "next_reset_at": 9611.97, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "", "included_grant": 7806.81, "prepaid_grant": 455.92, "remaining": 0, "usage": 100, "unlimited": false, "reset": {"interval": "month", "resets_at": 875.56}, "price": null, "expires_at": 9733.97}]}}} listCustomers: speakeasy-default-list-customers: parameters: @@ -1783,7 +1951,7 @@ examples: application/json: {"offset": 0, "limit": 10} responses: "200": - application/json: {"list": [], "has_more": true, "offset": 5136.21, "limit": 2534.27, "total": 7618.77} + application/json: {"list": [{"id": "2ee25a41-0d81-4ad2-8451-ec1aadaefe58", "name": "Patrick", "email": "patrick@useautumn.com", "created_at": 2358.1, "fingerprint": null, "stripe_id": null, "env": "sandbox", "metadata": {}, "send_email_receipts": false, "subscriptions": [{"plan_id": "", "auto_enable": true, "add_on": false, "status": "active", "past_due": true, "canceled_at": 1145.98, "expires_at": 4027.68, "trial_ends_at": 910.35, "started_at": 7325.71, "current_period_start": 406.39, "current_period_end": 2629.33, "quantity": 1}], "purchases": [], "balances": {"messages": {"feature_id": "", "granted": 100, "remaining": 0, "usage": 100, "unlimited": false, "overage_allowed": false, "max_purchase": 4531.44, "next_reset_at": 1010.14, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "", "included_grant": 4967.46, "prepaid_grant": 6928.7, "remaining": 0, "usage": 100, "unlimited": false, "reset": {"interval": "month", "resets_at": 7938.58}, "price": null, "expires_at": 7264.51}]}}}], "has_more": false, "offset": 0, "limit": 10, "total": 1} updateCustomer: speakeasy-default-update-customer: parameters: @@ -1793,7 +1961,7 @@ examples: application/json: {"customer_id": "cus_123", "name": "Jane Doe", "email": "jane@example.com"} responses: "200": - application/json: {"id": "cus_123", "name": "John Doe", "email": "john@example.com", "created_at": 1717000000, "fingerprint": "1234567890", "stripe_id": "cus_123", "env": "sandbox", "metadata": {}, "send_email_receipts": true, "subscriptions": [{"plan_id": "plan_123", "auto_enable": true, "add_on": true, "status": "active", "past_due": true, "canceled_at": 8303.59, "expires_at": 2755.88, "trial_ends_at": 1461.02, "started_at": 1649.05, "current_period_start": 8034.1, "current_period_end": 8058.66, "quantity": 1}], "purchases": [], "balances": {"balance_1": {"feature_id": "", "granted": 7559.37, "remaining": 952.25, "usage": 7029.24, "unlimited": true, "overage_allowed": true, "max_purchase": 7619.46, "next_reset_at": 411.76}}} + application/json: {"id": "2ee25a41-0d81-4ad2-8451-ec1aadaefe58", "name": "Patrick", "email": "patrick@useautumn.com", "created_at": 1717000000, "fingerprint": null, "stripe_id": "cus_123", "env": "sandbox", "metadata": {}, "send_email_receipts": true, "subscriptions": [{"plan_id": "plan_123", "auto_enable": true, "add_on": true, "status": "active", "past_due": true, "canceled_at": 8303.59, "expires_at": 2755.88, "trial_ends_at": 1461.02, "started_at": 1649.05, "current_period_start": 8034.1, "current_period_end": 8058.66, "quantity": 1}], "purchases": [], "balances": {"messages": {"feature_id": "", "granted": 100, "remaining": 0, "usage": 100, "unlimited": false, "overage_allowed": true, "max_purchase": 351.74, "next_reset_at": 3436.48, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "", "included_grant": 7153.13, "prepaid_grant": 2755.88, "remaining": 0, "usage": 100, "unlimited": false, "reset": {"interval": "month", "resets_at": 1461.02}, "price": null, "expires_at": 1881.65}]}}} deleteCustomer: speakeasy-default-delete-customer: parameters: @@ -1810,10 +1978,10 @@ examples: header: x-api-version: "2.1" requestBody: - application/json: {"customer_id": "", "plan_id": "", "redirect_mode": "always"} + application/json: {"customer_id": "cus_123", "plan_id": "pro_plan"} responses: "200": - application/json: {"customer_id": "", "payment_url": "https://lean-lobster.name/"} + application/json: {"customer_id": "cus_123", "payment_url": "https://checkout.stripe.com/..."} billingPreviewAttach: speakeasy-default-billing-preview-attach: parameters: @@ -1830,10 +1998,10 @@ examples: header: x-api-version: "2.1" requestBody: - application/json: {"customer_id": ""} + application/json: {"customer_id": "cus_123", "plan_id": "pro_plan", "feature_quantities": [{"feature_id": "seats", "quantity": 10}]} responses: "200": - application/json: {"customer_id": "", "payment_url": "https://salty-birdcage.biz/"} + application/json: {"customer_id": "cus_123", "invoice": {"status": "paid", "stripe_id": "in_1234", "total": 1500, "currency": "usd", "hosted_invoice_url": "https://invoice.stripe.com/..."}, "payment_url": null} billingPreviewUpdate: speakeasy-default-billing-preview-update: parameters: @@ -1860,7 +2028,7 @@ examples: header: x-api-version: "2.1" requestBody: - application/json: {"feature_id": "", "customer_id": ""} + application/json: {"customer_id": "", "feature_id": ""} responses: "200": application/json: {"success": false} @@ -1880,20 +2048,20 @@ examples: header: x-api-version: "2.1" requestBody: - application/json: {"customer_id": "", "feature_id": ""} + application/json: {"customer_id": "cus_123", "feature_id": "messages"} responses: "200": - application/json: {"allowed": true, "customer_id": "", "balance": {"feature_id": "", "granted": 7002.31, "remaining": 9536.21, "usage": 3270.65, "unlimited": false, "overage_allowed": true, "max_purchase": 8252.55, "next_reset_at": 9394.31}} + application/json: {"allowed": true, "customer_id": "cus_123", "entity_id": null, "required_balance": 1, "balance": {"feature_id": "messages", "granted": 100, "remaining": 72, "usage": 28, "unlimited": false, "overage_allowed": false, "max_purchase": null, "next_reset_at": 1773851121437, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "included_grant": 100, "prepaid_grant": 0, "remaining": 72, "usage": 28, "unlimited": false, "reset": {"interval": "month", "resets_at": 1773851121437}, "price": null, "expires_at": null}]}} balancesTrack: speakeasy-default-balances-track: parameters: header: x-api-version: "2.1" requestBody: - application/json: {"customer_id": ""} + application/json: {"customer_id": "cus_123", "feature_id": "messages", "value": 1} responses: "200": - application/json: {"customer_id": "", "value": 3371.48, "balance": {"feature_id": "", "granted": 4457.97, "remaining": 7901.2, "usage": 9728.03, "unlimited": false, "overage_allowed": false, "max_purchase": null, "next_reset_at": 9011.85}} + application/json: {"customer_id": "cus_123", "value": 1, "balance": {"feature_id": "messages", "granted": 100, "remaining": 72, "usage": 28, "unlimited": false, "overage_allowed": false, "max_purchase": null, "next_reset_at": 1773851121437, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "included_grant": 100, "prepaid_grant": 0, "remaining": 72, "usage": 28, "unlimited": false, "reset": {"interval": "month", "resets_at": 1773851121437}, "price": null, "expires_at": null}]}} listPlans: speakeasy-default-list-plans: parameters: @@ -1902,4 +2070,214 @@ examples: responses: "200": application/json: {"list": []} + previewAttach: + speakeasy-default-preview-attach: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "plan_id": "pro_plan"} + responses: + "200": + application/json: {"customer_id": "", "line_items": [], "total": 20, "currency": "usd"} + updateSubscription: + speakeasy-default-update-subscription: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": ""} + responses: + "200": + application/json: {"customer_id": "", "payment_url": "https://yearly-synergy.org"} + previewUpdateSubscription: + speakeasy-default-preview-update-subscription: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": ""} + responses: + "200": + application/json: {"customer_id": "", "line_items": [{"title": "", "description": "after geez graceful small mainstream minister profane", "amount": 727.26, "plan_id": "", "total_quantity": 3904.9, "paid_quantity": 5135.39}], "total": 1103.53, "currency": "Pataca"} + setupPayment: + speakeasy-default-setup-payment: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": ""} + responses: + "200": + application/json: {"customer_id": "", "url": "https://courteous-emergent.name"} + previewBillingUpdate: + speakeasy-default-preview-billing-update: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "plan_id": "pro_plan", "feature_quantities": [{"feature_id": "seats", "quantity": 15}]} + responses: + "200": + application/json: {"customer_id": "", "line_items": [], "total": 20, "currency": "usd"} + previewBillingAttach: + speakeasy-default-preview-billing-attach: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "plan_id": "pro_plan"} + responses: + "200": + application/json: {"customer_id": "", "line_items": [], "total": 20, "currency": "usd"} + openCustomerPortal: + speakeasy-default-open-customer-portal: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "return_url": "https://useautumn.com"} + responses: + "200": + application/json: {"customer_id": "cus_123", "url": "https://billing.stripe.com/session/..."} + previewUpdate: + speakeasy-default-preview-update: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "plan_id": "pro_plan", "feature_quantities": [{"feature_id": "seats", "quantity": 15}]} + responses: + "200": + application/json: {"customer_id": "", "line_items": [], "total": 20, "currency": "usd"} + createBalance: + speakeasy-default-create-balance: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "feature_id": "api_calls", "included": 1000, "reset": {"interval": "month"}} + responses: + "200": + application/json: {"success": true} + updateBalance: + speakeasy-default-update-balance: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "feature_id": "api_calls", "remaining": 5} + responses: + "200": + application/json: {"success": false} + check: + speakeasy-default-check: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "feature_id": "messages"} + responses: + "200": + application/json: {"allowed": true, "customer_id": "cus_123", "entity_id": null, "required_balance": 1, "balance": {"feature_id": "messages", "granted": 100, "remaining": 72, "usage": 28, "unlimited": false, "overage_allowed": false, "max_purchase": null, "next_reset_at": 1773851121437, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "included_grant": 100, "prepaid_grant": 0, "remaining": 72, "usage": 28, "unlimited": false, "reset": {"interval": "month", "resets_at": 1773851121437}, "price": null, "expires_at": null}]}} + track: + speakeasy-default-track: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "feature_id": "messages", "value": 1} + responses: + "200": + application/json: {"customer_id": "cus_123", "value": 1, "balance": {"feature_id": "messages", "granted": 100, "remaining": 72, "usage": 28, "unlimited": false, "overage_allowed": false, "max_purchase": null, "next_reset_at": 1773851121437, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "included_grant": 100, "prepaid_grant": 0, "remaining": 72, "usage": 28, "unlimited": false, "reset": {"interval": "month", "resets_at": 1773851121437}, "price": null, "expires_at": null}]}} + eventsList: + speakeasy-default-events-list: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"offset": 0, "limit": 50, "customer_id": "cus_123"} + responses: + "200": + application/json: {"list": [{"id": "evt_36xpk2TmuQX5zVPPQ8tCtnR5Weg", "timestamp": 1765958215459, "feature_id": "credits", "customer_id": "0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx", "value": 30, "properties": {}}, {"id": "evt_36xmHxxjAkqxufDf9yHAPNfRrLM", "timestamp": 1765956512057, "feature_id": "credits", "customer_id": "0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx", "value": 49, "properties": {}}], "has_more": false, "offset": 0, "limit": 100, "total": 2} + eventsAggregate: + speakeasy-default-events-aggregate: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "feature_id": "api_calls", "range": "30d", "bin_size": "day"} + responses: + "200": + application/json: {"list": [{"period": 1762905600000, "values": {"messages": 10, "sessions": 3}}, {"period": 1762992000000, "values": {"messages": 3, "sessions": 12}}], "total": {"messages": {"count": 2, "sum": 13}, "sessions": {"count": 2, "sum": 15}}} + createReferralCode: + speakeasy-default-create-referral-code: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "program_id": "prog_123"} + responses: + "200": + application/json: {"code": "", "customer_id": "", "created_at": 123} + redeemReferralCode: + speakeasy-default-redeem-referral-code: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"code": "REF123", "customer_id": "cus_456"} + responses: + "200": + application/json: {"id": "", "customer_id": "", "reward_id": ""} + createEntity: + speakeasy-default-create-entity: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"name": "Seat 42", "feature_id": "seats", "customer_id": "cus_123", "entity_id": "seat_42"} + responses: + "200": + application/json: {"id": "seat_42", "name": "Seat 42", "customer_id": "cus_123", "feature_id": "seats", "created_at": 1771409161016, "env": "sandbox", "subscriptions": [{"plan_id": "pro_plan", "auto_enable": true, "add_on": false, "status": "active", "past_due": false, "canceled_at": null, "expires_at": null, "trial_ends_at": null, "started_at": 1771431921437, "current_period_start": 1771431921437, "current_period_end": 1771999921437, "quantity": 1}], "purchases": [], "balances": {"messages": {"feature_id": "messages", "granted": 100, "remaining": 72, "usage": 28, "unlimited": false, "overage_allowed": false, "max_purchase": null, "next_reset_at": 1773851121437, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "included_grant": 100, "prepaid_grant": 0, "remaining": 72, "usage": 28, "unlimited": false, "reset": {"interval": "month", "resets_at": 1773851121437}, "price": null, "expires_at": null}]}}, "invoices": []} + getEntity: + speakeasy-default-get-entity: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"entity_id": "seat_42"} + responses: + "200": + application/json: {"id": "seat_42", "name": "Seat 42", "customer_id": "cus_123", "feature_id": "seats", "created_at": 1771409161016, "env": "sandbox", "subscriptions": [{"plan_id": "pro_plan", "auto_enable": true, "add_on": false, "status": "active", "past_due": false, "canceled_at": null, "expires_at": null, "trial_ends_at": null, "started_at": 1771431921437, "current_period_start": 1771431921437, "current_period_end": 1771999921437, "quantity": 1}], "purchases": [], "balances": {"messages": {"feature_id": "messages", "granted": 100, "remaining": 72, "usage": 28, "unlimited": false, "overage_allowed": false, "max_purchase": null, "next_reset_at": 1773851121437, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "included_grant": 100, "prepaid_grant": 0, "remaining": 72, "usage": 28, "unlimited": false, "reset": {"interval": "month", "resets_at": 1773851121437}, "price": null, "expires_at": null}]}}, "invoices": []} + deleteEntity: + speakeasy-default-delete-entity: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "entity_id": "seat_42"} + responses: + "200": + application/json: {"success": true} + listEvents: + speakeasy-default-list-events: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"offset": 0, "limit": 50, "customer_id": "cus_123"} + responses: + "200": + application/json: {"list": [{"id": "evt_36xpk2TmuQX5zVPPQ8tCtnR5Weg", "timestamp": 1765958215459, "feature_id": "credits", "customer_id": "0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx", "value": 30, "properties": {}}, {"id": "evt_36xmHxxjAkqxufDf9yHAPNfRrLM", "timestamp": 1765956512057, "feature_id": "credits", "customer_id": "0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx", "value": 49, "properties": {}}], "has_more": false, "offset": 0, "limit": 100, "total": 2} + aggregateEvents: + speakeasy-default-aggregate-events: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "feature_id": "api_calls", "range": "30d", "bin_size": "day"} + responses: + "200": + application/json: {"list": [{"period": 1762905600000, "values": {"messages": 10, "sessions": 3}}, {"period": 1762992000000, "values": {"messages": 3, "sessions": 12}}], "total": {"messages": {"count": 2, "sum": 13}, "sessions": {"count": 2, "sum": 15}}} examplesVersion: 1.0.2 diff --git a/others/python-sdk/.speakeasy/gen.yaml b/others/python-sdk/.speakeasy/gen.yaml index 37bc831c1..6c2c69cc4 100644 --- a/others/python-sdk/.speakeasy/gen.yaml +++ b/others/python-sdk/.speakeasy/gen.yaml @@ -30,7 +30,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: false python: - version: 0.2.23 + version: 0.4.4 additionalDependencies: dev: {} main: {} @@ -38,6 +38,7 @@ python: - id - object - input + - range asyncMode: both author: Autumn authors: diff --git a/others/python-sdk/README.md b/others/python-sdk/README.md index 1fcc0c9cf..6b1ad4bea 100644 --- a/others/python-sdk/README.md +++ b/others/python-sdk/README.md @@ -132,7 +132,7 @@ with Autumn( secret_key="", ) as autumn: - res = autumn.customers.get_or_create(customer_id="cus_123", name="John Doe", email="john@example.com") + res = autumn.check(customer_id="cus_123", feature_id="messages") # Handle response print(res) @@ -154,7 +154,7 @@ async def main(): secret_key="", ) as autumn: - res = await autumn.customers.get_or_create_async(customer_id="cus_123", name="John Doe", email="john@example.com") + res = await autumn.check_async(customer_id="cus_123", feature_id="messages") # Handle response print(res) @@ -184,7 +184,7 @@ with Autumn( x_api_version="2.1", ) as autumn: - res = autumn.customers.get_or_create(customer_id="cus_123", name="John Doe", email="john@example.com") + res = autumn.check(customer_id="cus_123", feature_id="messages") # Handle response print(res) @@ -198,20 +198,35 @@ with Autumn(
Available methods +### [Autumn SDK](docs/sdks/autumn/README.md) + +* [check](docs/sdks/autumn/README.md#check) - Checks whether a customer currently has enough balance to use a feature. + +Use this to gate access before a feature action. Enable sendEvent when you want to check and consume balance atomically in one request. +* [track](docs/sdks/autumn/README.md#track) - Records usage for a customer feature and returns updated balances. + +Use this after an action happens to decrement usage, or send a negative value to credit balance back. + ### [Balances](docs/sdks/balancessdk/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. -* [check](docs/sdks/balancessdk/README.md#check) - Check whether usage is allowed for a customer feature. -* [track](docs/sdks/balancessdk/README.md#track) - Track usage for a customer feature. ### [Billing](docs/sdks/billing/README.md) * [attach](docs/sdks/billing/README.md#attach) - Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. -* [preview_attach](docs/sdks/billing/README.md#preview_attach) - Preview billing changes before attaching a plan. -* [update](docs/sdks/billing/README.md#update) - Update an existing subscription. -* [preview_update](docs/sdks/billing/README.md#preview_update) - Preview billing changes before updating a subscription. -* [setup_payment](docs/sdks/billing/README.md#setup_payment) - Create a setup payment session for a customer. + +Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product. +* [preview_attach](docs/sdks/billing/README.md#preview_attach) - Previews the billing changes that would occur when attaching a plan, without actually making any changes. + +Use this endpoint to show customers what they will be charged before confirming a subscription change. +* [update](docs/sdks/billing/README.md#update) - Updates an existing subscription. Use to modify feature quantities, cancel, or change plan configuration. + +Use this endpoint to update prepaid quantities, cancel a subscription (immediately or at end of cycle), or modify subscription settings. +* [preview_update](docs/sdks/billing/README.md#preview_update) - Previews the billing changes that would occur when updating a subscription, without actually making any changes. + +Use this endpoint to show customers prorated charges or refunds before confirming subscription modifications. +* [open_customer_portal](docs/sdks/billing/README.md#open_customer_portal) - Create a billing portal session for a customer to manage their subscription. ### [Customers](docs/sdks/customers/README.md) @@ -222,10 +237,32 @@ Use this as the primary entrypoint before billing operations so the customer rec * [update](docs/sdks/customers/README.md#update) - Updates an existing customer by ID. * [delete](docs/sdks/customers/README.md#delete) - Deletes a customer by ID. +### [Entities](docs/sdks/entities/README.md) + +* [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. + +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. + +Use this when the underlying resource is removed and you no longer want entity-scoped balances or subscriptions tracked for it. + +### [Events](docs/sdks/events/README.md) + +* [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. + ### [Plans](docs/sdks/plans/README.md) * [list](docs/sdks/plans/README.md#list) - List all plans +### [Referrals](docs/sdks/referrals/README.md) + +* [create_code](docs/sdks/referrals/README.md#create_code) - Create or fetch a referral code for a customer in a referral program. +* [redeem_code](docs/sdks/referrals/README.md#redeem_code) - Redeem a referral code for a customer. +
@@ -245,7 +282,7 @@ with Autumn( secret_key="", ) as autumn: - res = autumn.customers.get_or_create(customer_id="cus_123", name="John Doe", email="john@example.com", + res = autumn.check(customer_id="cus_123", feature_id="messages", RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False)) # Handle response @@ -265,7 +302,7 @@ with Autumn( secret_key="", ) as autumn: - res = autumn.customers.get_or_create(customer_id="cus_123", name="John Doe", email="john@example.com") + res = autumn.check(customer_id="cus_123", feature_id="messages") # Handle response print(res) @@ -298,7 +335,7 @@ with Autumn( res = None try: - res = autumn.customers.get_or_create(customer_id="cus_123", name="John Doe", email="john@example.com") + res = autumn.check(customer_id="cus_123", feature_id="messages") # Handle response print(res) @@ -350,7 +387,7 @@ with Autumn( secret_key="", ) as autumn: - res = autumn.customers.get_or_create(customer_id="cus_123", name="John Doe", email="john@example.com") + res = autumn.check(customer_id="cus_123", feature_id="messages") # Handle response print(res) diff --git a/others/python-sdk/USAGE.md b/others/python-sdk/USAGE.md index d96fd08db..29eee3488 100644 --- a/others/python-sdk/USAGE.md +++ b/others/python-sdk/USAGE.md @@ -9,7 +9,7 @@ with Autumn( secret_key="", ) as autumn: - res = autumn.customers.get_or_create(customer_id="cus_123", name="John Doe", email="john@example.com") + res = autumn.check(customer_id="cus_123", feature_id="messages") # Handle response print(res) @@ -31,7 +31,7 @@ async def main(): secret_key="", ) as autumn: - res = await autumn.customers.get_or_create_async(customer_id="cus_123", name="John Doe", email="john@example.com") + res = await autumn.check_async(customer_id="cus_123", feature_id="messages") # Handle response print(res) diff --git a/others/python-sdk/docs/models/billingpreviewattachnextcycleeffectiveperiod.md b/others/python-sdk/docs/models/aggregateeventscustomrange.md similarity index 75% rename from others/python-sdk/docs/models/billingpreviewattachnextcycleeffectiveperiod.md rename to others/python-sdk/docs/models/aggregateeventscustomrange.md index 774b61b32..5aedc005f 100644 --- a/others/python-sdk/docs/models/billingpreviewattachnextcycleeffectiveperiod.md +++ b/others/python-sdk/docs/models/aggregateeventscustomrange.md @@ -1,4 +1,6 @@ -# BillingPreviewAttachNextCycleEffectivePeriod +# AggregateEventsCustomRange + +Custom time range to aggregate events for. If provided, range must not be provided ## Fields diff --git a/others/python-sdk/docs/models/aggregateeventsfeatureid.md b/others/python-sdk/docs/models/aggregateeventsfeatureid.md new file mode 100644 index 000000000..7afa32fe5 --- /dev/null +++ b/others/python-sdk/docs/models/aggregateeventsfeatureid.md @@ -0,0 +1,19 @@ +# AggregateEventsFeatureID + +Feature ID(s) to aggregate events for + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `List[str]` + +```python +value: List[str] = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/aggregateeventsglobals.md b/others/python-sdk/docs/models/aggregateeventsglobals.md new file mode 100644 index 000000000..811ef147b --- /dev/null +++ b/others/python-sdk/docs/models/aggregateeventsglobals.md @@ -0,0 +1,8 @@ +# AggregateEventsGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/aggregateeventslist.md b/others/python-sdk/docs/models/aggregateeventslist.md new file mode 100644 index 000000000..3885b7cfd --- /dev/null +++ b/others/python-sdk/docs/models/aggregateeventslist.md @@ -0,0 +1,10 @@ +# AggregateEventsList + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | +| `period` | *float* | :heavy_check_mark: | Unix timestamp (epoch ms) for this time period | +| `values` | Dict[str, *float*] | :heavy_check_mark: | Aggregated values per feature: { [featureId]: number } | +| `grouped_values` | Dict[str, Dict[str, *float*]] | :heavy_minus_sign: | Values broken down by group (only present when group_by is used): { [featureId]: { [groupValue]: number } } | \ No newline at end of file diff --git a/others/python-sdk/docs/models/aggregateeventsresponse.md b/others/python-sdk/docs/models/aggregateeventsresponse.md new file mode 100644 index 000000000..2fd7b5fb0 --- /dev/null +++ b/others/python-sdk/docs/models/aggregateeventsresponse.md @@ -0,0 +1,11 @@ +# AggregateEventsResponse + +OK + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | +| `list` | List[[models.AggregateEventsList](../models/aggregateeventslist.md)] | :heavy_check_mark: | Array of time periods with aggregated values | +| `total` | Dict[str, [models.Total](../models/total.md)] | :heavy_check_mark: | Total aggregations per feature. Keys are feature IDs, values contain count and sum. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachrequest.md b/others/python-sdk/docs/models/attachparams.md similarity index 56% rename from others/python-sdk/docs/models/billingpreviewattachrequest.md rename to others/python-sdk/docs/models/attachparams.md index a27c3cb0d..4f6a50e70 100644 --- a/others/python-sdk/docs/models/billingpreviewattachrequest.md +++ b/others/python-sdk/docs/models/attachparams.md @@ -1,21 +1,20 @@ -# BillingPreviewAttachRequest +# AttachParams ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to attach the plan to. | -| `entity_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | -| `feature_quantities` | List[[models.BillingPreviewAttachFeatureQuantities](../models/billingpreviewattachfeaturequantities.md)] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | -| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to attach. | -| `free_trial` | [OptionalNullable[models.BillingPreviewAttachFreeTrial]](../models/billingpreviewattachfreetrial.md) | :heavy_minus_sign: | N/A | -| `customize` | [Optional[models.BillingPreviewAttachCustomize]](../models/billingpreviewattachcustomize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | -| `plan_id` | *str* | :heavy_check_mark: | N/A | -| `invoice_mode` | [Optional[models.BillingPreviewAttachInvoiceMode]](../models/billingpreviewattachinvoicemode.md) | :heavy_minus_sign: | N/A | -| `discounts` | List[[models.BillingPreviewAttachDiscountUnion](../models/billingpreviewattachdiscountunion.md)] | :heavy_minus_sign: | N/A | -| `redirect_mode` | [Optional[models.BillingPreviewAttachRedirectMode]](../models/billingpreviewattachredirectmode.md) | :heavy_minus_sign: | N/A | -| `success_url` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `new_billing_subscription` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `plan_schedule` | [Optional[models.BillingPreviewAttachPlanSchedule]](../models/billingpreviewattachplanschedule.md) | :heavy_minus_sign: | N/A | -| `billing_behavior` | [Optional[models.BillingPreviewAttachBillingBehavior]](../models/billingpreviewattachbillingbehavior.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to attach the plan to. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | +| `plan_id` | *str* | :heavy_check_mark: | The ID of the plan. | +| `feature_quantities` | List[[models.BillingAttachFeatureQuantity](../models/billingattachfeaturequantity.md)] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | +| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to attach. | +| `free_trial` | [OptionalNullable[models.BillingAttachFreeTrial]](../models/billingattachfreetrial.md) | :heavy_minus_sign: | Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. | +| `customize` | [Optional[models.BillingAttachCustomize]](../models/billingattachcustomize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | +| `invoice_mode` | [Optional[models.BillingAttachInvoiceMode]](../models/billingattachinvoicemode.md) | :heavy_minus_sign: | Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. | +| `billing_behavior` | [Optional[models.BillingAttachBillingBehavior]](../models/billingattachbillingbehavior.md) | :heavy_minus_sign: | 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. | +| `discounts` | List[[models.BillingAttachDiscountUnion](../models/billingattachdiscountunion.md)] | :heavy_minus_sign: | List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. | +| `success_url` | *Optional[str]* | :heavy_minus_sign: | URL to redirect to after successful checkout. | +| `new_billing_subscription` | *Optional[bool]* | :heavy_minus_sign: | Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. | +| `plan_schedule` | [Optional[models.BillingAttachPlanSchedule]](../models/billingattachplanschedule.md) | :heavy_minus_sign: | When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balances.md b/others/python-sdk/docs/models/balances.md index dc522d990..cf6ca2395 100644 --- a/others/python-sdk/docs/models/balances.md +++ b/others/python-sdk/docs/models/balances.md @@ -3,16 +3,16 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `feature` | [Optional[models.CustomerFeature]](../models/customerfeature.md) | :heavy_minus_sign: | N/A | -| `granted` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `overage_allowed` | *bool* | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `next_reset_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `breakdown` | List[[models.Breakdown](../models/breakdown.md)] | :heavy_minus_sign: | N/A | -| `rollovers` | List[[models.CustomerRollover](../models/customerrollover.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| 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. | +| `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.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescheckbalance.md b/others/python-sdk/docs/models/balancescheckbalance.md deleted file mode 100644 index 198922a7d..000000000 --- a/others/python-sdk/docs/models/balancescheckbalance.md +++ /dev/null @@ -1,18 +0,0 @@ -# BalancesCheckBalance - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `feature` | [Optional[models.BalancesCheckFeature]](../models/balancescheckfeature.md) | :heavy_minus_sign: | N/A | -| `granted` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `overage_allowed` | *bool* | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `next_reset_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `breakdown` | List[[models.BalancesCheckBreakdown](../models/balancescheckbreakdown.md)] | :heavy_minus_sign: | N/A | -| `rollovers` | List[[models.BalancesCheckBalanceRollover](../models/balancescheckbalancerollover.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescheckbalancerollover.md b/others/python-sdk/docs/models/balancescheckbalancerollover.md deleted file mode 100644 index 31375269d..000000000 --- a/others/python-sdk/docs/models/balancescheckbalancerollover.md +++ /dev/null @@ -1,9 +0,0 @@ -# BalancesCheckBalanceRollover - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `balance` | *float* | :heavy_check_mark: | N/A | -| `expires_at` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescheckbreakdown.md b/others/python-sdk/docs/models/balancescheckbreakdown.md deleted file mode 100644 index 02feead42..000000000 --- a/others/python-sdk/docs/models/balancescheckbreakdown.md +++ /dev/null @@ -1,17 +0,0 @@ -# BalancesCheckBreakdown - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `plan_id` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `included_grant` | *float* | :heavy_check_mark: | N/A | -| `prepaid_grant` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `reset` | [Nullable[models.BalancesCheckReset]](../models/balancescheckreset.md) | :heavy_check_mark: | N/A | -| `price` | [Nullable[models.BalancesCheckPrice]](../models/balancescheckprice.md) | :heavy_check_mark: | N/A | -| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescheckintervalunion.md b/others/python-sdk/docs/models/balancescheckintervalunion.md deleted file mode 100644 index 826043c0e..000000000 --- a/others/python-sdk/docs/models/balancescheckintervalunion.md +++ /dev/null @@ -1,17 +0,0 @@ -# BalancesCheckIntervalUnion - - -## Supported Types - -### `models.BalancesCheckBalanceIntervalEnum` - -```python -value: models.BalancesCheckBalanceIntervalEnum = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` - diff --git a/others/python-sdk/docs/models/balancescheckprice.md b/others/python-sdk/docs/models/balancescheckprice.md deleted file mode 100644 index 3e6f66868..000000000 --- a/others/python-sdk/docs/models/balancescheckprice.md +++ /dev/null @@ -1,12 +0,0 @@ -# BalancesCheckPrice - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `tiers` | List[[models.BalancesCheckTier](../models/balanceschecktier.md)] | :heavy_minus_sign: | N/A | -| `billing_units` | *float* | :heavy_check_mark: | N/A | -| `billing_method` | [models.BalancesCheckBillingMethod](../models/balancescheckbillingmethod.md) | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescheckrequest.md b/others/python-sdk/docs/models/balancescheckrequest.md deleted file mode 100644 index 426327d98..000000000 --- a/others/python-sdk/docs/models/balancescheckrequest.md +++ /dev/null @@ -1,14 +0,0 @@ -# BalancesCheckRequest - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -| `customer_id` | *str* | :heavy_check_mark: | ID which you provided when creating the customer | -| `feature_id` | *str* | :heavy_check_mark: | ID of the feature to check access to. | -| `entity_id` | *Optional[str]* | :heavy_minus_sign: | If using entity balances (eg, seats), the entity ID to check access for. | -| `required_balance` | *Optional[float]* | :heavy_minus_sign: | If you know the amount of the feature the end user is consuming in advance. If their balance is below this quantity, allowed will be false. | -| `properties` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | -| `send_event` | *Optional[bool]* | :heavy_minus_sign: | If true, a usage event will be recorded together with checking access. The required_balance field will be used as the usage value. | -| `with_preview` | *Optional[bool]* | :heavy_minus_sign: | If true, the response will include a preview object, which can be used to display information such as a paywall or upgrade confirmation. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescheckresponse.md b/others/python-sdk/docs/models/balancescheckresponse.md deleted file mode 100644 index cc3aae7cb..000000000 --- a/others/python-sdk/docs/models/balancescheckresponse.md +++ /dev/null @@ -1,15 +0,0 @@ -# BalancesCheckResponse - -OK - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `allowed` | *bool* | :heavy_check_mark: | N/A | -| `customer_id` | *str* | :heavy_check_mark: | N/A | -| `entity_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `required_balance` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `balance` | [Nullable[models.BalancesCheckBalance]](../models/balancescheckbalance.md) | :heavy_check_mark: | N/A | -| `preview` | [Optional[models.Preview]](../models/preview.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescheckscenario.md b/others/python-sdk/docs/models/balancescheckscenario.md deleted file mode 100644 index a6effecf8..000000000 --- a/others/python-sdk/docs/models/balancescheckscenario.md +++ /dev/null @@ -1,9 +0,0 @@ -# BalancesCheckScenario - - -## Values - -| Name | Value | -| -------------- | -------------- | -| `USAGE_LIMIT` | usage_limit | -| `FEATURE_FLAG` | feature_flag | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balanceschecktier.md b/others/python-sdk/docs/models/balanceschecktier.md deleted file mode 100644 index 978e8b01a..000000000 --- a/others/python-sdk/docs/models/balanceschecktier.md +++ /dev/null @@ -1,9 +0,0 @@ -# BalancesCheckTier - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `to` | [models.BalancesCheckBalanceTo](../models/balancescheckbalanceto.md) | :heavy_check_mark: | N/A | -| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescreaterequest.md b/others/python-sdk/docs/models/balancescreaterequest.md deleted file mode 100644 index a8c77cb0e..000000000 --- a/others/python-sdk/docs/models/balancescreaterequest.md +++ /dev/null @@ -1,15 +0,0 @@ -# BalancesCreateRequest - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -| `feature_id` | *str* | :heavy_check_mark: | The feature ID to create the balance for | -| `customer_id` | *str* | :heavy_check_mark: | The customer ID to assign the balance to | -| `entity_id` | *Optional[str]* | :heavy_minus_sign: | Entity ID for entity-scoped balances | -| `included` | *Optional[float]* | :heavy_minus_sign: | The initial balance amount to grant | -| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | Whether the balance is unlimited | -| `reset` | [Optional[models.BalancesCreateReset]](../models/balancescreatereset.md) | :heavy_minus_sign: | Reset configuration for the balance | -| `expires_at` | *Optional[float]* | :heavy_minus_sign: | Unix timestamp (milliseconds) when the balance expires | -| `granted_balance` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescreatereset.md b/others/python-sdk/docs/models/balancescreatereset.md deleted file mode 100644 index 37dd46ea9..000000000 --- a/others/python-sdk/docs/models/balancescreatereset.md +++ /dev/null @@ -1,11 +0,0 @@ -# BalancesCreateReset - -Reset configuration for the balance - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `interval` | [models.BalancesCreateInterval](../models/balancescreateinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackbalance.md b/others/python-sdk/docs/models/balancestrackbalance.md deleted file mode 100644 index 5b98b79bc..000000000 --- a/others/python-sdk/docs/models/balancestrackbalance.md +++ /dev/null @@ -1,18 +0,0 @@ -# BalancesTrackBalance - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `feature` | [Optional[models.BalancesTrackBalanceFeature]](../models/balancestrackbalancefeature.md) | :heavy_minus_sign: | N/A | -| `granted` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `overage_allowed` | *bool* | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `next_reset_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `breakdown` | List[[models.BalancesTrackBalanceBreakdown](../models/balancestrackbalancebreakdown.md)] | :heavy_minus_sign: | N/A | -| `rollovers` | List[[models.BalancesTrackBalanceRollover](../models/balancestrackbalancerollover.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackbalancebreakdown.md b/others/python-sdk/docs/models/balancestrackbalancebreakdown.md deleted file mode 100644 index df781a50c..000000000 --- a/others/python-sdk/docs/models/balancestrackbalancebreakdown.md +++ /dev/null @@ -1,17 +0,0 @@ -# BalancesTrackBalanceBreakdown - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `plan_id` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `included_grant` | *float* | :heavy_check_mark: | N/A | -| `prepaid_grant` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `reset` | [Nullable[models.BalancesTrackBalanceReset]](../models/balancestrackbalancereset.md) | :heavy_check_mark: | N/A | -| `price` | [Nullable[models.BalancesTrackBalancePrice]](../models/balancestrackbalanceprice.md) | :heavy_check_mark: | N/A | -| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackbalancecreditschema.md b/others/python-sdk/docs/models/balancestrackbalancecreditschema.md deleted file mode 100644 index 10edc5168..000000000 --- a/others/python-sdk/docs/models/balancestrackbalancecreditschema.md +++ /dev/null @@ -1,9 +0,0 @@ -# BalancesTrackBalanceCreditSchema - - -## Fields - -| Field | Type | Required | Description | -| -------------------- | -------------------- | -------------------- | -------------------- | -| `metered_feature_id` | *str* | :heavy_check_mark: | N/A | -| `credit_cost` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackbalancedisplay.md b/others/python-sdk/docs/models/balancestrackbalancedisplay.md deleted file mode 100644 index b140610ae..000000000 --- a/others/python-sdk/docs/models/balancestrackbalancedisplay.md +++ /dev/null @@ -1,9 +0,0 @@ -# BalancesTrackBalanceDisplay - - -## Fields - -| Field | Type | Required | Description | -| ----------------------- | ----------------------- | ----------------------- | ----------------------- | -| `singular` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `plural` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackbalancefeature.md b/others/python-sdk/docs/models/balancestrackbalancefeature.md deleted file mode 100644 index 25e9dc302..000000000 --- a/others/python-sdk/docs/models/balancestrackbalancefeature.md +++ /dev/null @@ -1,15 +0,0 @@ -# BalancesTrackBalanceFeature - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | N/A | -| `name` | *str* | :heavy_check_mark: | N/A | -| `type` | [models.BalancesTrackBalanceType](../models/balancestrackbalancetype.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.BalancesTrackBalanceCreditSchema](../models/balancestrackbalancecreditschema.md)] | :heavy_minus_sign: | N/A | -| `display` | [Optional[models.BalancesTrackBalanceDisplay]](../models/balancestrackbalancedisplay.md) | :heavy_minus_sign: | N/A | -| `archived` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackbalanceintervalenum.md b/others/python-sdk/docs/models/balancestrackbalanceintervalenum.md deleted file mode 100644 index dd0df22dd..000000000 --- a/others/python-sdk/docs/models/balancestrackbalanceintervalenum.md +++ /dev/null @@ -1,16 +0,0 @@ -# BalancesTrackBalanceIntervalEnum - - -## 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 | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackbalanceintervalunion.md b/others/python-sdk/docs/models/balancestrackbalanceintervalunion.md deleted file mode 100644 index e5aededfa..000000000 --- a/others/python-sdk/docs/models/balancestrackbalanceintervalunion.md +++ /dev/null @@ -1,17 +0,0 @@ -# BalancesTrackBalanceIntervalUnion - - -## Supported Types - -### `models.BalancesTrackBalanceIntervalEnum` - -```python -value: models.BalancesTrackBalanceIntervalEnum = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` - diff --git a/others/python-sdk/docs/models/balancestrackbalanceprice.md b/others/python-sdk/docs/models/balancestrackbalanceprice.md deleted file mode 100644 index 229af6b05..000000000 --- a/others/python-sdk/docs/models/balancestrackbalanceprice.md +++ /dev/null @@ -1,12 +0,0 @@ -# BalancesTrackBalancePrice - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `tiers` | List[[models.BalancesTrackBalanceTier](../models/balancestrackbalancetier.md)] | :heavy_minus_sign: | N/A | -| `billing_units` | *float* | :heavy_check_mark: | N/A | -| `billing_method` | [models.BalancesTrackBalanceBillingMethod](../models/balancestrackbalancebillingmethod.md) | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackbalancerollover.md b/others/python-sdk/docs/models/balancestrackbalancerollover.md deleted file mode 100644 index 9bbb8583e..000000000 --- a/others/python-sdk/docs/models/balancestrackbalancerollover.md +++ /dev/null @@ -1,9 +0,0 @@ -# BalancesTrackBalanceRollover - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `balance` | *float* | :heavy_check_mark: | N/A | -| `expires_at` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackbalances.md b/others/python-sdk/docs/models/balancestrackbalances.md deleted file mode 100644 index ead243f65..000000000 --- a/others/python-sdk/docs/models/balancestrackbalances.md +++ /dev/null @@ -1,18 +0,0 @@ -# BalancesTrackBalances - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `feature` | [Optional[models.BalancesTrackFeature]](../models/balancestrackfeature.md) | :heavy_minus_sign: | N/A | -| `granted` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `overage_allowed` | *bool* | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `next_reset_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `breakdown` | List[[models.BalancesTrackBreakdown](../models/balancestrackbreakdown.md)] | :heavy_minus_sign: | N/A | -| `rollovers` | List[[models.BalancesTrackRollover](../models/balancestrackrollover.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackbalancetier.md b/others/python-sdk/docs/models/balancestrackbalancetier.md deleted file mode 100644 index 0247cd35f..000000000 --- a/others/python-sdk/docs/models/balancestrackbalancetier.md +++ /dev/null @@ -1,9 +0,0 @@ -# BalancesTrackBalanceTier - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `to` | [models.BalancesTrackBalanceTo](../models/balancestrackbalanceto.md) | :heavy_check_mark: | N/A | -| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackbalancetype.md b/others/python-sdk/docs/models/balancestrackbalancetype.md deleted file mode 100644 index 0480a30dc..000000000 --- a/others/python-sdk/docs/models/balancestrackbalancetype.md +++ /dev/null @@ -1,10 +0,0 @@ -# BalancesTrackBalanceType - - -## Values - -| Name | Value | -| --------------- | --------------- | -| `BOOLEAN` | boolean | -| `METERED` | metered | -| `CREDIT_SYSTEM` | credit_system | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackbreakdown.md b/others/python-sdk/docs/models/balancestrackbreakdown.md deleted file mode 100644 index 3e2417352..000000000 --- a/others/python-sdk/docs/models/balancestrackbreakdown.md +++ /dev/null @@ -1,17 +0,0 @@ -# BalancesTrackBreakdown - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `plan_id` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `included_grant` | *float* | :heavy_check_mark: | N/A | -| `prepaid_grant` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `reset` | [Nullable[models.BalancesTrackReset]](../models/balancestrackreset.md) | :heavy_check_mark: | N/A | -| `price` | [Nullable[models.BalancesTrackPrice]](../models/balancestrackprice.md) | :heavy_check_mark: | N/A | -| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackintervalunion.md b/others/python-sdk/docs/models/balancestrackintervalunion.md deleted file mode 100644 index 9e66d02e9..000000000 --- a/others/python-sdk/docs/models/balancestrackintervalunion.md +++ /dev/null @@ -1,17 +0,0 @@ -# BalancesTrackIntervalUnion - - -## Supported Types - -### `models.BalancesTrackIntervalEnum` - -```python -value: models.BalancesTrackIntervalEnum = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` - diff --git a/others/python-sdk/docs/models/balancestrackrequest.md b/others/python-sdk/docs/models/balancestrackrequest.md deleted file mode 100644 index b8e9a30c3..000000000 --- a/others/python-sdk/docs/models/balancestrackrequest.md +++ /dev/null @@ -1,14 +0,0 @@ -# BalancesTrackRequest - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `customer_id` | *str* | :heavy_check_mark: | ID which you provided when creating the customer | -| `feature_id` | *Optional[str]* | :heavy_minus_sign: | ID of the feature to track usage for. Required if event_name is not provided. Use this for direct feature tracking. | -| `event_name` | *Optional[str]* | :heavy_minus_sign: | An [event name](/features/tracking-usage#using-event-names) can be used in place of feature_id. This can be used if multiple features are tracked in the same event. | -| `value` | *Optional[float]* | :heavy_minus_sign: | The amount of usage to record. Defaults to 1. Can be negative to increase the balance (e.g., when removing a seat). | -| `properties` | Dict[str, *Any*] | :heavy_minus_sign: | Additional properties to attach to this usage event. | -| `idempotency_key` | *Optional[str]* | :heavy_minus_sign: | Unique key to prevent duplicate event recording. Use this to safely retry requests without creating duplicate usage records. | -| `entity_id` | *Optional[str]* | :heavy_minus_sign: | If using [entity balances](/features/feature-entities) (eg, seats), the entity ID to track usage for. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackresponse.md b/others/python-sdk/docs/models/balancestrackresponse.md deleted file mode 100644 index 727590b14..000000000 --- a/others/python-sdk/docs/models/balancestrackresponse.md +++ /dev/null @@ -1,15 +0,0 @@ -# BalancesTrackResponse - -OK - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer | -| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity (if provided) | -| `event_name` | *Optional[str]* | :heavy_minus_sign: | The name of the event | -| `value` | *float* | :heavy_check_mark: | N/A | -| `balance` | [Nullable[models.BalancesTrackBalance]](../models/balancestrackbalance.md) | :heavy_check_mark: | N/A | -| `balances` | Dict[str, [models.BalancesTrackBalances](../models/balancestrackbalances.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackrollover.md b/others/python-sdk/docs/models/balancestrackrollover.md deleted file mode 100644 index 28c88bd9e..000000000 --- a/others/python-sdk/docs/models/balancestrackrollover.md +++ /dev/null @@ -1,9 +0,0 @@ -# BalancesTrackRollover - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `balance` | *float* | :heavy_check_mark: | N/A | -| `expires_at` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancesupdaterequest.md b/others/python-sdk/docs/models/balancesupdaterequest.md deleted file mode 100644 index 366ee3e76..000000000 --- a/others/python-sdk/docs/models/balancesupdaterequest.md +++ /dev/null @@ -1,17 +0,0 @@ -# BalancesUpdateRequest - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer. | -| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity to update balance for (if using entity balances). | -| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature to update balance for. | -| `current_balance` | *Optional[float]* | :heavy_minus_sign: | The new balance value to set. | -| `interval` | [Optional[models.BalancesUpdateInterval]](../models/balancesupdateinterval.md) | :heavy_minus_sign: | The interval to update balance for. | -| `granted_balance` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `usage` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `customer_entitlement_id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `next_reset_at` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `add_to_balance` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingattachbillingbehavior.md b/others/python-sdk/docs/models/billingattachbillingbehavior.md index 1bf4fbb12..65926ef8f 100644 --- a/others/python-sdk/docs/models/billingattachbillingbehavior.md +++ b/others/python-sdk/docs/models/billingattachbillingbehavior.md @@ -1,5 +1,7 @@ # BillingAttachBillingBehavior +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. + ## Values diff --git a/others/python-sdk/docs/models/billingattachcode.md b/others/python-sdk/docs/models/billingattachcode.md index 9c7a2e760..c6c73c534 100644 --- a/others/python-sdk/docs/models/billingattachcode.md +++ b/others/python-sdk/docs/models/billingattachcode.md @@ -1,5 +1,7 @@ # BillingAttachCode +The type of action required to complete the payment. + ## Values diff --git a/others/python-sdk/docs/models/billingattachdiscount1.md b/others/python-sdk/docs/models/billingattachdiscount1.md index cddb4200f..b0b37a76f 100644 --- a/others/python-sdk/docs/models/billingattachdiscount1.md +++ b/others/python-sdk/docs/models/billingattachdiscount1.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `reward_id` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| `reward_id` | *str* | :heavy_check_mark: | The ID of the reward to apply as a discount. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingattachdiscount2.md b/others/python-sdk/docs/models/billingattachdiscount2.md index a9ad82b8b..d25dcb496 100644 --- a/others/python-sdk/docs/models/billingattachdiscount2.md +++ b/others/python-sdk/docs/models/billingattachdiscount2.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `promotion_code` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `promotion_code` | *str* | :heavy_check_mark: | The promotion code to apply as a discount. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingattachdiscountunion.md b/others/python-sdk/docs/models/billingattachdiscountunion.md index fb376da54..0dd81e207 100644 --- a/others/python-sdk/docs/models/billingattachdiscountunion.md +++ b/others/python-sdk/docs/models/billingattachdiscountunion.md @@ -1,5 +1,7 @@ # BillingAttachDiscountUnion +A discount to apply. Can be either a reward ID or a promotion code. + ## Supported Types diff --git a/others/python-sdk/docs/models/billingupdatefeaturequantities.md b/others/python-sdk/docs/models/billingattachfeaturequantity.md similarity index 93% rename from others/python-sdk/docs/models/billingupdatefeaturequantities.md rename to others/python-sdk/docs/models/billingattachfeaturequantity.md index bdb07ec26..486e96a2c 100644 --- a/others/python-sdk/docs/models/billingupdatefeaturequantities.md +++ b/others/python-sdk/docs/models/billingattachfeaturequantity.md @@ -1,4 +1,4 @@ -# BillingUpdateFeatureQuantities +# BillingAttachFeatureQuantity ## Fields diff --git a/others/python-sdk/docs/models/billingattachinvoice.md b/others/python-sdk/docs/models/billingattachinvoice.md index 07a1b788d..b396a7b81 100644 --- a/others/python-sdk/docs/models/billingattachinvoice.md +++ b/others/python-sdk/docs/models/billingattachinvoice.md @@ -1,12 +1,14 @@ # BillingAttachInvoice +Invoice details if an invoice was created. Only present when a charge was made. + ## Fields -| Field | Type | Required | Description | -| -------------------- | -------------------- | -------------------- | -------------------- | -| `status` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `stripe_id` | *str* | :heavy_check_mark: | N/A | -| `total` | *float* | :heavy_check_mark: | N/A | -| `currency` | *str* | :heavy_check_mark: | N/A | -| `hosted_invoice_url` | *Nullable[str]* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| `status` | *Nullable[str]* | :heavy_check_mark: | The status of the invoice (e.g., 'paid', 'open', 'draft'). | +| `stripe_id` | *str* | :heavy_check_mark: | The Stripe invoice ID. | +| `total` | *float* | :heavy_check_mark: | The total amount of the invoice in cents. | +| `currency` | *str* | :heavy_check_mark: | The three-letter ISO currency code (e.g., 'usd'). | +| `hosted_invoice_url` | *Nullable[str]* | :heavy_check_mark: | URL to the hosted invoice page where the customer can view and pay the invoice. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingattachinvoicemode.md b/others/python-sdk/docs/models/billingattachinvoicemode.md index 0b75ef8b0..51e603568 100644 --- a/others/python-sdk/docs/models/billingattachinvoicemode.md +++ b/others/python-sdk/docs/models/billingattachinvoicemode.md @@ -1,10 +1,12 @@ # BillingAttachInvoiceMode +Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + ## Fields -| Field | Type | Required | Description | -| ------------------------- | ------------------------- | ------------------------- | ------------------------- | -| `enabled` | *bool* | :heavy_check_mark: | N/A | -| `enable_plan_immediately` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `finalize` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `enabled` | *bool* | :heavy_check_mark: | When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. | +| `enable_plan_immediately` | *Optional[bool]* | :heavy_minus_sign: | If true, enables the plan immediately even though the invoice is not paid yet. | +| `finalize` | *Optional[bool]* | :heavy_minus_sign: | If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingattachplanschedule.md b/others/python-sdk/docs/models/billingattachplanschedule.md index 99e55f2bd..ae7e98ddb 100644 --- a/others/python-sdk/docs/models/billingattachplanschedule.md +++ b/others/python-sdk/docs/models/billingattachplanschedule.md @@ -1,5 +1,7 @@ # BillingAttachPlanSchedule +When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + ## Values diff --git a/others/python-sdk/docs/models/billingattachredirectmode.md b/others/python-sdk/docs/models/billingattachredirectmode.md deleted file mode 100644 index 68d694191..000000000 --- a/others/python-sdk/docs/models/billingattachredirectmode.md +++ /dev/null @@ -1,10 +0,0 @@ -# BillingAttachRedirectMode - - -## Values - -| Name | Value | -| ------------- | ------------- | -| `ALWAYS` | always | -| `IF_REQUIRED` | if_required | -| `NEVER` | never | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingattachrequiredaction.md b/others/python-sdk/docs/models/billingattachrequiredaction.md index 75397cd8d..5f3fb0c03 100644 --- a/others/python-sdk/docs/models/billingattachrequiredaction.md +++ b/others/python-sdk/docs/models/billingattachrequiredaction.md @@ -1,9 +1,11 @@ # BillingAttachRequiredAction +Details about any action required to complete the payment. Present when the payment could not be processed automatically. + ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `code` | [models.BillingAttachCode](../models/billingattachcode.md) | :heavy_check_mark: | N/A | -| `reason` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `code` | [models.BillingAttachCode](../models/billingattachcode.md) | :heavy_check_mark: | The type of action required to complete the payment. | +| `reason` | *str* | :heavy_check_mark: | A human-readable explanation of why this action is required. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingattachresponse.md b/others/python-sdk/docs/models/billingattachresponse.md index bb33ae9b3..476b0cefe 100644 --- a/others/python-sdk/docs/models/billingattachresponse.md +++ b/others/python-sdk/docs/models/billingattachresponse.md @@ -5,10 +5,10 @@ OK ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `customer_id` | *str* | :heavy_check_mark: | N/A | -| `entity_id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `invoice` | [Optional[models.BillingAttachInvoice]](../models/billingattachinvoice.md) | :heavy_minus_sign: | N/A | -| `payment_url` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `required_action` | [Optional[models.BillingAttachRequiredAction]](../models/billingattachrequiredaction.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity, if the plan was attached to an entity. | +| `invoice` | [Optional[models.BillingAttachInvoice]](../models/billingattachinvoice.md) | :heavy_minus_sign: | Invoice details if an invoice was created. Only present when a charge was made. | +| `payment_url` | *Nullable[str]* | :heavy_check_mark: | URL to redirect the customer to complete payment. Null if no payment action is required. | +| `required_action` | [Optional[models.BillingAttachRequiredAction]](../models/billingattachrequiredaction.md) | :heavy_minus_sign: | Details about any action required to complete the payment. Present when the payment could not be processed automatically. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachbillingbehavior.md b/others/python-sdk/docs/models/billingpreviewattachbillingbehavior.md deleted file mode 100644 index 285c5b2e6..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachbillingbehavior.md +++ /dev/null @@ -1,9 +0,0 @@ -# BillingPreviewAttachBillingBehavior - - -## Values - -| Name | Value | -| --------------------- | --------------------- | -| `PRORATE_IMMEDIATELY` | prorate_immediately | -| `NEXT_CYCLE_ONLY` | next_cycle_only | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachcustomize.md b/others/python-sdk/docs/models/billingpreviewattachcustomize.md deleted file mode 100644 index 1de1e485a..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachcustomize.md +++ /dev/null @@ -1,11 +0,0 @@ -# BillingPreviewAttachCustomize - -Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| `price` | [OptionalNullable[models.BillingPreviewAttachPriceRequest]](../models/billingpreviewattachpricerequest.md) | :heavy_minus_sign: | N/A | -| `items` | List[[models.BillingPreviewAttachItem](../models/billingpreviewattachitem.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachcustomizereset.md b/others/python-sdk/docs/models/billingpreviewattachcustomizereset.md deleted file mode 100644 index ab8511486..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachcustomizereset.md +++ /dev/null @@ -1,9 +0,0 @@ -# BillingPreviewAttachCustomizeReset - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `interval` | [models.BillingPreviewAttachItemResetInterval](../models/billingpreviewattachitemresetinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachdiscountrequest1.md b/others/python-sdk/docs/models/billingpreviewattachdiscountrequest1.md deleted file mode 100644 index bf721b666..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachdiscountrequest1.md +++ /dev/null @@ -1,8 +0,0 @@ -# BillingPreviewAttachDiscountRequest1 - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `reward_id` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachdiscountrequest2.md b/others/python-sdk/docs/models/billingpreviewattachdiscountrequest2.md deleted file mode 100644 index 54c14a87b..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachdiscountrequest2.md +++ /dev/null @@ -1,8 +0,0 @@ -# BillingPreviewAttachDiscountRequest2 - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `promotion_code` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachdiscountunion.md b/others/python-sdk/docs/models/billingpreviewattachdiscountunion.md deleted file mode 100644 index 0b9e534bb..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachdiscountunion.md +++ /dev/null @@ -1,17 +0,0 @@ -# BillingPreviewAttachDiscountUnion - - -## Supported Types - -### `models.BillingPreviewAttachDiscountRequest1` - -```python -value: models.BillingPreviewAttachDiscountRequest1 = /* values here */ -``` - -### `models.BillingPreviewAttachDiscountRequest2` - -```python -value: models.BillingPreviewAttachDiscountRequest2 = /* values here */ -``` - diff --git a/others/python-sdk/docs/models/billingpreviewattacheffectiveperiod.md b/others/python-sdk/docs/models/billingpreviewattacheffectiveperiod.md deleted file mode 100644 index 7e56c717a..000000000 --- a/others/python-sdk/docs/models/billingpreviewattacheffectiveperiod.md +++ /dev/null @@ -1,9 +0,0 @@ -# BillingPreviewAttachEffectivePeriod - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `start` | *float* | :heavy_check_mark: | N/A | -| `end` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachfreetrial.md b/others/python-sdk/docs/models/billingpreviewattachfreetrial.md deleted file mode 100644 index 7232ac27c..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachfreetrial.md +++ /dev/null @@ -1,10 +0,0 @@ -# BillingPreviewAttachFreeTrial - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `duration_length` | *float* | :heavy_check_mark: | N/A | -| `duration_type` | [Optional[models.BillingPreviewAttachDurationType]](../models/billingpreviewattachdurationtype.md) | :heavy_minus_sign: | N/A | -| `card_required` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachglobals.md b/others/python-sdk/docs/models/billingpreviewattachglobals.md deleted file mode 100644 index 53bf1dc4d..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachglobals.md +++ /dev/null @@ -1,8 +0,0 @@ -# BillingPreviewAttachGlobals - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachinvoicemode.md b/others/python-sdk/docs/models/billingpreviewattachinvoicemode.md deleted file mode 100644 index f902b8353..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachinvoicemode.md +++ /dev/null @@ -1,10 +0,0 @@ -# BillingPreviewAttachInvoiceMode - - -## Fields - -| Field | Type | Required | Description | -| ------------------------- | ------------------------- | ------------------------- | ------------------------- | -| `enabled` | *bool* | :heavy_check_mark: | N/A | -| `enable_plan_immediately` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `finalize` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachitem.md b/others/python-sdk/docs/models/billingpreviewattachitem.md deleted file mode 100644 index c1f7bed5e..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachitem.md +++ /dev/null @@ -1,14 +0,0 @@ -# BillingPreviewAttachItem - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `included` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `reset` | [Optional[models.BillingPreviewAttachCustomizeReset]](../models/billingpreviewattachcustomizereset.md) | :heavy_minus_sign: | N/A | -| `price` | [Optional[models.BillingPreviewAttachItemPrice]](../models/billingpreviewattachitemprice.md) | :heavy_minus_sign: | N/A | -| `proration` | [Optional[models.BillingPreviewAttachProration]](../models/billingpreviewattachproration.md) | :heavy_minus_sign: | N/A | -| `rollover` | [Optional[models.BillingPreviewAttachRolloverRequest]](../models/billingpreviewattachrolloverrequest.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachitemprice.md b/others/python-sdk/docs/models/billingpreviewattachitemprice.md deleted file mode 100644 index 3fa0e4182..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachitemprice.md +++ /dev/null @@ -1,14 +0,0 @@ -# BillingPreviewAttachItemPrice - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `tiers` | List[[models.BillingPreviewAttachTierRequest](../models/billingpreviewattachtierrequest.md)] | :heavy_minus_sign: | N/A | -| `interval` | [models.BillingPreviewAttachItemPriceInterval](../models/billingpreviewattachitempriceinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `billing_units` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `billing_method` | [models.BillingPreviewAttachBillingMethodRequest](../models/billingpreviewattachbillingmethodrequest.md) | :heavy_check_mark: | N/A | -| `max_purchase` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachitemresetinterval.md b/others/python-sdk/docs/models/billingpreviewattachitemresetinterval.md deleted file mode 100644 index 9d1304b37..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachitemresetinterval.md +++ /dev/null @@ -1,16 +0,0 @@ -# BillingPreviewAttachItemResetInterval - - -## 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 | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachlineitem.md b/others/python-sdk/docs/models/billingpreviewattachlineitem.md deleted file mode 100644 index aa563a5ea..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachlineitem.md +++ /dev/null @@ -1,17 +0,0 @@ -# BillingPreviewAttachLineItem - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `title` | *str* | :heavy_check_mark: | N/A | -| `description` | *str* | :heavy_check_mark: | N/A | -| `amount` | *float* | :heavy_check_mark: | N/A | -| `discounts` | List[[models.BillingPreviewAttachDiscountResponse](../models/billingpreviewattachdiscountresponse.md)] | :heavy_minus_sign: | N/A | -| `plan_id` | *str* | :heavy_check_mark: | N/A | -| `total_quantity` | *float* | :heavy_check_mark: | N/A | -| `paid_quantity` | *float* | :heavy_check_mark: | N/A | -| `deferred_for_trial` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `effective_period` | [Optional[models.BillingPreviewAttachEffectivePeriod]](../models/billingpreviewattacheffectiveperiod.md) | :heavy_minus_sign: | N/A | -| `is_base` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachnextcycle.md b/others/python-sdk/docs/models/billingpreviewattachnextcycle.md deleted file mode 100644 index e053c1ef2..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachnextcycle.md +++ /dev/null @@ -1,10 +0,0 @@ -# BillingPreviewAttachNextCycle - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `starts_at` | *float* | :heavy_check_mark: | N/A | -| `total` | *float* | :heavy_check_mark: | N/A | -| `line_items` | List[[models.BillingPreviewAttachNextCycleLineItem](../models/billingpreviewattachnextcyclelineitem.md)] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachnextcyclediscount.md b/others/python-sdk/docs/models/billingpreviewattachnextcyclediscount.md deleted file mode 100644 index c7b9e6fbd..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachnextcyclediscount.md +++ /dev/null @@ -1,11 +0,0 @@ -# BillingPreviewAttachNextCycleDiscount - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `amount_off` | *float* | :heavy_check_mark: | N/A | -| `percent_off` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `stripe_coupon_id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `coupon_name` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachnextcyclelineitem.md b/others/python-sdk/docs/models/billingpreviewattachnextcyclelineitem.md deleted file mode 100644 index 21ec8c900..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachnextcyclelineitem.md +++ /dev/null @@ -1,17 +0,0 @@ -# BillingPreviewAttachNextCycleLineItem - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -| `title` | *str* | :heavy_check_mark: | N/A | -| `description` | *str* | :heavy_check_mark: | N/A | -| `amount` | *float* | :heavy_check_mark: | N/A | -| `discounts` | List[[models.BillingPreviewAttachNextCycleDiscount](../models/billingpreviewattachnextcyclediscount.md)] | :heavy_minus_sign: | N/A | -| `plan_id` | *str* | :heavy_check_mark: | N/A | -| `total_quantity` | *float* | :heavy_check_mark: | N/A | -| `paid_quantity` | *float* | :heavy_check_mark: | N/A | -| `deferred_for_trial` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `effective_period` | [Optional[models.BillingPreviewAttachNextCycleEffectivePeriod]](../models/billingpreviewattachnextcycleeffectiveperiod.md) | :heavy_minus_sign: | N/A | -| `is_base` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachplanschedule.md b/others/python-sdk/docs/models/billingpreviewattachplanschedule.md deleted file mode 100644 index 8166539b3..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachplanschedule.md +++ /dev/null @@ -1,9 +0,0 @@ -# BillingPreviewAttachPlanSchedule - - -## Values - -| Name | Value | -| -------------- | -------------- | -| `IMMEDIATE` | immediate | -| `END_OF_CYCLE` | end_of_cycle | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachredirectmode.md b/others/python-sdk/docs/models/billingpreviewattachredirectmode.md deleted file mode 100644 index 54804abca..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachredirectmode.md +++ /dev/null @@ -1,10 +0,0 @@ -# BillingPreviewAttachRedirectMode - - -## Values - -| Name | Value | -| ------------- | ------------- | -| `ALWAYS` | always | -| `IF_REQUIRED` | if_required | -| `NEVER` | never | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachresponse.md b/others/python-sdk/docs/models/billingpreviewattachresponse.md deleted file mode 100644 index 96a1ad2e7..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachresponse.md +++ /dev/null @@ -1,19 +0,0 @@ -# BillingPreviewAttachResponse - -OK - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `customer_id` | *str* | :heavy_check_mark: | N/A | -| `line_items` | List[[models.BillingPreviewAttachLineItem](../models/billingpreviewattachlineitem.md)] | :heavy_check_mark: | N/A | -| `total` | *float* | :heavy_check_mark: | N/A | -| `currency` | *str* | :heavy_check_mark: | N/A | -| `period_start` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `period_end` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `next_cycle` | [Optional[models.BillingPreviewAttachNextCycle]](../models/billingpreviewattachnextcycle.md) | :heavy_minus_sign: | N/A | -| `incoming` | List[[models.Incoming](../models/incoming.md)] | :heavy_check_mark: | N/A | -| `outgoing` | List[[models.Outgoing](../models/outgoing.md)] | :heavy_check_mark: | N/A | -| `redirect_type` | [Nullable[models.RedirectType]](../models/redirecttype.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachrolloverrequest.md b/others/python-sdk/docs/models/billingpreviewattachrolloverrequest.md deleted file mode 100644 index 4feb602a2..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachrolloverrequest.md +++ /dev/null @@ -1,10 +0,0 @@ -# BillingPreviewAttachRolloverRequest - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| `max` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `expiry_duration_type` | [models.BillingPreviewAttachExpiryDurationType](../models/billingpreviewattachexpirydurationtype.md) | :heavy_check_mark: | N/A | -| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachtierrequest.md b/others/python-sdk/docs/models/billingpreviewattachtierrequest.md deleted file mode 100644 index 2f9d2c039..000000000 --- a/others/python-sdk/docs/models/billingpreviewattachtierrequest.md +++ /dev/null @@ -1,9 +0,0 @@ -# BillingPreviewAttachTierRequest - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `to` | [models.BillingPreviewAttachTo](../models/billingpreviewattachto.md) | :heavy_check_mark: | N/A | -| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdatebillingbehavior.md b/others/python-sdk/docs/models/billingpreviewupdatebillingbehavior.md deleted file mode 100644 index 5fb6e8527..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdatebillingbehavior.md +++ /dev/null @@ -1,9 +0,0 @@ -# BillingPreviewUpdateBillingBehavior - - -## Values - -| Name | Value | -| --------------------- | --------------------- | -| `PRORATE_IMMEDIATELY` | prorate_immediately | -| `NEXT_CYCLE_ONLY` | next_cycle_only | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdatebillingmethod.md b/others/python-sdk/docs/models/billingpreviewupdatebillingmethod.md deleted file mode 100644 index 6b94ed473..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdatebillingmethod.md +++ /dev/null @@ -1,9 +0,0 @@ -# BillingPreviewUpdateBillingMethod - - -## Values - -| Name | Value | -| ------------- | ------------- | -| `PREPAID` | prepaid | -| `USAGE_BASED` | usage_based | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdatecustomize.md b/others/python-sdk/docs/models/billingpreviewupdatecustomize.md deleted file mode 100644 index bef2b01e8..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdatecustomize.md +++ /dev/null @@ -1,11 +0,0 @@ -# BillingPreviewUpdateCustomize - -Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `price` | [OptionalNullable[models.BillingPreviewUpdatePrice]](../models/billingpreviewupdateprice.md) | :heavy_minus_sign: | N/A | -| `items` | List[[models.BillingPreviewUpdateItem](../models/billingpreviewupdateitem.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdateeffectiveperiod.md b/others/python-sdk/docs/models/billingpreviewupdateeffectiveperiod.md deleted file mode 100644 index 68822ab1a..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdateeffectiveperiod.md +++ /dev/null @@ -1,9 +0,0 @@ -# BillingPreviewUpdateEffectivePeriod - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `start` | *float* | :heavy_check_mark: | N/A | -| `end` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdatefreetrial.md b/others/python-sdk/docs/models/billingpreviewupdatefreetrial.md deleted file mode 100644 index 9616912d5..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdatefreetrial.md +++ /dev/null @@ -1,10 +0,0 @@ -# BillingPreviewUpdateFreeTrial - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `duration_length` | *float* | :heavy_check_mark: | N/A | -| `duration_type` | [Optional[models.BillingPreviewUpdateDurationType]](../models/billingpreviewupdatedurationtype.md) | :heavy_minus_sign: | N/A | -| `card_required` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdateglobals.md b/others/python-sdk/docs/models/billingpreviewupdateglobals.md deleted file mode 100644 index 8c960b0a5..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdateglobals.md +++ /dev/null @@ -1,8 +0,0 @@ -# BillingPreviewUpdateGlobals - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdateinvoicemode.md b/others/python-sdk/docs/models/billingpreviewupdateinvoicemode.md deleted file mode 100644 index bc1702520..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdateinvoicemode.md +++ /dev/null @@ -1,10 +0,0 @@ -# BillingPreviewUpdateInvoiceMode - - -## Fields - -| Field | Type | Required | Description | -| ------------------------- | ------------------------- | ------------------------- | ------------------------- | -| `enabled` | *bool* | :heavy_check_mark: | N/A | -| `enable_plan_immediately` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `finalize` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdateitem.md b/others/python-sdk/docs/models/billingpreviewupdateitem.md deleted file mode 100644 index fb5fe349e..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdateitem.md +++ /dev/null @@ -1,14 +0,0 @@ -# BillingPreviewUpdateItem - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `included` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `reset` | [Optional[models.BillingPreviewUpdateReset]](../models/billingpreviewupdatereset.md) | :heavy_minus_sign: | N/A | -| `price` | [Optional[models.BillingPreviewUpdateItemPrice]](../models/billingpreviewupdateitemprice.md) | :heavy_minus_sign: | N/A | -| `proration` | [Optional[models.BillingPreviewUpdateProration]](../models/billingpreviewupdateproration.md) | :heavy_minus_sign: | N/A | -| `rollover` | [Optional[models.BillingPreviewUpdateRollover]](../models/billingpreviewupdaterollover.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdateitemprice.md b/others/python-sdk/docs/models/billingpreviewupdateitemprice.md deleted file mode 100644 index ce8d7481a..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdateitemprice.md +++ /dev/null @@ -1,14 +0,0 @@ -# BillingPreviewUpdateItemPrice - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `tiers` | List[[models.BillingPreviewUpdateTier](../models/billingpreviewupdatetier.md)] | :heavy_minus_sign: | N/A | -| `interval` | [models.BillingPreviewUpdateItemPriceInterval](../models/billingpreviewupdateitempriceinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `billing_units` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `billing_method` | [models.BillingPreviewUpdateBillingMethod](../models/billingpreviewupdatebillingmethod.md) | :heavy_check_mark: | N/A | -| `max_purchase` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdatelineitem.md b/others/python-sdk/docs/models/billingpreviewupdatelineitem.md deleted file mode 100644 index 7c3eb9d1b..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdatelineitem.md +++ /dev/null @@ -1,17 +0,0 @@ -# BillingPreviewUpdateLineItem - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `title` | *str* | :heavy_check_mark: | N/A | -| `description` | *str* | :heavy_check_mark: | N/A | -| `amount` | *float* | :heavy_check_mark: | N/A | -| `discounts` | List[[models.BillingPreviewUpdateDiscount](../models/billingpreviewupdatediscount.md)] | :heavy_minus_sign: | N/A | -| `plan_id` | *str* | :heavy_check_mark: | N/A | -| `total_quantity` | *float* | :heavy_check_mark: | N/A | -| `paid_quantity` | *float* | :heavy_check_mark: | N/A | -| `deferred_for_trial` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `effective_period` | [Optional[models.BillingPreviewUpdateEffectivePeriod]](../models/billingpreviewupdateeffectiveperiod.md) | :heavy_minus_sign: | N/A | -| `is_base` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdatenextcycle.md b/others/python-sdk/docs/models/billingpreviewupdatenextcycle.md deleted file mode 100644 index eaf265b55..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdatenextcycle.md +++ /dev/null @@ -1,10 +0,0 @@ -# BillingPreviewUpdateNextCycle - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `starts_at` | *float* | :heavy_check_mark: | N/A | -| `total` | *float* | :heavy_check_mark: | N/A | -| `line_items` | List[[models.BillingPreviewUpdateNextCycleLineItem](../models/billingpreviewupdatenextcyclelineitem.md)] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdatenextcyclediscount.md b/others/python-sdk/docs/models/billingpreviewupdatenextcyclediscount.md deleted file mode 100644 index 287eab3b7..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdatenextcyclediscount.md +++ /dev/null @@ -1,11 +0,0 @@ -# BillingPreviewUpdateNextCycleDiscount - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `amount_off` | *float* | :heavy_check_mark: | N/A | -| `percent_off` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `stripe_coupon_id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `coupon_name` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdatenextcycleeffectiveperiod.md b/others/python-sdk/docs/models/billingpreviewupdatenextcycleeffectiveperiod.md deleted file mode 100644 index c76c45173..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdatenextcycleeffectiveperiod.md +++ /dev/null @@ -1,9 +0,0 @@ -# BillingPreviewUpdateNextCycleEffectivePeriod - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `start` | *float* | :heavy_check_mark: | N/A | -| `end` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdatenextcyclelineitem.md b/others/python-sdk/docs/models/billingpreviewupdatenextcyclelineitem.md deleted file mode 100644 index 810e17cab..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdatenextcyclelineitem.md +++ /dev/null @@ -1,17 +0,0 @@ -# BillingPreviewUpdateNextCycleLineItem - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -| `title` | *str* | :heavy_check_mark: | N/A | -| `description` | *str* | :heavy_check_mark: | N/A | -| `amount` | *float* | :heavy_check_mark: | N/A | -| `discounts` | List[[models.BillingPreviewUpdateNextCycleDiscount](../models/billingpreviewupdatenextcyclediscount.md)] | :heavy_minus_sign: | N/A | -| `plan_id` | *str* | :heavy_check_mark: | N/A | -| `total_quantity` | *float* | :heavy_check_mark: | N/A | -| `paid_quantity` | *float* | :heavy_check_mark: | N/A | -| `deferred_for_trial` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `effective_period` | [Optional[models.BillingPreviewUpdateNextCycleEffectivePeriod]](../models/billingpreviewupdatenextcycleeffectiveperiod.md) | :heavy_minus_sign: | N/A | -| `is_base` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdateprice.md b/others/python-sdk/docs/models/billingpreviewupdateprice.md deleted file mode 100644 index f67aa52a6..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdateprice.md +++ /dev/null @@ -1,10 +0,0 @@ -# BillingPreviewUpdatePrice - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `amount` | *float* | :heavy_check_mark: | N/A | -| `interval` | [models.BillingPreviewUpdatePriceInterval](../models/billingpreviewupdatepriceinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdatereset.md b/others/python-sdk/docs/models/billingpreviewupdatereset.md deleted file mode 100644 index 4f8919a3f..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdatereset.md +++ /dev/null @@ -1,9 +0,0 @@ -# BillingPreviewUpdateReset - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `interval` | [models.BillingPreviewUpdateResetInterval](../models/billingpreviewupdateresetinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdateresetinterval.md b/others/python-sdk/docs/models/billingpreviewupdateresetinterval.md deleted file mode 100644 index 9311e90cd..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdateresetinterval.md +++ /dev/null @@ -1,16 +0,0 @@ -# BillingPreviewUpdateResetInterval - - -## 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 | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdateresponse.md b/others/python-sdk/docs/models/billingpreviewupdateresponse.md deleted file mode 100644 index 8c8203a5d..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdateresponse.md +++ /dev/null @@ -1,16 +0,0 @@ -# BillingPreviewUpdateResponse - -OK - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `customer_id` | *str* | :heavy_check_mark: | N/A | -| `line_items` | List[[models.BillingPreviewUpdateLineItem](../models/billingpreviewupdatelineitem.md)] | :heavy_check_mark: | N/A | -| `total` | *float* | :heavy_check_mark: | N/A | -| `currency` | *str* | :heavy_check_mark: | N/A | -| `period_start` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `period_end` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `next_cycle` | [Optional[models.BillingPreviewUpdateNextCycle]](../models/billingpreviewupdatenextcycle.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdaterollover.md b/others/python-sdk/docs/models/billingpreviewupdaterollover.md deleted file mode 100644 index 59947eefd..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdaterollover.md +++ /dev/null @@ -1,10 +0,0 @@ -# BillingPreviewUpdateRollover - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| `max` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `expiry_duration_type` | [models.BillingPreviewUpdateExpiryDurationType](../models/billingpreviewupdateexpirydurationtype.md) | :heavy_check_mark: | N/A | -| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdatetier.md b/others/python-sdk/docs/models/billingpreviewupdatetier.md deleted file mode 100644 index cfc1eff48..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdatetier.md +++ /dev/null @@ -1,9 +0,0 @@ -# BillingPreviewUpdateTier - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `to` | [models.BillingPreviewUpdateTo](../models/billingpreviewupdateto.md) | :heavy_check_mark: | N/A | -| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdateto.md b/others/python-sdk/docs/models/billingpreviewupdateto.md deleted file mode 100644 index a8d74c661..000000000 --- a/others/python-sdk/docs/models/billingpreviewupdateto.md +++ /dev/null @@ -1,17 +0,0 @@ -# BillingPreviewUpdateTo - - -## Supported Types - -### `float` - -```python -value: float = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` - diff --git a/others/python-sdk/docs/models/billingsetuppaymentglobals.md b/others/python-sdk/docs/models/billingsetuppaymentglobals.md deleted file mode 100644 index ddf278680..000000000 --- a/others/python-sdk/docs/models/billingsetuppaymentglobals.md +++ /dev/null @@ -1,8 +0,0 @@ -# BillingSetupPaymentGlobals - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingsetuppaymentrequest.md b/others/python-sdk/docs/models/billingsetuppaymentrequest.md deleted file mode 100644 index dcf636247..000000000 --- a/others/python-sdk/docs/models/billingsetuppaymentrequest.md +++ /dev/null @@ -1,11 +0,0 @@ -# BillingSetupPaymentRequest - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer | -| `success_url` | *Optional[str]* | :heavy_minus_sign: | URL to redirect to after successful payment setup. Must start with either http:// or https:// | -| `customer_data` | [Optional[models.CustomerData]](../models/customerdata.md) | :heavy_minus_sign: | Customer details to set when creating a customer | -| `checkout_session_params` | Dict[str, *Any*] | :heavy_minus_sign: | Additional parameters for the checkout session | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingsetuppaymentresponse.md b/others/python-sdk/docs/models/billingsetuppaymentresponse.md deleted file mode 100644 index 083221455..000000000 --- a/others/python-sdk/docs/models/billingsetuppaymentresponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# BillingSetupPaymentResponse - -OK - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------- | ----------------------------- | ----------------------------- | ----------------------------- | -| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer | -| `url` | *str* | :heavy_check_mark: | URL to the payment setup page | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingupdatebillingbehavior.md b/others/python-sdk/docs/models/billingupdatebillingbehavior.md index a8bbbb43e..6299d3db6 100644 --- a/others/python-sdk/docs/models/billingupdatebillingbehavior.md +++ b/others/python-sdk/docs/models/billingupdatebillingbehavior.md @@ -1,5 +1,7 @@ # BillingUpdateBillingBehavior +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. + ## Values diff --git a/others/python-sdk/docs/models/billingupdatecancelaction.md b/others/python-sdk/docs/models/billingupdatecancelaction.md index 09b284914..7e74a4b0d 100644 --- a/others/python-sdk/docs/models/billingupdatecancelaction.md +++ b/others/python-sdk/docs/models/billingupdatecancelaction.md @@ -1,5 +1,7 @@ # BillingUpdateCancelAction +Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. + ## Values diff --git a/others/python-sdk/docs/models/billingupdatecode.md b/others/python-sdk/docs/models/billingupdatecode.md index 7d9a46a3e..ed6a76be7 100644 --- a/others/python-sdk/docs/models/billingupdatecode.md +++ b/others/python-sdk/docs/models/billingupdatecode.md @@ -1,5 +1,7 @@ # BillingUpdateCode +The type of action required to complete the payment. + ## Values diff --git a/others/python-sdk/docs/models/billingattachfeaturequantities.md b/others/python-sdk/docs/models/billingupdatefeaturequantity.md similarity index 93% rename from others/python-sdk/docs/models/billingattachfeaturequantities.md rename to others/python-sdk/docs/models/billingupdatefeaturequantity.md index 3a3c926fd..086cc66c3 100644 --- a/others/python-sdk/docs/models/billingattachfeaturequantities.md +++ b/others/python-sdk/docs/models/billingupdatefeaturequantity.md @@ -1,4 +1,4 @@ -# BillingAttachFeatureQuantities +# BillingUpdateFeatureQuantity ## Fields diff --git a/others/python-sdk/docs/models/billingupdateinvoice.md b/others/python-sdk/docs/models/billingupdateinvoice.md index a45dfb5d0..ff3ddb6e2 100644 --- a/others/python-sdk/docs/models/billingupdateinvoice.md +++ b/others/python-sdk/docs/models/billingupdateinvoice.md @@ -1,12 +1,14 @@ # BillingUpdateInvoice +Invoice details if an invoice was created. Only present when a charge was made. + ## Fields -| Field | Type | Required | Description | -| -------------------- | -------------------- | -------------------- | -------------------- | -| `status` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `stripe_id` | *str* | :heavy_check_mark: | N/A | -| `total` | *float* | :heavy_check_mark: | N/A | -| `currency` | *str* | :heavy_check_mark: | N/A | -| `hosted_invoice_url` | *Nullable[str]* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| `status` | *Nullable[str]* | :heavy_check_mark: | The status of the invoice (e.g., 'paid', 'open', 'draft'). | +| `stripe_id` | *str* | :heavy_check_mark: | The Stripe invoice ID. | +| `total` | *float* | :heavy_check_mark: | The total amount of the invoice in cents. | +| `currency` | *str* | :heavy_check_mark: | The three-letter ISO currency code (e.g., 'usd'). | +| `hosted_invoice_url` | *Nullable[str]* | :heavy_check_mark: | URL to the hosted invoice page where the customer can view and pay the invoice. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingupdateinvoicemode.md b/others/python-sdk/docs/models/billingupdateinvoicemode.md index 47fb7c47e..ccc987c41 100644 --- a/others/python-sdk/docs/models/billingupdateinvoicemode.md +++ b/others/python-sdk/docs/models/billingupdateinvoicemode.md @@ -1,10 +1,12 @@ # BillingUpdateInvoiceMode +Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + ## Fields -| Field | Type | Required | Description | -| ------------------------- | ------------------------- | ------------------------- | ------------------------- | -| `enabled` | *bool* | :heavy_check_mark: | N/A | -| `enable_plan_immediately` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `finalize` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `enabled` | *bool* | :heavy_check_mark: | When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. | +| `enable_plan_immediately` | *Optional[bool]* | :heavy_minus_sign: | If true, enables the plan immediately even though the invoice is not paid yet. | +| `finalize` | *Optional[bool]* | :heavy_minus_sign: | If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingupdaterequiredaction.md b/others/python-sdk/docs/models/billingupdaterequiredaction.md index 44e7fc4f6..7c2077289 100644 --- a/others/python-sdk/docs/models/billingupdaterequiredaction.md +++ b/others/python-sdk/docs/models/billingupdaterequiredaction.md @@ -1,9 +1,11 @@ # BillingUpdateRequiredAction +Details about any action required to complete the payment. Present when the payment could not be processed automatically. + ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `code` | [models.BillingUpdateCode](../models/billingupdatecode.md) | :heavy_check_mark: | N/A | -| `reason` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `code` | [models.BillingUpdateCode](../models/billingupdatecode.md) | :heavy_check_mark: | The type of action required to complete the payment. | +| `reason` | *str* | :heavy_check_mark: | A human-readable explanation of why this action is required. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingupdateresponse.md b/others/python-sdk/docs/models/billingupdateresponse.md index 3da82cda0..1650d1362 100644 --- a/others/python-sdk/docs/models/billingupdateresponse.md +++ b/others/python-sdk/docs/models/billingupdateresponse.md @@ -5,10 +5,10 @@ OK ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `customer_id` | *str* | :heavy_check_mark: | N/A | -| `entity_id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `invoice` | [Optional[models.BillingUpdateInvoice]](../models/billingupdateinvoice.md) | :heavy_minus_sign: | N/A | -| `payment_url` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `required_action` | [Optional[models.BillingUpdateRequiredAction]](../models/billingupdaterequiredaction.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity, if the plan was attached to an entity. | +| `invoice` | [Optional[models.BillingUpdateInvoice]](../models/billingupdateinvoice.md) | :heavy_minus_sign: | Invoice details if an invoice was created. Only present when a charge was made. | +| `payment_url` | *Nullable[str]* | :heavy_check_mark: | URL to redirect the customer to complete payment. Null if no payment action is required. | +| `required_action` | [Optional[models.BillingUpdateRequiredAction]](../models/billingupdaterequiredaction.md) | :heavy_minus_sign: | Details about any action required to complete the payment. Present when the payment could not be processed automatically. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/binsize.md b/others/python-sdk/docs/models/binsize.md new file mode 100644 index 000000000..a5d47c7f4 --- /dev/null +++ b/others/python-sdk/docs/models/binsize.md @@ -0,0 +1,12 @@ +# BinSize + +Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day + + +## Values + +| Name | Value | +| ------- | ------- | +| `DAY` | day | +| `HOUR` | hour | +| `MONTH` | month | \ No newline at end of file diff --git a/others/python-sdk/docs/models/breakdown.md b/others/python-sdk/docs/models/breakdown.md index 849ebfe99..ca1c6be00 100644 --- a/others/python-sdk/docs/models/breakdown.md +++ b/others/python-sdk/docs/models/breakdown.md @@ -3,15 +3,15 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `plan_id` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `included_grant` | *float* | :heavy_check_mark: | N/A | -| `prepaid_grant` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `reset` | [Nullable[models.CustomerReset]](../models/customerreset.md) | :heavy_check_mark: | N/A | -| `price` | [Nullable[models.CustomerPrice]](../models/customerprice.md) | :heavy_check_mark: | N/A | -| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file +| 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.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. | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when this balance expires, or null for no expiration. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/checkbalance.md b/others/python-sdk/docs/models/checkbalance.md new file mode 100644 index 000000000..465340459 --- /dev/null +++ b/others/python-sdk/docs/models/checkbalance.md @@ -0,0 +1,18 @@ +# 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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/incomingdisplay.md b/others/python-sdk/docs/models/checkbalancedisplay.md similarity index 95% rename from others/python-sdk/docs/models/incomingdisplay.md rename to others/python-sdk/docs/models/checkbalancedisplay.md index b9af806bf..4b891928f 100644 --- a/others/python-sdk/docs/models/incomingdisplay.md +++ b/others/python-sdk/docs/models/checkbalancedisplay.md @@ -1,4 +1,4 @@ -# IncomingDisplay +# CheckBalanceDisplay ## Fields diff --git a/others/python-sdk/docs/models/balancescreateinterval.md b/others/python-sdk/docs/models/checkbalanceintervalenum.md similarity index 93% rename from others/python-sdk/docs/models/balancescreateinterval.md rename to others/python-sdk/docs/models/checkbalanceintervalenum.md index 21424f760..cb3be22c9 100644 --- a/others/python-sdk/docs/models/balancescreateinterval.md +++ b/others/python-sdk/docs/models/checkbalanceintervalenum.md @@ -1,4 +1,4 @@ -# BalancesCreateInterval +# CheckBalanceIntervalEnum ## Values diff --git a/others/python-sdk/docs/models/checkbalancerollover.md b/others/python-sdk/docs/models/checkbalancerollover.md new file mode 100644 index 000000000..e47cef89c --- /dev/null +++ b/others/python-sdk/docs/models/checkbalancerollover.md @@ -0,0 +1,9 @@ +# 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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackto.md b/others/python-sdk/docs/models/checkbalanceto.md similarity index 88% rename from others/python-sdk/docs/models/balancestrackto.md rename to others/python-sdk/docs/models/checkbalanceto.md index 75ea2c5c2..3e0c4375d 100644 --- a/others/python-sdk/docs/models/balancestrackto.md +++ b/others/python-sdk/docs/models/checkbalanceto.md @@ -1,4 +1,4 @@ -# BalancesTrackTo +# CheckBalanceTo ## Supported Types diff --git a/others/python-sdk/docs/models/incomingtype.md b/others/python-sdk/docs/models/checkbalancetype.md similarity index 91% rename from others/python-sdk/docs/models/incomingtype.md rename to others/python-sdk/docs/models/checkbalancetype.md index ae92c9243..49dea4216 100644 --- a/others/python-sdk/docs/models/incomingtype.md +++ b/others/python-sdk/docs/models/checkbalancetype.md @@ -1,4 +1,4 @@ -# IncomingType +# CheckBalanceType ## Values diff --git a/others/python-sdk/docs/models/balancescheckbillingmethod.md b/others/python-sdk/docs/models/checkbillingmethod.md similarity index 67% rename from others/python-sdk/docs/models/balancescheckbillingmethod.md rename to others/python-sdk/docs/models/checkbillingmethod.md index cacafefc7..323989686 100644 --- a/others/python-sdk/docs/models/balancescheckbillingmethod.md +++ b/others/python-sdk/docs/models/checkbillingmethod.md @@ -1,4 +1,6 @@ -# BalancesCheckBillingMethod +# CheckBillingMethod + +Whether usage is prepaid or billed pay-per-use. ## Values diff --git a/others/python-sdk/docs/models/checkbreakdown.md b/others/python-sdk/docs/models/checkbreakdown.md new file mode 100644 index 000000000..8e11a3e9d --- /dev/null +++ b/others/python-sdk/docs/models/checkbreakdown.md @@ -0,0 +1,17 @@ +# 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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/outgoingcreditschema.md b/others/python-sdk/docs/models/checkcreditschema.md similarity index 94% rename from others/python-sdk/docs/models/outgoingcreditschema.md rename to others/python-sdk/docs/models/checkcreditschema.md index 887de97a2..0e6b74028 100644 --- a/others/python-sdk/docs/models/outgoingcreditschema.md +++ b/others/python-sdk/docs/models/checkcreditschema.md @@ -1,4 +1,4 @@ -# OutgoingCreditSchema +# CheckCreditSchema ## Fields diff --git a/others/python-sdk/docs/models/balancescheckenv.md b/others/python-sdk/docs/models/checkenv.md similarity index 88% rename from others/python-sdk/docs/models/balancescheckenv.md rename to others/python-sdk/docs/models/checkenv.md index 72a9f3685..063b53ed4 100644 --- a/others/python-sdk/docs/models/balancescheckenv.md +++ b/others/python-sdk/docs/models/checkenv.md @@ -1,4 +1,4 @@ -# BalancesCheckEnv +# CheckEnv The environment of the product diff --git a/others/python-sdk/docs/models/checkfeature.md b/others/python-sdk/docs/models/checkfeature.md new file mode 100644 index 000000000..d89127c83 --- /dev/null +++ b/others/python-sdk/docs/models/checkfeature.md @@ -0,0 +1,17 @@ +# 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 | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescheckfreetrial.md b/others/python-sdk/docs/models/checkfreetrial.md similarity index 99% rename from others/python-sdk/docs/models/balancescheckfreetrial.md rename to others/python-sdk/docs/models/checkfreetrial.md index e11e94df0..90a109f36 100644 --- a/others/python-sdk/docs/models/balancescheckfreetrial.md +++ b/others/python-sdk/docs/models/checkfreetrial.md @@ -1,4 +1,4 @@ -# BalancesCheckFreeTrial +# CheckFreeTrial ## Fields diff --git a/others/python-sdk/docs/models/balancestrackglobals.md b/others/python-sdk/docs/models/checkglobals.md similarity index 92% rename from others/python-sdk/docs/models/balancestrackglobals.md rename to others/python-sdk/docs/models/checkglobals.md index 547fef9cd..db1b11678 100644 --- a/others/python-sdk/docs/models/balancestrackglobals.md +++ b/others/python-sdk/docs/models/checkglobals.md @@ -1,4 +1,4 @@ -# BalancesTrackGlobals +# CheckGlobals ## Fields diff --git a/others/python-sdk/docs/models/checkintervalunion.md b/others/python-sdk/docs/models/checkintervalunion.md new file mode 100644 index 000000000..52d72777c --- /dev/null +++ b/others/python-sdk/docs/models/checkintervalunion.md @@ -0,0 +1,19 @@ +# 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 */ +``` + diff --git a/others/python-sdk/docs/models/balancescheckitem.md b/others/python-sdk/docs/models/checkitem.md similarity index 99% rename from others/python-sdk/docs/models/balancescheckitem.md rename to others/python-sdk/docs/models/checkitem.md index 28504eb15..d04118b1e 100644 --- a/others/python-sdk/docs/models/balancescheckitem.md +++ b/others/python-sdk/docs/models/checkitem.md @@ -1,4 +1,4 @@ -# BalancesCheckItem +# CheckItem Product item defining features and pricing within a product diff --git a/others/python-sdk/docs/models/balancescheckondecrease.md b/others/python-sdk/docs/models/checkondecrease.md similarity index 93% rename from others/python-sdk/docs/models/balancescheckondecrease.md rename to others/python-sdk/docs/models/checkondecrease.md index b57bea718..924902d40 100644 --- a/others/python-sdk/docs/models/balancescheckondecrease.md +++ b/others/python-sdk/docs/models/checkondecrease.md @@ -1,4 +1,4 @@ -# BalancesCheckOnDecrease +# CheckOnDecrease ## Values diff --git a/others/python-sdk/docs/models/balancescheckonincrease.md b/others/python-sdk/docs/models/checkonincrease.md similarity index 92% rename from others/python-sdk/docs/models/balancescheckonincrease.md rename to others/python-sdk/docs/models/checkonincrease.md index 3ebc6debb..188c047ce 100644 --- a/others/python-sdk/docs/models/balancescheckonincrease.md +++ b/others/python-sdk/docs/models/checkonincrease.md @@ -1,4 +1,4 @@ -# BalancesCheckOnIncrease +# CheckOnIncrease ## Values diff --git a/others/python-sdk/docs/models/checkparams.md b/others/python-sdk/docs/models/checkparams.md new file mode 100644 index 000000000..8efeab8cd --- /dev/null +++ b/others/python-sdk/docs/models/checkparams.md @@ -0,0 +1,14 @@ +# CheckParams + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer. | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity for entity-scoped balances (e.g., per-seat limits). | +| `required_balance` | *Optional[float]* | :heavy_minus_sign: | Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1. | +| `properties` | Dict[str, *Any*] | :heavy_minus_sign: | Additional properties to attach to the usage event if send_event is true. | +| `send_event` | *Optional[bool]* | :heavy_minus_sign: | If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. | +| `with_preview` | *Optional[bool]* | :heavy_minus_sign: | If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/checkprice.md b/others/python-sdk/docs/models/checkprice.md new file mode 100644 index 000000000..fbbe049bf --- /dev/null +++ b/others/python-sdk/docs/models/checkprice.md @@ -0,0 +1,12 @@ +# 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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/properties.md b/others/python-sdk/docs/models/checkproperties.md similarity index 99% rename from others/python-sdk/docs/models/properties.md rename to others/python-sdk/docs/models/checkproperties.md index e0cb2a68e..882e7a947 100644 --- a/others/python-sdk/docs/models/properties.md +++ b/others/python-sdk/docs/models/checkproperties.md @@ -1,4 +1,4 @@ -# Properties +# CheckProperties ## Fields diff --git a/others/python-sdk/docs/models/checkreset.md b/others/python-sdk/docs/models/checkreset.md new file mode 100644 index 000000000..208fc3703 --- /dev/null +++ b/others/python-sdk/docs/models/checkreset.md @@ -0,0 +1,10 @@ +# CheckReset + + +## 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_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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/checkresponse.md b/others/python-sdk/docs/models/checkresponse.md new file mode 100644 index 000000000..a04088005 --- /dev/null +++ b/others/python-sdk/docs/models/checkresponse.md @@ -0,0 +1,15 @@ +# CheckResponse + +OK + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allowed` | *bool* | :heavy_check_mark: | Whether the customer is allowed to use the feature. True if they have sufficient balance or the feature is unlimited/boolean. | | +| `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. | {
"feature_id": "messages",
"granted": 100,
"remaining": 72,
"usage": 28,
"unlimited": false,
"overage_allowed": false,
"max_purchase": null,
"next_reset_at": 1773851121437,
"breakdown": [
{
"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV",
"plan_id": "pro_plan",
"included_grant": 100,
"prepaid_grant": 0,
"remaining": 72,
"usage": 28,
"unlimited": false,
"reset": {
"interval": "month",
"resets_at": 1773851121437
},
"price": null,
"expires_at": null
}
]
} | +| `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. | | \ No newline at end of file diff --git a/others/python-sdk/docs/models/checkscenario.md b/others/python-sdk/docs/models/checkscenario.md new file mode 100644 index 000000000..a3439416a --- /dev/null +++ b/others/python-sdk/docs/models/checkscenario.md @@ -0,0 +1,11 @@ +# CheckScenario + +The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `USAGE_LIMIT` | usage_limit | +| `FEATURE_FLAG` | feature_flag | \ No newline at end of file diff --git a/others/python-sdk/docs/models/checktier.md b/others/python-sdk/docs/models/checktier.md new file mode 100644 index 000000000..426e97b4b --- /dev/null +++ b/others/python-sdk/docs/models/checktier.md @@ -0,0 +1,9 @@ +# CheckTier + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | +| `to` | [models.CheckBalanceTo](../models/checkbalanceto.md) | :heavy_check_mark: | N/A | +| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/config.md b/others/python-sdk/docs/models/config.md index 052a40331..8129e4783 100644 --- a/others/python-sdk/docs/models/config.md +++ b/others/python-sdk/docs/models/config.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `rollover` | [OptionalNullable[models.ConfigRollover]](../models/configrollover.md) | :heavy_minus_sign: | N/A | -| `on_increase` | [OptionalNullable[models.BalancesCheckOnIncrease]](../models/balancescheckonincrease.md) | :heavy_minus_sign: | N/A | -| `on_decrease` | [OptionalNullable[models.BalancesCheckOnDecrease]](../models/balancescheckondecrease.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `rollover` | [OptionalNullable[models.ConfigRollover]](../models/configrollover.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 | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescheckglobals.md b/others/python-sdk/docs/models/createbalanceglobals.md similarity index 92% rename from others/python-sdk/docs/models/balancescheckglobals.md rename to others/python-sdk/docs/models/createbalanceglobals.md index c2be245a9..e6e79f4e9 100644 --- a/others/python-sdk/docs/models/balancescheckglobals.md +++ b/others/python-sdk/docs/models/createbalanceglobals.md @@ -1,4 +1,4 @@ -# BalancesCheckGlobals +# CreateBalanceGlobals ## Fields diff --git a/others/python-sdk/docs/models/balancesupdateinterval.md b/others/python-sdk/docs/models/createbalanceinterval.md similarity index 79% rename from others/python-sdk/docs/models/balancesupdateinterval.md rename to others/python-sdk/docs/models/createbalanceinterval.md index 1f2b31383..e335f5306 100644 --- a/others/python-sdk/docs/models/balancesupdateinterval.md +++ b/others/python-sdk/docs/models/createbalanceinterval.md @@ -1,6 +1,6 @@ -# BalancesUpdateInterval +# CreateBalanceInterval -The interval to update balance for. +The interval at which the balance resets (e.g., 'month', 'day', 'year'). ## Values diff --git a/others/python-sdk/docs/models/createbalanceparams.md b/others/python-sdk/docs/models/createbalanceparams.md new file mode 100644 index 000000000..ca2751e17 --- /dev/null +++ b/others/python-sdk/docs/models/createbalanceparams.md @@ -0,0 +1,15 @@ +# CreateBalanceParams + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer. | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity for entity-scoped balances (e.g., per-seat limits). | +| `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 | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createbalancereset.md b/others/python-sdk/docs/models/createbalancereset.md new file mode 100644 index 000000000..7c05e71c3 --- /dev/null +++ b/others/python-sdk/docs/models/createbalancereset.md @@ -0,0 +1,11 @@ +# CreateBalanceReset + +Reset configuration for the balance. If not provided, the balance is a one-time grant that never resets. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `interval` | [models.CreateBalanceInterval](../models/createbalanceinterval.md) | :heavy_check_mark: | The interval at which the balance resets (e.g., 'month', 'day', 'year'). | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1 (e.g., interval_count: 2 with interval: 'month' resets every 2 months). | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancesupdateresponse.md b/others/python-sdk/docs/models/createbalanceresponse.md similarity index 91% rename from others/python-sdk/docs/models/balancesupdateresponse.md rename to others/python-sdk/docs/models/createbalanceresponse.md index c9c3d69ea..073f7e796 100644 --- a/others/python-sdk/docs/models/balancesupdateresponse.md +++ b/others/python-sdk/docs/models/createbalanceresponse.md @@ -1,4 +1,4 @@ -# BalancesUpdateResponse +# CreateBalanceResponse OK diff --git a/others/python-sdk/docs/models/createentitybalances.md b/others/python-sdk/docs/models/createentitybalances.md new file mode 100644 index 000000000..6fc103dc0 --- /dev/null +++ b/others/python-sdk/docs/models/createentitybalances.md @@ -0,0 +1,18 @@ +# 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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackbalancebillingmethod.md b/others/python-sdk/docs/models/createentitybillingmethod.md similarity index 65% rename from others/python-sdk/docs/models/balancestrackbalancebillingmethod.md rename to others/python-sdk/docs/models/createentitybillingmethod.md index ac9a442ee..888ba83ae 100644 --- a/others/python-sdk/docs/models/balancestrackbalancebillingmethod.md +++ b/others/python-sdk/docs/models/createentitybillingmethod.md @@ -1,4 +1,6 @@ -# BalancesTrackBalanceBillingMethod +# CreateEntityBillingMethod + +Whether usage is prepaid or billed pay-per-use. ## Values diff --git a/others/python-sdk/docs/models/createentitybreakdown.md b/others/python-sdk/docs/models/createentitybreakdown.md new file mode 100644 index 000000000..ede2f8e8e --- /dev/null +++ b/others/python-sdk/docs/models/createentitybreakdown.md @@ -0,0 +1,17 @@ +# 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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackcreditschema.md b/others/python-sdk/docs/models/createentitycreditschema.md similarity index 93% rename from others/python-sdk/docs/models/balancestrackcreditschema.md rename to others/python-sdk/docs/models/createentitycreditschema.md index 09df1cddc..6aa119897 100644 --- a/others/python-sdk/docs/models/balancestrackcreditschema.md +++ b/others/python-sdk/docs/models/createentitycreditschema.md @@ -1,4 +1,4 @@ -# BalancesTrackCreditSchema +# CreateEntityCreditSchema ## Fields diff --git a/others/python-sdk/docs/models/balancestrackdisplay.md b/others/python-sdk/docs/models/createentitydisplay.md similarity index 94% rename from others/python-sdk/docs/models/balancestrackdisplay.md rename to others/python-sdk/docs/models/createentitydisplay.md index eb33b7d72..13c836750 100644 --- a/others/python-sdk/docs/models/balancestrackdisplay.md +++ b/others/python-sdk/docs/models/createentitydisplay.md @@ -1,4 +1,4 @@ -# BalancesTrackDisplay +# CreateEntityDisplay ## Fields diff --git a/others/python-sdk/docs/models/createentityenv.md b/others/python-sdk/docs/models/createentityenv.md new file mode 100644 index 000000000..32f81e68d --- /dev/null +++ b/others/python-sdk/docs/models/createentityenv.md @@ -0,0 +1,11 @@ +# CreateEntityEnv + +The environment (sandbox/live) + + +## Values + +| Name | Value | +| --------- | --------- | +| `SANDBOX` | sandbox | +| `LIVE` | live | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createentityfeature.md b/others/python-sdk/docs/models/createentityfeature.md new file mode 100644 index 000000000..5d414ba10 --- /dev/null +++ b/others/python-sdk/docs/models/createentityfeature.md @@ -0,0 +1,17 @@ +# 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 | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescreateglobals.md b/others/python-sdk/docs/models/createentityglobals.md similarity index 91% rename from others/python-sdk/docs/models/balancescreateglobals.md rename to others/python-sdk/docs/models/createentityglobals.md index 81fe170dd..a3deb7746 100644 --- a/others/python-sdk/docs/models/balancescreateglobals.md +++ b/others/python-sdk/docs/models/createentityglobals.md @@ -1,4 +1,4 @@ -# BalancesCreateGlobals +# CreateEntityGlobals ## Fields diff --git a/others/python-sdk/docs/models/intervaloutgoingenum.md b/others/python-sdk/docs/models/createentityintervalenum.md similarity index 93% rename from others/python-sdk/docs/models/intervaloutgoingenum.md rename to others/python-sdk/docs/models/createentityintervalenum.md index 30fc02e79..12a5563b0 100644 --- a/others/python-sdk/docs/models/intervaloutgoingenum.md +++ b/others/python-sdk/docs/models/createentityintervalenum.md @@ -1,4 +1,4 @@ -# IntervalOutgoingEnum +# CreateEntityIntervalEnum ## Values diff --git a/others/python-sdk/docs/models/createentityintervalunion.md b/others/python-sdk/docs/models/createentityintervalunion.md new file mode 100644 index 000000000..31ec44c3c --- /dev/null +++ b/others/python-sdk/docs/models/createentityintervalunion.md @@ -0,0 +1,19 @@ +# 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 */ +``` + diff --git a/others/python-sdk/docs/models/createentityinvoice.md b/others/python-sdk/docs/models/createentityinvoice.md new file mode 100644 index 000000000..816cf0bf5 --- /dev/null +++ b/others/python-sdk/docs/models/createentityinvoice.md @@ -0,0 +1,14 @@ +# CreateEntityInvoice + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `plan_ids` | List[*str*] | :heavy_check_mark: | Array of plan IDs included in this invoice | +| `stripe_id` | *str* | :heavy_check_mark: | The Stripe invoice ID | +| `status` | *str* | :heavy_check_mark: | The status of the invoice | +| `total` | *float* | :heavy_check_mark: | The total amount of the invoice | +| `currency` | *str* | :heavy_check_mark: | The currency code for the invoice | +| `created_at` | *float* | :heavy_check_mark: | Timestamp when the invoice was created | +| `hosted_invoice_url` | *OptionalNullable[str]* | :heavy_minus_sign: | URL to the Stripe-hosted invoice page | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createentityparams.md b/others/python-sdk/docs/models/createentityparams.md new file mode 100644 index 000000000..d5c2fc59d --- /dev/null +++ b/others/python-sdk/docs/models/createentityparams.md @@ -0,0 +1,12 @@ +# CreateEntityParams + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | The name of the entity | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature this entity is associated with | +| `customer_data` | [Optional[models.CustomerData]](../models/customerdata.md) | :heavy_minus_sign: | Customer details to set when creating a customer | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to create the entity for. | +| `entity_id` | *str* | :heavy_check_mark: | The ID of the entity. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createentityprice.md b/others/python-sdk/docs/models/createentityprice.md new file mode 100644 index 000000000..2794e2d43 --- /dev/null +++ b/others/python-sdk/docs/models/createentityprice.md @@ -0,0 +1,12 @@ +# 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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createentitypurchase.md b/others/python-sdk/docs/models/createentitypurchase.md new file mode 100644 index 000000000..486d379d4 --- /dev/null +++ b/others/python-sdk/docs/models/createentitypurchase.md @@ -0,0 +1,12 @@ +# CreateEntityPurchase + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | +| `plan_id` | *str* | :heavy_check_mark: | The unique identifier of the purchased plan. | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the purchase expires, or null for lifetime access. | +| `started_at` | *float* | :heavy_check_mark: | Timestamp when the purchase was made. | +| `quantity` | *float* | :heavy_check_mark: | Number of units purchased. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createentityreset.md b/others/python-sdk/docs/models/createentityreset.md new file mode 100644 index 000000000..7f9c5f6ce --- /dev/null +++ b/others/python-sdk/docs/models/createentityreset.md @@ -0,0 +1,10 @@ +# 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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createentityresponse.md b/others/python-sdk/docs/models/createentityresponse.md new file mode 100644 index 000000000..35a8b88d6 --- /dev/null +++ b/others/python-sdk/docs/models/createentityresponse.md @@ -0,0 +1,20 @@ +# CreateEntityResponse + +OK + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `autumn_id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `id` | *Nullable[str]* | :heavy_check_mark: | The unique identifier of the entity | +| `name` | *Nullable[str]* | :heavy_check_mark: | The name of the entity | +| `customer_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The customer ID this entity belongs to | +| `feature_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The feature ID this entity belongs to | +| `created_at` | *float* | :heavy_check_mark: | Unix timestamp when the entity was created | +| `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 | +| `invoices` | List[[models.CreateEntityInvoice](../models/createentityinvoice.md)] | :heavy_minus_sign: | Invoices for this entity (only included when expand=invoices) | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createentityrollover.md b/others/python-sdk/docs/models/createentityrollover.md new file mode 100644 index 000000000..0610426e0 --- /dev/null +++ b/others/python-sdk/docs/models/createentityrollover.md @@ -0,0 +1,9 @@ +# 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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createentitystatus.md b/others/python-sdk/docs/models/createentitystatus.md new file mode 100644 index 000000000..9a91415c6 --- /dev/null +++ b/others/python-sdk/docs/models/createentitystatus.md @@ -0,0 +1,11 @@ +# CreateEntityStatus + +Current status of the subscription. + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `ACTIVE` | active | +| `SCHEDULED` | scheduled | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createentitysubscription.md b/others/python-sdk/docs/models/createentitysubscription.md new file mode 100644 index 000000000..cede3bc17 --- /dev/null +++ b/others/python-sdk/docs/models/createentitysubscription.md @@ -0,0 +1,20 @@ +# CreateEntitySubscription + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | +| `plan_id` | *str* | :heavy_check_mark: | The unique identifier of the subscribed plan. | +| `auto_enable` | *bool* | :heavy_check_mark: | Whether the plan was automatically enabled for the customer. | +| `add_on` | *bool* | :heavy_check_mark: | Whether this is an add-on plan rather than a base subscription. | +| `status` | [models.CreateEntityStatus](../models/createentitystatus.md) | :heavy_check_mark: | Current status of the subscription. | +| `past_due` | *bool* | :heavy_check_mark: | Whether the subscription has overdue payments. | +| `canceled_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the subscription was canceled, or null if not canceled. | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the subscription will expire, or null if no expiry set. | +| `trial_ends_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the trial period ends, or null if not on trial. | +| `started_at` | *float* | :heavy_check_mark: | Timestamp when the subscription started. | +| `current_period_start` | *Nullable[float]* | :heavy_check_mark: | Start timestamp of the current billing period. | +| `current_period_end` | *Nullable[float]* | :heavy_check_mark: | End timestamp of the current billing period. | +| `quantity` | *float* | :heavy_check_mark: | Number of units of this subscription (for per-seat plans). | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createentitytier.md b/others/python-sdk/docs/models/createentitytier.md new file mode 100644 index 000000000..c457c621e --- /dev/null +++ b/others/python-sdk/docs/models/createentitytier.md @@ -0,0 +1,9 @@ +# CreateEntityTier + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | +| `to` | [models.CreateEntityTo](../models/createentityto.md) | :heavy_check_mark: | N/A | +| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackbalanceto.md b/others/python-sdk/docs/models/createentityto.md similarity index 84% rename from others/python-sdk/docs/models/balancestrackbalanceto.md rename to others/python-sdk/docs/models/createentityto.md index b169e69ab..11f35e3c9 100644 --- a/others/python-sdk/docs/models/balancestrackbalanceto.md +++ b/others/python-sdk/docs/models/createentityto.md @@ -1,4 +1,4 @@ -# BalancesTrackBalanceTo +# CreateEntityTo ## Supported Types diff --git a/others/python-sdk/docs/models/balancestracktype.md b/others/python-sdk/docs/models/createentitytype.md similarity index 90% rename from others/python-sdk/docs/models/balancestracktype.md rename to others/python-sdk/docs/models/createentitytype.md index f0e4c544f..3312ce3a5 100644 --- a/others/python-sdk/docs/models/balancestracktype.md +++ b/others/python-sdk/docs/models/createentitytype.md @@ -1,4 +1,4 @@ -# BalancesTrackType +# CreateEntityType ## Values diff --git a/others/python-sdk/docs/models/createreferralcodeglobals.md b/others/python-sdk/docs/models/createreferralcodeglobals.md new file mode 100644 index 000000000..8ce1edc5a --- /dev/null +++ b/others/python-sdk/docs/models/createreferralcodeglobals.md @@ -0,0 +1,8 @@ +# CreateReferralCodeGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createreferralcodeparams.md b/others/python-sdk/docs/models/createreferralcodeparams.md new file mode 100644 index 000000000..ccb0251be --- /dev/null +++ b/others/python-sdk/docs/models/createreferralcodeparams.md @@ -0,0 +1,9 @@ +# CreateReferralCodeParams + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------- | ------------------------------------- | ------------------------------------- | ------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | The unique identifier of the customer | +| `program_id` | *str* | :heavy_check_mark: | ID of your referral program | \ No newline at end of file diff --git a/others/python-sdk/docs/models/createreferralcoderesponse.md b/others/python-sdk/docs/models/createreferralcoderesponse.md new file mode 100644 index 000000000..cef67b1f1 --- /dev/null +++ b/others/python-sdk/docs/models/createreferralcoderesponse.md @@ -0,0 +1,12 @@ +# CreateReferralCodeResponse + +OK + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | +| `code` | *str* | :heavy_check_mark: | The referral code that can be shared with customers | +| `customer_id` | *str* | :heavy_check_mark: | Your unique identifier for the customer | +| `created_at` | *float* | :heavy_check_mark: | The timestamp of when the referral code was created | \ No newline at end of file diff --git a/others/python-sdk/docs/models/customer.md b/others/python-sdk/docs/models/customer.md index 778515408..b224be77d 100644 --- a/others/python-sdk/docs/models/customer.md +++ b/others/python-sdk/docs/models/customer.md @@ -14,9 +14,9 @@ | `env` | [models.CustomerEnv](../models/customerenv.md) | :heavy_check_mark: | The environment this customer was created in. | | `metadata` | Dict[str, *Any*] | :heavy_check_mark: | The metadata for the customer. | | `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: | N/A | -| `purchases` | List[[models.Purchase](../models/purchase.md)] | :heavy_check_mark: | N/A | -| `balances` | Dict[str, [models.Balances](../models/balances.md)] | :heavy_check_mark: | N/A | +| `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. | | `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 | diff --git a/others/python-sdk/docs/models/customerbillingmethod.md b/others/python-sdk/docs/models/customerbillingmethod.md index 0f5a43b73..b4338bc31 100644 --- a/others/python-sdk/docs/models/customerbillingmethod.md +++ b/others/python-sdk/docs/models/customerbillingmethod.md @@ -1,5 +1,7 @@ # CustomerBillingMethod +Whether usage is prepaid or billed pay-per-use. + ## Values diff --git a/others/python-sdk/docs/models/customerfeature.md b/others/python-sdk/docs/models/customerfeature.md index 076eb6dc3..2c73280fb 100644 --- a/others/python-sdk/docs/models/customerfeature.md +++ b/others/python-sdk/docs/models/customerfeature.md @@ -1,5 +1,7 @@ # CustomerFeature +The full feature object if expanded. + ## Fields diff --git a/others/python-sdk/docs/models/customerintervalunion.md b/others/python-sdk/docs/models/customerintervalunion.md index 7e9dd6d8a..9d0c61d38 100644 --- a/others/python-sdk/docs/models/customerintervalunion.md +++ b/others/python-sdk/docs/models/customerintervalunion.md @@ -1,5 +1,7 @@ # CustomerIntervalUnion +The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + ## Supported Types diff --git a/others/python-sdk/docs/models/customerprice.md b/others/python-sdk/docs/models/customerprice.md index 88630fbea..bbb194fdb 100644 --- a/others/python-sdk/docs/models/customerprice.md +++ b/others/python-sdk/docs/models/customerprice.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `tiers` | List[[models.CustomerTier](../models/customertier.md)] | :heavy_minus_sign: | N/A | -| `billing_units` | *float* | :heavy_check_mark: | N/A | -| `billing_method` | [models.CustomerBillingMethod](../models/customerbillingmethod.md) | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file +| `amount` | *Optional[float]* | :heavy_minus_sign: | The per-unit price amount. | +| `tiers` | List[[models.CustomerTier](../models/customertier.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.CustomerBillingMethod](../models/customerbillingmethod.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/customerreset.md b/others/python-sdk/docs/models/customerreset.md index 49409b4c0..61c5334d2 100644 --- a/others/python-sdk/docs/models/customerreset.md +++ b/others/python-sdk/docs/models/customerreset.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `interval` | [models.CustomerIntervalUnion](../models/customerintervalunion.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `resets_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file +| 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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/customerrollover.md b/others/python-sdk/docs/models/customerrollover.md index 8db9ac673..ea8a9ed81 100644 --- a/others/python-sdk/docs/models/customerrollover.md +++ b/others/python-sdk/docs/models/customerrollover.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `balance` | *float* | :heavy_check_mark: | N/A | -| `expires_at` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file +| 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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancesupdateglobals.md b/others/python-sdk/docs/models/deleteentityglobals.md similarity index 91% rename from others/python-sdk/docs/models/balancesupdateglobals.md rename to others/python-sdk/docs/models/deleteentityglobals.md index 507415cb6..c3a1c6527 100644 --- a/others/python-sdk/docs/models/balancesupdateglobals.md +++ b/others/python-sdk/docs/models/deleteentityglobals.md @@ -1,4 +1,4 @@ -# BalancesUpdateGlobals +# DeleteEntityGlobals ## Fields diff --git a/others/python-sdk/docs/models/deleteentityparams.md b/others/python-sdk/docs/models/deleteentityparams.md new file mode 100644 index 000000000..39368a848 --- /dev/null +++ b/others/python-sdk/docs/models/deleteentityparams.md @@ -0,0 +1,9 @@ +# DeleteEntityParams + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `customer_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the customer. | +| `entity_id` | *str* | :heavy_check_mark: | The ID of the entity. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescreateresponse.md b/others/python-sdk/docs/models/deleteentityresponse.md similarity index 91% rename from others/python-sdk/docs/models/balancescreateresponse.md rename to others/python-sdk/docs/models/deleteentityresponse.md index 899743b48..0f842e811 100644 --- a/others/python-sdk/docs/models/balancescreateresponse.md +++ b/others/python-sdk/docs/models/deleteentityresponse.md @@ -1,4 +1,4 @@ -# BalancesCreateResponse +# DeleteEntityResponse OK diff --git a/others/python-sdk/docs/models/eventsaggregateparams.md b/others/python-sdk/docs/models/eventsaggregateparams.md new file mode 100644 index 000000000..080822aa5 --- /dev/null +++ b/others/python-sdk/docs/models/eventsaggregateparams.md @@ -0,0 +1,13 @@ +# EventsAggregateParams + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | Customer ID to aggregate events for | +| `feature_id` | [models.AggregateEventsFeatureID](../models/aggregateeventsfeatureid.md) | :heavy_check_mark: | Feature ID(s) to aggregate events for | +| `group_by` | *Optional[str]* | :heavy_minus_sign: | Property to group events by. If provided, each key in the response will be an object with distinct groups as the keys | +| `range` | [Optional[models.Range]](../models/range.md) | :heavy_minus_sign: | Time range to aggregate events for. Either range or custom_range must be provided | +| `bin_size` | [Optional[models.BinSize]](../models/binsize.md) | :heavy_minus_sign: | Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day | +| `custom_range` | [Optional[models.AggregateEventsCustomRange]](../models/aggregateeventscustomrange.md) | :heavy_minus_sign: | Custom time range to aggregate events for. If provided, range must not be provided | \ No newline at end of file diff --git a/others/python-sdk/docs/models/eventslistparams.md b/others/python-sdk/docs/models/eventslistparams.md new file mode 100644 index 000000000..baeb7ce12 --- /dev/null +++ b/others/python-sdk/docs/models/eventslistparams.md @@ -0,0 +1,12 @@ +# EventsListParams + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `offset` | *Optional[int]* | :heavy_minus_sign: | Number of items to skip | +| `limit` | *Optional[int]* | :heavy_minus_sign: | Number of items to return. Default 100, max 1000. | +| `customer_id` | *Optional[str]* | :heavy_minus_sign: | Filter events by customer ID | +| `feature_id` | [Optional[models.ListEventsFeatureID]](../models/listeventsfeatureid.md) | :heavy_minus_sign: | Filter by specific feature ID(s) | +| `custom_range` | [Optional[models.ListEventsCustomRange]](../models/listeventscustomrange.md) | :heavy_minus_sign: | Filter events by time range | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getentitybalances.md b/others/python-sdk/docs/models/getentitybalances.md new file mode 100644 index 000000000..81f18b467 --- /dev/null +++ b/others/python-sdk/docs/models/getentitybalances.md @@ -0,0 +1,18 @@ +# GetEntityBalances + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `feature_id` | *str* | :heavy_check_mark: | The feature ID this balance is for. | +| `feature` | [Optional[models.GetEntityFeature]](../models/getentityfeature.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.GetEntityBreakdown](../models/getentitybreakdown.md)] | :heavy_minus_sign: | Detailed breakdown of balance sources when stacking multiple plans or grants. | +| `rollovers` | List[[models.GetEntityRollover](../models/getentityrollover.md)] | :heavy_minus_sign: | Rollover balances carried over from previous periods. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachbillingmethodrequest.md b/others/python-sdk/docs/models/getentitybillingmethod.md similarity index 66% rename from others/python-sdk/docs/models/billingpreviewattachbillingmethodrequest.md rename to others/python-sdk/docs/models/getentitybillingmethod.md index 2e87268eb..74e431015 100644 --- a/others/python-sdk/docs/models/billingpreviewattachbillingmethodrequest.md +++ b/others/python-sdk/docs/models/getentitybillingmethod.md @@ -1,4 +1,6 @@ -# BillingPreviewAttachBillingMethodRequest +# GetEntityBillingMethod + +Whether usage is prepaid or billed pay-per-use. ## Values diff --git a/others/python-sdk/docs/models/getentitybreakdown.md b/others/python-sdk/docs/models/getentitybreakdown.md new file mode 100644 index 000000000..de4ed7f4b --- /dev/null +++ b/others/python-sdk/docs/models/getentitybreakdown.md @@ -0,0 +1,17 @@ +# GetEntityBreakdown + + +## 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.GetEntityReset]](../models/getentityreset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. | +| `price` | [Nullable[models.GetEntityPrice]](../models/getentityprice.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/incomingcreditschema.md b/others/python-sdk/docs/models/getentitycreditschema.md similarity index 94% rename from others/python-sdk/docs/models/incomingcreditschema.md rename to others/python-sdk/docs/models/getentitycreditschema.md index 93455777a..c1f245948 100644 --- a/others/python-sdk/docs/models/incomingcreditschema.md +++ b/others/python-sdk/docs/models/getentitycreditschema.md @@ -1,4 +1,4 @@ -# IncomingCreditSchema +# GetEntityCreditSchema ## Fields diff --git a/others/python-sdk/docs/models/outgoingdisplay.md b/others/python-sdk/docs/models/getentitydisplay.md similarity index 95% rename from others/python-sdk/docs/models/outgoingdisplay.md rename to others/python-sdk/docs/models/getentitydisplay.md index 971fb78c5..46c3eec41 100644 --- a/others/python-sdk/docs/models/outgoingdisplay.md +++ b/others/python-sdk/docs/models/getentitydisplay.md @@ -1,4 +1,4 @@ -# OutgoingDisplay +# GetEntityDisplay ## Fields diff --git a/others/python-sdk/docs/models/getentityenv.md b/others/python-sdk/docs/models/getentityenv.md new file mode 100644 index 000000000..63a901b4f --- /dev/null +++ b/others/python-sdk/docs/models/getentityenv.md @@ -0,0 +1,11 @@ +# GetEntityEnv + +The environment (sandbox/live) + + +## Values + +| Name | Value | +| --------- | --------- | +| `SANDBOX` | sandbox | +| `LIVE` | live | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getentityfeature.md b/others/python-sdk/docs/models/getentityfeature.md new file mode 100644 index 000000000..df28fd2e0 --- /dev/null +++ b/others/python-sdk/docs/models/getentityfeature.md @@ -0,0 +1,17 @@ +# GetEntityFeature + +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.GetEntityType](../models/getentitytype.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.GetEntityCreditSchema](../models/getentitycreditschema.md)] | :heavy_minus_sign: | N/A | +| `display` | [Optional[models.GetEntityDisplay]](../models/getentitydisplay.md) | :heavy_minus_sign: | N/A | +| `archived` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getentityglobals.md b/others/python-sdk/docs/models/getentityglobals.md new file mode 100644 index 000000000..c56a206c0 --- /dev/null +++ b/others/python-sdk/docs/models/getentityglobals.md @@ -0,0 +1,8 @@ +# GetEntityGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/intervalincomingenum.md b/others/python-sdk/docs/models/getentityintervalenum.md similarity index 94% rename from others/python-sdk/docs/models/intervalincomingenum.md rename to others/python-sdk/docs/models/getentityintervalenum.md index a6eecf963..cf5173e59 100644 --- a/others/python-sdk/docs/models/intervalincomingenum.md +++ b/others/python-sdk/docs/models/getentityintervalenum.md @@ -1,4 +1,4 @@ -# IntervalIncomingEnum +# GetEntityIntervalEnum ## Values diff --git a/others/python-sdk/docs/models/getentityintervalunion.md b/others/python-sdk/docs/models/getentityintervalunion.md new file mode 100644 index 000000000..d3e6f0d71 --- /dev/null +++ b/others/python-sdk/docs/models/getentityintervalunion.md @@ -0,0 +1,19 @@ +# GetEntityIntervalUnion + +The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + +## Supported Types + +### `models.GetEntityIntervalEnum` + +```python +value: models.GetEntityIntervalEnum = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/getentityinvoice.md b/others/python-sdk/docs/models/getentityinvoice.md new file mode 100644 index 000000000..48ebfe080 --- /dev/null +++ b/others/python-sdk/docs/models/getentityinvoice.md @@ -0,0 +1,14 @@ +# GetEntityInvoice + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `plan_ids` | List[*str*] | :heavy_check_mark: | Array of plan IDs included in this invoice | +| `stripe_id` | *str* | :heavy_check_mark: | The Stripe invoice ID | +| `status` | *str* | :heavy_check_mark: | The status of the invoice | +| `total` | *float* | :heavy_check_mark: | The total amount of the invoice | +| `currency` | *str* | :heavy_check_mark: | The currency code for the invoice | +| `created_at` | *float* | :heavy_check_mark: | Timestamp when the invoice was created | +| `hosted_invoice_url` | *OptionalNullable[str]* | :heavy_minus_sign: | URL to the Stripe-hosted invoice page | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getentityparams.md b/others/python-sdk/docs/models/getentityparams.md new file mode 100644 index 000000000..6e33a8fe4 --- /dev/null +++ b/others/python-sdk/docs/models/getentityparams.md @@ -0,0 +1,9 @@ +# GetEntityParams + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | +| `customer_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the customer to create the entity for. | +| `entity_id` | *str* | :heavy_check_mark: | The ID of the entity. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getentityprice.md b/others/python-sdk/docs/models/getentityprice.md new file mode 100644 index 000000000..370659053 --- /dev/null +++ b/others/python-sdk/docs/models/getentityprice.md @@ -0,0 +1,12 @@ +# GetEntityPrice + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `amount` | *Optional[float]* | :heavy_minus_sign: | The per-unit price amount. | +| `tiers` | List[[models.GetEntityTier](../models/getentitytier.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.GetEntityBillingMethod](../models/getentitybillingmethod.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getentitypurchase.md b/others/python-sdk/docs/models/getentitypurchase.md new file mode 100644 index 000000000..88e4c2669 --- /dev/null +++ b/others/python-sdk/docs/models/getentitypurchase.md @@ -0,0 +1,12 @@ +# GetEntityPurchase + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | +| `plan_id` | *str* | :heavy_check_mark: | The unique identifier of the purchased plan. | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the purchase expires, or null for lifetime access. | +| `started_at` | *float* | :heavy_check_mark: | Timestamp when the purchase was made. | +| `quantity` | *float* | :heavy_check_mark: | Number of units purchased. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getentityreset.md b/others/python-sdk/docs/models/getentityreset.md new file mode 100644 index 000000000..14e5995a8 --- /dev/null +++ b/others/python-sdk/docs/models/getentityreset.md @@ -0,0 +1,10 @@ +# GetEntityReset + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `interval` | [models.GetEntityIntervalUnion](../models/getentityintervalunion.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getentityresponse.md b/others/python-sdk/docs/models/getentityresponse.md new file mode 100644 index 000000000..4455851d2 --- /dev/null +++ b/others/python-sdk/docs/models/getentityresponse.md @@ -0,0 +1,20 @@ +# GetEntityResponse + +OK + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `autumn_id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `id` | *Nullable[str]* | :heavy_check_mark: | The unique identifier of the entity | +| `name` | *Nullable[str]* | :heavy_check_mark: | The name of the entity | +| `customer_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The customer ID this entity belongs to | +| `feature_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The feature ID this entity belongs to | +| `created_at` | *float* | :heavy_check_mark: | Unix timestamp when the entity was created | +| `env` | [models.GetEntityEnv](../models/getentityenv.md) | :heavy_check_mark: | The environment (sandbox/live) | +| `subscriptions` | List[[models.GetEntitySubscription](../models/getentitysubscription.md)] | :heavy_check_mark: | N/A | +| `purchases` | List[[models.GetEntityPurchase](../models/getentitypurchase.md)] | :heavy_check_mark: | N/A | +| `balances` | Dict[str, [models.GetEntityBalances](../models/getentitybalances.md)] | :heavy_check_mark: | N/A | +| `invoices` | List[[models.GetEntityInvoice](../models/getentityinvoice.md)] | :heavy_minus_sign: | Invoices for this entity (only included when expand=invoices) | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getentityrollover.md b/others/python-sdk/docs/models/getentityrollover.md new file mode 100644 index 000000000..7601f45a7 --- /dev/null +++ b/others/python-sdk/docs/models/getentityrollover.md @@ -0,0 +1,9 @@ +# GetEntityRollover + + +## 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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getentitystatus.md b/others/python-sdk/docs/models/getentitystatus.md new file mode 100644 index 000000000..9c9b61b2e --- /dev/null +++ b/others/python-sdk/docs/models/getentitystatus.md @@ -0,0 +1,11 @@ +# GetEntityStatus + +Current status of the subscription. + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `ACTIVE` | active | +| `SCHEDULED` | scheduled | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getentitysubscription.md b/others/python-sdk/docs/models/getentitysubscription.md new file mode 100644 index 000000000..f4ac67fd0 --- /dev/null +++ b/others/python-sdk/docs/models/getentitysubscription.md @@ -0,0 +1,20 @@ +# GetEntitySubscription + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | +| `plan_id` | *str* | :heavy_check_mark: | The unique identifier of the subscribed plan. | +| `auto_enable` | *bool* | :heavy_check_mark: | Whether the plan was automatically enabled for the customer. | +| `add_on` | *bool* | :heavy_check_mark: | Whether this is an add-on plan rather than a base subscription. | +| `status` | [models.GetEntityStatus](../models/getentitystatus.md) | :heavy_check_mark: | Current status of the subscription. | +| `past_due` | *bool* | :heavy_check_mark: | Whether the subscription has overdue payments. | +| `canceled_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the subscription was canceled, or null if not canceled. | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the subscription will expire, or null if no expiry set. | +| `trial_ends_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the trial period ends, or null if not on trial. | +| `started_at` | *float* | :heavy_check_mark: | Timestamp when the subscription started. | +| `current_period_start` | *Nullable[float]* | :heavy_check_mark: | Start timestamp of the current billing period. | +| `current_period_end` | *Nullable[float]* | :heavy_check_mark: | End timestamp of the current billing period. | +| `quantity` | *float* | :heavy_check_mark: | Number of units of this subscription (for per-seat plans). | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getentitytier.md b/others/python-sdk/docs/models/getentitytier.md new file mode 100644 index 000000000..b56df546a --- /dev/null +++ b/others/python-sdk/docs/models/getentitytier.md @@ -0,0 +1,9 @@ +# GetEntityTier + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | +| `to` | [models.GetEntityTo](../models/getentityto.md) | :heavy_check_mark: | N/A | +| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachto.md b/others/python-sdk/docs/models/getentityto.md similarity index 84% rename from others/python-sdk/docs/models/billingpreviewattachto.md rename to others/python-sdk/docs/models/getentityto.md index b032a3063..a21a23252 100644 --- a/others/python-sdk/docs/models/billingpreviewattachto.md +++ b/others/python-sdk/docs/models/getentityto.md @@ -1,4 +1,4 @@ -# BillingPreviewAttachTo +# GetEntityTo ## Supported Types diff --git a/others/python-sdk/docs/models/outgoingtype.md b/others/python-sdk/docs/models/getentitytype.md similarity index 92% rename from others/python-sdk/docs/models/outgoingtype.md rename to others/python-sdk/docs/models/getentitytype.md index 041513176..dc72cdd80 100644 --- a/others/python-sdk/docs/models/outgoingtype.md +++ b/others/python-sdk/docs/models/getentitytype.md @@ -1,4 +1,4 @@ -# OutgoingType +# GetEntityType ## Values diff --git a/others/python-sdk/docs/models/incoming.md b/others/python-sdk/docs/models/incoming.md deleted file mode 100644 index 9486f06c2..000000000 --- a/others/python-sdk/docs/models/incoming.md +++ /dev/null @@ -1,12 +0,0 @@ -# Incoming - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `plan` | [models.Plan](../models/plan.md) | :heavy_check_mark: | N/A | -| `feature_quantities` | List[[models.IncomingFeatureQuantity](../models/incomingfeaturequantity.md)] | :heavy_check_mark: | N/A | -| `balances` | Dict[str, [models.IncomingBalances](../models/incomingbalances.md)] | :heavy_check_mark: | N/A | -| `period_start` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `period_end` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/incomingbalances.md b/others/python-sdk/docs/models/incomingbalances.md deleted file mode 100644 index 063c002b3..000000000 --- a/others/python-sdk/docs/models/incomingbalances.md +++ /dev/null @@ -1,18 +0,0 @@ -# IncomingBalances - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `feature` | [Optional[models.IncomingFeature]](../models/incomingfeature.md) | :heavy_minus_sign: | N/A | -| `granted` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `overage_allowed` | *bool* | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `next_reset_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `breakdown` | List[[models.IncomingBreakdown](../models/incomingbreakdown.md)] | :heavy_minus_sign: | N/A | -| `rollovers` | List[[models.IncomingRollover](../models/incomingrollover.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/incomingbreakdown.md b/others/python-sdk/docs/models/incomingbreakdown.md deleted file mode 100644 index 164b60da4..000000000 --- a/others/python-sdk/docs/models/incomingbreakdown.md +++ /dev/null @@ -1,17 +0,0 @@ -# IncomingBreakdown - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `plan_id` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `included_grant` | *float* | :heavy_check_mark: | N/A | -| `prepaid_grant` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `reset` | [Nullable[models.IncomingReset]](../models/incomingreset.md) | :heavy_check_mark: | N/A | -| `price` | [Nullable[models.IncomingPrice]](../models/incomingprice.md) | :heavy_check_mark: | N/A | -| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/incomingfeature.md b/others/python-sdk/docs/models/incomingfeature.md deleted file mode 100644 index cd9c74177..000000000 --- a/others/python-sdk/docs/models/incomingfeature.md +++ /dev/null @@ -1,15 +0,0 @@ -# IncomingFeature - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | N/A | -| `name` | *str* | :heavy_check_mark: | N/A | -| `type` | [models.IncomingType](../models/incomingtype.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.IncomingCreditSchema](../models/incomingcreditschema.md)] | :heavy_minus_sign: | N/A | -| `display` | [Optional[models.IncomingDisplay]](../models/incomingdisplay.md) | :heavy_minus_sign: | N/A | -| `archived` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/incomingfeaturequantity.md b/others/python-sdk/docs/models/incomingfeaturequantity.md deleted file mode 100644 index 9df4947fd..000000000 --- a/others/python-sdk/docs/models/incomingfeaturequantity.md +++ /dev/null @@ -1,9 +0,0 @@ -# IncomingFeatureQuantity - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `quantity` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/incomingintervalunion.md b/others/python-sdk/docs/models/incomingintervalunion.md deleted file mode 100644 index e2a177866..000000000 --- a/others/python-sdk/docs/models/incomingintervalunion.md +++ /dev/null @@ -1,17 +0,0 @@ -# IncomingIntervalUnion - - -## Supported Types - -### `models.IntervalIncomingEnum` - -```python -value: models.IntervalIncomingEnum = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` - diff --git a/others/python-sdk/docs/models/incomingprice.md b/others/python-sdk/docs/models/incomingprice.md deleted file mode 100644 index 605159dc4..000000000 --- a/others/python-sdk/docs/models/incomingprice.md +++ /dev/null @@ -1,12 +0,0 @@ -# IncomingPrice - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `tiers` | List[[models.IncomingTier](../models/incomingtier.md)] | :heavy_minus_sign: | N/A | -| `billing_units` | *float* | :heavy_check_mark: | N/A | -| `billing_method` | [models.IncomingBillingMethod](../models/incomingbillingmethod.md) | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/incomingreset.md b/others/python-sdk/docs/models/incomingreset.md deleted file mode 100644 index dd6be2841..000000000 --- a/others/python-sdk/docs/models/incomingreset.md +++ /dev/null @@ -1,10 +0,0 @@ -# IncomingReset - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `interval` | [models.IncomingIntervalUnion](../models/incomingintervalunion.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `resets_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/incomingrollover.md b/others/python-sdk/docs/models/incomingrollover.md deleted file mode 100644 index f113b1a9e..000000000 --- a/others/python-sdk/docs/models/incomingrollover.md +++ /dev/null @@ -1,9 +0,0 @@ -# IncomingRollover - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `balance` | *float* | :heavy_check_mark: | N/A | -| `expires_at` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/incomingtier.md b/others/python-sdk/docs/models/incomingtier.md deleted file mode 100644 index cf29e356f..000000000 --- a/others/python-sdk/docs/models/incomingtier.md +++ /dev/null @@ -1,9 +0,0 @@ -# IncomingTier - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `to` | *Optional[Any]* | :heavy_minus_sign: | N/A | -| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersbalances.md b/others/python-sdk/docs/models/listcustomersbalances.md index 47ea14702..f32c589b5 100644 --- a/others/python-sdk/docs/models/listcustomersbalances.md +++ b/others/python-sdk/docs/models/listcustomersbalances.md @@ -3,16 +3,16 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `feature` | [Optional[models.ListCustomersFeature]](../models/listcustomersfeature.md) | :heavy_minus_sign: | N/A | -| `granted` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `overage_allowed` | *bool* | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `next_reset_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `breakdown` | List[[models.ListCustomersBreakdown](../models/listcustomersbreakdown.md)] | :heavy_minus_sign: | N/A | -| `rollovers` | List[[models.ListCustomersRollover](../models/listcustomersrollover.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `feature_id` | *str* | :heavy_check_mark: | The feature ID this balance is for. | +| `feature` | [Optional[models.ListCustomersFeature]](../models/listcustomersfeature.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.ListCustomersBreakdown](../models/listcustomersbreakdown.md)] | :heavy_minus_sign: | Detailed breakdown of balance sources when stacking multiple plans or grants. | +| `rollovers` | List[[models.ListCustomersRollover](../models/listcustomersrollover.md)] | :heavy_minus_sign: | Rollover balances carried over from previous periods. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersbillingmethod.md b/others/python-sdk/docs/models/listcustomersbillingmethod.md index d394f3fcb..efee88965 100644 --- a/others/python-sdk/docs/models/listcustomersbillingmethod.md +++ b/others/python-sdk/docs/models/listcustomersbillingmethod.md @@ -1,5 +1,7 @@ # ListCustomersBillingMethod +Whether usage is prepaid or billed pay-per-use. + ## Values diff --git a/others/python-sdk/docs/models/listcustomersbreakdown.md b/others/python-sdk/docs/models/listcustomersbreakdown.md index b41b3d433..2e7e509db 100644 --- a/others/python-sdk/docs/models/listcustomersbreakdown.md +++ b/others/python-sdk/docs/models/listcustomersbreakdown.md @@ -3,15 +3,15 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `plan_id` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `included_grant` | *float* | :heavy_check_mark: | N/A | -| `prepaid_grant` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `reset` | [Nullable[models.ListCustomersReset]](../models/listcustomersreset.md) | :heavy_check_mark: | N/A | -| `price` | [Nullable[models.ListCustomersPrice]](../models/listcustomersprice.md) | :heavy_check_mark: | N/A | -| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file +| 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.ListCustomersReset]](../models/listcustomersreset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. | +| `price` | [Nullable[models.ListCustomersPrice]](../models/listcustomersprice.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersfeature.md b/others/python-sdk/docs/models/listcustomersfeature.md index 7b61528e5..9fc578f26 100644 --- a/others/python-sdk/docs/models/listcustomersfeature.md +++ b/others/python-sdk/docs/models/listcustomersfeature.md @@ -1,5 +1,7 @@ # ListCustomersFeature +The full feature object if expanded. + ## Fields diff --git a/others/python-sdk/docs/models/listcustomersintervalunion.md b/others/python-sdk/docs/models/listcustomersintervalunion.md index b2c4f91d3..72b3636e7 100644 --- a/others/python-sdk/docs/models/listcustomersintervalunion.md +++ b/others/python-sdk/docs/models/listcustomersintervalunion.md @@ -1,5 +1,7 @@ # ListCustomersIntervalUnion +The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + ## Supported Types diff --git a/others/python-sdk/docs/models/listt.md b/others/python-sdk/docs/models/listcustomerslist.md similarity index 92% rename from others/python-sdk/docs/models/listt.md rename to others/python-sdk/docs/models/listcustomerslist.md index f9761f758..6962f7672 100644 --- a/others/python-sdk/docs/models/listt.md +++ b/others/python-sdk/docs/models/listcustomerslist.md @@ -1,4 +1,4 @@ -# ListT +# ListCustomersList ## Fields @@ -14,6 +14,6 @@ | `env` | [models.ListCustomersEnv](../models/listcustomersenv.md) | :heavy_check_mark: | The environment this customer was created in. | | `metadata` | Dict[str, *Any*] | :heavy_check_mark: | The metadata for the customer. | | `send_email_receipts` | *bool* | :heavy_check_mark: | Whether to send email receipts to the customer. | -| `subscriptions` | List[[models.ListCustomersSubscription](../models/listcustomerssubscription.md)] | :heavy_check_mark: | N/A | -| `purchases` | List[[models.ListCustomersPurchase](../models/listcustomerspurchase.md)] | :heavy_check_mark: | N/A | -| `balances` | Dict[str, [models.ListCustomersBalances](../models/listcustomersbalances.md)] | :heavy_check_mark: | N/A | \ No newline at end of file +| `subscriptions` | List[[models.ListCustomersSubscription](../models/listcustomerssubscription.md)] | :heavy_check_mark: | Active and scheduled recurring plans that this customer has attached. | +| `purchases` | List[[models.ListCustomersPurchase](../models/listcustomerspurchase.md)] | :heavy_check_mark: | One-time purchases made by the customer. | +| `balances` | Dict[str, [models.ListCustomersBalances](../models/listcustomersbalances.md)] | :heavy_check_mark: | Feature balances keyed by feature ID, showing usage limits and remaining amounts. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersprice.md b/others/python-sdk/docs/models/listcustomersprice.md index 11660aa4e..8befe0085 100644 --- a/others/python-sdk/docs/models/listcustomersprice.md +++ b/others/python-sdk/docs/models/listcustomersprice.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `tiers` | List[[models.ListCustomersTier](../models/listcustomerstier.md)] | :heavy_minus_sign: | N/A | -| `billing_units` | *float* | :heavy_check_mark: | N/A | -| `billing_method` | [models.ListCustomersBillingMethod](../models/listcustomersbillingmethod.md) | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file +| `amount` | *Optional[float]* | :heavy_minus_sign: | The per-unit price amount. | +| `tiers` | List[[models.ListCustomersTier](../models/listcustomerstier.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.ListCustomersBillingMethod](../models/listcustomersbillingmethod.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomerspurchase.md b/others/python-sdk/docs/models/listcustomerspurchase.md index ba47d94a1..e2c10dcf5 100644 --- a/others/python-sdk/docs/models/listcustomerspurchase.md +++ b/others/python-sdk/docs/models/listcustomerspurchase.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | -| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | -| `plan_id` | *str* | :heavy_check_mark: | N/A | -| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `started_at` | *float* | :heavy_check_mark: | N/A | -| `quantity` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | +| `plan_id` | *str* | :heavy_check_mark: | The unique identifier of the purchased plan. | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the purchase expires, or null for lifetime access. | +| `started_at` | *float* | :heavy_check_mark: | Timestamp when the purchase was made. | +| `quantity` | *float* | :heavy_check_mark: | Number of units purchased. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersreset.md b/others/python-sdk/docs/models/listcustomersreset.md index 032f8c8d4..958fb5efc 100644 --- a/others/python-sdk/docs/models/listcustomersreset.md +++ b/others/python-sdk/docs/models/listcustomersreset.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `interval` | [models.ListCustomersIntervalUnion](../models/listcustomersintervalunion.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `resets_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `interval` | [models.ListCustomersIntervalUnion](../models/listcustomersintervalunion.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersresponse.md b/others/python-sdk/docs/models/listcustomersresponse.md index 4d7bbf3ef..a9000e17d 100644 --- a/others/python-sdk/docs/models/listcustomersresponse.md +++ b/others/python-sdk/docs/models/listcustomersresponse.md @@ -5,10 +5,10 @@ OK ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -| `list` | List[[models.ListT](../models/listt.md)] | :heavy_check_mark: | Array of items for current page | -| `has_more` | *bool* | :heavy_check_mark: | Whether more results exist after this page | -| `offset` | *float* | :heavy_check_mark: | Current offset position | -| `limit` | *float* | :heavy_check_mark: | Limit passed in the request | -| `total` | *float* | :heavy_check_mark: | Total number of items returned in the current page | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `list` | List[[models.ListCustomersList](../models/listcustomerslist.md)] | :heavy_check_mark: | Array of items for current page | +| `has_more` | *bool* | :heavy_check_mark: | Whether more results exist after this page | +| `offset` | *float* | :heavy_check_mark: | Current offset position | +| `limit` | *float* | :heavy_check_mark: | Limit passed in the request | +| `total` | *float* | :heavy_check_mark: | Total number of items returned in the current page | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersrollover.md b/others/python-sdk/docs/models/listcustomersrollover.md index 01463f0ef..469e24088 100644 --- a/others/python-sdk/docs/models/listcustomersrollover.md +++ b/others/python-sdk/docs/models/listcustomersrollover.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `balance` | *float* | :heavy_check_mark: | N/A | -| `expires_at` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file +| 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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersstatus.md b/others/python-sdk/docs/models/listcustomersstatus.md index 06b87554d..e11dcb9ea 100644 --- a/others/python-sdk/docs/models/listcustomersstatus.md +++ b/others/python-sdk/docs/models/listcustomersstatus.md @@ -1,10 +1,11 @@ # ListCustomersStatus +Current status of the subscription. + ## Values | Name | Value | | ----------- | ----------- | | `ACTIVE` | active | -| `SCHEDULED` | scheduled | -| `EXPIRED` | expired | \ No newline at end of file +| `SCHEDULED` | scheduled | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomerssubscription.md b/others/python-sdk/docs/models/listcustomerssubscription.md index 40294b3c6..851b003d8 100644 --- a/others/python-sdk/docs/models/listcustomerssubscription.md +++ b/others/python-sdk/docs/models/listcustomerssubscription.md @@ -3,18 +3,18 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | -| `plan_id` | *str* | :heavy_check_mark: | N/A | -| `auto_enable` | *bool* | :heavy_check_mark: | N/A | -| `add_on` | *bool* | :heavy_check_mark: | N/A | -| `status` | [models.ListCustomersStatus](../models/listcustomersstatus.md) | :heavy_check_mark: | N/A | -| `past_due` | *bool* | :heavy_check_mark: | N/A | -| `canceled_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `trial_ends_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `started_at` | *float* | :heavy_check_mark: | N/A | -| `current_period_start` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `current_period_end` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `quantity` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | +| `plan_id` | *str* | :heavy_check_mark: | The unique identifier of the subscribed plan. | +| `auto_enable` | *bool* | :heavy_check_mark: | Whether the plan was automatically enabled for the customer. | +| `add_on` | *bool* | :heavy_check_mark: | Whether this is an add-on plan rather than a base subscription. | +| `status` | [models.ListCustomersStatus](../models/listcustomersstatus.md) | :heavy_check_mark: | Current status of the subscription. | +| `past_due` | *bool* | :heavy_check_mark: | Whether the subscription has overdue payments. | +| `canceled_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the subscription was canceled, or null if not canceled. | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the subscription will expire, or null if no expiry set. | +| `trial_ends_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the trial period ends, or null if not on trial. | +| `started_at` | *float* | :heavy_check_mark: | Timestamp when the subscription started. | +| `current_period_start` | *Nullable[float]* | :heavy_check_mark: | Start timestamp of the current billing period. | +| `current_period_end` | *Nullable[float]* | :heavy_check_mark: | End timestamp of the current billing period. | +| `quantity` | *float* | :heavy_check_mark: | Number of units of this subscription (for per-seat plans). | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listeventscustomrange.md b/others/python-sdk/docs/models/listeventscustomrange.md new file mode 100644 index 000000000..bfc9d8933 --- /dev/null +++ b/others/python-sdk/docs/models/listeventscustomrange.md @@ -0,0 +1,11 @@ +# ListEventsCustomRange + +Filter events by time range + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `start` | *Optional[float]* | :heavy_minus_sign: | Filter events after this timestamp (epoch milliseconds) | +| `end` | *Optional[float]* | :heavy_minus_sign: | Filter events before this timestamp (epoch milliseconds) | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listeventsfeatureid.md b/others/python-sdk/docs/models/listeventsfeatureid.md new file mode 100644 index 000000000..ddf59bdd8 --- /dev/null +++ b/others/python-sdk/docs/models/listeventsfeatureid.md @@ -0,0 +1,19 @@ +# ListEventsFeatureID + +Filter by specific feature ID(s) + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `List[str]` + +```python +value: List[str] = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/listeventsglobals.md b/others/python-sdk/docs/models/listeventsglobals.md new file mode 100644 index 000000000..6be5efa88 --- /dev/null +++ b/others/python-sdk/docs/models/listeventsglobals.md @@ -0,0 +1,8 @@ +# ListEventsGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listeventslist.md b/others/python-sdk/docs/models/listeventslist.md new file mode 100644 index 000000000..bee48b3d8 --- /dev/null +++ b/others/python-sdk/docs/models/listeventslist.md @@ -0,0 +1,13 @@ +# ListEventsList + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Event ID (KSUID) | +| `timestamp` | *float* | :heavy_check_mark: | Event timestamp (epoch milliseconds) | +| `feature_id` | *str* | :heavy_check_mark: | ID of the feature that the event belongs to | +| `customer_id` | *str* | :heavy_check_mark: | Customer identifier | +| `value` | *float* | :heavy_check_mark: | Event value/count | +| `properties` | [models.ListEventsProperties](../models/listeventsproperties.md) | :heavy_check_mark: | Event properties (JSONB) | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listeventsproperties.md b/others/python-sdk/docs/models/listeventsproperties.md new file mode 100644 index 000000000..8f209af3f --- /dev/null +++ b/others/python-sdk/docs/models/listeventsproperties.md @@ -0,0 +1,9 @@ +# ListEventsProperties + +Event properties (JSONB) + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listeventsresponse.md b/others/python-sdk/docs/models/listeventsresponse.md new file mode 100644 index 000000000..0350b288f --- /dev/null +++ b/others/python-sdk/docs/models/listeventsresponse.md @@ -0,0 +1,14 @@ +# ListEventsResponse + +OK + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| `list` | List[[models.ListEventsList](../models/listeventslist.md)] | :heavy_check_mark: | Array of items for current page | +| `has_more` | *bool* | :heavy_check_mark: | Whether more results exist after this page | +| `offset` | *float* | :heavy_check_mark: | Current offset position | +| `limit` | *float* | :heavy_check_mark: | Limit passed in the request | +| `total` | *float* | :heavy_check_mark: | Total number of items returned in the current page | \ No newline at end of file diff --git a/others/python-sdk/docs/models/opencustomerportalglobals.md b/others/python-sdk/docs/models/opencustomerportalglobals.md new file mode 100644 index 000000000..eb21b29e8 --- /dev/null +++ b/others/python-sdk/docs/models/opencustomerportalglobals.md @@ -0,0 +1,8 @@ +# OpenCustomerPortalGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/opencustomerportalparams.md b/others/python-sdk/docs/models/opencustomerportalparams.md new file mode 100644 index 000000000..4d1d005b8 --- /dev/null +++ b/others/python-sdk/docs/models/opencustomerportalparams.md @@ -0,0 +1,10 @@ +# OpenCustomerPortalParams + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to open the billing portal for. | +| `configuration_id` | *Optional[str]* | :heavy_minus_sign: | Stripe billing portal configuration ID. Create configurations in your Stripe dashboard. | +| `return_url` | *Optional[str]* | :heavy_minus_sign: | URL to redirect to when back button is clicked in the billing portal | \ No newline at end of file diff --git a/others/python-sdk/docs/models/opencustomerportalresponse.md b/others/python-sdk/docs/models/opencustomerportalresponse.md new file mode 100644 index 000000000..e837aa4e1 --- /dev/null +++ b/others/python-sdk/docs/models/opencustomerportalresponse.md @@ -0,0 +1,11 @@ +# OpenCustomerPortalResponse + +OK + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the billing portal session | +| `url` | *str* | :heavy_check_mark: | URL to the billing portal | \ No newline at end of file diff --git a/others/python-sdk/docs/models/outgoing.md b/others/python-sdk/docs/models/outgoing.md deleted file mode 100644 index 907e05058..000000000 --- a/others/python-sdk/docs/models/outgoing.md +++ /dev/null @@ -1,12 +0,0 @@ -# Outgoing - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `plan` | [models.Plan](../models/plan.md) | :heavy_check_mark: | N/A | -| `feature_quantities` | List[[models.OutgoingFeatureQuantity](../models/outgoingfeaturequantity.md)] | :heavy_check_mark: | N/A | -| `balances` | Dict[str, [models.OutgoingBalances](../models/outgoingbalances.md)] | :heavy_check_mark: | N/A | -| `period_start` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `period_end` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/outgoingbalances.md b/others/python-sdk/docs/models/outgoingbalances.md deleted file mode 100644 index 67b05200a..000000000 --- a/others/python-sdk/docs/models/outgoingbalances.md +++ /dev/null @@ -1,18 +0,0 @@ -# OutgoingBalances - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `feature` | [Optional[models.OutgoingFeature]](../models/outgoingfeature.md) | :heavy_minus_sign: | N/A | -| `granted` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `overage_allowed` | *bool* | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `next_reset_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `breakdown` | List[[models.OutgoingBreakdown](../models/outgoingbreakdown.md)] | :heavy_minus_sign: | N/A | -| `rollovers` | List[[models.OutgoingRollover](../models/outgoingrollover.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/outgoingbreakdown.md b/others/python-sdk/docs/models/outgoingbreakdown.md deleted file mode 100644 index 835417699..000000000 --- a/others/python-sdk/docs/models/outgoingbreakdown.md +++ /dev/null @@ -1,17 +0,0 @@ -# OutgoingBreakdown - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `plan_id` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `included_grant` | *float* | :heavy_check_mark: | N/A | -| `prepaid_grant` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `reset` | [Nullable[models.OutgoingReset]](../models/outgoingreset.md) | :heavy_check_mark: | N/A | -| `price` | [Nullable[models.OutgoingPrice]](../models/outgoingprice.md) | :heavy_check_mark: | N/A | -| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/outgoingfeature.md b/others/python-sdk/docs/models/outgoingfeature.md deleted file mode 100644 index be19c88f8..000000000 --- a/others/python-sdk/docs/models/outgoingfeature.md +++ /dev/null @@ -1,15 +0,0 @@ -# OutgoingFeature - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | N/A | -| `name` | *str* | :heavy_check_mark: | N/A | -| `type` | [models.OutgoingType](../models/outgoingtype.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.OutgoingCreditSchema](../models/outgoingcreditschema.md)] | :heavy_minus_sign: | N/A | -| `display` | [Optional[models.OutgoingDisplay]](../models/outgoingdisplay.md) | :heavy_minus_sign: | N/A | -| `archived` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/outgoingfeaturequantity.md b/others/python-sdk/docs/models/outgoingfeaturequantity.md deleted file mode 100644 index bf6ac7965..000000000 --- a/others/python-sdk/docs/models/outgoingfeaturequantity.md +++ /dev/null @@ -1,9 +0,0 @@ -# OutgoingFeatureQuantity - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `quantity` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/outgoingintervalunion.md b/others/python-sdk/docs/models/outgoingintervalunion.md deleted file mode 100644 index 39506696d..000000000 --- a/others/python-sdk/docs/models/outgoingintervalunion.md +++ /dev/null @@ -1,17 +0,0 @@ -# OutgoingIntervalUnion - - -## Supported Types - -### `models.IntervalOutgoingEnum` - -```python -value: models.IntervalOutgoingEnum = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` - diff --git a/others/python-sdk/docs/models/outgoingprice.md b/others/python-sdk/docs/models/outgoingprice.md deleted file mode 100644 index 672a1b630..000000000 --- a/others/python-sdk/docs/models/outgoingprice.md +++ /dev/null @@ -1,12 +0,0 @@ -# OutgoingPrice - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `tiers` | List[[models.OutgoingTier](../models/outgoingtier.md)] | :heavy_minus_sign: | N/A | -| `billing_units` | *float* | :heavy_check_mark: | N/A | -| `billing_method` | [models.OutgoingBillingMethod](../models/outgoingbillingmethod.md) | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/outgoingreset.md b/others/python-sdk/docs/models/outgoingreset.md deleted file mode 100644 index e8c5d5a58..000000000 --- a/others/python-sdk/docs/models/outgoingreset.md +++ /dev/null @@ -1,10 +0,0 @@ -# OutgoingReset - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `interval` | [models.OutgoingIntervalUnion](../models/outgoingintervalunion.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `resets_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/outgoingrollover.md b/others/python-sdk/docs/models/outgoingrollover.md deleted file mode 100644 index 05c8274a3..000000000 --- a/others/python-sdk/docs/models/outgoingrollover.md +++ /dev/null @@ -1,9 +0,0 @@ -# OutgoingRollover - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `balance` | *float* | :heavy_check_mark: | N/A | -| `expires_at` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/outgoingtier.md b/others/python-sdk/docs/models/outgoingtier.md deleted file mode 100644 index 8442e7a75..000000000 --- a/others/python-sdk/docs/models/outgoingtier.md +++ /dev/null @@ -1,9 +0,0 @@ -# OutgoingTier - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `to` | *Optional[Any]* | :heavy_minus_sign: | N/A | -| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/preview.md b/others/python-sdk/docs/models/preview.md index 2ce7b1880..f1c2dbfbe 100644 --- a/others/python-sdk/docs/models/preview.md +++ b/others/python-sdk/docs/models/preview.md @@ -1,13 +1,15 @@ # Preview +Upgrade/upsell information when access is denied. Only present if with_preview was true and allowed is false. + ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `scenario` | [models.BalancesCheckScenario](../models/balancescheckscenario.md) | :heavy_check_mark: | N/A | -| `title` | *str* | :heavy_check_mark: | N/A | -| `message` | *str* | :heavy_check_mark: | N/A | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `feature_name` | *str* | :heavy_check_mark: | N/A | -| `products` | List[[models.Product](../models/product.md)] | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `scenario` | [models.CheckScenario](../models/checkscenario.md) | :heavy_check_mark: | The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. | +| `title` | *str* | :heavy_check_mark: | A title suitable for displaying in a paywall or upgrade modal. | +| `message` | *str* | :heavy_check_mark: | A message explaining why access was denied. | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature that was checked. | +| `feature_name` | *str* | :heavy_check_mark: | The display name of the feature. | +| `products` | List[[models.Product](../models/product.md)] | :heavy_check_mark: | Products that would grant access to this feature. Use to display upgrade options. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachbillingbehavior.md b/others/python-sdk/docs/models/previewattachbillingbehavior.md new file mode 100644 index 000000000..939760d3c --- /dev/null +++ b/others/python-sdk/docs/models/previewattachbillingbehavior.md @@ -0,0 +1,11 @@ +# PreviewAttachBillingBehavior + +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. + + +## Values + +| Name | Value | +| --------------------- | --------------------- | +| `PRORATE_IMMEDIATELY` | prorate_immediately | +| `NEXT_CYCLE_ONLY` | next_cycle_only | \ No newline at end of file diff --git a/others/python-sdk/docs/models/incomingbillingmethod.md b/others/python-sdk/docs/models/previewattachbillingmethod.md similarity index 83% rename from others/python-sdk/docs/models/incomingbillingmethod.md rename to others/python-sdk/docs/models/previewattachbillingmethod.md index 625b2ea8e..c7a69be0d 100644 --- a/others/python-sdk/docs/models/incomingbillingmethod.md +++ b/others/python-sdk/docs/models/previewattachbillingmethod.md @@ -1,4 +1,4 @@ -# IncomingBillingMethod +# PreviewAttachBillingMethod ## Values diff --git a/others/python-sdk/docs/models/previewattachcustomize.md b/others/python-sdk/docs/models/previewattachcustomize.md new file mode 100644 index 000000000..33454b398 --- /dev/null +++ b/others/python-sdk/docs/models/previewattachcustomize.md @@ -0,0 +1,11 @@ +# PreviewAttachCustomize + +Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `price` | [OptionalNullable[models.PreviewAttachPrice]](../models/previewattachprice.md) | :heavy_minus_sign: | N/A | +| `items` | List[[models.PreviewAttachItem](../models/previewattachitem.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachdiscountrequest1.md b/others/python-sdk/docs/models/previewattachdiscountrequest1.md new file mode 100644 index 000000000..3668fc69c --- /dev/null +++ b/others/python-sdk/docs/models/previewattachdiscountrequest1.md @@ -0,0 +1,8 @@ +# PreviewAttachDiscountRequest1 + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| `reward_id` | *str* | :heavy_check_mark: | The ID of the reward to apply as a discount. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachdiscountrequest2.md b/others/python-sdk/docs/models/previewattachdiscountrequest2.md new file mode 100644 index 000000000..2aec53384 --- /dev/null +++ b/others/python-sdk/docs/models/previewattachdiscountrequest2.md @@ -0,0 +1,8 @@ +# PreviewAttachDiscountRequest2 + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `promotion_code` | *str* | :heavy_check_mark: | The promotion code to apply as a discount. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachdiscountresponse.md b/others/python-sdk/docs/models/previewattachdiscountresponse.md similarity index 93% rename from others/python-sdk/docs/models/billingpreviewattachdiscountresponse.md rename to others/python-sdk/docs/models/previewattachdiscountresponse.md index ceeff606e..6d7254cdb 100644 --- a/others/python-sdk/docs/models/billingpreviewattachdiscountresponse.md +++ b/others/python-sdk/docs/models/previewattachdiscountresponse.md @@ -1,4 +1,4 @@ -# BillingPreviewAttachDiscountResponse +# PreviewAttachDiscountResponse ## Fields diff --git a/others/python-sdk/docs/models/previewattachdiscountunion.md b/others/python-sdk/docs/models/previewattachdiscountunion.md new file mode 100644 index 000000000..3a363e45f --- /dev/null +++ b/others/python-sdk/docs/models/previewattachdiscountunion.md @@ -0,0 +1,19 @@ +# PreviewAttachDiscountUnion + +A discount to apply. Can be either a reward ID or a promotion code. + + +## Supported Types + +### `models.PreviewAttachDiscountRequest1` + +```python +value: models.PreviewAttachDiscountRequest1 = /* values here */ +``` + +### `models.PreviewAttachDiscountRequest2` + +```python +value: models.PreviewAttachDiscountRequest2 = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/billingpreviewupdatedurationtype.md b/others/python-sdk/docs/models/previewattachdurationtype.md similarity index 77% rename from others/python-sdk/docs/models/billingpreviewupdatedurationtype.md rename to others/python-sdk/docs/models/previewattachdurationtype.md index bc9bf8399..a995bff9f 100644 --- a/others/python-sdk/docs/models/billingpreviewupdatedurationtype.md +++ b/others/python-sdk/docs/models/previewattachdurationtype.md @@ -1,4 +1,4 @@ -# BillingPreviewUpdateDurationType +# PreviewAttachDurationType ## Values diff --git a/others/python-sdk/docs/models/billingpreviewattachexpirydurationtype.md b/others/python-sdk/docs/models/previewattachexpirydurationtype.md similarity index 73% rename from others/python-sdk/docs/models/billingpreviewattachexpirydurationtype.md rename to others/python-sdk/docs/models/previewattachexpirydurationtype.md index fa4a03f9d..dcc75b098 100644 --- a/others/python-sdk/docs/models/billingpreviewattachexpirydurationtype.md +++ b/others/python-sdk/docs/models/previewattachexpirydurationtype.md @@ -1,4 +1,4 @@ -# BillingPreviewAttachExpiryDurationType +# PreviewAttachExpiryDurationType ## Values diff --git a/others/python-sdk/docs/models/billingpreviewattachfeaturequantities.md b/others/python-sdk/docs/models/previewattachfeaturequantity.md similarity index 91% rename from others/python-sdk/docs/models/billingpreviewattachfeaturequantities.md rename to others/python-sdk/docs/models/previewattachfeaturequantity.md index 9cbf9b7ae..0a0775496 100644 --- a/others/python-sdk/docs/models/billingpreviewattachfeaturequantities.md +++ b/others/python-sdk/docs/models/previewattachfeaturequantity.md @@ -1,4 +1,4 @@ -# BillingPreviewAttachFeatureQuantities +# PreviewAttachFeatureQuantity ## Fields diff --git a/others/python-sdk/docs/models/billingpreviewattachproration.md b/others/python-sdk/docs/models/previewattachfreetrial.md similarity index 53% rename from others/python-sdk/docs/models/billingpreviewattachproration.md rename to others/python-sdk/docs/models/previewattachfreetrial.md index cc692a111..54d2be4ee 100644 --- a/others/python-sdk/docs/models/billingpreviewattachproration.md +++ b/others/python-sdk/docs/models/previewattachfreetrial.md @@ -1,9 +1,10 @@ -# BillingPreviewAttachProration +# PreviewAttachFreeTrial ## Fields | Field | Type | Required | Description | | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `on_increase` | [models.BillingPreviewAttachOnIncrease](../models/billingpreviewattachonincrease.md) | :heavy_check_mark: | N/A | -| `on_decrease` | [models.BillingPreviewAttachOnDecrease](../models/billingpreviewattachondecrease.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| `duration_length` | *float* | :heavy_check_mark: | N/A | +| `duration_type` | [Optional[models.PreviewAttachDurationType]](../models/previewattachdurationtype.md) | :heavy_minus_sign: | N/A | +| `card_required` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachglobals.md b/others/python-sdk/docs/models/previewattachglobals.md new file mode 100644 index 000000000..cb44702b2 --- /dev/null +++ b/others/python-sdk/docs/models/previewattachglobals.md @@ -0,0 +1,8 @@ +# PreviewAttachGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachinvoicemode.md b/others/python-sdk/docs/models/previewattachinvoicemode.md new file mode 100644 index 000000000..52153f9fd --- /dev/null +++ b/others/python-sdk/docs/models/previewattachinvoicemode.md @@ -0,0 +1,12 @@ +# PreviewAttachInvoiceMode + +Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `enabled` | *bool* | :heavy_check_mark: | When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. | +| `enable_plan_immediately` | *Optional[bool]* | :heavy_minus_sign: | If true, enables the plan immediately even though the invoice is not paid yet. | +| `finalize` | *Optional[bool]* | :heavy_minus_sign: | If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachitem.md b/others/python-sdk/docs/models/previewattachitem.md new file mode 100644 index 000000000..ced5afb0b --- /dev/null +++ b/others/python-sdk/docs/models/previewattachitem.md @@ -0,0 +1,14 @@ +# PreviewAttachItem + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `feature_id` | *str* | :heavy_check_mark: | N/A | +| `included` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | N/A | +| `reset` | [Optional[models.PreviewAttachReset]](../models/previewattachreset.md) | :heavy_minus_sign: | N/A | +| `price` | [Optional[models.PreviewAttachItemPrice]](../models/previewattachitemprice.md) | :heavy_minus_sign: | N/A | +| `proration` | [Optional[models.PreviewAttachProration]](../models/previewattachproration.md) | :heavy_minus_sign: | N/A | +| `rollover` | [Optional[models.PreviewAttachRollover]](../models/previewattachrollover.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachitemprice.md b/others/python-sdk/docs/models/previewattachitemprice.md new file mode 100644 index 000000000..09404c66b --- /dev/null +++ b/others/python-sdk/docs/models/previewattachitemprice.md @@ -0,0 +1,14 @@ +# PreviewAttachItemPrice + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `tiers` | List[[models.PreviewAttachTier](../models/previewattachtier.md)] | :heavy_minus_sign: | N/A | +| `interval` | [models.PreviewAttachItemPriceInterval](../models/previewattachitempriceinterval.md) | :heavy_check_mark: | N/A | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `billing_units` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `billing_method` | [models.PreviewAttachBillingMethod](../models/previewattachbillingmethod.md) | :heavy_check_mark: | N/A | +| `max_purchase` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdatepriceinterval.md b/others/python-sdk/docs/models/previewattachitempriceinterval.md similarity index 88% rename from others/python-sdk/docs/models/billingpreviewupdatepriceinterval.md rename to others/python-sdk/docs/models/previewattachitempriceinterval.md index 9aae40a55..b258bbbcb 100644 --- a/others/python-sdk/docs/models/billingpreviewupdatepriceinterval.md +++ b/others/python-sdk/docs/models/previewattachitempriceinterval.md @@ -1,4 +1,4 @@ -# BillingPreviewUpdatePriceInterval +# PreviewAttachItemPriceInterval ## Values diff --git a/others/python-sdk/docs/models/previewattachlineitem.md b/others/python-sdk/docs/models/previewattachlineitem.md new file mode 100644 index 000000000..15eaac658 --- /dev/null +++ b/others/python-sdk/docs/models/previewattachlineitem.md @@ -0,0 +1,11 @@ +# PreviewAttachLineItem + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `title` | *str* | :heavy_check_mark: | The title of the line item. | +| `description` | *str* | :heavy_check_mark: | A detailed description of the line item. | +| `amount` | *float* | :heavy_check_mark: | The amount in cents for this line item. | +| `discounts` | List[[models.PreviewAttachDiscountResponse](../models/previewattachdiscountresponse.md)] | :heavy_minus_sign: | List of discounts applied to this line item. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachnextcycle.md b/others/python-sdk/docs/models/previewattachnextcycle.md new file mode 100644 index 000000000..4e08b0510 --- /dev/null +++ b/others/python-sdk/docs/models/previewattachnextcycle.md @@ -0,0 +1,11 @@ +# PreviewAttachNextCycle + +Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `starts_at` | *float* | :heavy_check_mark: | Unix timestamp (milliseconds) when the next billing cycle starts. | +| `total` | *float* | :heavy_check_mark: | The total amount in cents for the next cycle. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdateondecrease.md b/others/python-sdk/docs/models/previewattachondecrease.md similarity index 91% rename from others/python-sdk/docs/models/billingpreviewupdateondecrease.md rename to others/python-sdk/docs/models/previewattachondecrease.md index 563a48499..e092b88fd 100644 --- a/others/python-sdk/docs/models/billingpreviewupdateondecrease.md +++ b/others/python-sdk/docs/models/previewattachondecrease.md @@ -1,4 +1,4 @@ -# BillingPreviewUpdateOnDecrease +# PreviewAttachOnDecrease ## Values diff --git a/others/python-sdk/docs/models/billingpreviewattachonincrease.md b/others/python-sdk/docs/models/previewattachonincrease.md similarity index 90% rename from others/python-sdk/docs/models/billingpreviewattachonincrease.md rename to others/python-sdk/docs/models/previewattachonincrease.md index 3340da539..eb0441c2d 100644 --- a/others/python-sdk/docs/models/billingpreviewattachonincrease.md +++ b/others/python-sdk/docs/models/previewattachonincrease.md @@ -1,4 +1,4 @@ -# BillingPreviewAttachOnIncrease +# PreviewAttachOnIncrease ## Values diff --git a/others/python-sdk/docs/models/billingattachrequest.md b/others/python-sdk/docs/models/previewattachparams.md similarity index 56% rename from others/python-sdk/docs/models/billingattachrequest.md rename to others/python-sdk/docs/models/previewattachparams.md index 8d69dbc29..26735f118 100644 --- a/others/python-sdk/docs/models/billingattachrequest.md +++ b/others/python-sdk/docs/models/previewattachparams.md @@ -1,21 +1,20 @@ -# BillingAttachRequest +# PreviewAttachParams ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to attach the plan to. | -| `entity_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | -| `feature_quantities` | List[[models.BillingAttachFeatureQuantities](../models/billingattachfeaturequantities.md)] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | -| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to attach. | -| `free_trial` | [OptionalNullable[models.BillingAttachFreeTrial]](../models/billingattachfreetrial.md) | :heavy_minus_sign: | N/A | -| `customize` | [Optional[models.BillingAttachCustomize]](../models/billingattachcustomize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | -| `plan_id` | *str* | :heavy_check_mark: | N/A | -| `invoice_mode` | [Optional[models.BillingAttachInvoiceMode]](../models/billingattachinvoicemode.md) | :heavy_minus_sign: | N/A | -| `discounts` | List[[models.BillingAttachDiscountUnion](../models/billingattachdiscountunion.md)] | :heavy_minus_sign: | N/A | -| `redirect_mode` | [Optional[models.BillingAttachRedirectMode]](../models/billingattachredirectmode.md) | :heavy_minus_sign: | N/A | -| `success_url` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `new_billing_subscription` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `plan_schedule` | [Optional[models.BillingAttachPlanSchedule]](../models/billingattachplanschedule.md) | :heavy_minus_sign: | N/A | -| `billing_behavior` | [Optional[models.BillingAttachBillingBehavior]](../models/billingattachbillingbehavior.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to attach the plan to. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | +| `plan_id` | *str* | :heavy_check_mark: | The ID of the plan. | +| `feature_quantities` | List[[models.PreviewAttachFeatureQuantity](../models/previewattachfeaturequantity.md)] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | +| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to attach. | +| `free_trial` | [OptionalNullable[models.PreviewAttachFreeTrial]](../models/previewattachfreetrial.md) | :heavy_minus_sign: | Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. | +| `customize` | [Optional[models.PreviewAttachCustomize]](../models/previewattachcustomize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | +| `invoice_mode` | [Optional[models.PreviewAttachInvoiceMode]](../models/previewattachinvoicemode.md) | :heavy_minus_sign: | Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. | +| `billing_behavior` | [Optional[models.PreviewAttachBillingBehavior]](../models/previewattachbillingbehavior.md) | :heavy_minus_sign: | 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. | +| `discounts` | List[[models.PreviewAttachDiscountUnion](../models/previewattachdiscountunion.md)] | :heavy_minus_sign: | List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. | +| `success_url` | *Optional[str]* | :heavy_minus_sign: | URL to redirect to after successful checkout. | +| `new_billing_subscription` | *Optional[bool]* | :heavy_minus_sign: | Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. | +| `plan_schedule` | [Optional[models.PreviewAttachPlanSchedule]](../models/previewattachplanschedule.md) | :heavy_minus_sign: | When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachplanschedule.md b/others/python-sdk/docs/models/previewattachplanschedule.md new file mode 100644 index 000000000..7551150c5 --- /dev/null +++ b/others/python-sdk/docs/models/previewattachplanschedule.md @@ -0,0 +1,11 @@ +# PreviewAttachPlanSchedule + +When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `IMMEDIATE` | immediate | +| `END_OF_CYCLE` | end_of_cycle | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescheckreset.md b/others/python-sdk/docs/models/previewattachprice.md similarity index 82% rename from others/python-sdk/docs/models/balancescheckreset.md rename to others/python-sdk/docs/models/previewattachprice.md index e74c11589..ccc415e76 100644 --- a/others/python-sdk/docs/models/balancescheckreset.md +++ b/others/python-sdk/docs/models/previewattachprice.md @@ -1,10 +1,10 @@ -# BalancesCheckReset +# PreviewAttachPrice ## Fields | Field | Type | Required | Description | | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `interval` | [models.BalancesCheckIntervalUnion](../models/balancescheckintervalunion.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `resets_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file +| `amount` | *float* | :heavy_check_mark: | N/A | +| `interval` | [models.PreviewAttachPriceInterval](../models/previewattachpriceinterval.md) | :heavy_check_mark: | N/A | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachpriceinterval.md b/others/python-sdk/docs/models/previewattachpriceinterval.md similarity index 88% rename from others/python-sdk/docs/models/billingpreviewattachpriceinterval.md rename to others/python-sdk/docs/models/previewattachpriceinterval.md index cad605ebd..9d9ee86de 100644 --- a/others/python-sdk/docs/models/billingpreviewattachpriceinterval.md +++ b/others/python-sdk/docs/models/previewattachpriceinterval.md @@ -1,4 +1,4 @@ -# BillingPreviewAttachPriceInterval +# PreviewAttachPriceInterval ## Values diff --git a/packages/sdk/docs/models/balances-create-reset.md b/others/python-sdk/docs/models/previewattachproration.md similarity index 57% rename from packages/sdk/docs/models/balances-create-reset.md rename to others/python-sdk/docs/models/previewattachproration.md index eea59cb51..f7f7fb38b 100644 --- a/packages/sdk/docs/models/balances-create-reset.md +++ b/others/python-sdk/docs/models/previewattachproration.md @@ -1,20 +1,9 @@ -# BalancesCreateReset +# PreviewAttachProration -Reset configuration for the balance - -## Example Usage - -```typescript -import { BalancesCreateReset } from "@useautumn/sdk"; - -let value: BalancesCreateReset = { - interval: "year", -}; -``` ## Fields | Field | Type | Required | Description | | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `interval` | [models.BalancesCreateInterval](../models/balances-create-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `on_increase` | [models.PreviewAttachOnIncrease](../models/previewattachonincrease.md) | :heavy_check_mark: | N/A | +| `on_decrease` | [models.PreviewAttachOnDecrease](../models/previewattachondecrease.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachreset.md b/others/python-sdk/docs/models/previewattachreset.md new file mode 100644 index 000000000..2d89267d6 --- /dev/null +++ b/others/python-sdk/docs/models/previewattachreset.md @@ -0,0 +1,9 @@ +# PreviewAttachReset + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `interval` | [models.PreviewAttachResetInterval](../models/previewattachresetinterval.md) | :heavy_check_mark: | N/A | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachresetinterval.md b/others/python-sdk/docs/models/previewattachresetinterval.md new file mode 100644 index 000000000..85e80bbd0 --- /dev/null +++ b/others/python-sdk/docs/models/previewattachresetinterval.md @@ -0,0 +1,16 @@ +# PreviewAttachResetInterval + + +## 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 | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachresponse.md b/others/python-sdk/docs/models/previewattachresponse.md new file mode 100644 index 000000000..4d5b7e88b --- /dev/null +++ b/others/python-sdk/docs/models/previewattachresponse.md @@ -0,0 +1,14 @@ +# PreviewAttachResponse + +OK + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer. | +| `line_items` | List[[models.PreviewAttachLineItem](../models/previewattachlineitem.md)] | :heavy_check_mark: | List of line items for the current billing period. | +| `total` | *float* | :heavy_check_mark: | The total amount in cents for the current billing period. | +| `currency` | *str* | :heavy_check_mark: | The three-letter ISO currency code (e.g., 'usd'). | +| `next_cycle` | [Optional[models.PreviewAttachNextCycle]](../models/previewattachnextcycle.md) | :heavy_minus_sign: | Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewattachrollover.md b/others/python-sdk/docs/models/previewattachrollover.md new file mode 100644 index 000000000..35b9addf8 --- /dev/null +++ b/others/python-sdk/docs/models/previewattachrollover.md @@ -0,0 +1,10 @@ +# PreviewAttachRollover + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `max` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `expiry_duration_type` | [models.PreviewAttachExpiryDurationType](../models/previewattachexpirydurationtype.md) | :heavy_check_mark: | N/A | +| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestracktier.md b/others/python-sdk/docs/models/previewattachtier.md similarity index 91% rename from others/python-sdk/docs/models/balancestracktier.md rename to others/python-sdk/docs/models/previewattachtier.md index 7ca7d8665..014eb1109 100644 --- a/others/python-sdk/docs/models/balancestracktier.md +++ b/others/python-sdk/docs/models/previewattachtier.md @@ -1,9 +1,9 @@ -# BalancesTrackTier +# PreviewAttachTier ## Fields | Field | Type | Required | Description | | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | -| `to` | [models.BalancesTrackTo](../models/balancestrackto.md) | :heavy_check_mark: | N/A | +| `to` | [models.PreviewAttachTo](../models/previewattachto.md) | :heavy_check_mark: | N/A | | `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescheckbalanceto.md b/others/python-sdk/docs/models/previewattachto.md similarity index 84% rename from others/python-sdk/docs/models/balancescheckbalanceto.md rename to others/python-sdk/docs/models/previewattachto.md index 7424bebbb..90c95d6ef 100644 --- a/others/python-sdk/docs/models/balancescheckbalanceto.md +++ b/others/python-sdk/docs/models/previewattachto.md @@ -1,4 +1,4 @@ -# BalancesCheckBalanceTo +# PreviewAttachTo ## Supported Types diff --git a/others/python-sdk/docs/models/previewupdatebillingbehavior.md b/others/python-sdk/docs/models/previewupdatebillingbehavior.md new file mode 100644 index 000000000..622030b67 --- /dev/null +++ b/others/python-sdk/docs/models/previewupdatebillingbehavior.md @@ -0,0 +1,11 @@ +# PreviewUpdateBillingBehavior + +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. + + +## Values + +| Name | Value | +| --------------------- | --------------------- | +| `PRORATE_IMMEDIATELY` | prorate_immediately | +| `NEXT_CYCLE_ONLY` | next_cycle_only | \ No newline at end of file diff --git a/others/python-sdk/docs/models/outgoingbillingmethod.md b/others/python-sdk/docs/models/previewupdatebillingmethod.md similarity index 83% rename from others/python-sdk/docs/models/outgoingbillingmethod.md rename to others/python-sdk/docs/models/previewupdatebillingmethod.md index 0b62751cf..07e5a9ad4 100644 --- a/others/python-sdk/docs/models/outgoingbillingmethod.md +++ b/others/python-sdk/docs/models/previewupdatebillingmethod.md @@ -1,4 +1,4 @@ -# OutgoingBillingMethod +# PreviewUpdateBillingMethod ## Values diff --git a/others/python-sdk/docs/models/billingpreviewupdatecancelaction.md b/others/python-sdk/docs/models/previewupdatecancelaction.md similarity index 55% rename from others/python-sdk/docs/models/billingpreviewupdatecancelaction.md rename to others/python-sdk/docs/models/previewupdatecancelaction.md index 3afae72ae..e5347d997 100644 --- a/others/python-sdk/docs/models/billingpreviewupdatecancelaction.md +++ b/others/python-sdk/docs/models/previewupdatecancelaction.md @@ -1,4 +1,6 @@ -# BillingPreviewUpdateCancelAction +# PreviewUpdateCancelAction + +Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. ## Values diff --git a/others/python-sdk/docs/models/previewupdatecustomize.md b/others/python-sdk/docs/models/previewupdatecustomize.md new file mode 100644 index 000000000..dd1c31dcf --- /dev/null +++ b/others/python-sdk/docs/models/previewupdatecustomize.md @@ -0,0 +1,11 @@ +# PreviewUpdateCustomize + +Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `price` | [OptionalNullable[models.PreviewUpdatePrice]](../models/previewupdateprice.md) | :heavy_minus_sign: | N/A | +| `items` | List[[models.PreviewUpdateItem](../models/previewupdateitem.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdatediscount.md b/others/python-sdk/docs/models/previewupdatediscount.md similarity index 94% rename from others/python-sdk/docs/models/billingpreviewupdatediscount.md rename to others/python-sdk/docs/models/previewupdatediscount.md index 5c8834286..b1b08d33b 100644 --- a/others/python-sdk/docs/models/billingpreviewupdatediscount.md +++ b/others/python-sdk/docs/models/previewupdatediscount.md @@ -1,4 +1,4 @@ -# BillingPreviewUpdateDiscount +# PreviewUpdateDiscount ## Fields diff --git a/others/python-sdk/docs/models/billingpreviewattachdurationtype.md b/others/python-sdk/docs/models/previewupdatedurationtype.md similarity index 77% rename from others/python-sdk/docs/models/billingpreviewattachdurationtype.md rename to others/python-sdk/docs/models/previewupdatedurationtype.md index a105fd4ca..260c788c7 100644 --- a/others/python-sdk/docs/models/billingpreviewattachdurationtype.md +++ b/others/python-sdk/docs/models/previewupdatedurationtype.md @@ -1,4 +1,4 @@ -# BillingPreviewAttachDurationType +# PreviewUpdateDurationType ## Values diff --git a/others/python-sdk/docs/models/billingpreviewupdateexpirydurationtype.md b/others/python-sdk/docs/models/previewupdateexpirydurationtype.md similarity index 73% rename from others/python-sdk/docs/models/billingpreviewupdateexpirydurationtype.md rename to others/python-sdk/docs/models/previewupdateexpirydurationtype.md index 791a80ecf..f48ebd5a7 100644 --- a/others/python-sdk/docs/models/billingpreviewupdateexpirydurationtype.md +++ b/others/python-sdk/docs/models/previewupdateexpirydurationtype.md @@ -1,4 +1,4 @@ -# BillingPreviewUpdateExpiryDurationType +# PreviewUpdateExpiryDurationType ## Values diff --git a/others/python-sdk/docs/models/billingpreviewupdatefeaturequantities.md b/others/python-sdk/docs/models/previewupdatefeaturequantity.md similarity index 91% rename from others/python-sdk/docs/models/billingpreviewupdatefeaturequantities.md rename to others/python-sdk/docs/models/previewupdatefeaturequantity.md index a15e753cb..dbc2e2723 100644 --- a/others/python-sdk/docs/models/billingpreviewupdatefeaturequantities.md +++ b/others/python-sdk/docs/models/previewupdatefeaturequantity.md @@ -1,4 +1,4 @@ -# BillingPreviewUpdateFeatureQuantities +# PreviewUpdateFeatureQuantity ## Fields diff --git a/others/python-sdk/docs/models/billingpreviewupdateproration.md b/others/python-sdk/docs/models/previewupdatefreetrial.md similarity index 53% rename from others/python-sdk/docs/models/billingpreviewupdateproration.md rename to others/python-sdk/docs/models/previewupdatefreetrial.md index 334f3ff9f..195d54bc5 100644 --- a/others/python-sdk/docs/models/billingpreviewupdateproration.md +++ b/others/python-sdk/docs/models/previewupdatefreetrial.md @@ -1,9 +1,10 @@ -# BillingPreviewUpdateProration +# PreviewUpdateFreeTrial ## Fields | Field | Type | Required | Description | | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `on_increase` | [models.BillingPreviewUpdateOnIncrease](../models/billingpreviewupdateonincrease.md) | :heavy_check_mark: | N/A | -| `on_decrease` | [models.BillingPreviewUpdateOnDecrease](../models/billingpreviewupdateondecrease.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| `duration_length` | *float* | :heavy_check_mark: | N/A | +| `duration_type` | [Optional[models.PreviewUpdateDurationType]](../models/previewupdatedurationtype.md) | :heavy_minus_sign: | N/A | +| `card_required` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdateglobals.md b/others/python-sdk/docs/models/previewupdateglobals.md new file mode 100644 index 000000000..a2643aff7 --- /dev/null +++ b/others/python-sdk/docs/models/previewupdateglobals.md @@ -0,0 +1,8 @@ +# PreviewUpdateGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdateinvoicemode.md b/others/python-sdk/docs/models/previewupdateinvoicemode.md new file mode 100644 index 000000000..7210d48c7 --- /dev/null +++ b/others/python-sdk/docs/models/previewupdateinvoicemode.md @@ -0,0 +1,12 @@ +# PreviewUpdateInvoiceMode + +Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `enabled` | *bool* | :heavy_check_mark: | When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. | +| `enable_plan_immediately` | *Optional[bool]* | :heavy_minus_sign: | If true, enables the plan immediately even though the invoice is not paid yet. | +| `finalize` | *Optional[bool]* | :heavy_minus_sign: | If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdateitem.md b/others/python-sdk/docs/models/previewupdateitem.md new file mode 100644 index 000000000..1afdeceab --- /dev/null +++ b/others/python-sdk/docs/models/previewupdateitem.md @@ -0,0 +1,14 @@ +# PreviewUpdateItem + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `feature_id` | *str* | :heavy_check_mark: | N/A | +| `included` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | N/A | +| `reset` | [Optional[models.PreviewUpdateReset]](../models/previewupdatereset.md) | :heavy_minus_sign: | N/A | +| `price` | [Optional[models.PreviewUpdateItemPrice]](../models/previewupdateitemprice.md) | :heavy_minus_sign: | N/A | +| `proration` | [Optional[models.PreviewUpdateProration]](../models/previewupdateproration.md) | :heavy_minus_sign: | N/A | +| `rollover` | [Optional[models.PreviewUpdateRollover]](../models/previewupdaterollover.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdateitemprice.md b/others/python-sdk/docs/models/previewupdateitemprice.md new file mode 100644 index 000000000..f699b1b9c --- /dev/null +++ b/others/python-sdk/docs/models/previewupdateitemprice.md @@ -0,0 +1,14 @@ +# PreviewUpdateItemPrice + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `tiers` | List[[models.PreviewUpdateTier](../models/previewupdatetier.md)] | :heavy_minus_sign: | N/A | +| `interval` | [models.PreviewUpdateItemPriceInterval](../models/previewupdateitempriceinterval.md) | :heavy_check_mark: | N/A | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `billing_units` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `billing_method` | [models.PreviewUpdateBillingMethod](../models/previewupdatebillingmethod.md) | :heavy_check_mark: | N/A | +| `max_purchase` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachitempriceinterval.md b/others/python-sdk/docs/models/previewupdateitempriceinterval.md similarity index 87% rename from others/python-sdk/docs/models/billingpreviewattachitempriceinterval.md rename to others/python-sdk/docs/models/previewupdateitempriceinterval.md index ce1e43170..de9ace7df 100644 --- a/others/python-sdk/docs/models/billingpreviewattachitempriceinterval.md +++ b/others/python-sdk/docs/models/previewupdateitempriceinterval.md @@ -1,4 +1,4 @@ -# BillingPreviewAttachItemPriceInterval +# PreviewUpdateItemPriceInterval ## Values diff --git a/others/python-sdk/docs/models/previewupdatelineitem.md b/others/python-sdk/docs/models/previewupdatelineitem.md new file mode 100644 index 000000000..b281ea60c --- /dev/null +++ b/others/python-sdk/docs/models/previewupdatelineitem.md @@ -0,0 +1,11 @@ +# PreviewUpdateLineItem + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `title` | *str* | :heavy_check_mark: | The title of the line item. | +| `description` | *str* | :heavy_check_mark: | A detailed description of the line item. | +| `amount` | *float* | :heavy_check_mark: | The amount in cents for this line item. | +| `discounts` | List[[models.PreviewUpdateDiscount](../models/previewupdatediscount.md)] | :heavy_minus_sign: | List of discounts applied to this line item. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdatenextcycle.md b/others/python-sdk/docs/models/previewupdatenextcycle.md new file mode 100644 index 000000000..5a571a97d --- /dev/null +++ b/others/python-sdk/docs/models/previewupdatenextcycle.md @@ -0,0 +1,11 @@ +# PreviewUpdateNextCycle + +Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `starts_at` | *float* | :heavy_check_mark: | Unix timestamp (milliseconds) when the next billing cycle starts. | +| `total` | *float* | :heavy_check_mark: | The total amount in cents for the next cycle. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachondecrease.md b/others/python-sdk/docs/models/previewupdateondecrease.md similarity index 91% rename from others/python-sdk/docs/models/billingpreviewattachondecrease.md rename to others/python-sdk/docs/models/previewupdateondecrease.md index 215203f10..418b15cfe 100644 --- a/others/python-sdk/docs/models/billingpreviewattachondecrease.md +++ b/others/python-sdk/docs/models/previewupdateondecrease.md @@ -1,4 +1,4 @@ -# BillingPreviewAttachOnDecrease +# PreviewUpdateOnDecrease ## Values diff --git a/others/python-sdk/docs/models/billingpreviewupdateonincrease.md b/others/python-sdk/docs/models/previewupdateonincrease.md similarity index 90% rename from others/python-sdk/docs/models/billingpreviewupdateonincrease.md rename to others/python-sdk/docs/models/previewupdateonincrease.md index ce640196b..e3e53e3b7 100644 --- a/others/python-sdk/docs/models/billingpreviewupdateonincrease.md +++ b/others/python-sdk/docs/models/previewupdateonincrease.md @@ -1,4 +1,4 @@ -# BillingPreviewUpdateOnIncrease +# PreviewUpdateOnIncrease ## Values diff --git a/others/python-sdk/docs/models/billingpreviewupdaterequest.md b/others/python-sdk/docs/models/previewupdateparams.md similarity index 57% rename from others/python-sdk/docs/models/billingpreviewupdaterequest.md rename to others/python-sdk/docs/models/previewupdateparams.md index e4399ce1f..46a76e5ac 100644 --- a/others/python-sdk/docs/models/billingpreviewupdaterequest.md +++ b/others/python-sdk/docs/models/previewupdateparams.md @@ -1,17 +1,17 @@ -# BillingPreviewUpdateRequest +# PreviewUpdateParams ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to attach the plan to. | -| `entity_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | -| `feature_quantities` | List[[models.BillingPreviewUpdateFeatureQuantities](../models/billingpreviewupdatefeaturequantities.md)] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | -| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to attach. | -| `free_trial` | [OptionalNullable[models.BillingPreviewUpdateFreeTrial]](../models/billingpreviewupdatefreetrial.md) | :heavy_minus_sign: | N/A | -| `customize` | [Optional[models.BillingPreviewUpdateCustomize]](../models/billingpreviewupdatecustomize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | -| `plan_id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `invoice_mode` | [Optional[models.BillingPreviewUpdateInvoiceMode]](../models/billingpreviewupdateinvoicemode.md) | :heavy_minus_sign: | N/A | -| `cancel_action` | [Optional[models.BillingPreviewUpdateCancelAction]](../models/billingpreviewupdatecancelaction.md) | :heavy_minus_sign: | N/A | -| `billing_behavior` | [Optional[models.BillingPreviewUpdateBillingBehavior]](../models/billingpreviewupdatebillingbehavior.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to attach the plan to. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | +| `plan_id` | *str* | :heavy_check_mark: | The ID of the plan. | +| `feature_quantities` | List[[models.PreviewUpdateFeatureQuantity](../models/previewupdatefeaturequantity.md)] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | +| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to attach. | +| `free_trial` | [OptionalNullable[models.PreviewUpdateFreeTrial]](../models/previewupdatefreetrial.md) | :heavy_minus_sign: | Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. | +| `customize` | [Optional[models.PreviewUpdateCustomize]](../models/previewupdatecustomize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | +| `invoice_mode` | [Optional[models.PreviewUpdateInvoiceMode]](../models/previewupdateinvoicemode.md) | :heavy_minus_sign: | Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. | +| `billing_behavior` | [Optional[models.PreviewUpdateBillingBehavior]](../models/previewupdatebillingbehavior.md) | :heavy_minus_sign: | 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. | +| `cancel_action` | [Optional[models.PreviewUpdateCancelAction]](../models/previewupdatecancelaction.md) | :heavy_minus_sign: | Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackreset.md b/others/python-sdk/docs/models/previewupdateprice.md similarity index 82% rename from others/python-sdk/docs/models/balancestrackreset.md rename to others/python-sdk/docs/models/previewupdateprice.md index 4e018a335..a0c8b350a 100644 --- a/others/python-sdk/docs/models/balancestrackreset.md +++ b/others/python-sdk/docs/models/previewupdateprice.md @@ -1,10 +1,10 @@ -# BalancesTrackReset +# PreviewUpdatePrice ## Fields | Field | Type | Required | Description | | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `interval` | [models.BalancesTrackIntervalUnion](../models/balancestrackintervalunion.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `resets_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file +| `amount` | *float* | :heavy_check_mark: | N/A | +| `interval` | [models.PreviewUpdatePriceInterval](../models/previewupdatepriceinterval.md) | :heavy_check_mark: | N/A | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewupdateitempriceinterval.md b/others/python-sdk/docs/models/previewupdatepriceinterval.md similarity index 87% rename from others/python-sdk/docs/models/billingpreviewupdateitempriceinterval.md rename to others/python-sdk/docs/models/previewupdatepriceinterval.md index 0b3f4d8ea..04ed4b006 100644 --- a/others/python-sdk/docs/models/billingpreviewupdateitempriceinterval.md +++ b/others/python-sdk/docs/models/previewupdatepriceinterval.md @@ -1,4 +1,4 @@ -# BillingPreviewUpdateItemPriceInterval +# PreviewUpdatePriceInterval ## Values diff --git a/others/python-sdk/docs/models/previewupdateproration.md b/others/python-sdk/docs/models/previewupdateproration.md new file mode 100644 index 000000000..36d19f6f8 --- /dev/null +++ b/others/python-sdk/docs/models/previewupdateproration.md @@ -0,0 +1,9 @@ +# PreviewUpdateProration + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `on_increase` | [models.PreviewUpdateOnIncrease](../models/previewupdateonincrease.md) | :heavy_check_mark: | N/A | +| `on_decrease` | [models.PreviewUpdateOnDecrease](../models/previewupdateondecrease.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdatereset.md b/others/python-sdk/docs/models/previewupdatereset.md new file mode 100644 index 000000000..c77a0bf23 --- /dev/null +++ b/others/python-sdk/docs/models/previewupdatereset.md @@ -0,0 +1,9 @@ +# PreviewUpdateReset + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `interval` | [models.PreviewUpdateResetInterval](../models/previewupdateresetinterval.md) | :heavy_check_mark: | N/A | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdateresetinterval.md b/others/python-sdk/docs/models/previewupdateresetinterval.md new file mode 100644 index 000000000..3aaf15ff0 --- /dev/null +++ b/others/python-sdk/docs/models/previewupdateresetinterval.md @@ -0,0 +1,16 @@ +# PreviewUpdateResetInterval + + +## 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 | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdateresponse.md b/others/python-sdk/docs/models/previewupdateresponse.md new file mode 100644 index 000000000..595be6d28 --- /dev/null +++ b/others/python-sdk/docs/models/previewupdateresponse.md @@ -0,0 +1,14 @@ +# PreviewUpdateResponse + +OK + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer. | +| `line_items` | List[[models.PreviewUpdateLineItem](../models/previewupdatelineitem.md)] | :heavy_check_mark: | List of line items for the current billing period. | +| `total` | *float* | :heavy_check_mark: | The total amount in cents for the current billing period. | +| `currency` | *str* | :heavy_check_mark: | The three-letter ISO currency code (e.g., 'usd'). | +| `next_cycle` | [Optional[models.PreviewUpdateNextCycle]](../models/previewupdatenextcycle.md) | :heavy_minus_sign: | Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdaterollover.md b/others/python-sdk/docs/models/previewupdaterollover.md new file mode 100644 index 000000000..2972f7cd1 --- /dev/null +++ b/others/python-sdk/docs/models/previewupdaterollover.md @@ -0,0 +1,10 @@ +# PreviewUpdateRollover + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `max` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `expiry_duration_type` | [models.PreviewUpdateExpiryDurationType](../models/previewupdateexpirydurationtype.md) | :heavy_check_mark: | N/A | +| `expiry_duration_length` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdatetier.md b/others/python-sdk/docs/models/previewupdatetier.md new file mode 100644 index 000000000..07811547b --- /dev/null +++ b/others/python-sdk/docs/models/previewupdatetier.md @@ -0,0 +1,9 @@ +# PreviewUpdateTier + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | +| `to` | [models.PreviewUpdateTo](../models/previewupdateto.md) | :heavy_check_mark: | N/A | +| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/previewupdateto.md b/others/python-sdk/docs/models/previewupdateto.md new file mode 100644 index 000000000..95413264a --- /dev/null +++ b/others/python-sdk/docs/models/previewupdateto.md @@ -0,0 +1,17 @@ +# PreviewUpdateTo + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/product.md b/others/python-sdk/docs/models/product.md index 002e88966..61d180959 100644 --- a/others/python-sdk/docs/models/product.md +++ b/others/python-sdk/docs/models/product.md @@ -8,14 +8,14 @@ | `id` | *str* | :heavy_check_mark: | The ID of the product you set when creating the product | | `name` | *str* | :heavy_check_mark: | The name of the product | | `group` | *Nullable[str]* | :heavy_check_mark: | Product group which this product belongs to | -| `env` | [models.BalancesCheckEnv](../models/balancescheckenv.md) | :heavy_check_mark: | The environment of the product | +| `env` | [models.CheckEnv](../models/checkenv.md) | :heavy_check_mark: | The environment of the product | | `is_add_on` | *bool* | :heavy_check_mark: | Whether the product is an add-on and can be purchased alongside other products | | `is_default` | *bool* | :heavy_check_mark: | Whether the product is the default product | | `archived` | *bool* | :heavy_check_mark: | Whether this product has been archived and is no longer available | | `version` | *float* | :heavy_check_mark: | The current version of the product | | `created_at` | *float* | :heavy_check_mark: | The timestamp of when the product was created in milliseconds since epoch | -| `items` | List[[models.BalancesCheckItem](../models/balancescheckitem.md)] | :heavy_check_mark: | Array of product items that define the product's features and pricing | -| `free_trial` | [Nullable[models.BalancesCheckFreeTrial]](../models/balancescheckfreetrial.md) | :heavy_check_mark: | Free trial configuration for this product, if available | +| `items` | List[[models.CheckItem](../models/checkitem.md)] | :heavy_check_mark: | Array of product items that define the product's features and pricing | +| `free_trial` | [Nullable[models.CheckFreeTrial]](../models/checkfreetrial.md) | :heavy_check_mark: | Free trial configuration for this product, if available | | `base_variant_id` | *Nullable[str]* | :heavy_check_mark: | ID of the base variant this product is derived from | | `scenario` | [Optional[models.ProductScenario]](../models/productscenario.md) | :heavy_minus_sign: | Scenario for when this product is used in attach flows | -| `properties` | [Optional[models.Properties]](../models/properties.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `properties` | [Optional[models.CheckProperties]](../models/checkproperties.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/purchase.md b/others/python-sdk/docs/models/purchase.md index f01a0bf06..133bec63c 100644 --- a/others/python-sdk/docs/models/purchase.md +++ b/others/python-sdk/docs/models/purchase.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | -| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | -| `plan_id` | *str* | :heavy_check_mark: | N/A | -| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `started_at` | *float* | :heavy_check_mark: | N/A | -| `quantity` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | +| `plan_id` | *str* | :heavy_check_mark: | The unique identifier of the purchased plan. | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the purchase expires, or null for lifetime access. | +| `started_at` | *float* | :heavy_check_mark: | Timestamp when the purchase was made. | +| `quantity` | *float* | :heavy_check_mark: | Number of units purchased. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/range.md b/others/python-sdk/docs/models/range.md new file mode 100644 index 000000000..88e64b855 --- /dev/null +++ b/others/python-sdk/docs/models/range.md @@ -0,0 +1,16 @@ +# Range + +Time range to aggregate events for. Either range or custom_range must be provided + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `TWENTY_FOURH` | 24h | +| `SEVEND` | 7d | +| `THIRTYD` | 30d | +| `NINETYD` | 90d | +| `LAST_CYCLE` | last_cycle | +| `ONEBC` | 1bc | +| `THREEBC` | 3bc | \ No newline at end of file diff --git a/others/python-sdk/docs/models/redeemreferralcodeglobals.md b/others/python-sdk/docs/models/redeemreferralcodeglobals.md new file mode 100644 index 000000000..b02075fda --- /dev/null +++ b/others/python-sdk/docs/models/redeemreferralcodeglobals.md @@ -0,0 +1,8 @@ +# RedeemReferralCodeGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/redeemreferralcodeparams.md b/others/python-sdk/docs/models/redeemreferralcodeparams.md new file mode 100644 index 000000000..0c211d6b3 --- /dev/null +++ b/others/python-sdk/docs/models/redeemreferralcodeparams.md @@ -0,0 +1,9 @@ +# RedeemReferralCodeParams + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `code` | *str* | :heavy_check_mark: | The referral code to redeem | +| `customer_id` | *str* | :heavy_check_mark: | The unique identifier of the customer redeeming the code | \ No newline at end of file diff --git a/others/python-sdk/docs/models/redeemreferralcoderesponse.md b/others/python-sdk/docs/models/redeemreferralcoderesponse.md new file mode 100644 index 000000000..86a305301 --- /dev/null +++ b/others/python-sdk/docs/models/redeemreferralcoderesponse.md @@ -0,0 +1,12 @@ +# RedeemReferralCodeResponse + +OK + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The ID of the redemption event | +| `customer_id` | *str* | :heavy_check_mark: | Your unique identifier for the customer | +| `reward_id` | *str* | :heavy_check_mark: | The ID of the reward that will be granted | \ No newline at end of file diff --git a/others/python-sdk/docs/models/redirecttype.md b/others/python-sdk/docs/models/redirecttype.md deleted file mode 100644 index 9dd413cda..000000000 --- a/others/python-sdk/docs/models/redirecttype.md +++ /dev/null @@ -1,9 +0,0 @@ -# RedirectType - - -## Values - -| Name | Value | -| ----------------- | ----------------- | -| `STRIPE_CHECKOUT` | stripe_checkout | -| `AUTUMN_CHECKOUT` | autumn_checkout | \ No newline at end of file diff --git a/others/python-sdk/docs/models/status.md b/others/python-sdk/docs/models/status.md index ea0eb8293..cdb313f7b 100644 --- a/others/python-sdk/docs/models/status.md +++ b/others/python-sdk/docs/models/status.md @@ -1,10 +1,11 @@ # Status +Current status of the subscription. + ## Values | Name | Value | | ----------- | ----------- | | `ACTIVE` | active | -| `SCHEDULED` | scheduled | -| `EXPIRED` | expired | \ No newline at end of file +| `SCHEDULED` | scheduled | \ No newline at end of file diff --git a/others/python-sdk/docs/models/subscription.md b/others/python-sdk/docs/models/subscription.md index e7c4060bc..d8c7fa664 100644 --- a/others/python-sdk/docs/models/subscription.md +++ b/others/python-sdk/docs/models/subscription.md @@ -3,18 +3,18 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | -| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | -| `plan_id` | *str* | :heavy_check_mark: | N/A | -| `auto_enable` | *bool* | :heavy_check_mark: | N/A | -| `add_on` | *bool* | :heavy_check_mark: | N/A | -| `status` | [models.Status](../models/status.md) | :heavy_check_mark: | N/A | -| `past_due` | *bool* | :heavy_check_mark: | N/A | -| `canceled_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `trial_ends_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `started_at` | *float* | :heavy_check_mark: | N/A | -| `current_period_start` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `current_period_end` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `quantity` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | +| `plan_id` | *str* | :heavy_check_mark: | The unique identifier of the subscribed plan. | +| `auto_enable` | *bool* | :heavy_check_mark: | Whether the plan was automatically enabled for the customer. | +| `add_on` | *bool* | :heavy_check_mark: | Whether this is an add-on plan rather than a base subscription. | +| `status` | [models.Status](../models/status.md) | :heavy_check_mark: | Current status of the subscription. | +| `past_due` | *bool* | :heavy_check_mark: | Whether the subscription has overdue payments. | +| `canceled_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the subscription was canceled, or null if not canceled. | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the subscription will expire, or null if no expiry set. | +| `trial_ends_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the trial period ends, or null if not on trial. | +| `started_at` | *float* | :heavy_check_mark: | Timestamp when the subscription started. | +| `current_period_start` | *Nullable[float]* | :heavy_check_mark: | Start timestamp of the current billing period. | +| `current_period_end` | *Nullable[float]* | :heavy_check_mark: | End timestamp of the current billing period. | +| `quantity` | *float* | :heavy_check_mark: | Number of units of this subscription (for per-seat plans). | \ No newline at end of file diff --git a/others/python-sdk/docs/models/total.md b/others/python-sdk/docs/models/total.md new file mode 100644 index 000000000..0ffbc190b --- /dev/null +++ b/others/python-sdk/docs/models/total.md @@ -0,0 +1,9 @@ +# Total + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `count` | *float* | :heavy_check_mark: | Number of events for this feature | +| `sum` | *float* | :heavy_check_mark: | Sum of event values for this feature | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackbalance.md b/others/python-sdk/docs/models/trackbalance.md new file mode 100644 index 000000000..3aae6b7ae --- /dev/null +++ b/others/python-sdk/docs/models/trackbalance.md @@ -0,0 +1,18 @@ +# TrackBalance + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `feature_id` | *str* | :heavy_check_mark: | The feature ID this balance is for. | +| `feature` | [Optional[models.TrackBalanceFeature]](../models/trackbalancefeature.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.TrackBalanceBreakdown](../models/trackbalancebreakdown.md)] | :heavy_minus_sign: | Detailed breakdown of balance sources when stacking multiple plans or grants. | +| `rollovers` | List[[models.TrackBalanceRollover](../models/trackbalancerollover.md)] | :heavy_minus_sign: | Rollover balances carried over from previous periods. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackbillingmethod.md b/others/python-sdk/docs/models/trackbalancebillingmethod.md similarity index 65% rename from others/python-sdk/docs/models/balancestrackbillingmethod.md rename to others/python-sdk/docs/models/trackbalancebillingmethod.md index f0836fdab..0d9c0dadd 100644 --- a/others/python-sdk/docs/models/balancestrackbillingmethod.md +++ b/others/python-sdk/docs/models/trackbalancebillingmethod.md @@ -1,4 +1,6 @@ -# BalancesTrackBillingMethod +# TrackBalanceBillingMethod + +Whether usage is prepaid or billed pay-per-use. ## Values diff --git a/others/python-sdk/docs/models/trackbalancebreakdown.md b/others/python-sdk/docs/models/trackbalancebreakdown.md new file mode 100644 index 000000000..7caf9da1c --- /dev/null +++ b/others/python-sdk/docs/models/trackbalancebreakdown.md @@ -0,0 +1,17 @@ +# TrackBalanceBreakdown + + +## 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.TrackBalanceReset]](../models/trackbalancereset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. | +| `price` | [Nullable[models.TrackBalancePrice]](../models/trackbalanceprice.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescheckcreditschema.md b/others/python-sdk/docs/models/trackbalancecreditschema.md similarity index 93% rename from others/python-sdk/docs/models/balancescheckcreditschema.md rename to others/python-sdk/docs/models/trackbalancecreditschema.md index de7631ec8..49ebdd267 100644 --- a/others/python-sdk/docs/models/balancescheckcreditschema.md +++ b/others/python-sdk/docs/models/trackbalancecreditschema.md @@ -1,4 +1,4 @@ -# BalancesCheckCreditSchema +# TrackBalanceCreditSchema ## Fields diff --git a/others/python-sdk/docs/models/balancescheckbalancedisplay.md b/others/python-sdk/docs/models/trackbalancedisplay.md similarity index 93% rename from others/python-sdk/docs/models/balancescheckbalancedisplay.md rename to others/python-sdk/docs/models/trackbalancedisplay.md index 73dc4f82e..8031124dd 100644 --- a/others/python-sdk/docs/models/balancescheckbalancedisplay.md +++ b/others/python-sdk/docs/models/trackbalancedisplay.md @@ -1,4 +1,4 @@ -# BalancesCheckBalanceDisplay +# TrackBalanceDisplay ## Fields diff --git a/others/python-sdk/docs/models/trackbalancefeature.md b/others/python-sdk/docs/models/trackbalancefeature.md new file mode 100644 index 000000000..05ca029a5 --- /dev/null +++ b/others/python-sdk/docs/models/trackbalancefeature.md @@ -0,0 +1,17 @@ +# TrackBalanceFeature + +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.TrackBalanceType](../models/trackbalancetype.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.TrackBalanceCreditSchema](../models/trackbalancecreditschema.md)] | :heavy_minus_sign: | N/A | +| `display` | [Optional[models.TrackBalanceDisplay]](../models/trackbalancedisplay.md) | :heavy_minus_sign: | N/A | +| `archived` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackintervalenum.md b/others/python-sdk/docs/models/trackbalanceintervalenum.md similarity index 93% rename from others/python-sdk/docs/models/balancestrackintervalenum.md rename to others/python-sdk/docs/models/trackbalanceintervalenum.md index 977324a88..f094b0962 100644 --- a/others/python-sdk/docs/models/balancestrackintervalenum.md +++ b/others/python-sdk/docs/models/trackbalanceintervalenum.md @@ -1,4 +1,4 @@ -# BalancesTrackIntervalEnum +# TrackBalanceIntervalEnum ## Values diff --git a/others/python-sdk/docs/models/trackbalanceintervalunion.md b/others/python-sdk/docs/models/trackbalanceintervalunion.md new file mode 100644 index 000000000..287b9be87 --- /dev/null +++ b/others/python-sdk/docs/models/trackbalanceintervalunion.md @@ -0,0 +1,19 @@ +# TrackBalanceIntervalUnion + +The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + +## Supported Types + +### `models.TrackBalanceIntervalEnum` + +```python +value: models.TrackBalanceIntervalEnum = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/trackbalanceprice.md b/others/python-sdk/docs/models/trackbalanceprice.md new file mode 100644 index 000000000..ed98307a0 --- /dev/null +++ b/others/python-sdk/docs/models/trackbalanceprice.md @@ -0,0 +1,12 @@ +# TrackBalancePrice + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `amount` | *Optional[float]* | :heavy_minus_sign: | The per-unit price amount. | +| `tiers` | List[[models.TrackBalanceTier](../models/trackbalancetier.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.TrackBalanceBillingMethod](../models/trackbalancebillingmethod.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackbalancereset.md b/others/python-sdk/docs/models/trackbalancereset.md new file mode 100644 index 000000000..34b4f9bac --- /dev/null +++ b/others/python-sdk/docs/models/trackbalancereset.md @@ -0,0 +1,10 @@ +# TrackBalanceReset + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `interval` | [models.TrackBalanceIntervalUnion](../models/trackbalanceintervalunion.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackbalancerollover.md b/others/python-sdk/docs/models/trackbalancerollover.md new file mode 100644 index 000000000..16eca6cd2 --- /dev/null +++ b/others/python-sdk/docs/models/trackbalancerollover.md @@ -0,0 +1,9 @@ +# TrackBalanceRollover + + +## 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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackbalances.md b/others/python-sdk/docs/models/trackbalances.md new file mode 100644 index 000000000..5e2ec49e4 --- /dev/null +++ b/others/python-sdk/docs/models/trackbalances.md @@ -0,0 +1,18 @@ +# TrackBalances + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `feature_id` | *str* | :heavy_check_mark: | The feature ID this balance is for. | +| `feature` | [Optional[models.TrackBalancesFeature]](../models/trackbalancesfeature.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.TrackBalancesBreakdown](../models/trackbalancesbreakdown.md)] | :heavy_minus_sign: | Detailed breakdown of balance sources when stacking multiple plans or grants. | +| `rollovers` | List[[models.TrackBalancesRollover](../models/trackbalancesrollover.md)] | :heavy_minus_sign: | Rollover balances carried over from previous periods. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackbalancesbillingmethod.md b/others/python-sdk/docs/models/trackbalancesbillingmethod.md new file mode 100644 index 000000000..b76e5994b --- /dev/null +++ b/others/python-sdk/docs/models/trackbalancesbillingmethod.md @@ -0,0 +1,11 @@ +# TrackBalancesBillingMethod + +Whether usage is prepaid or billed pay-per-use. + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `PREPAID` | prepaid | +| `USAGE_BASED` | usage_based | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackbalancesbreakdown.md b/others/python-sdk/docs/models/trackbalancesbreakdown.md new file mode 100644 index 000000000..76ad1869e --- /dev/null +++ b/others/python-sdk/docs/models/trackbalancesbreakdown.md @@ -0,0 +1,17 @@ +# TrackBalancesBreakdown + + +## 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.TrackBalancesReset]](../models/trackbalancesreset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. | +| `price` | [Nullable[models.TrackBalancesPrice]](../models/trackbalancesprice.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackbalancescreditschema.md b/others/python-sdk/docs/models/trackbalancescreditschema.md new file mode 100644 index 000000000..2b1379836 --- /dev/null +++ b/others/python-sdk/docs/models/trackbalancescreditschema.md @@ -0,0 +1,9 @@ +# TrackBalancesCreditSchema + + +## Fields + +| Field | Type | Required | Description | +| -------------------- | -------------------- | -------------------- | -------------------- | +| `metered_feature_id` | *str* | :heavy_check_mark: | N/A | +| `credit_cost` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackbalancesdisplay.md b/others/python-sdk/docs/models/trackbalancesdisplay.md new file mode 100644 index 000000000..97e421e0c --- /dev/null +++ b/others/python-sdk/docs/models/trackbalancesdisplay.md @@ -0,0 +1,9 @@ +# TrackBalancesDisplay + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `singular` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `plural` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackfeature.md b/others/python-sdk/docs/models/trackbalancesfeature.md similarity index 86% rename from others/python-sdk/docs/models/balancestrackfeature.md rename to others/python-sdk/docs/models/trackbalancesfeature.md index 0e3784c74..dc74285da 100644 --- a/others/python-sdk/docs/models/balancestrackfeature.md +++ b/others/python-sdk/docs/models/trackbalancesfeature.md @@ -1,4 +1,6 @@ -# BalancesTrackFeature +# TrackBalancesFeature + +The full feature object if expanded. ## Fields @@ -7,9 +9,9 @@ | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | | `id` | *str* | :heavy_check_mark: | N/A | | `name` | *str* | :heavy_check_mark: | N/A | -| `type` | [models.BalancesTrackType](../models/balancestracktype.md) | :heavy_check_mark: | N/A | +| `type` | [models.TrackBalancesType](../models/trackbalancestype.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.BalancesTrackCreditSchema](../models/balancestrackcreditschema.md)] | :heavy_minus_sign: | N/A | -| `display` | [Optional[models.BalancesTrackDisplay]](../models/balancestrackdisplay.md) | :heavy_minus_sign: | N/A | +| `credit_schema` | List[[models.TrackBalancesCreditSchema](../models/trackbalancescreditschema.md)] | :heavy_minus_sign: | N/A | +| `display` | [Optional[models.TrackBalancesDisplay]](../models/trackbalancesdisplay.md) | :heavy_minus_sign: | N/A | | `archived` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackbalancesintervalunion.md b/others/python-sdk/docs/models/trackbalancesintervalunion.md new file mode 100644 index 000000000..19550d352 --- /dev/null +++ b/others/python-sdk/docs/models/trackbalancesintervalunion.md @@ -0,0 +1,19 @@ +# TrackBalancesIntervalUnion + +The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + +## Supported Types + +### `models.TrackIntervalBalancesEnum` + +```python +value: models.TrackIntervalBalancesEnum = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/balancestrackprice.md b/others/python-sdk/docs/models/trackbalancesprice.md similarity index 59% rename from others/python-sdk/docs/models/balancestrackprice.md rename to others/python-sdk/docs/models/trackbalancesprice.md index 3019c1422..f613cc1fe 100644 --- a/others/python-sdk/docs/models/balancestrackprice.md +++ b/others/python-sdk/docs/models/trackbalancesprice.md @@ -1,12 +1,12 @@ -# BalancesTrackPrice +# TrackBalancesPrice ## Fields | Field | Type | Required | Description | | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `tiers` | List[[models.BalancesTrackTier](../models/balancestracktier.md)] | :heavy_minus_sign: | N/A | -| `billing_units` | *float* | :heavy_check_mark: | N/A | -| `billing_method` | [models.BalancesTrackBillingMethod](../models/balancestrackbillingmethod.md) | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file +| `amount` | *Optional[float]* | :heavy_minus_sign: | The per-unit price amount. | +| `tiers` | List[[models.TrackBalancesTier](../models/trackbalancestier.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.TrackBalancesBillingMethod](../models/trackbalancesbillingmethod.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackbalancesreset.md b/others/python-sdk/docs/models/trackbalancesreset.md new file mode 100644 index 000000000..e95975ce1 --- /dev/null +++ b/others/python-sdk/docs/models/trackbalancesreset.md @@ -0,0 +1,10 @@ +# TrackBalancesReset + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `interval` | [models.TrackBalancesIntervalUnion](../models/trackbalancesintervalunion.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackbalancesrollover.md b/others/python-sdk/docs/models/trackbalancesrollover.md new file mode 100644 index 000000000..a24bd1a9e --- /dev/null +++ b/others/python-sdk/docs/models/trackbalancesrollover.md @@ -0,0 +1,9 @@ +# TrackBalancesRollover + + +## 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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackbalancestier.md b/others/python-sdk/docs/models/trackbalancestier.md new file mode 100644 index 000000000..46979e604 --- /dev/null +++ b/others/python-sdk/docs/models/trackbalancestier.md @@ -0,0 +1,9 @@ +# TrackBalancesTier + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | +| `to` | [models.TrackBalancesTo](../models/trackbalancesto.md) | :heavy_check_mark: | N/A | +| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackbalancesto.md b/others/python-sdk/docs/models/trackbalancesto.md new file mode 100644 index 000000000..afcec8cee --- /dev/null +++ b/others/python-sdk/docs/models/trackbalancesto.md @@ -0,0 +1,17 @@ +# TrackBalancesTo + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/balancescheckbalancetype.md b/others/python-sdk/docs/models/trackbalancestype.md similarity index 88% rename from others/python-sdk/docs/models/balancescheckbalancetype.md rename to others/python-sdk/docs/models/trackbalancestype.md index 417070a47..ba67240af 100644 --- a/others/python-sdk/docs/models/balancescheckbalancetype.md +++ b/others/python-sdk/docs/models/trackbalancestype.md @@ -1,4 +1,4 @@ -# BalancesCheckBalanceType +# TrackBalancesType ## Values diff --git a/others/python-sdk/docs/models/trackbalancetier.md b/others/python-sdk/docs/models/trackbalancetier.md new file mode 100644 index 000000000..7441749ae --- /dev/null +++ b/others/python-sdk/docs/models/trackbalancetier.md @@ -0,0 +1,9 @@ +# TrackBalanceTier + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | +| `to` | [models.TrackBalanceTo](../models/trackbalanceto.md) | :heavy_check_mark: | N/A | +| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackbalanceto.md b/others/python-sdk/docs/models/trackbalanceto.md new file mode 100644 index 000000000..1936d6025 --- /dev/null +++ b/others/python-sdk/docs/models/trackbalanceto.md @@ -0,0 +1,17 @@ +# TrackBalanceTo + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/trackbalancetype.md b/others/python-sdk/docs/models/trackbalancetype.md new file mode 100644 index 000000000..d22958514 --- /dev/null +++ b/others/python-sdk/docs/models/trackbalancetype.md @@ -0,0 +1,10 @@ +# TrackBalanceType + + +## Values + +| Name | Value | +| --------------- | --------------- | +| `BOOLEAN` | boolean | +| `METERED` | metered | +| `CREDIT_SYSTEM` | credit_system | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackglobals.md b/others/python-sdk/docs/models/trackglobals.md new file mode 100644 index 000000000..42d7bc2cf --- /dev/null +++ b/others/python-sdk/docs/models/trackglobals.md @@ -0,0 +1,8 @@ +# TrackGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackintervalbalancesenum.md b/others/python-sdk/docs/models/trackintervalbalancesenum.md new file mode 100644 index 000000000..c67945668 --- /dev/null +++ b/others/python-sdk/docs/models/trackintervalbalancesenum.md @@ -0,0 +1,16 @@ +# TrackIntervalBalancesEnum + + +## 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 | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackparams.md b/others/python-sdk/docs/models/trackparams.md new file mode 100644 index 000000000..2ab698ddd --- /dev/null +++ b/others/python-sdk/docs/models/trackparams.md @@ -0,0 +1,13 @@ +# TrackParams + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer. | +| `feature_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the feature to track usage for. Required if event_name is not provided. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity for entity-scoped balances (e.g., per-seat limits). | +| `event_name` | *Optional[str]* | :heavy_minus_sign: | Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. | +| `value` | *Optional[float]* | :heavy_minus_sign: | The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). | +| `properties` | Dict[str, *Any*] | :heavy_minus_sign: | Additional properties to attach to this usage event. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/trackresponse.md b/others/python-sdk/docs/models/trackresponse.md new file mode 100644 index 000000000..657524211 --- /dev/null +++ b/others/python-sdk/docs/models/trackresponse.md @@ -0,0 +1,15 @@ +# TrackResponse + +OK + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer whose usage was tracked. | | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity, if entity-scoped tracking was performed. | | +| `event_name` | *Optional[str]* | :heavy_minus_sign: | The event name that was tracked, if event_name was used instead of feature_id. | | +| `value` | *float* | :heavy_check_mark: | The amount of usage that was recorded. | | +| `balance` | [Nullable[models.TrackBalance]](../models/trackbalance.md) | :heavy_check_mark: | The updated balance for the tracked feature. Null if tracking by event_name that affects multiple features. | {
"feature_id": "messages",
"granted": 100,
"remaining": 72,
"usage": 28,
"unlimited": false,
"overage_allowed": false,
"max_purchase": null,
"next_reset_at": 1773851121437,
"breakdown": [
{
"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV",
"plan_id": "pro_plan",
"included_grant": 100,
"prepaid_grant": 0,
"remaining": 72,
"usage": 28,
"unlimited": false,
"reset": {
"interval": "month",
"resets_at": 1773851121437
},
"price": null,
"expires_at": null
}
]
} | +| `balances` | Dict[str, [models.TrackBalances](../models/trackbalances.md)] | :heavy_minus_sign: | Map of feature_id to updated balance when tracking by event_name affects multiple features. | | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatebalanceglobals.md b/others/python-sdk/docs/models/updatebalanceglobals.md new file mode 100644 index 000000000..7f44dc945 --- /dev/null +++ b/others/python-sdk/docs/models/updatebalanceglobals.md @@ -0,0 +1,8 @@ +# UpdateBalanceGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescheckbalanceintervalenum.md b/others/python-sdk/docs/models/updatebalanceinterval.md similarity index 69% rename from others/python-sdk/docs/models/balancescheckbalanceintervalenum.md rename to others/python-sdk/docs/models/updatebalanceinterval.md index abb1f6fd6..b4afc96b1 100644 --- a/others/python-sdk/docs/models/balancescheckbalanceintervalenum.md +++ b/others/python-sdk/docs/models/updatebalanceinterval.md @@ -1,4 +1,6 @@ -# BalancesCheckBalanceIntervalEnum +# UpdateBalanceInterval + +Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals. ## Values diff --git a/others/python-sdk/docs/models/updatebalanceparams.md b/others/python-sdk/docs/models/updatebalanceparams.md new file mode 100644 index 000000000..9bc0da110 --- /dev/null +++ b/others/python-sdk/docs/models/updatebalanceparams.md @@ -0,0 +1,13 @@ +# UpdateBalanceParams + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer. | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity for entity-scoped balances (e.g., per-seat limits). | +| `remaining` | *Optional[float]* | :heavy_minus_sign: | Set the remaining balance to this exact value. Cannot be combined with add_to_balance. | +| `add_to_balance` | *Optional[float]* | :heavy_minus_sign: | Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance. | +| `interval` | [Optional[models.UpdateBalanceInterval]](../models/updatebalanceinterval.md) | :heavy_minus_sign: | Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatebalanceresponse.md b/others/python-sdk/docs/models/updatebalanceresponse.md new file mode 100644 index 000000000..e2df03126 --- /dev/null +++ b/others/python-sdk/docs/models/updatebalanceresponse.md @@ -0,0 +1,10 @@ +# UpdateBalanceResponse + +OK + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `success` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerbalances.md b/others/python-sdk/docs/models/updatecustomerbalances.md index 273486f9e..109ef75bc 100644 --- a/others/python-sdk/docs/models/updatecustomerbalances.md +++ b/others/python-sdk/docs/models/updatecustomerbalances.md @@ -3,16 +3,16 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `feature` | [Optional[models.UpdateCustomerFeature]](../models/updatecustomerfeature.md) | :heavy_minus_sign: | N/A | -| `granted` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `overage_allowed` | *bool* | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `next_reset_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `breakdown` | List[[models.UpdateCustomerBreakdown](../models/updatecustomerbreakdown.md)] | :heavy_minus_sign: | N/A | -| `rollovers` | List[[models.UpdateCustomerRollover](../models/updatecustomerrollover.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `feature_id` | *str* | :heavy_check_mark: | The feature ID this balance is for. | +| `feature` | [Optional[models.UpdateCustomerFeature]](../models/updatecustomerfeature.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.UpdateCustomerBreakdown](../models/updatecustomerbreakdown.md)] | :heavy_minus_sign: | Detailed breakdown of balance sources when stacking multiple plans or grants. | +| `rollovers` | List[[models.UpdateCustomerRollover](../models/updatecustomerrollover.md)] | :heavy_minus_sign: | Rollover balances carried over from previous periods. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerbillingmethod.md b/others/python-sdk/docs/models/updatecustomerbillingmethod.md index 175ceae8f..f28881233 100644 --- a/others/python-sdk/docs/models/updatecustomerbillingmethod.md +++ b/others/python-sdk/docs/models/updatecustomerbillingmethod.md @@ -1,5 +1,7 @@ # UpdateCustomerBillingMethod +Whether usage is prepaid or billed pay-per-use. + ## Values diff --git a/others/python-sdk/docs/models/updatecustomerbreakdown.md b/others/python-sdk/docs/models/updatecustomerbreakdown.md index 0a5f66612..fd5ecf56e 100644 --- a/others/python-sdk/docs/models/updatecustomerbreakdown.md +++ b/others/python-sdk/docs/models/updatecustomerbreakdown.md @@ -3,15 +3,15 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `plan_id` | *Nullable[str]* | :heavy_check_mark: | N/A | -| `included_grant` | *float* | :heavy_check_mark: | N/A | -| `prepaid_grant` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `reset` | [Nullable[models.UpdateCustomerReset]](../models/updatecustomerreset.md) | :heavy_check_mark: | N/A | -| `price` | [Nullable[models.UpdateCustomerPrice]](../models/updatecustomerprice.md) | :heavy_check_mark: | N/A | -| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file +| 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.UpdateCustomerReset]](../models/updatecustomerreset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. | +| `price` | [Nullable[models.UpdateCustomerPrice]](../models/updatecustomerprice.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerfeature.md b/others/python-sdk/docs/models/updatecustomerfeature.md index 773fbeb9e..38a41c548 100644 --- a/others/python-sdk/docs/models/updatecustomerfeature.md +++ b/others/python-sdk/docs/models/updatecustomerfeature.md @@ -1,5 +1,7 @@ # UpdateCustomerFeature +The full feature object if expanded. + ## Fields diff --git a/others/python-sdk/docs/models/updatecustomerintervalunion.md b/others/python-sdk/docs/models/updatecustomerintervalunion.md index c47a47e06..d2e8f08d8 100644 --- a/others/python-sdk/docs/models/updatecustomerintervalunion.md +++ b/others/python-sdk/docs/models/updatecustomerintervalunion.md @@ -1,5 +1,7 @@ # UpdateCustomerIntervalUnion +The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + ## Supported Types diff --git a/others/python-sdk/docs/models/updatecustomerprice.md b/others/python-sdk/docs/models/updatecustomerprice.md index 073a0ccc1..106c34e09 100644 --- a/others/python-sdk/docs/models/updatecustomerprice.md +++ b/others/python-sdk/docs/models/updatecustomerprice.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `tiers` | List[[models.UpdateCustomerTier](../models/updatecustomertier.md)] | :heavy_minus_sign: | N/A | -| `billing_units` | *float* | :heavy_check_mark: | N/A | -| `billing_method` | [models.UpdateCustomerBillingMethod](../models/updatecustomerbillingmethod.md) | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file +| `amount` | *Optional[float]* | :heavy_minus_sign: | The per-unit price amount. | +| `tiers` | List[[models.UpdateCustomerTier](../models/updatecustomertier.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.UpdateCustomerBillingMethod](../models/updatecustomerbillingmethod.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerpurchase.md b/others/python-sdk/docs/models/updatecustomerpurchase.md index 0e7ac3b22..6870656ed 100644 --- a/others/python-sdk/docs/models/updatecustomerpurchase.md +++ b/others/python-sdk/docs/models/updatecustomerpurchase.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | -| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | -| `plan_id` | *str* | :heavy_check_mark: | N/A | -| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `started_at` | *float* | :heavy_check_mark: | N/A | -| `quantity` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | +| `plan_id` | *str* | :heavy_check_mark: | The unique identifier of the purchased plan. | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the purchase expires, or null for lifetime access. | +| `started_at` | *float* | :heavy_check_mark: | Timestamp when the purchase was made. | +| `quantity` | *float* | :heavy_check_mark: | Number of units purchased. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerreset.md b/others/python-sdk/docs/models/updatecustomerreset.md index ff27d3a15..0084e341a 100644 --- a/others/python-sdk/docs/models/updatecustomerreset.md +++ b/others/python-sdk/docs/models/updatecustomerreset.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `interval` | [models.UpdateCustomerIntervalUnion](../models/updatecustomerintervalunion.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `resets_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `interval` | [models.UpdateCustomerIntervalUnion](../models/updatecustomerintervalunion.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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerresponse.md b/others/python-sdk/docs/models/updatecustomerresponse.md index 655453dd0..b0df4e916 100644 --- a/others/python-sdk/docs/models/updatecustomerresponse.md +++ b/others/python-sdk/docs/models/updatecustomerresponse.md @@ -16,6 +16,6 @@ OK | `env` | [models.UpdateCustomerEnv](../models/updatecustomerenv.md) | :heavy_check_mark: | The environment this customer was created in. | | `metadata` | Dict[str, *Any*] | :heavy_check_mark: | The metadata for the customer. | | `send_email_receipts` | *bool* | :heavy_check_mark: | Whether to send email receipts to the customer. | -| `subscriptions` | List[[models.UpdateCustomerSubscription](../models/updatecustomersubscription.md)] | :heavy_check_mark: | N/A | -| `purchases` | List[[models.UpdateCustomerPurchase](../models/updatecustomerpurchase.md)] | :heavy_check_mark: | N/A | -| `balances` | Dict[str, [models.UpdateCustomerBalances](../models/updatecustomerbalances.md)] | :heavy_check_mark: | N/A | \ No newline at end of file +| `subscriptions` | List[[models.UpdateCustomerSubscription](../models/updatecustomersubscription.md)] | :heavy_check_mark: | Active and scheduled recurring plans that this customer has attached. | +| `purchases` | List[[models.UpdateCustomerPurchase](../models/updatecustomerpurchase.md)] | :heavy_check_mark: | One-time purchases made by the customer. | +| `balances` | Dict[str, [models.UpdateCustomerBalances](../models/updatecustomerbalances.md)] | :heavy_check_mark: | Feature balances keyed by feature ID, showing usage limits and remaining amounts. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerrollover.md b/others/python-sdk/docs/models/updatecustomerrollover.md index af07f81be..5e6872ef3 100644 --- a/others/python-sdk/docs/models/updatecustomerrollover.md +++ b/others/python-sdk/docs/models/updatecustomerrollover.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `balance` | *float* | :heavy_check_mark: | N/A | -| `expires_at` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file +| 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. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerstatus.md b/others/python-sdk/docs/models/updatecustomerstatus.md index 09097d659..991481f1a 100644 --- a/others/python-sdk/docs/models/updatecustomerstatus.md +++ b/others/python-sdk/docs/models/updatecustomerstatus.md @@ -1,10 +1,11 @@ # UpdateCustomerStatus +Current status of the subscription. + ## Values | Name | Value | | ----------- | ----------- | | `ACTIVE` | active | -| `SCHEDULED` | scheduled | -| `EXPIRED` | expired | \ No newline at end of file +| `SCHEDULED` | scheduled | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomersubscription.md b/others/python-sdk/docs/models/updatecustomersubscription.md index a09e306f9..4161afdc3 100644 --- a/others/python-sdk/docs/models/updatecustomersubscription.md +++ b/others/python-sdk/docs/models/updatecustomersubscription.md @@ -3,18 +3,18 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | -| `plan_id` | *str* | :heavy_check_mark: | N/A | -| `auto_enable` | *bool* | :heavy_check_mark: | N/A | -| `add_on` | *bool* | :heavy_check_mark: | N/A | -| `status` | [models.UpdateCustomerStatus](../models/updatecustomerstatus.md) | :heavy_check_mark: | N/A | -| `past_due` | *bool* | :heavy_check_mark: | N/A | -| `canceled_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `trial_ends_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `started_at` | *float* | :heavy_check_mark: | N/A | -| `current_period_start` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `current_period_end` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `quantity` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | +| `plan_id` | *str* | :heavy_check_mark: | The unique identifier of the subscribed plan. | +| `auto_enable` | *bool* | :heavy_check_mark: | Whether the plan was automatically enabled for the customer. | +| `add_on` | *bool* | :heavy_check_mark: | Whether this is an add-on plan rather than a base subscription. | +| `status` | [models.UpdateCustomerStatus](../models/updatecustomerstatus.md) | :heavy_check_mark: | Current status of the subscription. | +| `past_due` | *bool* | :heavy_check_mark: | Whether the subscription has overdue payments. | +| `canceled_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the subscription was canceled, or null if not canceled. | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the subscription will expire, or null if no expiry set. | +| `trial_ends_at` | *Nullable[float]* | :heavy_check_mark: | Timestamp when the trial period ends, or null if not on trial. | +| `started_at` | *float* | :heavy_check_mark: | Timestamp when the subscription started. | +| `current_period_start` | *Nullable[float]* | :heavy_check_mark: | Start timestamp of the current billing period. | +| `current_period_end` | *Nullable[float]* | :heavy_check_mark: | End timestamp of the current billing period. | +| `quantity` | *float* | :heavy_check_mark: | Number of units of this subscription (for per-seat plans). | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingupdaterequest.md b/others/python-sdk/docs/models/updatesubscriptionparams.md similarity index 57% rename from others/python-sdk/docs/models/billingupdaterequest.md rename to others/python-sdk/docs/models/updatesubscriptionparams.md index 1840eb3fa..0c2a3d302 100644 --- a/others/python-sdk/docs/models/billingupdaterequest.md +++ b/others/python-sdk/docs/models/updatesubscriptionparams.md @@ -1,17 +1,17 @@ -# BillingUpdateRequest +# UpdateSubscriptionParams ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to attach the plan to. | -| `entity_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | -| `feature_quantities` | List[[models.BillingUpdateFeatureQuantities](../models/billingupdatefeaturequantities.md)] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | -| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to attach. | -| `free_trial` | [OptionalNullable[models.BillingUpdateFreeTrial]](../models/billingupdatefreetrial.md) | :heavy_minus_sign: | N/A | -| `customize` | [Optional[models.BillingUpdateCustomize]](../models/billingupdatecustomize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | -| `plan_id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `invoice_mode` | [Optional[models.BillingUpdateInvoiceMode]](../models/billingupdateinvoicemode.md) | :heavy_minus_sign: | N/A | -| `cancel_action` | [Optional[models.BillingUpdateCancelAction]](../models/billingupdatecancelaction.md) | :heavy_minus_sign: | N/A | -| `billing_behavior` | [Optional[models.BillingUpdateBillingBehavior]](../models/billingupdatebillingbehavior.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to attach the plan to. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | +| `plan_id` | *str* | :heavy_check_mark: | The ID of the plan. | +| `feature_quantities` | List[[models.BillingUpdateFeatureQuantity](../models/billingupdatefeaturequantity.md)] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | +| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to attach. | +| `free_trial` | [OptionalNullable[models.BillingUpdateFreeTrial]](../models/billingupdatefreetrial.md) | :heavy_minus_sign: | Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. | +| `customize` | [Optional[models.BillingUpdateCustomize]](../models/billingupdatecustomize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | +| `invoice_mode` | [Optional[models.BillingUpdateInvoiceMode]](../models/billingupdateinvoicemode.md) | :heavy_minus_sign: | Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. | +| `billing_behavior` | [Optional[models.BillingUpdateBillingBehavior]](../models/billingupdatebillingbehavior.md) | :heavy_minus_sign: | 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. | +| `cancel_action` | [Optional[models.BillingUpdateCancelAction]](../models/billingupdatecancelaction.md) | :heavy_minus_sign: | Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. | \ No newline at end of file diff --git a/others/python-sdk/docs/sdks/autumn/README.md b/others/python-sdk/docs/sdks/autumn/README.md new file mode 100644 index 000000000..e71ec2951 --- /dev/null +++ b/others/python-sdk/docs/sdks/autumn/README.md @@ -0,0 +1,107 @@ +# Autumn SDK + +## Overview + +### Available Operations + +* [check](#check) - Checks whether a customer currently has enough balance to use a feature. + +Use this to gate access before a feature action. Enable sendEvent when you want to check and consume balance atomically in one request. +* [track](#track) - Records usage for a customer feature and returns updated balances. + +Use this after an action happens to decrement usage, or send a negative value to credit balance back. + +## check + +Checks whether a customer currently has enough balance to use a feature. + +Use this to gate access before a feature action. Enable sendEvent when you want to check and consume balance atomically in one request. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.check(customer_id="cus_123", feature_id="messages") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer. | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity for entity-scoped balances (e.g., per-seat limits). | +| `required_balance` | *Optional[float]* | :heavy_minus_sign: | Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1. | +| `properties` | Dict[str, *Any*] | :heavy_minus_sign: | Additional properties to attach to the usage event if send_event is true. | +| `send_event` | *Optional[bool]* | :heavy_minus_sign: | If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. | +| `with_preview` | *Optional[bool]* | :heavy_minus_sign: | If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.CheckResponse](../../models/checkresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## track + +Records usage for a customer feature and returns updated balances. + +Use this after an action happens to decrement usage, or send a negative value to credit balance back. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.track(customer_id="cus_123", feature_id="messages", value=1) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer. | +| `feature_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the feature to track usage for. Required if event_name is not provided. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity for entity-scoped balances (e.g., per-seat limits). | +| `event_name` | *Optional[str]* | :heavy_minus_sign: | Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. | +| `value` | *Optional[float]* | :heavy_minus_sign: | The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). | +| `properties` | Dict[str, *Any*] | :heavy_minus_sign: | Additional properties to attach to this usage event. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.TrackResponse](../../models/trackresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/others/python-sdk/docs/sdks/balancessdk/README.md b/others/python-sdk/docs/sdks/balancessdk/README.md index 7afb196a0..53904f7fb 100644 --- a/others/python-sdk/docs/sdks/balancessdk/README.md +++ b/others/python-sdk/docs/sdks/balancessdk/README.md @@ -6,8 +6,6 @@ * [create](#create) - Create a balance for a customer feature. * [update](#update) - Update a customer balance. -* [check](#check) - Check whether usage is allowed for a customer feature. -* [track](#track) - Track usage for a customer feature. ## create @@ -15,7 +13,7 @@ Create a balance for a customer feature. ### Example Usage - + ```python from autumn_sdk import Autumn @@ -25,7 +23,9 @@ with Autumn( secret_key="", ) as autumn: - res = autumn.balances.create(feature_id="", customer_id="") + res = autumn.balances.create(customer_id="cus_123", feature_id="api_calls", included=1000, reset={ + "interval": "month", + }) # Handle response print(res) @@ -34,21 +34,21 @@ with Autumn( ### Parameters -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -| `feature_id` | *str* | :heavy_check_mark: | The feature ID to create the balance for | -| `customer_id` | *str* | :heavy_check_mark: | The customer ID to assign the balance to | -| `entity_id` | *Optional[str]* | :heavy_minus_sign: | Entity ID for entity-scoped balances | -| `included` | *Optional[float]* | :heavy_minus_sign: | The initial balance amount to grant | -| `unlimited` | *Optional[bool]* | :heavy_minus_sign: | Whether the balance is unlimited | -| `reset` | [Optional[models.BalancesCreateReset]](../../models/balancescreatereset.md) | :heavy_minus_sign: | Reset configuration for the balance | -| `expires_at` | *Optional[float]* | :heavy_minus_sign: | Unix timestamp (milliseconds) when the balance expires | -| `granted_balance` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer. | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity for entity-scoped balances (e.g., per-seat limits). | +| `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 | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response -**[models.BalancesCreateResponse](../../models/balancescreateresponse.md)** +**[models.CreateBalanceResponse](../../models/createbalanceresponse.md)** ### Errors @@ -62,7 +62,7 @@ Update a customer balance. ### Example Usage - + ```python from autumn_sdk import Autumn @@ -72,7 +72,7 @@ with Autumn( secret_key="", ) as autumn: - res = autumn.balances.update(customer_id="", feature_id="") + res = autumn.balances.update(customer_id="cus_123", feature_id="api_calls", remaining=5) # Handle response print(res) @@ -81,115 +81,19 @@ with Autumn( ### Parameters -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | -| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer. | -| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature to update balance for. | -| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity to update balance for (if using entity balances). | -| `current_balance` | *Optional[float]* | :heavy_minus_sign: | The new balance value to set. | -| `interval` | [Optional[models.BalancesUpdateInterval]](../../models/balancesupdateinterval.md) | :heavy_minus_sign: | The interval to update balance for. | -| `granted_balance` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `usage` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `customer_entitlement_id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `next_reset_at` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `add_to_balance` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer. | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity for entity-scoped balances (e.g., per-seat limits). | +| `remaining` | *Optional[float]* | :heavy_minus_sign: | Set the remaining balance to this exact value. Cannot be combined with add_to_balance. | +| `add_to_balance` | *Optional[float]* | :heavy_minus_sign: | Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance. | +| `interval` | [Optional[models.UpdateBalanceInterval]](../../models/updatebalanceinterval.md) | :heavy_minus_sign: | Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response -**[models.BalancesUpdateResponse](../../models/balancesupdateresponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ------------------------- | ------------------------- | ------------------------- | -| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | - -## check - -Check whether usage is allowed for a customer feature. - -### Example Usage - - -```python -from autumn_sdk import Autumn - - -with Autumn( - x_api_version="2.1", - secret_key="", -) as autumn: - - res = autumn.balances.check(customer_id="", feature_id="") - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -| `customer_id` | *str* | :heavy_check_mark: | ID which you provided when creating the customer | -| `feature_id` | *str* | :heavy_check_mark: | ID of the feature to check access to. | -| `entity_id` | *Optional[str]* | :heavy_minus_sign: | If using entity balances (eg, seats), the entity ID to check access for. | -| `required_balance` | *Optional[float]* | :heavy_minus_sign: | If you know the amount of the feature the end user is consuming in advance. If their balance is below this quantity, allowed will be false. | -| `properties` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | -| `send_event` | *Optional[bool]* | :heavy_minus_sign: | If true, a usage event will be recorded together with checking access. The required_balance field will be used as the usage value. | -| `with_preview` | *Optional[bool]* | :heavy_minus_sign: | If true, the response will include a preview object, which can be used to display information such as a paywall or upgrade confirmation. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[models.BalancesCheckResponse](../../models/balancescheckresponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ------------------------- | ------------------------- | ------------------------- | -| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | - -## track - -Track usage for a customer feature. - -### Example Usage - - -```python -from autumn_sdk import Autumn - - -with Autumn( - x_api_version="2.1", - secret_key="", -) as autumn: - - res = autumn.balances.track(customer_id="") - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `customer_id` | *str* | :heavy_check_mark: | ID which you provided when creating the customer | -| `feature_id` | *Optional[str]* | :heavy_minus_sign: | ID of the feature to track usage for. Required if event_name is not provided. Use this for direct feature tracking. | -| `event_name` | *Optional[str]* | :heavy_minus_sign: | An [event name](/features/tracking-usage#using-event-names) can be used in place of feature_id. This can be used if multiple features are tracked in the same event. | -| `value` | *Optional[float]* | :heavy_minus_sign: | The amount of usage to record. Defaults to 1. Can be negative to increase the balance (e.g., when removing a seat). | -| `properties` | Dict[str, *Any*] | :heavy_minus_sign: | Additional properties to attach to this usage event. | -| `idempotency_key` | *Optional[str]* | :heavy_minus_sign: | Unique key to prevent duplicate event recording. Use this to safely retry requests without creating duplicate usage records. | -| `entity_id` | *Optional[str]* | :heavy_minus_sign: | If using [entity balances](/features/feature-entities) (eg, seats), the entity ID to track usage for. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[models.BalancesTrackResponse](../../models/balancestrackresponse.md)** +**[models.UpdateBalanceResponse](../../models/updatebalanceresponse.md)** ### Errors diff --git a/others/python-sdk/docs/sdks/billing/README.md b/others/python-sdk/docs/sdks/billing/README.md index a61169284..0ee824016 100644 --- a/others/python-sdk/docs/sdks/billing/README.md +++ b/others/python-sdk/docs/sdks/billing/README.md @@ -5,15 +5,25 @@ ### Available Operations * [attach](#attach) - Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. -* [preview_attach](#preview_attach) - Preview billing changes before attaching a plan. -* [update](#update) - Update an existing subscription. -* [preview_update](#preview_update) - Preview billing changes before updating a subscription. -* [setup_payment](#setup_payment) - Create a setup payment session for a customer. + +Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product. +* [preview_attach](#preview_attach) - Previews the billing changes that would occur when attaching a plan, without actually making any changes. + +Use this endpoint to show customers what they will be charged before confirming a subscription change. +* [update](#update) - Updates an existing subscription. Use to modify feature quantities, cancel, or change plan configuration. + +Use this endpoint to update prepaid quantities, cancel a subscription (immediately or at end of cycle), or modify subscription settings. +* [preview_update](#preview_update) - Previews the billing changes that would occur when updating a subscription, without actually making any changes. + +Use this endpoint to show customers prorated charges or refunds before confirming subscription modifications. +* [open_customer_portal](#open_customer_portal) - Create a billing portal session for a customer to manage their subscription. ## attach Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. +Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product. + ### Example Usage @@ -26,7 +36,7 @@ with Autumn( secret_key="", ) as autumn: - res = autumn.billing.attach(customer_id="", plan_id="", redirect_mode="always") + res = autumn.billing.attach(customer_id="cus_123", plan_id="pro_plan") # Handle response print(res) @@ -35,23 +45,22 @@ with Autumn( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to attach the plan to. | -| `plan_id` | *str* | :heavy_check_mark: | N/A | -| `entity_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | -| `feature_quantities` | List[[models.BillingAttachFeatureQuantities](../../models/billingattachfeaturequantities.md)] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | -| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to attach. | -| `free_trial` | [OptionalNullable[models.BillingAttachFreeTrial]](../../models/billingattachfreetrial.md) | :heavy_minus_sign: | N/A | -| `customize` | [Optional[models.BillingAttachCustomize]](../../models/billingattachcustomize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | -| `invoice_mode` | [Optional[models.BillingAttachInvoiceMode]](../../models/billingattachinvoicemode.md) | :heavy_minus_sign: | N/A | -| `discounts` | List[[models.BillingAttachDiscountUnion](../../models/billingattachdiscountunion.md)] | :heavy_minus_sign: | N/A | -| `redirect_mode` | [Optional[models.BillingAttachRedirectMode]](../../models/billingattachredirectmode.md) | :heavy_minus_sign: | N/A | -| `success_url` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `new_billing_subscription` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `plan_schedule` | [Optional[models.BillingAttachPlanSchedule]](../../models/billingattachplanschedule.md) | :heavy_minus_sign: | N/A | -| `billing_behavior` | [Optional[models.BillingAttachBillingBehavior]](../../models/billingattachbillingbehavior.md) | :heavy_minus_sign: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to attach the plan to. | +| `plan_id` | *str* | :heavy_check_mark: | The ID of the plan. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | +| `feature_quantities` | List[[models.BillingAttachFeatureQuantity](../../models/billingattachfeaturequantity.md)] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | +| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to attach. | +| `free_trial` | [OptionalNullable[models.BillingAttachFreeTrial]](../../models/billingattachfreetrial.md) | :heavy_minus_sign: | Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. | +| `customize` | [Optional[models.BillingAttachCustomize]](../../models/billingattachcustomize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | +| `invoice_mode` | [Optional[models.BillingAttachInvoiceMode]](../../models/billingattachinvoicemode.md) | :heavy_minus_sign: | Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. | +| `billing_behavior` | [Optional[models.BillingAttachBillingBehavior]](../../models/billingattachbillingbehavior.md) | :heavy_minus_sign: | 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. | +| `discounts` | List[[models.BillingAttachDiscountUnion](../../models/billingattachdiscountunion.md)] | :heavy_minus_sign: | List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. | +| `success_url` | *Optional[str]* | :heavy_minus_sign: | URL to redirect to after successful checkout. | +| `new_billing_subscription` | *Optional[bool]* | :heavy_minus_sign: | Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. | +| `plan_schedule` | [Optional[models.BillingAttachPlanSchedule]](../../models/billingattachplanschedule.md) | :heavy_minus_sign: | When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response @@ -65,11 +74,13 @@ with Autumn( ## preview_attach -Preview billing changes before attaching a plan. +Previews the billing changes that would occur when attaching a plan, without actually making any changes. + +Use this endpoint to show customers what they will be charged before confirming a subscription change. ### Example Usage - + ```python from autumn_sdk import Autumn @@ -79,7 +90,7 @@ with Autumn( secret_key="", ) as autumn: - res = autumn.billing.preview_attach(customer_id="", plan_id="", redirect_mode="always") + res = autumn.billing.preview_attach(customer_id="cus_123", plan_id="pro_plan") # Handle response print(res) @@ -88,27 +99,26 @@ with Autumn( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to attach the plan to. | -| `plan_id` | *str* | :heavy_check_mark: | N/A | -| `entity_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | -| `feature_quantities` | List[[models.BillingPreviewAttachFeatureQuantities](../../models/billingpreviewattachfeaturequantities.md)] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | -| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to attach. | -| `free_trial` | [OptionalNullable[models.BillingPreviewAttachFreeTrial]](../../models/billingpreviewattachfreetrial.md) | :heavy_minus_sign: | N/A | -| `customize` | [Optional[models.BillingPreviewAttachCustomize]](../../models/billingpreviewattachcustomize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | -| `invoice_mode` | [Optional[models.BillingPreviewAttachInvoiceMode]](../../models/billingpreviewattachinvoicemode.md) | :heavy_minus_sign: | N/A | -| `discounts` | List[[models.BillingPreviewAttachDiscountUnion](../../models/billingpreviewattachdiscountunion.md)] | :heavy_minus_sign: | N/A | -| `redirect_mode` | [Optional[models.BillingPreviewAttachRedirectMode]](../../models/billingpreviewattachredirectmode.md) | :heavy_minus_sign: | N/A | -| `success_url` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `new_billing_subscription` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `plan_schedule` | [Optional[models.BillingPreviewAttachPlanSchedule]](../../models/billingpreviewattachplanschedule.md) | :heavy_minus_sign: | N/A | -| `billing_behavior` | [Optional[models.BillingPreviewAttachBillingBehavior]](../../models/billingpreviewattachbillingbehavior.md) | :heavy_minus_sign: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to attach the plan to. | +| `plan_id` | *str* | :heavy_check_mark: | The ID of the plan. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | +| `feature_quantities` | List[[models.PreviewAttachFeatureQuantity](../../models/previewattachfeaturequantity.md)] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | +| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to attach. | +| `free_trial` | [OptionalNullable[models.PreviewAttachFreeTrial]](../../models/previewattachfreetrial.md) | :heavy_minus_sign: | Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. | +| `customize` | [Optional[models.PreviewAttachCustomize]](../../models/previewattachcustomize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | +| `invoice_mode` | [Optional[models.PreviewAttachInvoiceMode]](../../models/previewattachinvoicemode.md) | :heavy_minus_sign: | Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. | +| `billing_behavior` | [Optional[models.PreviewAttachBillingBehavior]](../../models/previewattachbillingbehavior.md) | :heavy_minus_sign: | 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. | +| `discounts` | List[[models.PreviewAttachDiscountUnion](../../models/previewattachdiscountunion.md)] | :heavy_minus_sign: | List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. | +| `success_url` | *Optional[str]* | :heavy_minus_sign: | URL to redirect to after successful checkout. | +| `new_billing_subscription` | *Optional[bool]* | :heavy_minus_sign: | Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. | +| `plan_schedule` | [Optional[models.PreviewAttachPlanSchedule]](../../models/previewattachplanschedule.md) | :heavy_minus_sign: | When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response -**[models.BillingPreviewAttachResponse](../../models/billingpreviewattachresponse.md)** +**[models.PreviewAttachResponse](../../models/previewattachresponse.md)** ### Errors @@ -118,7 +128,9 @@ with Autumn( ## update -Update an existing subscription. +Updates an existing subscription. Use to modify feature quantities, cancel, or change plan configuration. + +Use this endpoint to update prepaid quantities, cancel a subscription (immediately or at end of cycle), or modify subscription settings. ### Example Usage @@ -132,7 +144,12 @@ with Autumn( secret_key="", ) as autumn: - res = autumn.billing.update(customer_id="") + res = autumn.billing.update(customer_id="cus_123", plan_id="pro_plan", feature_quantities=[ + { + "feature_id": "seats", + "quantity": 10, + }, + ]) # Handle response print(res) @@ -141,19 +158,19 @@ with Autumn( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to attach the plan to. | -| `entity_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | -| `feature_quantities` | List[[models.BillingUpdateFeatureQuantities](../../models/billingupdatefeaturequantities.md)] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | -| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to attach. | -| `free_trial` | [OptionalNullable[models.BillingUpdateFreeTrial]](../../models/billingupdatefreetrial.md) | :heavy_minus_sign: | N/A | -| `customize` | [Optional[models.BillingUpdateCustomize]](../../models/billingupdatecustomize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | -| `plan_id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `invoice_mode` | [Optional[models.BillingUpdateInvoiceMode]](../../models/billingupdateinvoicemode.md) | :heavy_minus_sign: | N/A | -| `cancel_action` | [Optional[models.BillingUpdateCancelAction]](../../models/billingupdatecancelaction.md) | :heavy_minus_sign: | N/A | -| `billing_behavior` | [Optional[models.BillingUpdateBillingBehavior]](../../models/billingupdatebillingbehavior.md) | :heavy_minus_sign: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to attach the plan to. | +| `plan_id` | *str* | :heavy_check_mark: | The ID of the plan. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | +| `feature_quantities` | List[[models.BillingUpdateFeatureQuantity](../../models/billingupdatefeaturequantity.md)] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | +| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to attach. | +| `free_trial` | [OptionalNullable[models.BillingUpdateFreeTrial]](../../models/billingupdatefreetrial.md) | :heavy_minus_sign: | Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. | +| `customize` | [Optional[models.BillingUpdateCustomize]](../../models/billingupdatecustomize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | +| `invoice_mode` | [Optional[models.BillingUpdateInvoiceMode]](../../models/billingupdateinvoicemode.md) | :heavy_minus_sign: | Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. | +| `billing_behavior` | [Optional[models.BillingUpdateBillingBehavior]](../../models/billingupdatebillingbehavior.md) | :heavy_minus_sign: | 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. | +| `cancel_action` | [Optional[models.BillingUpdateCancelAction]](../../models/billingupdatecancelaction.md) | :heavy_minus_sign: | Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response @@ -167,11 +184,13 @@ with Autumn( ## preview_update -Preview billing changes before updating a subscription. +Previews the billing changes that would occur when updating a subscription, without actually making any changes. + +Use this endpoint to show customers prorated charges or refunds before confirming subscription modifications. ### Example Usage - + ```python from autumn_sdk import Autumn @@ -181,7 +200,12 @@ with Autumn( secret_key="", ) as autumn: - res = autumn.billing.preview_update(customer_id="") + res = autumn.billing.preview_update(customer_id="cus_123", plan_id="pro_plan", feature_quantities=[ + { + "feature_id": "seats", + "quantity": 15, + }, + ]) # Handle response print(res) @@ -190,23 +214,23 @@ with Autumn( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to attach the plan to. | -| `entity_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | -| `feature_quantities` | List[[models.BillingPreviewUpdateFeatureQuantities](../../models/billingpreviewupdatefeaturequantities.md)] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | -| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to attach. | -| `free_trial` | [OptionalNullable[models.BillingPreviewUpdateFreeTrial]](../../models/billingpreviewupdatefreetrial.md) | :heavy_minus_sign: | N/A | -| `customize` | [Optional[models.BillingPreviewUpdateCustomize]](../../models/billingpreviewupdatecustomize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | -| `plan_id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `invoice_mode` | [Optional[models.BillingPreviewUpdateInvoiceMode]](../../models/billingpreviewupdateinvoicemode.md) | :heavy_minus_sign: | N/A | -| `cancel_action` | [Optional[models.BillingPreviewUpdateCancelAction]](../../models/billingpreviewupdatecancelaction.md) | :heavy_minus_sign: | N/A | -| `billing_behavior` | [Optional[models.BillingPreviewUpdateBillingBehavior]](../../models/billingpreviewupdatebillingbehavior.md) | :heavy_minus_sign: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to attach the plan to. | +| `plan_id` | *str* | :heavy_check_mark: | The ID of the plan. | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | +| `feature_quantities` | List[[models.PreviewUpdateFeatureQuantity](../../models/previewupdatefeaturequantity.md)] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | +| `version` | *Optional[float]* | :heavy_minus_sign: | The version of the plan to attach. | +| `free_trial` | [OptionalNullable[models.PreviewUpdateFreeTrial]](../../models/previewupdatefreetrial.md) | :heavy_minus_sign: | Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. | +| `customize` | [Optional[models.PreviewUpdateCustomize]](../../models/previewupdatecustomize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | +| `invoice_mode` | [Optional[models.PreviewUpdateInvoiceMode]](../../models/previewupdateinvoicemode.md) | :heavy_minus_sign: | Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. | +| `billing_behavior` | [Optional[models.PreviewUpdateBillingBehavior]](../../models/previewupdatebillingbehavior.md) | :heavy_minus_sign: | 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. | +| `cancel_action` | [Optional[models.PreviewUpdateCancelAction]](../../models/previewupdatecancelaction.md) | :heavy_minus_sign: | Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response -**[models.BillingPreviewUpdateResponse](../../models/billingpreviewupdateresponse.md)** +**[models.PreviewUpdateResponse](../../models/previewupdateresponse.md)** ### Errors @@ -214,13 +238,13 @@ with Autumn( | ------------------------- | ------------------------- | ------------------------- | | errors.AutumnDefaultError | 4XX, 5XX | \*/\* | -## setup_payment +## open_customer_portal -Create a setup payment session for a customer. +Create a billing portal session for a customer to manage their subscription. ### Example Usage - + ```python from autumn_sdk import Autumn @@ -230,7 +254,7 @@ with Autumn( secret_key="", ) as autumn: - res = autumn.billing.setup_payment(customer_id="") + res = autumn.billing.open_customer_portal(customer_id="cus_123", return_url="https://useautumn.com") # Handle response print(res) @@ -239,17 +263,16 @@ with Autumn( ### Parameters -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer | -| `success_url` | *Optional[str]* | :heavy_minus_sign: | URL to redirect to after successful payment setup. Must start with either http:// or https:// | -| `customer_data` | [Optional[models.CustomerData]](../../models/customerdata.md) | :heavy_minus_sign: | Customer details to set when creating a customer | -| `checkout_session_params` | Dict[str, *Any*] | :heavy_minus_sign: | Additional parameters for the checkout session | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to open the billing portal for. | +| `configuration_id` | *Optional[str]* | :heavy_minus_sign: | Stripe billing portal configuration ID. Create configurations in your Stripe dashboard. | +| `return_url` | *Optional[str]* | :heavy_minus_sign: | URL to redirect to when back button is clicked in the billing portal | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response -**[models.BillingSetupPaymentResponse](../../models/billingsetuppaymentresponse.md)** +**[models.OpenCustomerPortalResponse](../../models/opencustomerportalresponse.md)** ### Errors diff --git a/others/python-sdk/docs/sdks/entities/README.md b/others/python-sdk/docs/sdks/entities/README.md new file mode 100644 index 000000000..cfb79812b --- /dev/null +++ b/others/python-sdk/docs/sdks/entities/README.md @@ -0,0 +1,147 @@ +# Entities + +## Overview + +### Available Operations + +* [create](#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](#get) - Fetches a single entity by entity ID. + +Use this to read one entity's current state. Pass customerId when you want to scope the lookup to a specific customer. +* [delete](#delete) - Deletes an entity by entity ID. + +Use this when the underlying resource is removed and you no longer want entity-scoped balances or subscriptions tracked for it. + +## 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. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.entities.create(feature_id="seats", customer_id="cus_123", entity_id="seat_42", name="Seat 42") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `feature_id` | *str* | :heavy_check_mark: | The ID of the feature this entity is associated with | +| `customer_id` | *str* | :heavy_check_mark: | The ID of the customer to create the entity for. | +| `entity_id` | *str* | :heavy_check_mark: | The ID of the entity. | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | The name of the entity | +| `customer_data` | [Optional[models.CustomerData]](../../models/customerdata.md) | :heavy_minus_sign: | Customer details to set when creating a customer | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.CreateEntityResponse](../../models/createentityresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## get + +Fetches a single entity by entity ID. + +Use this to read one entity's current state. Pass customerId when you want to scope the lookup to a specific customer. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.entities.get(entity_id="seat_42") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `entity_id` | *str* | :heavy_check_mark: | The ID of the entity. | +| `customer_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the customer to create the entity for. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.GetEntityResponse](../../models/getentityresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## delete + +Deletes an entity by entity ID. + +Use this when the underlying resource is removed and you no longer want entity-scoped balances or subscriptions tracked for it. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.entities.delete(entity_id="seat_42", customer_id="cus_123") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `entity_id` | *str* | :heavy_check_mark: | The ID of the entity. | +| `customer_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the customer. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.DeleteEntityResponse](../../models/deleteentityresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/others/python-sdk/docs/sdks/events/README.md b/others/python-sdk/docs/sdks/events/README.md new file mode 100644 index 000000000..e450e815a --- /dev/null +++ b/others/python-sdk/docs/sdks/events/README.md @@ -0,0 +1,97 @@ +# Events + +## Overview + +### Available Operations + +* [list](#list) - List usage events for your organization. Filter by customer, feature, or time range. +* [aggregate](#aggregate) - Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property. + +## list + +List usage events for your organization. Filter by customer, feature, or time range. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.events.list(offset=0, limit=50, customer_id="cus_123") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| `offset` | *Optional[int]* | :heavy_minus_sign: | Number of items to skip | +| `limit` | *Optional[int]* | :heavy_minus_sign: | Number of items to return. Default 100, max 1000. | +| `customer_id` | *Optional[str]* | :heavy_minus_sign: | Filter events by customer ID | +| `feature_id` | [Optional[models.ListEventsFeatureID]](../../models/listeventsfeatureid.md) | :heavy_minus_sign: | Filter by specific feature ID(s) | +| `custom_range` | [Optional[models.ListEventsCustomRange]](../../models/listeventscustomrange.md) | :heavy_minus_sign: | Filter events by time range | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.ListEventsResponse](../../models/listeventsresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## aggregate + +Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.events.aggregate(customer_id="cus_123", feature_id="api_calls", range="30d", bin_size="day") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | Customer ID to aggregate events for | +| `feature_id` | [models.AggregateEventsFeatureID](../../models/aggregateeventsfeatureid.md) | :heavy_check_mark: | Feature ID(s) to aggregate events for | +| `group_by` | *Optional[str]* | :heavy_minus_sign: | Property to group events by. If provided, each key in the response will be an object with distinct groups as the keys | +| `range` | [Optional[models.Range]](../../models/range.md) | :heavy_minus_sign: | Time range to aggregate events for. Either range or custom_range must be provided | +| `bin_size` | [Optional[models.BinSize]](../../models/binsize.md) | :heavy_minus_sign: | Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day | +| `custom_range` | [Optional[models.AggregateEventsCustomRange]](../../models/aggregateeventscustomrange.md) | :heavy_minus_sign: | Custom time range to aggregate events for. If provided, range must not be provided | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.AggregateEventsResponse](../../models/aggregateeventsresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/others/python-sdk/docs/sdks/referrals/README.md b/others/python-sdk/docs/sdks/referrals/README.md new file mode 100644 index 000000000..1420a21b2 --- /dev/null +++ b/others/python-sdk/docs/sdks/referrals/README.md @@ -0,0 +1,90 @@ +# Referrals + +## Overview + +### Available Operations + +* [create_code](#create_code) - Create or fetch a referral code for a customer in a referral program. +* [redeem_code](#redeem_code) - Redeem a referral code for a customer. + +## create_code + +Create or fetch a referral code for a customer in a referral program. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.referrals.create_code(customer_id="cus_123", program_id="prog_123") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | The unique identifier of the customer | +| `program_id` | *str* | :heavy_check_mark: | ID of your referral program | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.CreateReferralCodeResponse](../../models/createreferralcoderesponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## redeem_code + +Redeem a referral code for a customer. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.referrals.redeem_code(code="REF123", customer_id="cus_456") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `code` | *str* | :heavy_check_mark: | The referral code to redeem | +| `customer_id` | *str* | :heavy_check_mark: | The unique identifier of the customer redeeming the code | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.RedeemReferralCodeResponse](../../models/redeemreferralcoderesponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/others/python-sdk/pylintrc b/others/python-sdk/pylintrc index f13c2fb55..5650f49e0 100644 --- a/others/python-sdk/pylintrc +++ b/others/python-sdk/pylintrc @@ -641,7 +641,7 @@ additional-builtins= allow-global-unused-variables=yes # List of names allowed to shadow builtins -allowed-redefined-builtins=id,object,input +allowed-redefined-builtins=id,object,input,range # List of strings which can identify a callback function by name. A callback # name must start or end with one of those strings. diff --git a/others/python-sdk/pyproject.toml b/others/python-sdk/pyproject.toml index 724b12dd0..7a93ba2a4 100644 --- a/others/python-sdk/pyproject.toml +++ b/others/python-sdk/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "autumn-sdk" -version = "0.2.23" +version = "0.4.4" description = "Python SDK for the Autumn billing API" authors = [{ name = "Autumn" },] readme = "README.md" diff --git a/others/python-sdk/src/autumn_sdk/_version.py b/others/python-sdk/src/autumn_sdk/_version.py index 657096928..7bdbc7436 100644 --- a/others/python-sdk/src/autumn_sdk/_version.py +++ b/others/python-sdk/src/autumn_sdk/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "autumn-sdk" -__version__: str = "0.2.23" +__version__: str = "0.4.4" __openapi_doc_version__: str = "2.1.0" __gen_version__: str = "2.824.1" -__user_agent__: str = "speakeasy-sdk/python 0.2.23 2.824.1 2.1.0 autumn-sdk" +__user_agent__: str = "speakeasy-sdk/python 0.4.4 2.824.1 2.1.0 autumn-sdk" try: if __package__ is not None: diff --git a/others/python-sdk/src/autumn_sdk/balances_sdk.py b/others/python-sdk/src/autumn_sdk/balances_sdk.py index 10dad7519..a077a5f1c 100644 --- a/others/python-sdk/src/autumn_sdk/balances_sdk.py +++ b/others/python-sdk/src/autumn_sdk/balances_sdk.py @@ -5,20 +5,20 @@ from autumn_sdk import errors, models, utils from autumn_sdk._hooks import HookContext from autumn_sdk.types import OptionalNullable, UNSET from autumn_sdk.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Dict, Mapping, Optional, Union +from typing import Mapping, Optional, Union class BalancesSDK(BaseSDK): def create( self, *, - feature_id: str, customer_id: str, + feature_id: str, entity_id: Optional[str] = None, included: Optional[float] = None, unlimited: Optional[bool] = None, reset: Optional[ - Union[models.BalancesCreateReset, models.BalancesCreateResetTypedDict] + Union[models.CreateBalanceReset, models.CreateBalanceResetTypedDict] ] = None, expires_at: Optional[float] = None, granted_balance: Optional[float] = None, @@ -26,16 +26,16 @@ class BalancesSDK(BaseSDK): server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> models.BalancesCreateResponse: + ) -> models.CreateBalanceResponse: r"""Create a balance for a customer feature. - :param feature_id: The feature ID to create the balance for - :param customer_id: The customer ID to assign the balance to - :param entity_id: Entity ID for entity-scoped balances - :param included: The initial balance amount to grant - :param unlimited: Whether the balance is unlimited - :param reset: Reset configuration for the balance - :param expires_at: Unix timestamp (milliseconds) when the balance expires + :param customer_id: The ID of the customer. + :param feature_id: The ID of the feature. + :param entity_id: The ID of the entity for entity-scoped balances (e.g., per-seat limits). + :param included: The initial balance amount to grant. For metered features, this is the number of units the customer can use. + :param unlimited: If true, the balance has unlimited usage. Cannot be combined with 'included'. + :param reset: Reset configuration for the balance. If not provided, the balance is a one-time grant that never resets. + :param expires_at: Unix timestamp (milliseconds) when the balance expires. Mutually exclusive with reset. :param granted_balance: :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -52,13 +52,13 @@ class BalancesSDK(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = models.BalancesCreateRequest( - feature_id=feature_id, + request = models.CreateBalanceParams( customer_id=customer_id, + feature_id=feature_id, entity_id=entity_id, included=included, unlimited=unlimited, - reset=utils.get_pydantic_model(reset, Optional[models.BalancesCreateReset]), + reset=utils.get_pydantic_model(reset, Optional[models.CreateBalanceReset]), expires_at=expires_at, granted_balance=granted_balance, ) @@ -75,12 +75,12 @@ class BalancesSDK(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, - _globals=models.BalancesCreateGlobals( + _globals=models.CreateBalanceGlobals( x_api_version=self.sdk_configuration.globals.x_api_version, ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BalancesCreateRequest + request, False, False, "json", models.CreateBalanceParams ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -98,7 +98,7 @@ class BalancesSDK(BaseSDK): hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="balancesCreate", + operation_id="createBalance", oauth2_scopes=None, security_source=self.sdk_configuration.security, ), @@ -108,7 +108,7 @@ class BalancesSDK(BaseSDK): ) if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(models.BalancesCreateResponse, http_res) + return unmarshal_json_response(models.CreateBalanceResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise errors.AutumnDefaultError( @@ -125,13 +125,13 @@ class BalancesSDK(BaseSDK): async def create_async( self, *, - feature_id: str, customer_id: str, + feature_id: str, entity_id: Optional[str] = None, included: Optional[float] = None, unlimited: Optional[bool] = None, reset: Optional[ - Union[models.BalancesCreateReset, models.BalancesCreateResetTypedDict] + Union[models.CreateBalanceReset, models.CreateBalanceResetTypedDict] ] = None, expires_at: Optional[float] = None, granted_balance: Optional[float] = None, @@ -139,16 +139,16 @@ class BalancesSDK(BaseSDK): server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> models.BalancesCreateResponse: + ) -> models.CreateBalanceResponse: r"""Create a balance for a customer feature. - :param feature_id: The feature ID to create the balance for - :param customer_id: The customer ID to assign the balance to - :param entity_id: Entity ID for entity-scoped balances - :param included: The initial balance amount to grant - :param unlimited: Whether the balance is unlimited - :param reset: Reset configuration for the balance - :param expires_at: Unix timestamp (milliseconds) when the balance expires + :param customer_id: The ID of the customer. + :param feature_id: The ID of the feature. + :param entity_id: The ID of the entity for entity-scoped balances (e.g., per-seat limits). + :param included: The initial balance amount to grant. For metered features, this is the number of units the customer can use. + :param unlimited: If true, the balance has unlimited usage. Cannot be combined with 'included'. + :param reset: Reset configuration for the balance. If not provided, the balance is a one-time grant that never resets. + :param expires_at: Unix timestamp (milliseconds) when the balance expires. Mutually exclusive with reset. :param granted_balance: :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -165,13 +165,13 @@ class BalancesSDK(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = models.BalancesCreateRequest( - feature_id=feature_id, + request = models.CreateBalanceParams( customer_id=customer_id, + feature_id=feature_id, entity_id=entity_id, included=included, unlimited=unlimited, - reset=utils.get_pydantic_model(reset, Optional[models.BalancesCreateReset]), + reset=utils.get_pydantic_model(reset, Optional[models.CreateBalanceReset]), expires_at=expires_at, granted_balance=granted_balance, ) @@ -188,12 +188,12 @@ class BalancesSDK(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, - _globals=models.BalancesCreateGlobals( + _globals=models.CreateBalanceGlobals( x_api_version=self.sdk_configuration.globals.x_api_version, ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BalancesCreateRequest + request, False, False, "json", models.CreateBalanceParams ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -211,7 +211,7 @@ class BalancesSDK(BaseSDK): hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="balancesCreate", + operation_id="createBalance", oauth2_scopes=None, security_source=self.sdk_configuration.security, ), @@ -221,7 +221,7 @@ class BalancesSDK(BaseSDK): ) if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(models.BalancesCreateResponse, http_res) + return unmarshal_json_response(models.CreateBalanceResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.AutumnDefaultError( @@ -241,30 +241,22 @@ class BalancesSDK(BaseSDK): customer_id: str, feature_id: str, entity_id: Optional[str] = None, - current_balance: Optional[float] = None, - interval: Optional[models.BalancesUpdateInterval] = None, - granted_balance: Optional[float] = None, - usage: Optional[float] = None, - customer_entitlement_id: Optional[str] = None, - next_reset_at: Optional[float] = None, + remaining: Optional[float] = None, add_to_balance: Optional[float] = None, + interval: Optional[models.UpdateBalanceInterval] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> models.BalancesUpdateResponse: + ) -> models.UpdateBalanceResponse: r"""Update a customer balance. :param customer_id: The ID of the customer. - :param feature_id: The ID of the feature to update balance for. - :param entity_id: The ID of the entity to update balance for (if using entity balances). - :param current_balance: The new balance value to set. - :param interval: The interval to update balance for. - :param granted_balance: - :param usage: - :param customer_entitlement_id: - :param next_reset_at: - :param add_to_balance: + :param feature_id: The ID of the feature. + :param entity_id: The ID of the entity for entity-scoped balances (e.g., per-seat limits). + :param remaining: Set the remaining balance to this exact value. Cannot be combined with add_to_balance. + :param add_to_balance: Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance. + :param interval: Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -280,17 +272,13 @@ class BalancesSDK(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = models.BalancesUpdateRequest( + request = models.UpdateBalanceParams( customer_id=customer_id, - entity_id=entity_id, feature_id=feature_id, - current_balance=current_balance, - interval=interval, - granted_balance=granted_balance, - usage=usage, - customer_entitlement_id=customer_entitlement_id, - next_reset_at=next_reset_at, + entity_id=entity_id, + remaining=remaining, add_to_balance=add_to_balance, + interval=interval, ) req = self._build_request( @@ -305,12 +293,12 @@ class BalancesSDK(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, - _globals=models.BalancesUpdateGlobals( + _globals=models.UpdateBalanceGlobals( x_api_version=self.sdk_configuration.globals.x_api_version, ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BalancesUpdateRequest + request, False, False, "json", models.UpdateBalanceParams ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -328,7 +316,7 @@ class BalancesSDK(BaseSDK): hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="balancesUpdate", + operation_id="updateBalance", oauth2_scopes=None, security_source=self.sdk_configuration.security, ), @@ -338,7 +326,7 @@ class BalancesSDK(BaseSDK): ) if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(models.BalancesUpdateResponse, http_res) + return unmarshal_json_response(models.UpdateBalanceResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise errors.AutumnDefaultError( @@ -358,30 +346,22 @@ class BalancesSDK(BaseSDK): customer_id: str, feature_id: str, entity_id: Optional[str] = None, - current_balance: Optional[float] = None, - interval: Optional[models.BalancesUpdateInterval] = None, - granted_balance: Optional[float] = None, - usage: Optional[float] = None, - customer_entitlement_id: Optional[str] = None, - next_reset_at: Optional[float] = None, + remaining: Optional[float] = None, add_to_balance: Optional[float] = None, + interval: Optional[models.UpdateBalanceInterval] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> models.BalancesUpdateResponse: + ) -> models.UpdateBalanceResponse: r"""Update a customer balance. :param customer_id: The ID of the customer. - :param feature_id: The ID of the feature to update balance for. - :param entity_id: The ID of the entity to update balance for (if using entity balances). - :param current_balance: The new balance value to set. - :param interval: The interval to update balance for. - :param granted_balance: - :param usage: - :param customer_entitlement_id: - :param next_reset_at: - :param add_to_balance: + :param feature_id: The ID of the feature. + :param entity_id: The ID of the entity for entity-scoped balances (e.g., per-seat limits). + :param remaining: Set the remaining balance to this exact value. Cannot be combined with add_to_balance. + :param add_to_balance: Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance. + :param interval: Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -397,17 +377,13 @@ class BalancesSDK(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = models.BalancesUpdateRequest( + request = models.UpdateBalanceParams( customer_id=customer_id, - entity_id=entity_id, feature_id=feature_id, - current_balance=current_balance, - interval=interval, - granted_balance=granted_balance, - usage=usage, - customer_entitlement_id=customer_entitlement_id, - next_reset_at=next_reset_at, + entity_id=entity_id, + remaining=remaining, add_to_balance=add_to_balance, + interval=interval, ) req = self._build_request_async( @@ -422,12 +398,12 @@ class BalancesSDK(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, - _globals=models.BalancesUpdateGlobals( + _globals=models.UpdateBalanceGlobals( x_api_version=self.sdk_configuration.globals.x_api_version, ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BalancesUpdateRequest + request, False, False, "json", models.UpdateBalanceParams ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -445,7 +421,7 @@ class BalancesSDK(BaseSDK): hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="balancesUpdate", + operation_id="updateBalance", oauth2_scopes=None, security_source=self.sdk_configuration.security, ), @@ -455,439 +431,7 @@ class BalancesSDK(BaseSDK): ) if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(models.BalancesUpdateResponse, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.AutumnDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.AutumnDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.AutumnDefaultError("Unexpected response received", http_res) - - def check( - self, - *, - customer_id: str, - feature_id: str, - entity_id: Optional[str] = None, - required_balance: Optional[float] = None, - properties: Optional[Dict[str, Any]] = None, - send_event: Optional[bool] = None, - with_preview: Optional[bool] = None, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> models.BalancesCheckResponse: - r"""Check whether usage is allowed for a customer feature. - - :param customer_id: ID which you provided when creating the customer - :param feature_id: ID of the feature to check access to. - :param entity_id: If using entity balances (eg, seats), the entity ID to check access for. - :param required_balance: If you know the amount of the feature the end user is consuming in advance. If their balance is below this quantity, allowed will be false. - :param properties: - :param send_event: If true, a usage event will be recorded together with checking access. The required_balance field will be used as the usage value. - :param with_preview: If true, the response will include a preview object, which can be used to display information such as a paywall or upgrade confirmation. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.BalancesCheckRequest( - customer_id=customer_id, - feature_id=feature_id, - entity_id=entity_id, - required_balance=required_balance, - properties=properties, - send_event=send_event, - with_preview=with_preview, - ) - - req = self._build_request( - method="POST", - path="/v1/balances.check", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=False, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - _globals=models.BalancesCheckGlobals( - x_api_version=self.sdk_configuration.globals.x_api_version, - ), - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BalancesCheckRequest - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = self.do_request( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="balancesCheck", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=["4XX", "5XX"], - retry_config=retry_config, - ) - - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(models.BalancesCheckResponse, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.AutumnDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.AutumnDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.AutumnDefaultError("Unexpected response received", http_res) - - async def check_async( - self, - *, - customer_id: str, - feature_id: str, - entity_id: Optional[str] = None, - required_balance: Optional[float] = None, - properties: Optional[Dict[str, Any]] = None, - send_event: Optional[bool] = None, - with_preview: Optional[bool] = None, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> models.BalancesCheckResponse: - r"""Check whether usage is allowed for a customer feature. - - :param customer_id: ID which you provided when creating the customer - :param feature_id: ID of the feature to check access to. - :param entity_id: If using entity balances (eg, seats), the entity ID to check access for. - :param required_balance: If you know the amount of the feature the end user is consuming in advance. If their balance is below this quantity, allowed will be false. - :param properties: - :param send_event: If true, a usage event will be recorded together with checking access. The required_balance field will be used as the usage value. - :param with_preview: If true, the response will include a preview object, which can be used to display information such as a paywall or upgrade confirmation. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.BalancesCheckRequest( - customer_id=customer_id, - feature_id=feature_id, - entity_id=entity_id, - required_balance=required_balance, - properties=properties, - send_event=send_event, - with_preview=with_preview, - ) - - req = self._build_request_async( - method="POST", - path="/v1/balances.check", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=False, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - _globals=models.BalancesCheckGlobals( - x_api_version=self.sdk_configuration.globals.x_api_version, - ), - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BalancesCheckRequest - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = await self.do_request_async( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="balancesCheck", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=["4XX", "5XX"], - retry_config=retry_config, - ) - - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(models.BalancesCheckResponse, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.AutumnDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.AutumnDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.AutumnDefaultError("Unexpected response received", http_res) - - def track( - self, - *, - customer_id: str, - feature_id: Optional[str] = None, - event_name: Optional[str] = None, - value: Optional[float] = None, - properties: Optional[Dict[str, Any]] = None, - idempotency_key: Optional[str] = None, - entity_id: Optional[str] = None, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> models.BalancesTrackResponse: - r"""Track usage for a customer feature. - - :param customer_id: ID which you provided when creating the customer - :param feature_id: ID of the feature to track usage for. Required if event_name is not provided. Use this for direct feature tracking. - :param event_name: An [event name](/features/tracking-usage#using-event-names) can be used in place of feature_id. This can be used if multiple features are tracked in the same event. - :param value: The amount of usage to record. Defaults to 1. Can be negative to increase the balance (e.g., when removing a seat). - :param properties: Additional properties to attach to this usage event. - :param idempotency_key: Unique key to prevent duplicate event recording. Use this to safely retry requests without creating duplicate usage records. - :param entity_id: If using [entity balances](/features/feature-entities) (eg, seats), the entity ID to track usage for. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.BalancesTrackRequest( - customer_id=customer_id, - feature_id=feature_id, - event_name=event_name, - value=value, - properties=properties, - idempotency_key=idempotency_key, - entity_id=entity_id, - ) - - req = self._build_request( - method="POST", - path="/v1/balances.track", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=False, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - _globals=models.BalancesTrackGlobals( - x_api_version=self.sdk_configuration.globals.x_api_version, - ), - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BalancesTrackRequest - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = self.do_request( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="balancesTrack", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=["4XX", "5XX"], - retry_config=retry_config, - ) - - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(models.BalancesTrackResponse, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.AutumnDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.AutumnDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.AutumnDefaultError("Unexpected response received", http_res) - - async def track_async( - self, - *, - customer_id: str, - feature_id: Optional[str] = None, - event_name: Optional[str] = None, - value: Optional[float] = None, - properties: Optional[Dict[str, Any]] = None, - idempotency_key: Optional[str] = None, - entity_id: Optional[str] = None, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> models.BalancesTrackResponse: - r"""Track usage for a customer feature. - - :param customer_id: ID which you provided when creating the customer - :param feature_id: ID of the feature to track usage for. Required if event_name is not provided. Use this for direct feature tracking. - :param event_name: An [event name](/features/tracking-usage#using-event-names) can be used in place of feature_id. This can be used if multiple features are tracked in the same event. - :param value: The amount of usage to record. Defaults to 1. Can be negative to increase the balance (e.g., when removing a seat). - :param properties: Additional properties to attach to this usage event. - :param idempotency_key: Unique key to prevent duplicate event recording. Use this to safely retry requests without creating duplicate usage records. - :param entity_id: If using [entity balances](/features/feature-entities) (eg, seats), the entity ID to track usage for. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.BalancesTrackRequest( - customer_id=customer_id, - feature_id=feature_id, - event_name=event_name, - value=value, - properties=properties, - idempotency_key=idempotency_key, - entity_id=entity_id, - ) - - req = self._build_request_async( - method="POST", - path="/v1/balances.track", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=False, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - _globals=models.BalancesTrackGlobals( - x_api_version=self.sdk_configuration.globals.x_api_version, - ), - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BalancesTrackRequest - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = await self.do_request_async( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="balancesTrack", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=["4XX", "5XX"], - retry_config=retry_config, - ) - - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(models.BalancesTrackResponse, http_res) + return unmarshal_json_response(models.UpdateBalanceResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.AutumnDefaultError( diff --git a/others/python-sdk/src/autumn_sdk/billing.py b/others/python-sdk/src/autumn_sdk/billing.py index 1c2d8ce6f..bb52c0bb5 100644 --- a/others/python-sdk/src/autumn_sdk/billing.py +++ b/others/python-sdk/src/autumn_sdk/billing.py @@ -5,7 +5,7 @@ from autumn_sdk import errors, models, utils from autumn_sdk._hooks import HookContext from autumn_sdk.types import OptionalNullable, UNSET from autumn_sdk.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Dict, List, Mapping, Optional, Union +from typing import List, Mapping, Optional, Union class Billing(BaseSDK): @@ -14,13 +14,13 @@ class Billing(BaseSDK): *, customer_id: str, plan_id: str, - entity_id: OptionalNullable[str] = UNSET, - feature_quantities: OptionalNullable[ + entity_id: Optional[str] = None, + feature_quantities: Optional[ Union[ - List[models.BillingAttachFeatureQuantities], - List[models.BillingAttachFeatureQuantitiesTypedDict], + List[models.BillingAttachFeatureQuantity], + List[models.BillingAttachFeatureQuantityTypedDict], ] - ] = UNSET, + ] = None, version: Optional[float] = None, free_trial: OptionalNullable[ Union[models.BillingAttachFreeTrial, models.BillingAttachFreeTrialTypedDict] @@ -34,17 +34,16 @@ class Billing(BaseSDK): models.BillingAttachInvoiceModeTypedDict, ] ] = None, + billing_behavior: Optional[models.BillingAttachBillingBehavior] = None, discounts: Optional[ Union[ List[models.BillingAttachDiscountUnion], List[models.BillingAttachDiscountUnionTypedDict], ] ] = None, - redirect_mode: Optional[models.BillingAttachRedirectMode] = "always", success_url: Optional[str] = None, new_billing_subscription: Optional[bool] = None, plan_schedule: Optional[models.BillingAttachPlanSchedule] = None, - billing_behavior: Optional[models.BillingAttachBillingBehavior] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -52,20 +51,21 @@ class Billing(BaseSDK): ) -> models.BillingAttachResponse: r"""Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. + Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product. + :param customer_id: The ID of the customer to attach the plan to. - :param plan_id: + :param plan_id: The ID of the plan. :param entity_id: The ID of the entity to attach the plan to. :param feature_quantities: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. :param version: The version of the plan to attach. - :param free_trial: + :param free_trial: Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. :param customize: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - :param invoice_mode: - :param discounts: - :param redirect_mode: - :param success_url: - :param new_billing_subscription: - :param plan_schedule: - :param billing_behavior: + :param invoice_mode: Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + :param billing_behavior: 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. + :param discounts: List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + :param success_url: URL to redirect to after successful checkout. + :param new_billing_subscription: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + :param plan_schedule: When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -81,12 +81,12 @@ class Billing(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = models.BillingAttachRequest( + request = models.AttachParams( customer_id=customer_id, entity_id=entity_id, + plan_id=plan_id, feature_quantities=utils.get_pydantic_model( - feature_quantities, - OptionalNullable[List[models.BillingAttachFeatureQuantities]], + feature_quantities, Optional[List[models.BillingAttachFeatureQuantity]] ), version=version, free_trial=utils.get_pydantic_model( @@ -95,18 +95,16 @@ class Billing(BaseSDK): customize=utils.get_pydantic_model( customize, Optional[models.BillingAttachCustomize] ), - plan_id=plan_id, invoice_mode=utils.get_pydantic_model( invoice_mode, Optional[models.BillingAttachInvoiceMode] ), + billing_behavior=billing_behavior, discounts=utils.get_pydantic_model( discounts, Optional[List[models.BillingAttachDiscountUnion]] ), - redirect_mode=redirect_mode, success_url=success_url, new_billing_subscription=new_billing_subscription, plan_schedule=plan_schedule, - billing_behavior=billing_behavior, ) req = self._build_request( @@ -126,7 +124,7 @@ class Billing(BaseSDK): ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BillingAttachRequest + request, False, False, "json", models.AttachParams ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -173,13 +171,13 @@ class Billing(BaseSDK): *, customer_id: str, plan_id: str, - entity_id: OptionalNullable[str] = UNSET, - feature_quantities: OptionalNullable[ + entity_id: Optional[str] = None, + feature_quantities: Optional[ Union[ - List[models.BillingAttachFeatureQuantities], - List[models.BillingAttachFeatureQuantitiesTypedDict], + List[models.BillingAttachFeatureQuantity], + List[models.BillingAttachFeatureQuantityTypedDict], ] - ] = UNSET, + ] = None, version: Optional[float] = None, free_trial: OptionalNullable[ Union[models.BillingAttachFreeTrial, models.BillingAttachFreeTrialTypedDict] @@ -193,17 +191,16 @@ class Billing(BaseSDK): models.BillingAttachInvoiceModeTypedDict, ] ] = None, + billing_behavior: Optional[models.BillingAttachBillingBehavior] = None, discounts: Optional[ Union[ List[models.BillingAttachDiscountUnion], List[models.BillingAttachDiscountUnionTypedDict], ] ] = None, - redirect_mode: Optional[models.BillingAttachRedirectMode] = "always", success_url: Optional[str] = None, new_billing_subscription: Optional[bool] = None, plan_schedule: Optional[models.BillingAttachPlanSchedule] = None, - billing_behavior: Optional[models.BillingAttachBillingBehavior] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -211,20 +208,21 @@ class Billing(BaseSDK): ) -> models.BillingAttachResponse: r"""Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. + Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product. + :param customer_id: The ID of the customer to attach the plan to. - :param plan_id: + :param plan_id: The ID of the plan. :param entity_id: The ID of the entity to attach the plan to. :param feature_quantities: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. :param version: The version of the plan to attach. - :param free_trial: + :param free_trial: Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. :param customize: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - :param invoice_mode: - :param discounts: - :param redirect_mode: - :param success_url: - :param new_billing_subscription: - :param plan_schedule: - :param billing_behavior: + :param invoice_mode: Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + :param billing_behavior: 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. + :param discounts: List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + :param success_url: URL to redirect to after successful checkout. + :param new_billing_subscription: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + :param plan_schedule: When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -240,12 +238,12 @@ class Billing(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = models.BillingAttachRequest( + request = models.AttachParams( customer_id=customer_id, entity_id=entity_id, + plan_id=plan_id, feature_quantities=utils.get_pydantic_model( - feature_quantities, - OptionalNullable[List[models.BillingAttachFeatureQuantities]], + feature_quantities, Optional[List[models.BillingAttachFeatureQuantity]] ), version=version, free_trial=utils.get_pydantic_model( @@ -254,18 +252,16 @@ class Billing(BaseSDK): customize=utils.get_pydantic_model( customize, Optional[models.BillingAttachCustomize] ), - plan_id=plan_id, invoice_mode=utils.get_pydantic_model( invoice_mode, Optional[models.BillingAttachInvoiceMode] ), + billing_behavior=billing_behavior, discounts=utils.get_pydantic_model( discounts, Optional[List[models.BillingAttachDiscountUnion]] ), - redirect_mode=redirect_mode, success_url=success_url, new_billing_subscription=new_billing_subscription, plan_schedule=plan_schedule, - billing_behavior=billing_behavior, ) req = self._build_request_async( @@ -285,7 +281,7 @@ class Billing(BaseSDK): ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BillingAttachRequest + request, False, False, "json", models.AttachParams ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -332,64 +328,58 @@ class Billing(BaseSDK): *, customer_id: str, plan_id: str, - entity_id: OptionalNullable[str] = UNSET, - feature_quantities: OptionalNullable[ + entity_id: Optional[str] = None, + feature_quantities: Optional[ Union[ - List[models.BillingPreviewAttachFeatureQuantities], - List[models.BillingPreviewAttachFeatureQuantitiesTypedDict], + List[models.PreviewAttachFeatureQuantity], + List[models.PreviewAttachFeatureQuantityTypedDict], ] - ] = UNSET, + ] = None, version: Optional[float] = None, free_trial: OptionalNullable[ - Union[ - models.BillingPreviewAttachFreeTrial, - models.BillingPreviewAttachFreeTrialTypedDict, - ] + Union[models.PreviewAttachFreeTrial, models.PreviewAttachFreeTrialTypedDict] ] = UNSET, customize: Optional[ - Union[ - models.BillingPreviewAttachCustomize, - models.BillingPreviewAttachCustomizeTypedDict, - ] + Union[models.PreviewAttachCustomize, models.PreviewAttachCustomizeTypedDict] ] = None, invoice_mode: Optional[ Union[ - models.BillingPreviewAttachInvoiceMode, - models.BillingPreviewAttachInvoiceModeTypedDict, + models.PreviewAttachInvoiceMode, + models.PreviewAttachInvoiceModeTypedDict, ] ] = None, + billing_behavior: Optional[models.PreviewAttachBillingBehavior] = None, discounts: Optional[ Union[ - List[models.BillingPreviewAttachDiscountUnion], - List[models.BillingPreviewAttachDiscountUnionTypedDict], + List[models.PreviewAttachDiscountUnion], + List[models.PreviewAttachDiscountUnionTypedDict], ] ] = None, - redirect_mode: Optional[models.BillingPreviewAttachRedirectMode] = "always", success_url: Optional[str] = None, new_billing_subscription: Optional[bool] = None, - plan_schedule: Optional[models.BillingPreviewAttachPlanSchedule] = None, - billing_behavior: Optional[models.BillingPreviewAttachBillingBehavior] = None, + plan_schedule: Optional[models.PreviewAttachPlanSchedule] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> models.BillingPreviewAttachResponse: - r"""Preview billing changes before attaching a plan. + ) -> models.PreviewAttachResponse: + r"""Previews the billing changes that would occur when attaching a plan, without actually making any changes. + + Use this endpoint to show customers what they will be charged before confirming a subscription change. :param customer_id: The ID of the customer to attach the plan to. - :param plan_id: + :param plan_id: The ID of the plan. :param entity_id: The ID of the entity to attach the plan to. :param feature_quantities: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. :param version: The version of the plan to attach. - :param free_trial: + :param free_trial: Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. :param customize: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - :param invoice_mode: - :param discounts: - :param redirect_mode: - :param success_url: - :param new_billing_subscription: - :param plan_schedule: - :param billing_behavior: + :param invoice_mode: Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + :param billing_behavior: 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. + :param discounts: List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + :param success_url: URL to redirect to after successful checkout. + :param new_billing_subscription: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + :param plan_schedule: When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -405,32 +395,30 @@ class Billing(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = models.BillingPreviewAttachRequest( + request = models.PreviewAttachParams( customer_id=customer_id, entity_id=entity_id, + plan_id=plan_id, feature_quantities=utils.get_pydantic_model( - feature_quantities, - OptionalNullable[List[models.BillingPreviewAttachFeatureQuantities]], + feature_quantities, Optional[List[models.PreviewAttachFeatureQuantity]] ), version=version, free_trial=utils.get_pydantic_model( - free_trial, OptionalNullable[models.BillingPreviewAttachFreeTrial] + free_trial, OptionalNullable[models.PreviewAttachFreeTrial] ), customize=utils.get_pydantic_model( - customize, Optional[models.BillingPreviewAttachCustomize] + customize, Optional[models.PreviewAttachCustomize] ), - plan_id=plan_id, invoice_mode=utils.get_pydantic_model( - invoice_mode, Optional[models.BillingPreviewAttachInvoiceMode] + invoice_mode, Optional[models.PreviewAttachInvoiceMode] ), + billing_behavior=billing_behavior, discounts=utils.get_pydantic_model( - discounts, Optional[List[models.BillingPreviewAttachDiscountUnion]] + discounts, Optional[List[models.PreviewAttachDiscountUnion]] ), - redirect_mode=redirect_mode, success_url=success_url, new_billing_subscription=new_billing_subscription, plan_schedule=plan_schedule, - billing_behavior=billing_behavior, ) req = self._build_request( @@ -445,12 +433,12 @@ class Billing(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, - _globals=models.BillingPreviewAttachGlobals( + _globals=models.PreviewAttachGlobals( x_api_version=self.sdk_configuration.globals.x_api_version, ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BillingPreviewAttachRequest + request, False, False, "json", models.PreviewAttachParams ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -468,7 +456,7 @@ class Billing(BaseSDK): hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="billingPreviewAttach", + operation_id="previewAttach", oauth2_scopes=None, security_source=self.sdk_configuration.security, ), @@ -478,9 +466,7 @@ class Billing(BaseSDK): ) if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - models.BillingPreviewAttachResponse, http_res - ) + return unmarshal_json_response(models.PreviewAttachResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise errors.AutumnDefaultError( @@ -499,64 +485,58 @@ class Billing(BaseSDK): *, customer_id: str, plan_id: str, - entity_id: OptionalNullable[str] = UNSET, - feature_quantities: OptionalNullable[ + entity_id: Optional[str] = None, + feature_quantities: Optional[ Union[ - List[models.BillingPreviewAttachFeatureQuantities], - List[models.BillingPreviewAttachFeatureQuantitiesTypedDict], + List[models.PreviewAttachFeatureQuantity], + List[models.PreviewAttachFeatureQuantityTypedDict], ] - ] = UNSET, + ] = None, version: Optional[float] = None, free_trial: OptionalNullable[ - Union[ - models.BillingPreviewAttachFreeTrial, - models.BillingPreviewAttachFreeTrialTypedDict, - ] + Union[models.PreviewAttachFreeTrial, models.PreviewAttachFreeTrialTypedDict] ] = UNSET, customize: Optional[ - Union[ - models.BillingPreviewAttachCustomize, - models.BillingPreviewAttachCustomizeTypedDict, - ] + Union[models.PreviewAttachCustomize, models.PreviewAttachCustomizeTypedDict] ] = None, invoice_mode: Optional[ Union[ - models.BillingPreviewAttachInvoiceMode, - models.BillingPreviewAttachInvoiceModeTypedDict, + models.PreviewAttachInvoiceMode, + models.PreviewAttachInvoiceModeTypedDict, ] ] = None, + billing_behavior: Optional[models.PreviewAttachBillingBehavior] = None, discounts: Optional[ Union[ - List[models.BillingPreviewAttachDiscountUnion], - List[models.BillingPreviewAttachDiscountUnionTypedDict], + List[models.PreviewAttachDiscountUnion], + List[models.PreviewAttachDiscountUnionTypedDict], ] ] = None, - redirect_mode: Optional[models.BillingPreviewAttachRedirectMode] = "always", success_url: Optional[str] = None, new_billing_subscription: Optional[bool] = None, - plan_schedule: Optional[models.BillingPreviewAttachPlanSchedule] = None, - billing_behavior: Optional[models.BillingPreviewAttachBillingBehavior] = None, + plan_schedule: Optional[models.PreviewAttachPlanSchedule] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> models.BillingPreviewAttachResponse: - r"""Preview billing changes before attaching a plan. + ) -> models.PreviewAttachResponse: + r"""Previews the billing changes that would occur when attaching a plan, without actually making any changes. + + Use this endpoint to show customers what they will be charged before confirming a subscription change. :param customer_id: The ID of the customer to attach the plan to. - :param plan_id: + :param plan_id: The ID of the plan. :param entity_id: The ID of the entity to attach the plan to. :param feature_quantities: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. :param version: The version of the plan to attach. - :param free_trial: + :param free_trial: Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. :param customize: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - :param invoice_mode: - :param discounts: - :param redirect_mode: - :param success_url: - :param new_billing_subscription: - :param plan_schedule: - :param billing_behavior: + :param invoice_mode: Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + :param billing_behavior: 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. + :param discounts: List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + :param success_url: URL to redirect to after successful checkout. + :param new_billing_subscription: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + :param plan_schedule: When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -572,32 +552,30 @@ class Billing(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = models.BillingPreviewAttachRequest( + request = models.PreviewAttachParams( customer_id=customer_id, entity_id=entity_id, + plan_id=plan_id, feature_quantities=utils.get_pydantic_model( - feature_quantities, - OptionalNullable[List[models.BillingPreviewAttachFeatureQuantities]], + feature_quantities, Optional[List[models.PreviewAttachFeatureQuantity]] ), version=version, free_trial=utils.get_pydantic_model( - free_trial, OptionalNullable[models.BillingPreviewAttachFreeTrial] + free_trial, OptionalNullable[models.PreviewAttachFreeTrial] ), customize=utils.get_pydantic_model( - customize, Optional[models.BillingPreviewAttachCustomize] + customize, Optional[models.PreviewAttachCustomize] ), - plan_id=plan_id, invoice_mode=utils.get_pydantic_model( - invoice_mode, Optional[models.BillingPreviewAttachInvoiceMode] + invoice_mode, Optional[models.PreviewAttachInvoiceMode] ), + billing_behavior=billing_behavior, discounts=utils.get_pydantic_model( - discounts, Optional[List[models.BillingPreviewAttachDiscountUnion]] + discounts, Optional[List[models.PreviewAttachDiscountUnion]] ), - redirect_mode=redirect_mode, success_url=success_url, new_billing_subscription=new_billing_subscription, plan_schedule=plan_schedule, - billing_behavior=billing_behavior, ) req = self._build_request_async( @@ -612,12 +590,12 @@ class Billing(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, - _globals=models.BillingPreviewAttachGlobals( + _globals=models.PreviewAttachGlobals( x_api_version=self.sdk_configuration.globals.x_api_version, ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BillingPreviewAttachRequest + request, False, False, "json", models.PreviewAttachParams ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -635,7 +613,7 @@ class Billing(BaseSDK): hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="billingPreviewAttach", + operation_id="previewAttach", oauth2_scopes=None, security_source=self.sdk_configuration.security, ), @@ -645,9 +623,7 @@ class Billing(BaseSDK): ) if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - models.BillingPreviewAttachResponse, http_res - ) + return unmarshal_json_response(models.PreviewAttachResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.AutumnDefaultError( @@ -665,13 +641,14 @@ class Billing(BaseSDK): self, *, customer_id: str, - entity_id: OptionalNullable[str] = UNSET, - feature_quantities: OptionalNullable[ + plan_id: str, + entity_id: Optional[str] = None, + feature_quantities: Optional[ Union[ - List[models.BillingUpdateFeatureQuantities], - List[models.BillingUpdateFeatureQuantitiesTypedDict], + List[models.BillingUpdateFeatureQuantity], + List[models.BillingUpdateFeatureQuantityTypedDict], ] - ] = UNSET, + ] = None, version: Optional[float] = None, free_trial: OptionalNullable[ Union[models.BillingUpdateFreeTrial, models.BillingUpdateFreeTrialTypedDict] @@ -679,32 +656,33 @@ class Billing(BaseSDK): customize: Optional[ Union[models.BillingUpdateCustomize, models.BillingUpdateCustomizeTypedDict] ] = None, - plan_id: Optional[str] = None, invoice_mode: Optional[ Union[ models.BillingUpdateInvoiceMode, models.BillingUpdateInvoiceModeTypedDict, ] ] = None, - cancel_action: Optional[models.BillingUpdateCancelAction] = None, billing_behavior: Optional[models.BillingUpdateBillingBehavior] = None, + cancel_action: Optional[models.BillingUpdateCancelAction] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, ) -> models.BillingUpdateResponse: - r"""Update an existing subscription. + r"""Updates an existing subscription. Use to modify feature quantities, cancel, or change plan configuration. + + Use this endpoint to update prepaid quantities, cancel a subscription (immediately or at end of cycle), or modify subscription settings. :param customer_id: The ID of the customer to attach the plan to. + :param plan_id: The ID of the plan. :param entity_id: The ID of the entity to attach the plan to. :param feature_quantities: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. :param version: The version of the plan to attach. - :param free_trial: + :param free_trial: Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. :param customize: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - :param plan_id: - :param invoice_mode: - :param cancel_action: - :param billing_behavior: + :param invoice_mode: Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + :param billing_behavior: 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. + :param cancel_action: Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -720,12 +698,12 @@ class Billing(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = models.BillingUpdateRequest( + request = models.UpdateSubscriptionParams( customer_id=customer_id, entity_id=entity_id, + plan_id=plan_id, feature_quantities=utils.get_pydantic_model( - feature_quantities, - OptionalNullable[List[models.BillingUpdateFeatureQuantities]], + feature_quantities, Optional[List[models.BillingUpdateFeatureQuantity]] ), version=version, free_trial=utils.get_pydantic_model( @@ -734,12 +712,11 @@ class Billing(BaseSDK): customize=utils.get_pydantic_model( customize, Optional[models.BillingUpdateCustomize] ), - plan_id=plan_id, invoice_mode=utils.get_pydantic_model( invoice_mode, Optional[models.BillingUpdateInvoiceMode] ), - cancel_action=cancel_action, billing_behavior=billing_behavior, + cancel_action=cancel_action, ) req = self._build_request( @@ -759,7 +736,7 @@ class Billing(BaseSDK): ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BillingUpdateRequest + request, False, False, "json", models.UpdateSubscriptionParams ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -805,13 +782,14 @@ class Billing(BaseSDK): self, *, customer_id: str, - entity_id: OptionalNullable[str] = UNSET, - feature_quantities: OptionalNullable[ + plan_id: str, + entity_id: Optional[str] = None, + feature_quantities: Optional[ Union[ - List[models.BillingUpdateFeatureQuantities], - List[models.BillingUpdateFeatureQuantitiesTypedDict], + List[models.BillingUpdateFeatureQuantity], + List[models.BillingUpdateFeatureQuantityTypedDict], ] - ] = UNSET, + ] = None, version: Optional[float] = None, free_trial: OptionalNullable[ Union[models.BillingUpdateFreeTrial, models.BillingUpdateFreeTrialTypedDict] @@ -819,32 +797,33 @@ class Billing(BaseSDK): customize: Optional[ Union[models.BillingUpdateCustomize, models.BillingUpdateCustomizeTypedDict] ] = None, - plan_id: Optional[str] = None, invoice_mode: Optional[ Union[ models.BillingUpdateInvoiceMode, models.BillingUpdateInvoiceModeTypedDict, ] ] = None, - cancel_action: Optional[models.BillingUpdateCancelAction] = None, billing_behavior: Optional[models.BillingUpdateBillingBehavior] = None, + cancel_action: Optional[models.BillingUpdateCancelAction] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, ) -> models.BillingUpdateResponse: - r"""Update an existing subscription. + r"""Updates an existing subscription. Use to modify feature quantities, cancel, or change plan configuration. + + Use this endpoint to update prepaid quantities, cancel a subscription (immediately or at end of cycle), or modify subscription settings. :param customer_id: The ID of the customer to attach the plan to. + :param plan_id: The ID of the plan. :param entity_id: The ID of the entity to attach the plan to. :param feature_quantities: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. :param version: The version of the plan to attach. - :param free_trial: + :param free_trial: Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. :param customize: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - :param plan_id: - :param invoice_mode: - :param cancel_action: - :param billing_behavior: + :param invoice_mode: Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + :param billing_behavior: 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. + :param cancel_action: Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -860,12 +839,12 @@ class Billing(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = models.BillingUpdateRequest( + request = models.UpdateSubscriptionParams( customer_id=customer_id, entity_id=entity_id, + plan_id=plan_id, feature_quantities=utils.get_pydantic_model( - feature_quantities, - OptionalNullable[List[models.BillingUpdateFeatureQuantities]], + feature_quantities, Optional[List[models.BillingUpdateFeatureQuantity]] ), version=version, free_trial=utils.get_pydantic_model( @@ -874,12 +853,11 @@ class Billing(BaseSDK): customize=utils.get_pydantic_model( customize, Optional[models.BillingUpdateCustomize] ), - plan_id=plan_id, invoice_mode=utils.get_pydantic_model( invoice_mode, Optional[models.BillingUpdateInvoiceMode] ), - cancel_action=cancel_action, billing_behavior=billing_behavior, + cancel_action=cancel_action, ) req = self._build_request_async( @@ -899,7 +877,7 @@ class Billing(BaseSDK): ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BillingUpdateRequest + request, False, False, "json", models.UpdateSubscriptionParams ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -945,52 +923,48 @@ class Billing(BaseSDK): self, *, customer_id: str, - entity_id: OptionalNullable[str] = UNSET, - feature_quantities: OptionalNullable[ + plan_id: str, + entity_id: Optional[str] = None, + feature_quantities: Optional[ Union[ - List[models.BillingPreviewUpdateFeatureQuantities], - List[models.BillingPreviewUpdateFeatureQuantitiesTypedDict], + List[models.PreviewUpdateFeatureQuantity], + List[models.PreviewUpdateFeatureQuantityTypedDict], ] - ] = UNSET, + ] = None, version: Optional[float] = None, free_trial: OptionalNullable[ - Union[ - models.BillingPreviewUpdateFreeTrial, - models.BillingPreviewUpdateFreeTrialTypedDict, - ] + Union[models.PreviewUpdateFreeTrial, models.PreviewUpdateFreeTrialTypedDict] ] = UNSET, customize: Optional[ - Union[ - models.BillingPreviewUpdateCustomize, - models.BillingPreviewUpdateCustomizeTypedDict, - ] + Union[models.PreviewUpdateCustomize, models.PreviewUpdateCustomizeTypedDict] ] = None, - plan_id: Optional[str] = None, invoice_mode: Optional[ Union[ - models.BillingPreviewUpdateInvoiceMode, - models.BillingPreviewUpdateInvoiceModeTypedDict, + models.PreviewUpdateInvoiceMode, + models.PreviewUpdateInvoiceModeTypedDict, ] ] = None, - cancel_action: Optional[models.BillingPreviewUpdateCancelAction] = None, - billing_behavior: Optional[models.BillingPreviewUpdateBillingBehavior] = None, + billing_behavior: Optional[models.PreviewUpdateBillingBehavior] = None, + cancel_action: Optional[models.PreviewUpdateCancelAction] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> models.BillingPreviewUpdateResponse: - r"""Preview billing changes before updating a subscription. + ) -> models.PreviewUpdateResponse: + r"""Previews the billing changes that would occur when updating a subscription, without actually making any changes. + + Use this endpoint to show customers prorated charges or refunds before confirming subscription modifications. :param customer_id: The ID of the customer to attach the plan to. + :param plan_id: The ID of the plan. :param entity_id: The ID of the entity to attach the plan to. :param feature_quantities: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. :param version: The version of the plan to attach. - :param free_trial: + :param free_trial: Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. :param customize: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - :param plan_id: - :param invoice_mode: - :param cancel_action: - :param billing_behavior: + :param invoice_mode: Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + :param billing_behavior: 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. + :param cancel_action: Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -1006,26 +980,25 @@ class Billing(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = models.BillingPreviewUpdateRequest( + request = models.PreviewUpdateParams( customer_id=customer_id, entity_id=entity_id, + plan_id=plan_id, feature_quantities=utils.get_pydantic_model( - feature_quantities, - OptionalNullable[List[models.BillingPreviewUpdateFeatureQuantities]], + feature_quantities, Optional[List[models.PreviewUpdateFeatureQuantity]] ), version=version, free_trial=utils.get_pydantic_model( - free_trial, OptionalNullable[models.BillingPreviewUpdateFreeTrial] + free_trial, OptionalNullable[models.PreviewUpdateFreeTrial] ), customize=utils.get_pydantic_model( - customize, Optional[models.BillingPreviewUpdateCustomize] + customize, Optional[models.PreviewUpdateCustomize] ), - plan_id=plan_id, invoice_mode=utils.get_pydantic_model( - invoice_mode, Optional[models.BillingPreviewUpdateInvoiceMode] + invoice_mode, Optional[models.PreviewUpdateInvoiceMode] ), - cancel_action=cancel_action, billing_behavior=billing_behavior, + cancel_action=cancel_action, ) req = self._build_request( @@ -1040,12 +1013,12 @@ class Billing(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, - _globals=models.BillingPreviewUpdateGlobals( + _globals=models.PreviewUpdateGlobals( x_api_version=self.sdk_configuration.globals.x_api_version, ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BillingPreviewUpdateRequest + request, False, False, "json", models.PreviewUpdateParams ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -1063,7 +1036,7 @@ class Billing(BaseSDK): hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="billingPreviewUpdate", + operation_id="previewUpdate", oauth2_scopes=None, security_source=self.sdk_configuration.security, ), @@ -1073,9 +1046,7 @@ class Billing(BaseSDK): ) if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - models.BillingPreviewUpdateResponse, http_res - ) + return unmarshal_json_response(models.PreviewUpdateResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise errors.AutumnDefaultError( @@ -1093,52 +1064,48 @@ class Billing(BaseSDK): self, *, customer_id: str, - entity_id: OptionalNullable[str] = UNSET, - feature_quantities: OptionalNullable[ + plan_id: str, + entity_id: Optional[str] = None, + feature_quantities: Optional[ Union[ - List[models.BillingPreviewUpdateFeatureQuantities], - List[models.BillingPreviewUpdateFeatureQuantitiesTypedDict], + List[models.PreviewUpdateFeatureQuantity], + List[models.PreviewUpdateFeatureQuantityTypedDict], ] - ] = UNSET, + ] = None, version: Optional[float] = None, free_trial: OptionalNullable[ - Union[ - models.BillingPreviewUpdateFreeTrial, - models.BillingPreviewUpdateFreeTrialTypedDict, - ] + Union[models.PreviewUpdateFreeTrial, models.PreviewUpdateFreeTrialTypedDict] ] = UNSET, customize: Optional[ - Union[ - models.BillingPreviewUpdateCustomize, - models.BillingPreviewUpdateCustomizeTypedDict, - ] + Union[models.PreviewUpdateCustomize, models.PreviewUpdateCustomizeTypedDict] ] = None, - plan_id: Optional[str] = None, invoice_mode: Optional[ Union[ - models.BillingPreviewUpdateInvoiceMode, - models.BillingPreviewUpdateInvoiceModeTypedDict, + models.PreviewUpdateInvoiceMode, + models.PreviewUpdateInvoiceModeTypedDict, ] ] = None, - cancel_action: Optional[models.BillingPreviewUpdateCancelAction] = None, - billing_behavior: Optional[models.BillingPreviewUpdateBillingBehavior] = None, + billing_behavior: Optional[models.PreviewUpdateBillingBehavior] = None, + cancel_action: Optional[models.PreviewUpdateCancelAction] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> models.BillingPreviewUpdateResponse: - r"""Preview billing changes before updating a subscription. + ) -> models.PreviewUpdateResponse: + r"""Previews the billing changes that would occur when updating a subscription, without actually making any changes. + + Use this endpoint to show customers prorated charges or refunds before confirming subscription modifications. :param customer_id: The ID of the customer to attach the plan to. + :param plan_id: The ID of the plan. :param entity_id: The ID of the entity to attach the plan to. :param feature_quantities: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. :param version: The version of the plan to attach. - :param free_trial: + :param free_trial: Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. :param customize: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - :param plan_id: - :param invoice_mode: - :param cancel_action: - :param billing_behavior: + :param invoice_mode: Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + :param billing_behavior: 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. + :param cancel_action: Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -1154,26 +1121,25 @@ class Billing(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = models.BillingPreviewUpdateRequest( + request = models.PreviewUpdateParams( customer_id=customer_id, entity_id=entity_id, + plan_id=plan_id, feature_quantities=utils.get_pydantic_model( - feature_quantities, - OptionalNullable[List[models.BillingPreviewUpdateFeatureQuantities]], + feature_quantities, Optional[List[models.PreviewUpdateFeatureQuantity]] ), version=version, free_trial=utils.get_pydantic_model( - free_trial, OptionalNullable[models.BillingPreviewUpdateFreeTrial] + free_trial, OptionalNullable[models.PreviewUpdateFreeTrial] ), customize=utils.get_pydantic_model( - customize, Optional[models.BillingPreviewUpdateCustomize] + customize, Optional[models.PreviewUpdateCustomize] ), - plan_id=plan_id, invoice_mode=utils.get_pydantic_model( - invoice_mode, Optional[models.BillingPreviewUpdateInvoiceMode] + invoice_mode, Optional[models.PreviewUpdateInvoiceMode] ), - cancel_action=cancel_action, billing_behavior=billing_behavior, + cancel_action=cancel_action, ) req = self._build_request_async( @@ -1188,12 +1154,12 @@ class Billing(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, - _globals=models.BillingPreviewUpdateGlobals( + _globals=models.PreviewUpdateGlobals( x_api_version=self.sdk_configuration.globals.x_api_version, ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BillingPreviewUpdateRequest + request, False, False, "json", models.PreviewUpdateParams ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -1211,7 +1177,7 @@ class Billing(BaseSDK): hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="billingPreviewUpdate", + operation_id="previewUpdate", oauth2_scopes=None, security_source=self.sdk_configuration.security, ), @@ -1221,9 +1187,7 @@ class Billing(BaseSDK): ) if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - models.BillingPreviewUpdateResponse, http_res - ) + return unmarshal_json_response(models.PreviewUpdateResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.AutumnDefaultError( @@ -1237,26 +1201,22 @@ class Billing(BaseSDK): raise errors.AutumnDefaultError("Unexpected response received", http_res) - def setup_payment( + def open_customer_portal( self, *, customer_id: str, - success_url: Optional[str] = None, - customer_data: Optional[ - Union[models.CustomerData, models.CustomerDataTypedDict] - ] = None, - checkout_session_params: Optional[Dict[str, Any]] = None, + configuration_id: Optional[str] = None, + return_url: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> models.BillingSetupPaymentResponse: - r"""Create a setup payment session for a customer. + ) -> models.OpenCustomerPortalResponse: + r"""Create a billing portal session for a customer to manage their subscription. - :param customer_id: The ID of the customer - :param success_url: URL to redirect to after successful payment setup. Must start with either http:// or https:// - :param customer_data: Customer details to set when creating a customer - :param checkout_session_params: Additional parameters for the checkout session + :param customer_id: The ID of the customer to open the billing portal for. + :param configuration_id: Stripe billing portal configuration ID. Create configurations in your Stripe dashboard. + :param return_url: URL to redirect to when back button is clicked in the billing portal :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -1272,18 +1232,15 @@ class Billing(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = models.BillingSetupPaymentRequest( + request = models.OpenCustomerPortalParams( customer_id=customer_id, - success_url=success_url, - customer_data=utils.get_pydantic_model( - customer_data, Optional[models.CustomerData] - ), - checkout_session_params=checkout_session_params, + configuration_id=configuration_id, + return_url=return_url, ) req = self._build_request( method="POST", - path="/v1/billing.setup_payment", + path="/v1/billing.open_customer_portal", base_url=base_url, url_variables=url_variables, request=request, @@ -1293,12 +1250,12 @@ class Billing(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, - _globals=models.BillingSetupPaymentGlobals( + _globals=models.OpenCustomerPortalGlobals( x_api_version=self.sdk_configuration.globals.x_api_version, ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BillingSetupPaymentRequest + request, False, False, "json", models.OpenCustomerPortalParams ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -1316,7 +1273,7 @@ class Billing(BaseSDK): hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="billingSetupPayment", + operation_id="openCustomerPortal", oauth2_scopes=None, security_source=self.sdk_configuration.security, ), @@ -1326,7 +1283,7 @@ class Billing(BaseSDK): ) if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(models.BillingSetupPaymentResponse, http_res) + return unmarshal_json_response(models.OpenCustomerPortalResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) raise errors.AutumnDefaultError( @@ -1340,26 +1297,22 @@ class Billing(BaseSDK): raise errors.AutumnDefaultError("Unexpected response received", http_res) - async def setup_payment_async( + async def open_customer_portal_async( self, *, customer_id: str, - success_url: Optional[str] = None, - customer_data: Optional[ - Union[models.CustomerData, models.CustomerDataTypedDict] - ] = None, - checkout_session_params: Optional[Dict[str, Any]] = None, + configuration_id: Optional[str] = None, + return_url: Optional[str] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> models.BillingSetupPaymentResponse: - r"""Create a setup payment session for a customer. + ) -> models.OpenCustomerPortalResponse: + r"""Create a billing portal session for a customer to manage their subscription. - :param customer_id: The ID of the customer - :param success_url: URL to redirect to after successful payment setup. Must start with either http:// or https:// - :param customer_data: Customer details to set when creating a customer - :param checkout_session_params: Additional parameters for the checkout session + :param customer_id: The ID of the customer to open the billing portal for. + :param configuration_id: Stripe billing portal configuration ID. Create configurations in your Stripe dashboard. + :param return_url: URL to redirect to when back button is clicked in the billing portal :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -1375,18 +1328,15 @@ class Billing(BaseSDK): else: base_url = self._get_url(base_url, url_variables) - request = models.BillingSetupPaymentRequest( + request = models.OpenCustomerPortalParams( customer_id=customer_id, - success_url=success_url, - customer_data=utils.get_pydantic_model( - customer_data, Optional[models.CustomerData] - ), - checkout_session_params=checkout_session_params, + configuration_id=configuration_id, + return_url=return_url, ) req = self._build_request_async( method="POST", - path="/v1/billing.setup_payment", + path="/v1/billing.open_customer_portal", base_url=base_url, url_variables=url_variables, request=request, @@ -1396,12 +1346,12 @@ class Billing(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, - _globals=models.BillingSetupPaymentGlobals( + _globals=models.OpenCustomerPortalGlobals( x_api_version=self.sdk_configuration.globals.x_api_version, ), security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.BillingSetupPaymentRequest + request, False, False, "json", models.OpenCustomerPortalParams ), allow_empty_value=None, timeout_ms=timeout_ms, @@ -1419,7 +1369,7 @@ class Billing(BaseSDK): hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="billingSetupPayment", + operation_id="openCustomerPortal", oauth2_scopes=None, security_source=self.sdk_configuration.security, ), @@ -1429,7 +1379,7 @@ class Billing(BaseSDK): ) if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(models.BillingSetupPaymentResponse, http_res) + return unmarshal_json_response(models.OpenCustomerPortalResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise errors.AutumnDefaultError( diff --git a/others/python-sdk/src/autumn_sdk/entities.py b/others/python-sdk/src/autumn_sdk/entities.py new file mode 100644 index 000000000..b05b02840 --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/entities.py @@ -0,0 +1,606 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from autumn_sdk import errors, models, utils +from autumn_sdk._hooks import HookContext +from autumn_sdk.types import OptionalNullable, UNSET +from autumn_sdk.utils.unmarshal_json_response import unmarshal_json_response +from typing import Mapping, Optional, Union + + +class Entities(BaseSDK): + def create( + self, + *, + feature_id: str, + customer_id: str, + entity_id: str, + name: OptionalNullable[str] = UNSET, + customer_data: Optional[ + Union[models.CustomerData, models.CustomerDataTypedDict] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.CreateEntityResponse: + r"""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. + + :param feature_id: The ID of the feature this entity is associated with + :param customer_id: The ID of the customer to create the entity for. + :param entity_id: The ID of the entity. + :param name: The name of the entity + :param customer_data: Customer details to set when creating a customer + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.CreateEntityParams( + name=name, + feature_id=feature_id, + customer_data=utils.get_pydantic_model( + customer_data, Optional[models.CustomerData] + ), + customer_id=customer_id, + entity_id=entity_id, + ) + + req = self._build_request( + method="POST", + path="/v1/entities.create", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.CreateEntityGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.CreateEntityParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="createEntity", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.CreateEntityResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def create_async( + self, + *, + feature_id: str, + customer_id: str, + entity_id: str, + name: OptionalNullable[str] = UNSET, + customer_data: Optional[ + Union[models.CustomerData, models.CustomerDataTypedDict] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.CreateEntityResponse: + r"""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. + + :param feature_id: The ID of the feature this entity is associated with + :param customer_id: The ID of the customer to create the entity for. + :param entity_id: The ID of the entity. + :param name: The name of the entity + :param customer_data: Customer details to set when creating a customer + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.CreateEntityParams( + name=name, + feature_id=feature_id, + customer_data=utils.get_pydantic_model( + customer_data, Optional[models.CustomerData] + ), + customer_id=customer_id, + entity_id=entity_id, + ) + + req = self._build_request_async( + method="POST", + path="/v1/entities.create", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.CreateEntityGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.CreateEntityParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="createEntity", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.CreateEntityResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + def get( + self, + *, + entity_id: str, + customer_id: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.GetEntityResponse: + r"""Fetches a single entity by entity ID. + + Use this to read one entity's current state. Pass customerId when you want to scope the lookup to a specific customer. + + :param entity_id: The ID of the entity. + :param customer_id: The ID of the customer to create the entity for. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.GetEntityParams( + customer_id=customer_id, + entity_id=entity_id, + ) + + req = self._build_request( + method="POST", + path="/v1/entities.get", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.GetEntityGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.GetEntityParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getEntity", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.GetEntityResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def get_async( + self, + *, + entity_id: str, + customer_id: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.GetEntityResponse: + r"""Fetches a single entity by entity ID. + + Use this to read one entity's current state. Pass customerId when you want to scope the lookup to a specific customer. + + :param entity_id: The ID of the entity. + :param customer_id: The ID of the customer to create the entity for. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.GetEntityParams( + customer_id=customer_id, + entity_id=entity_id, + ) + + req = self._build_request_async( + method="POST", + path="/v1/entities.get", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.GetEntityGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.GetEntityParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="getEntity", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.GetEntityResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + def delete( + self, + *, + entity_id: str, + customer_id: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.DeleteEntityResponse: + r"""Deletes an entity by entity ID. + + Use this when the underlying resource is removed and you no longer want entity-scoped balances or subscriptions tracked for it. + + :param entity_id: The ID of the entity. + :param customer_id: The ID of the customer. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.DeleteEntityParams( + customer_id=customer_id, + entity_id=entity_id, + ) + + req = self._build_request( + method="POST", + path="/v1/entities.delete", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.DeleteEntityGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.DeleteEntityParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deleteEntity", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.DeleteEntityResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def delete_async( + self, + *, + entity_id: str, + customer_id: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.DeleteEntityResponse: + r"""Deletes an entity by entity ID. + + Use this when the underlying resource is removed and you no longer want entity-scoped balances or subscriptions tracked for it. + + :param entity_id: The ID of the entity. + :param customer_id: The ID of the customer. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.DeleteEntityParams( + customer_id=customer_id, + entity_id=entity_id, + ) + + req = self._build_request_async( + method="POST", + path="/v1/entities.delete", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.DeleteEntityGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.DeleteEntityParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deleteEntity", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.DeleteEntityResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) diff --git a/others/python-sdk/src/autumn_sdk/events.py b/others/python-sdk/src/autumn_sdk/events.py new file mode 100644 index 000000000..7cda6a979 --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/events.py @@ -0,0 +1,454 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from autumn_sdk import errors, models, utils +from autumn_sdk._hooks import HookContext +from autumn_sdk.types import OptionalNullable, UNSET +from autumn_sdk.utils.unmarshal_json_response import unmarshal_json_response +from typing import Mapping, Optional, Union + + +class Events(BaseSDK): + def list( + self, + *, + offset: Optional[int] = 0, + limit: Optional[int] = 100, + customer_id: Optional[str] = None, + feature_id: Optional[ + Union[models.ListEventsFeatureID, models.ListEventsFeatureIDTypedDict] + ] = None, + custom_range: Optional[ + Union[models.ListEventsCustomRange, models.ListEventsCustomRangeTypedDict] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.ListEventsResponse: + r"""List usage events for your organization. Filter by customer, feature, or time range. + + :param offset: Number of items to skip + :param limit: Number of items to return. Default 100, max 1000. + :param customer_id: Filter events by customer ID + :param feature_id: Filter by specific feature ID(s) + :param custom_range: Filter events by time range + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.EventsListParams( + offset=offset, + limit=limit, + customer_id=customer_id, + feature_id=feature_id, + custom_range=utils.get_pydantic_model( + custom_range, Optional[models.ListEventsCustomRange] + ), + ) + + req = self._build_request( + method="POST", + path="/v1/events.list", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.ListEventsGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.EventsListParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listEvents", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.ListEventsResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def list_async( + self, + *, + offset: Optional[int] = 0, + limit: Optional[int] = 100, + customer_id: Optional[str] = None, + feature_id: Optional[ + Union[models.ListEventsFeatureID, models.ListEventsFeatureIDTypedDict] + ] = None, + custom_range: Optional[ + Union[models.ListEventsCustomRange, models.ListEventsCustomRangeTypedDict] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.ListEventsResponse: + r"""List usage events for your organization. Filter by customer, feature, or time range. + + :param offset: Number of items to skip + :param limit: Number of items to return. Default 100, max 1000. + :param customer_id: Filter events by customer ID + :param feature_id: Filter by specific feature ID(s) + :param custom_range: Filter events by time range + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.EventsListParams( + offset=offset, + limit=limit, + customer_id=customer_id, + feature_id=feature_id, + custom_range=utils.get_pydantic_model( + custom_range, Optional[models.ListEventsCustomRange] + ), + ) + + req = self._build_request_async( + method="POST", + path="/v1/events.list", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.ListEventsGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.EventsListParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="listEvents", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.ListEventsResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + def aggregate( + self, + *, + customer_id: str, + feature_id: Union[ + models.AggregateEventsFeatureID, models.AggregateEventsFeatureIDTypedDict + ], + group_by: Optional[str] = None, + range: Optional[models.Range] = None, + bin_size: Optional[models.BinSize] = "day", + custom_range: Optional[ + Union[ + models.AggregateEventsCustomRange, + models.AggregateEventsCustomRangeTypedDict, + ] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.AggregateEventsResponse: + r"""Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property. + + :param customer_id: Customer ID to aggregate events for + :param feature_id: Feature ID(s) to aggregate events for + :param group_by: Property to group events by. If provided, each key in the response will be an object with distinct groups as the keys + :param range: Time range to aggregate events for. Either range or custom_range must be provided + :param bin_size: Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day + :param custom_range: Custom time range to aggregate events for. If provided, range must not be provided + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.EventsAggregateParams( + customer_id=customer_id, + feature_id=feature_id, + group_by=group_by, + range=range, + bin_size=bin_size, + custom_range=utils.get_pydantic_model( + custom_range, Optional[models.AggregateEventsCustomRange] + ), + ) + + req = self._build_request( + method="POST", + path="/v1/events.aggregate", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.AggregateEventsGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.EventsAggregateParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="aggregateEvents", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.AggregateEventsResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def aggregate_async( + self, + *, + customer_id: str, + feature_id: Union[ + models.AggregateEventsFeatureID, models.AggregateEventsFeatureIDTypedDict + ], + group_by: Optional[str] = None, + range: Optional[models.Range] = None, + bin_size: Optional[models.BinSize] = "day", + custom_range: Optional[ + Union[ + models.AggregateEventsCustomRange, + models.AggregateEventsCustomRangeTypedDict, + ] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.AggregateEventsResponse: + r"""Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property. + + :param customer_id: Customer ID to aggregate events for + :param feature_id: Feature ID(s) to aggregate events for + :param group_by: Property to group events by. If provided, each key in the response will be an object with distinct groups as the keys + :param range: Time range to aggregate events for. Either range or custom_range must be provided + :param bin_size: Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day + :param custom_range: Custom time range to aggregate events for. If provided, range must not be provided + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.EventsAggregateParams( + customer_id=customer_id, + feature_id=feature_id, + group_by=group_by, + range=range, + bin_size=bin_size, + custom_range=utils.get_pydantic_model( + custom_range, Optional[models.AggregateEventsCustomRange] + ), + ) + + req = self._build_request_async( + method="POST", + path="/v1/events.aggregate", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.AggregateEventsGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.EventsAggregateParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="aggregateEvents", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.AggregateEventsResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) diff --git a/others/python-sdk/src/autumn_sdk/models/__init__.py b/others/python-sdk/src/autumn_sdk/models/__init__.py index ef0446c2a..a42e1620a 100644 --- a/others/python-sdk/src/autumn_sdk/models/__init__.py +++ b/others/python-sdk/src/autumn_sdk/models/__init__.py @@ -6,151 +6,27 @@ import builtins import sys if TYPE_CHECKING: - from .balancescheckop import ( - BalancesCheckBalance, - BalancesCheckBalanceDisplay, - BalancesCheckBalanceDisplayTypedDict, - BalancesCheckBalanceIntervalEnum, - BalancesCheckBalanceRollover, - BalancesCheckBalanceRolloverTypedDict, - BalancesCheckBalanceTo, - BalancesCheckBalanceToTypedDict, - BalancesCheckBalanceType, - BalancesCheckBalanceTypedDict, - BalancesCheckBillingMethod, - BalancesCheckBreakdown, - BalancesCheckBreakdownTypedDict, - BalancesCheckCreditSchema, - BalancesCheckCreditSchemaTypedDict, - BalancesCheckEnv, - BalancesCheckFeature, - BalancesCheckFeatureTypedDict, - BalancesCheckFreeTrial, - BalancesCheckFreeTrialTypedDict, - BalancesCheckGlobals, - BalancesCheckGlobalsTypedDict, - BalancesCheckIntervalUnion, - BalancesCheckIntervalUnionTypedDict, - BalancesCheckItem, - BalancesCheckItemTypedDict, - BalancesCheckOnDecrease, - BalancesCheckOnIncrease, - BalancesCheckPrice, - BalancesCheckPriceTypedDict, - BalancesCheckRequest, - BalancesCheckRequestTypedDict, - BalancesCheckReset, - BalancesCheckResetTypedDict, - BalancesCheckResponse, - BalancesCheckResponseTypedDict, - BalancesCheckScenario, - BalancesCheckTier, - BalancesCheckTierTypedDict, - Config, - ConfigRollover, - ConfigRolloverTypedDict, - ConfigTypedDict, - FeatureType, - FreeTrialDuration, - IncludedUsage, - IncludedUsageTypedDict, - Preview, - PreviewTypedDict, - Product, - ProductDisplay, - ProductDisplayTypedDict, - ProductInterval, - ProductScenario, - ProductType, - ProductTypedDict, - Properties, - PropertiesTypedDict, - RolloverDuration, - Tiers, - TiersTo, - TiersToTypedDict, - TiersTypedDict, - UsageModel, - ) - from .balancescreateop import ( - BalancesCreateGlobals, - BalancesCreateGlobalsTypedDict, - BalancesCreateInterval, - BalancesCreateRequest, - BalancesCreateRequestTypedDict, - BalancesCreateReset, - BalancesCreateResetTypedDict, - BalancesCreateResponse, - BalancesCreateResponseTypedDict, - ) - from .balancestrackop import ( - BalancesTrackBalance, - BalancesTrackBalanceBillingMethod, - BalancesTrackBalanceBreakdown, - BalancesTrackBalanceBreakdownTypedDict, - BalancesTrackBalanceCreditSchema, - BalancesTrackBalanceCreditSchemaTypedDict, - BalancesTrackBalanceDisplay, - BalancesTrackBalanceDisplayTypedDict, - BalancesTrackBalanceFeature, - BalancesTrackBalanceFeatureTypedDict, - BalancesTrackBalanceIntervalEnum, - BalancesTrackBalanceIntervalUnion, - BalancesTrackBalanceIntervalUnionTypedDict, - BalancesTrackBalancePrice, - BalancesTrackBalancePriceTypedDict, - BalancesTrackBalanceReset, - BalancesTrackBalanceResetTypedDict, - BalancesTrackBalanceRollover, - BalancesTrackBalanceRolloverTypedDict, - BalancesTrackBalanceTier, - BalancesTrackBalanceTierTypedDict, - BalancesTrackBalanceTo, - BalancesTrackBalanceToTypedDict, - BalancesTrackBalanceType, - BalancesTrackBalanceTypedDict, - BalancesTrackBalances, - BalancesTrackBalancesTypedDict, - BalancesTrackBillingMethod, - BalancesTrackBreakdown, - BalancesTrackBreakdownTypedDict, - BalancesTrackCreditSchema, - BalancesTrackCreditSchemaTypedDict, - BalancesTrackDisplay, - BalancesTrackDisplayTypedDict, - BalancesTrackFeature, - BalancesTrackFeatureTypedDict, - BalancesTrackGlobals, - BalancesTrackGlobalsTypedDict, - BalancesTrackIntervalEnum, - BalancesTrackIntervalUnion, - BalancesTrackIntervalUnionTypedDict, - BalancesTrackPrice, - BalancesTrackPriceTypedDict, - BalancesTrackRequest, - BalancesTrackRequestTypedDict, - BalancesTrackReset, - BalancesTrackResetTypedDict, - BalancesTrackResponse, - BalancesTrackResponseTypedDict, - BalancesTrackRollover, - BalancesTrackRolloverTypedDict, - BalancesTrackTier, - BalancesTrackTierTypedDict, - BalancesTrackTo, - BalancesTrackToTypedDict, - BalancesTrackType, - ) - from .balancesupdateop import ( - BalancesUpdateGlobals, - BalancesUpdateGlobalsTypedDict, - BalancesUpdateInterval, - BalancesUpdateRequest, - BalancesUpdateRequestTypedDict, - BalancesUpdateResponse, - BalancesUpdateResponseTypedDict, + from .aggregateeventsop import ( + AggregateEventsCustomRange, + AggregateEventsCustomRangeTypedDict, + AggregateEventsFeatureID, + AggregateEventsFeatureIDTypedDict, + AggregateEventsGlobals, + AggregateEventsGlobalsTypedDict, + AggregateEventsList, + AggregateEventsListTypedDict, + AggregateEventsResponse, + AggregateEventsResponseTypedDict, + BinSize, + EventsAggregateParams, + EventsAggregateParamsTypedDict, + Range, + Total, + TotalTypedDict, ) from .billingattachop import ( + AttachParams, + AttachParamsTypedDict, BillingAttachBillingBehavior, BillingAttachBillingMethod, BillingAttachCode, @@ -164,8 +40,8 @@ if TYPE_CHECKING: BillingAttachDiscountUnionTypedDict, BillingAttachDurationType, BillingAttachExpiryDurationType, - BillingAttachFeatureQuantities, - BillingAttachFeatureQuantitiesTypedDict, + BillingAttachFeatureQuantity, + BillingAttachFeatureQuantityTypedDict, BillingAttachFreeTrial, BillingAttachFreeTrialTypedDict, BillingAttachGlobals, @@ -187,9 +63,6 @@ if TYPE_CHECKING: BillingAttachPriceTypedDict, BillingAttachProration, BillingAttachProrationTypedDict, - BillingAttachRedirectMode, - BillingAttachRequest, - BillingAttachRequestTypedDict, BillingAttachRequiredAction, BillingAttachRequiredActionTypedDict, BillingAttachReset, @@ -204,188 +77,6 @@ if TYPE_CHECKING: BillingAttachTo, BillingAttachToTypedDict, ) - from .billingpreviewattachop import ( - BillingPreviewAttachBillingBehavior, - BillingPreviewAttachBillingMethodRequest, - BillingPreviewAttachCustomize, - BillingPreviewAttachCustomizeReset, - BillingPreviewAttachCustomizeResetTypedDict, - BillingPreviewAttachCustomizeTypedDict, - BillingPreviewAttachDiscountRequest1, - BillingPreviewAttachDiscountRequest1TypedDict, - BillingPreviewAttachDiscountRequest2, - BillingPreviewAttachDiscountRequest2TypedDict, - BillingPreviewAttachDiscountResponse, - BillingPreviewAttachDiscountResponseTypedDict, - BillingPreviewAttachDiscountUnion, - BillingPreviewAttachDiscountUnionTypedDict, - BillingPreviewAttachDurationType, - BillingPreviewAttachEffectivePeriod, - BillingPreviewAttachEffectivePeriodTypedDict, - BillingPreviewAttachExpiryDurationType, - BillingPreviewAttachFeatureQuantities, - BillingPreviewAttachFeatureQuantitiesTypedDict, - BillingPreviewAttachFreeTrial, - BillingPreviewAttachFreeTrialTypedDict, - BillingPreviewAttachGlobals, - BillingPreviewAttachGlobalsTypedDict, - BillingPreviewAttachInvoiceMode, - BillingPreviewAttachInvoiceModeTypedDict, - BillingPreviewAttachItem, - BillingPreviewAttachItemPrice, - BillingPreviewAttachItemPriceInterval, - BillingPreviewAttachItemPriceTypedDict, - BillingPreviewAttachItemResetInterval, - BillingPreviewAttachItemTypedDict, - BillingPreviewAttachLineItem, - BillingPreviewAttachLineItemTypedDict, - BillingPreviewAttachNextCycle, - BillingPreviewAttachNextCycleDiscount, - BillingPreviewAttachNextCycleDiscountTypedDict, - BillingPreviewAttachNextCycleEffectivePeriod, - BillingPreviewAttachNextCycleEffectivePeriodTypedDict, - BillingPreviewAttachNextCycleLineItem, - BillingPreviewAttachNextCycleLineItemTypedDict, - BillingPreviewAttachNextCycleTypedDict, - BillingPreviewAttachOnDecrease, - BillingPreviewAttachOnIncrease, - BillingPreviewAttachPlanSchedule, - BillingPreviewAttachPriceInterval, - BillingPreviewAttachPriceRequest, - BillingPreviewAttachPriceRequestTypedDict, - BillingPreviewAttachProration, - BillingPreviewAttachProrationTypedDict, - BillingPreviewAttachRedirectMode, - BillingPreviewAttachRequest, - BillingPreviewAttachRequestTypedDict, - BillingPreviewAttachResponse, - BillingPreviewAttachResponseTypedDict, - BillingPreviewAttachRolloverRequest, - BillingPreviewAttachRolloverRequestTypedDict, - BillingPreviewAttachTierRequest, - BillingPreviewAttachTierRequestTypedDict, - BillingPreviewAttachTo, - BillingPreviewAttachToTypedDict, - Incoming, - IncomingBalances, - IncomingBalancesTypedDict, - IncomingBillingMethod, - IncomingBreakdown, - IncomingBreakdownTypedDict, - IncomingCreditSchema, - IncomingCreditSchemaTypedDict, - IncomingDisplay, - IncomingDisplayTypedDict, - IncomingFeature, - IncomingFeatureQuantity, - IncomingFeatureQuantityTypedDict, - IncomingFeatureTypedDict, - IncomingIntervalUnion, - IncomingIntervalUnionTypedDict, - IncomingPrice, - IncomingPriceTypedDict, - IncomingReset, - IncomingResetTypedDict, - IncomingRollover, - IncomingRolloverTypedDict, - IncomingTier, - IncomingTierTypedDict, - IncomingType, - IncomingTypedDict, - IntervalIncomingEnum, - IntervalOutgoingEnum, - Outgoing, - OutgoingBalances, - OutgoingBalancesTypedDict, - OutgoingBillingMethod, - OutgoingBreakdown, - OutgoingBreakdownTypedDict, - OutgoingCreditSchema, - OutgoingCreditSchemaTypedDict, - OutgoingDisplay, - OutgoingDisplayTypedDict, - OutgoingFeature, - OutgoingFeatureQuantity, - OutgoingFeatureQuantityTypedDict, - OutgoingFeatureTypedDict, - OutgoingIntervalUnion, - OutgoingIntervalUnionTypedDict, - OutgoingPrice, - OutgoingPriceTypedDict, - OutgoingReset, - OutgoingResetTypedDict, - OutgoingRollover, - OutgoingRolloverTypedDict, - OutgoingTier, - OutgoingTierTypedDict, - OutgoingType, - OutgoingTypedDict, - RedirectType, - ) - from .billingpreviewupdateop import ( - BillingPreviewUpdateBillingBehavior, - BillingPreviewUpdateBillingMethod, - BillingPreviewUpdateCancelAction, - BillingPreviewUpdateCustomize, - BillingPreviewUpdateCustomizeTypedDict, - BillingPreviewUpdateDiscount, - BillingPreviewUpdateDiscountTypedDict, - BillingPreviewUpdateDurationType, - BillingPreviewUpdateEffectivePeriod, - BillingPreviewUpdateEffectivePeriodTypedDict, - BillingPreviewUpdateExpiryDurationType, - BillingPreviewUpdateFeatureQuantities, - BillingPreviewUpdateFeatureQuantitiesTypedDict, - BillingPreviewUpdateFreeTrial, - BillingPreviewUpdateFreeTrialTypedDict, - BillingPreviewUpdateGlobals, - BillingPreviewUpdateGlobalsTypedDict, - BillingPreviewUpdateInvoiceMode, - BillingPreviewUpdateInvoiceModeTypedDict, - BillingPreviewUpdateItem, - BillingPreviewUpdateItemPrice, - BillingPreviewUpdateItemPriceInterval, - BillingPreviewUpdateItemPriceTypedDict, - BillingPreviewUpdateItemTypedDict, - BillingPreviewUpdateLineItem, - BillingPreviewUpdateLineItemTypedDict, - BillingPreviewUpdateNextCycle, - BillingPreviewUpdateNextCycleDiscount, - BillingPreviewUpdateNextCycleDiscountTypedDict, - BillingPreviewUpdateNextCycleEffectivePeriod, - BillingPreviewUpdateNextCycleEffectivePeriodTypedDict, - BillingPreviewUpdateNextCycleLineItem, - BillingPreviewUpdateNextCycleLineItemTypedDict, - BillingPreviewUpdateNextCycleTypedDict, - BillingPreviewUpdateOnDecrease, - BillingPreviewUpdateOnIncrease, - BillingPreviewUpdatePrice, - BillingPreviewUpdatePriceInterval, - BillingPreviewUpdatePriceTypedDict, - BillingPreviewUpdateProration, - BillingPreviewUpdateProrationTypedDict, - BillingPreviewUpdateRequest, - BillingPreviewUpdateRequestTypedDict, - BillingPreviewUpdateReset, - BillingPreviewUpdateResetInterval, - BillingPreviewUpdateResetTypedDict, - BillingPreviewUpdateResponse, - BillingPreviewUpdateResponseTypedDict, - BillingPreviewUpdateRollover, - BillingPreviewUpdateRolloverTypedDict, - BillingPreviewUpdateTier, - BillingPreviewUpdateTierTypedDict, - BillingPreviewUpdateTo, - BillingPreviewUpdateToTypedDict, - ) - from .billingsetuppaymentop import ( - BillingSetupPaymentGlobals, - BillingSetupPaymentGlobalsTypedDict, - BillingSetupPaymentRequest, - BillingSetupPaymentRequestTypedDict, - BillingSetupPaymentResponse, - BillingSetupPaymentResponseTypedDict, - ) from .billingupdateop import ( BillingUpdateBillingBehavior, BillingUpdateBillingMethod, @@ -395,8 +86,8 @@ if TYPE_CHECKING: BillingUpdateCustomizeTypedDict, BillingUpdateDurationType, BillingUpdateExpiryDurationType, - BillingUpdateFeatureQuantities, - BillingUpdateFeatureQuantitiesTypedDict, + BillingUpdateFeatureQuantity, + BillingUpdateFeatureQuantityTypedDict, BillingUpdateFreeTrial, BillingUpdateFreeTrialTypedDict, BillingUpdateGlobals, @@ -417,8 +108,6 @@ if TYPE_CHECKING: BillingUpdatePriceTypedDict, BillingUpdateProration, BillingUpdateProrationTypedDict, - BillingUpdateRequest, - BillingUpdateRequestTypedDict, BillingUpdateRequiredAction, BillingUpdateRequiredActionTypedDict, BillingUpdateReset, @@ -432,6 +121,134 @@ if TYPE_CHECKING: BillingUpdateTierTypedDict, BillingUpdateTo, BillingUpdateToTypedDict, + UpdateSubscriptionParams, + UpdateSubscriptionParamsTypedDict, + ) + from .checkop import ( + CheckBalance, + CheckBalanceDisplay, + CheckBalanceDisplayTypedDict, + CheckBalanceIntervalEnum, + CheckBalanceRollover, + CheckBalanceRolloverTypedDict, + CheckBalanceTo, + CheckBalanceToTypedDict, + CheckBalanceType, + CheckBalanceTypedDict, + CheckBillingMethod, + CheckBreakdown, + CheckBreakdownTypedDict, + CheckCreditSchema, + CheckCreditSchemaTypedDict, + CheckEnv, + CheckFeature, + CheckFeatureTypedDict, + CheckFreeTrial, + CheckFreeTrialTypedDict, + CheckGlobals, + CheckGlobalsTypedDict, + CheckIntervalUnion, + CheckIntervalUnionTypedDict, + CheckItem, + CheckItemTypedDict, + CheckOnDecrease, + CheckOnIncrease, + CheckParams, + CheckParamsTypedDict, + CheckPrice, + CheckPriceTypedDict, + CheckProperties, + CheckPropertiesTypedDict, + CheckReset, + CheckResetTypedDict, + CheckResponse, + CheckResponseTypedDict, + CheckScenario, + CheckTier, + CheckTierTypedDict, + Config, + ConfigRollover, + ConfigRolloverTypedDict, + ConfigTypedDict, + FeatureType, + FreeTrialDuration, + IncludedUsage, + IncludedUsageTypedDict, + Preview, + PreviewTypedDict, + Product, + ProductDisplay, + ProductDisplayTypedDict, + ProductInterval, + ProductScenario, + ProductType, + ProductTypedDict, + RolloverDuration, + Tiers, + TiersTo, + TiersToTypedDict, + TiersTypedDict, + UsageModel, + ) + from .createbalanceop import ( + CreateBalanceGlobals, + CreateBalanceGlobalsTypedDict, + CreateBalanceInterval, + CreateBalanceParams, + CreateBalanceParamsTypedDict, + CreateBalanceReset, + CreateBalanceResetTypedDict, + CreateBalanceResponse, + CreateBalanceResponseTypedDict, + ) + from .createentityop import ( + CreateEntityBalances, + CreateEntityBalancesTypedDict, + CreateEntityBillingMethod, + CreateEntityBreakdown, + CreateEntityBreakdownTypedDict, + CreateEntityCreditSchema, + CreateEntityCreditSchemaTypedDict, + CreateEntityDisplay, + CreateEntityDisplayTypedDict, + CreateEntityEnv, + CreateEntityFeature, + CreateEntityFeatureTypedDict, + CreateEntityGlobals, + CreateEntityGlobalsTypedDict, + CreateEntityIntervalEnum, + CreateEntityIntervalUnion, + CreateEntityIntervalUnionTypedDict, + CreateEntityInvoice, + CreateEntityInvoiceTypedDict, + CreateEntityParams, + CreateEntityParamsTypedDict, + CreateEntityPrice, + CreateEntityPriceTypedDict, + CreateEntityPurchase, + CreateEntityPurchaseTypedDict, + CreateEntityReset, + CreateEntityResetTypedDict, + CreateEntityResponse, + CreateEntityResponseTypedDict, + CreateEntityRollover, + CreateEntityRolloverTypedDict, + CreateEntityStatus, + CreateEntitySubscription, + CreateEntitySubscriptionTypedDict, + CreateEntityTier, + CreateEntityTierTypedDict, + CreateEntityTo, + CreateEntityToTypedDict, + CreateEntityType, + ) + from .createreferralcodeop import ( + CreateReferralCodeGlobals, + CreateReferralCodeGlobalsTypedDict, + CreateReferralCodeParams, + CreateReferralCodeParamsTypedDict, + CreateReferralCodeResponse, + CreateReferralCodeResponseTypedDict, ) from .customer import ( Balances, @@ -495,6 +312,55 @@ if TYPE_CHECKING: DeleteCustomerResponse, DeleteCustomerResponseTypedDict, ) + from .deleteentityop import ( + DeleteEntityGlobals, + DeleteEntityGlobalsTypedDict, + DeleteEntityParams, + DeleteEntityParamsTypedDict, + DeleteEntityResponse, + DeleteEntityResponseTypedDict, + ) + from .getentityop import ( + GetEntityBalances, + GetEntityBalancesTypedDict, + GetEntityBillingMethod, + GetEntityBreakdown, + GetEntityBreakdownTypedDict, + GetEntityCreditSchema, + GetEntityCreditSchemaTypedDict, + GetEntityDisplay, + GetEntityDisplayTypedDict, + GetEntityEnv, + GetEntityFeature, + GetEntityFeatureTypedDict, + GetEntityGlobals, + GetEntityGlobalsTypedDict, + GetEntityIntervalEnum, + GetEntityIntervalUnion, + GetEntityIntervalUnionTypedDict, + GetEntityInvoice, + GetEntityInvoiceTypedDict, + GetEntityParams, + GetEntityParamsTypedDict, + GetEntityPrice, + GetEntityPriceTypedDict, + GetEntityPurchase, + GetEntityPurchaseTypedDict, + GetEntityReset, + GetEntityResetTypedDict, + GetEntityResponse, + GetEntityResponseTypedDict, + GetEntityRollover, + GetEntityRolloverTypedDict, + GetEntityStatus, + GetEntitySubscription, + GetEntitySubscriptionTypedDict, + GetEntityTier, + GetEntityTierTypedDict, + GetEntityTo, + GetEntityToTypedDict, + GetEntityType, + ) from .getorcreatecustomerop import ( GetOrCreateCustomerGlobals, GetOrCreateCustomerGlobalsTypedDict, @@ -519,6 +385,8 @@ if TYPE_CHECKING: ListCustomersIntervalEnum, ListCustomersIntervalUnion, ListCustomersIntervalUnionTypedDict, + ListCustomersList, + ListCustomersListTypedDict, ListCustomersParams, ListCustomersParamsTypedDict, ListCustomersPlan, @@ -539,10 +407,24 @@ if TYPE_CHECKING: ListCustomersTier, ListCustomersTierTypedDict, ListCustomersType, - ListT, - ListTTypedDict, SubscriptionStatus, ) + from .listeventsop import ( + EventsListParams, + EventsListParamsTypedDict, + ListEventsCustomRange, + ListEventsCustomRangeTypedDict, + ListEventsFeatureID, + ListEventsFeatureIDTypedDict, + ListEventsGlobals, + ListEventsGlobalsTypedDict, + ListEventsList, + ListEventsListTypedDict, + ListEventsProperties, + ListEventsPropertiesTypedDict, + ListEventsResponse, + ListEventsResponseTypedDict, + ) from .listplansop import ( ListPlansGlobals, ListPlansGlobalsTypedDict, @@ -551,6 +433,14 @@ if TYPE_CHECKING: ListPlansResponse, ListPlansResponseTypedDict, ) + from .opencustomerportalop import ( + OpenCustomerPortalGlobals, + OpenCustomerPortalGlobalsTypedDict, + OpenCustomerPortalParams, + OpenCustomerPortalParamsTypedDict, + OpenCustomerPortalResponse, + OpenCustomerPortalResponseTypedDict, + ) from .plan import ( CustomerEligibility, CustomerEligibilityTypedDict, @@ -596,7 +486,184 @@ if TYPE_CHECKING: ProrationTypedDict, Scenario, ) + from .previewattachop import ( + PreviewAttachBillingBehavior, + PreviewAttachBillingMethod, + PreviewAttachCustomize, + PreviewAttachCustomizeTypedDict, + PreviewAttachDiscountRequest1, + PreviewAttachDiscountRequest1TypedDict, + PreviewAttachDiscountRequest2, + PreviewAttachDiscountRequest2TypedDict, + PreviewAttachDiscountResponse, + PreviewAttachDiscountResponseTypedDict, + PreviewAttachDiscountUnion, + PreviewAttachDiscountUnionTypedDict, + PreviewAttachDurationType, + PreviewAttachExpiryDurationType, + PreviewAttachFeatureQuantity, + PreviewAttachFeatureQuantityTypedDict, + PreviewAttachFreeTrial, + PreviewAttachFreeTrialTypedDict, + PreviewAttachGlobals, + PreviewAttachGlobalsTypedDict, + PreviewAttachInvoiceMode, + PreviewAttachInvoiceModeTypedDict, + PreviewAttachItem, + PreviewAttachItemPrice, + PreviewAttachItemPriceInterval, + PreviewAttachItemPriceTypedDict, + PreviewAttachItemTypedDict, + PreviewAttachLineItem, + PreviewAttachLineItemTypedDict, + PreviewAttachNextCycle, + PreviewAttachNextCycleTypedDict, + PreviewAttachOnDecrease, + PreviewAttachOnIncrease, + PreviewAttachParams, + PreviewAttachParamsTypedDict, + PreviewAttachPlanSchedule, + PreviewAttachPrice, + PreviewAttachPriceInterval, + PreviewAttachPriceTypedDict, + PreviewAttachProration, + PreviewAttachProrationTypedDict, + PreviewAttachReset, + PreviewAttachResetInterval, + PreviewAttachResetTypedDict, + PreviewAttachResponse, + PreviewAttachResponseTypedDict, + PreviewAttachRollover, + PreviewAttachRolloverTypedDict, + PreviewAttachTier, + PreviewAttachTierTypedDict, + PreviewAttachTo, + PreviewAttachToTypedDict, + ) + from .previewupdateop import ( + PreviewUpdateBillingBehavior, + PreviewUpdateBillingMethod, + PreviewUpdateCancelAction, + PreviewUpdateCustomize, + PreviewUpdateCustomizeTypedDict, + PreviewUpdateDiscount, + PreviewUpdateDiscountTypedDict, + PreviewUpdateDurationType, + PreviewUpdateExpiryDurationType, + PreviewUpdateFeatureQuantity, + PreviewUpdateFeatureQuantityTypedDict, + PreviewUpdateFreeTrial, + PreviewUpdateFreeTrialTypedDict, + PreviewUpdateGlobals, + PreviewUpdateGlobalsTypedDict, + PreviewUpdateInvoiceMode, + PreviewUpdateInvoiceModeTypedDict, + PreviewUpdateItem, + PreviewUpdateItemPrice, + PreviewUpdateItemPriceInterval, + PreviewUpdateItemPriceTypedDict, + PreviewUpdateItemTypedDict, + PreviewUpdateLineItem, + PreviewUpdateLineItemTypedDict, + PreviewUpdateNextCycle, + PreviewUpdateNextCycleTypedDict, + PreviewUpdateOnDecrease, + PreviewUpdateOnIncrease, + PreviewUpdateParams, + PreviewUpdateParamsTypedDict, + PreviewUpdatePrice, + PreviewUpdatePriceInterval, + PreviewUpdatePriceTypedDict, + PreviewUpdateProration, + PreviewUpdateProrationTypedDict, + PreviewUpdateReset, + PreviewUpdateResetInterval, + PreviewUpdateResetTypedDict, + PreviewUpdateResponse, + PreviewUpdateResponseTypedDict, + PreviewUpdateRollover, + PreviewUpdateRolloverTypedDict, + PreviewUpdateTier, + PreviewUpdateTierTypedDict, + PreviewUpdateTo, + PreviewUpdateToTypedDict, + ) + from .redeemreferralcodeop import ( + RedeemReferralCodeGlobals, + RedeemReferralCodeGlobalsTypedDict, + RedeemReferralCodeParams, + RedeemReferralCodeParamsTypedDict, + RedeemReferralCodeResponse, + RedeemReferralCodeResponseTypedDict, + ) from .security import Security, SecurityTypedDict + from .trackop import ( + TrackBalance, + TrackBalanceBillingMethod, + TrackBalanceBreakdown, + TrackBalanceBreakdownTypedDict, + TrackBalanceCreditSchema, + TrackBalanceCreditSchemaTypedDict, + TrackBalanceDisplay, + TrackBalanceDisplayTypedDict, + TrackBalanceFeature, + TrackBalanceFeatureTypedDict, + TrackBalanceIntervalEnum, + TrackBalanceIntervalUnion, + TrackBalanceIntervalUnionTypedDict, + TrackBalancePrice, + TrackBalancePriceTypedDict, + TrackBalanceReset, + TrackBalanceResetTypedDict, + TrackBalanceRollover, + TrackBalanceRolloverTypedDict, + TrackBalanceTier, + TrackBalanceTierTypedDict, + TrackBalanceTo, + TrackBalanceToTypedDict, + TrackBalanceType, + TrackBalanceTypedDict, + TrackBalances, + TrackBalancesBillingMethod, + TrackBalancesBreakdown, + TrackBalancesBreakdownTypedDict, + TrackBalancesCreditSchema, + TrackBalancesCreditSchemaTypedDict, + TrackBalancesDisplay, + TrackBalancesDisplayTypedDict, + TrackBalancesFeature, + TrackBalancesFeatureTypedDict, + TrackBalancesIntervalUnion, + TrackBalancesIntervalUnionTypedDict, + TrackBalancesPrice, + TrackBalancesPriceTypedDict, + TrackBalancesReset, + TrackBalancesResetTypedDict, + TrackBalancesRollover, + TrackBalancesRolloverTypedDict, + TrackBalancesTier, + TrackBalancesTierTypedDict, + TrackBalancesTo, + TrackBalancesToTypedDict, + TrackBalancesType, + TrackBalancesTypedDict, + TrackGlobals, + TrackGlobalsTypedDict, + TrackIntervalBalancesEnum, + TrackParams, + TrackParamsTypedDict, + TrackResponse, + TrackResponseTypedDict, + ) + from .updatebalanceop import ( + UpdateBalanceGlobals, + UpdateBalanceGlobalsTypedDict, + UpdateBalanceInterval, + UpdateBalanceParams, + UpdateBalanceParamsTypedDict, + UpdateBalanceResponse, + UpdateBalanceResponseTypedDict, + ) from .updatecustomerop import ( UpdateCustomerBalances, UpdateCustomerBalancesTypedDict, @@ -638,119 +705,20 @@ if TYPE_CHECKING: ) __all__ = [ + "AggregateEventsCustomRange", + "AggregateEventsCustomRangeTypedDict", + "AggregateEventsFeatureID", + "AggregateEventsFeatureIDTypedDict", + "AggregateEventsGlobals", + "AggregateEventsGlobalsTypedDict", + "AggregateEventsList", + "AggregateEventsListTypedDict", + "AggregateEventsResponse", + "AggregateEventsResponseTypedDict", + "AttachParams", + "AttachParamsTypedDict", "Balances", - "BalancesCheckBalance", - "BalancesCheckBalanceDisplay", - "BalancesCheckBalanceDisplayTypedDict", - "BalancesCheckBalanceIntervalEnum", - "BalancesCheckBalanceRollover", - "BalancesCheckBalanceRolloverTypedDict", - "BalancesCheckBalanceTo", - "BalancesCheckBalanceToTypedDict", - "BalancesCheckBalanceType", - "BalancesCheckBalanceTypedDict", - "BalancesCheckBillingMethod", - "BalancesCheckBreakdown", - "BalancesCheckBreakdownTypedDict", - "BalancesCheckCreditSchema", - "BalancesCheckCreditSchemaTypedDict", - "BalancesCheckEnv", - "BalancesCheckFeature", - "BalancesCheckFeatureTypedDict", - "BalancesCheckFreeTrial", - "BalancesCheckFreeTrialTypedDict", - "BalancesCheckGlobals", - "BalancesCheckGlobalsTypedDict", - "BalancesCheckIntervalUnion", - "BalancesCheckIntervalUnionTypedDict", - "BalancesCheckItem", - "BalancesCheckItemTypedDict", - "BalancesCheckOnDecrease", - "BalancesCheckOnIncrease", - "BalancesCheckPrice", - "BalancesCheckPriceTypedDict", - "BalancesCheckRequest", - "BalancesCheckRequestTypedDict", - "BalancesCheckReset", - "BalancesCheckResetTypedDict", - "BalancesCheckResponse", - "BalancesCheckResponseTypedDict", - "BalancesCheckScenario", - "BalancesCheckTier", - "BalancesCheckTierTypedDict", - "BalancesCreateGlobals", - "BalancesCreateGlobalsTypedDict", - "BalancesCreateInterval", - "BalancesCreateRequest", - "BalancesCreateRequestTypedDict", - "BalancesCreateReset", - "BalancesCreateResetTypedDict", - "BalancesCreateResponse", - "BalancesCreateResponseTypedDict", - "BalancesTrackBalance", - "BalancesTrackBalanceBillingMethod", - "BalancesTrackBalanceBreakdown", - "BalancesTrackBalanceBreakdownTypedDict", - "BalancesTrackBalanceCreditSchema", - "BalancesTrackBalanceCreditSchemaTypedDict", - "BalancesTrackBalanceDisplay", - "BalancesTrackBalanceDisplayTypedDict", - "BalancesTrackBalanceFeature", - "BalancesTrackBalanceFeatureTypedDict", - "BalancesTrackBalanceIntervalEnum", - "BalancesTrackBalanceIntervalUnion", - "BalancesTrackBalanceIntervalUnionTypedDict", - "BalancesTrackBalancePrice", - "BalancesTrackBalancePriceTypedDict", - "BalancesTrackBalanceReset", - "BalancesTrackBalanceResetTypedDict", - "BalancesTrackBalanceRollover", - "BalancesTrackBalanceRolloverTypedDict", - "BalancesTrackBalanceTier", - "BalancesTrackBalanceTierTypedDict", - "BalancesTrackBalanceTo", - "BalancesTrackBalanceToTypedDict", - "BalancesTrackBalanceType", - "BalancesTrackBalanceTypedDict", - "BalancesTrackBalances", - "BalancesTrackBalancesTypedDict", - "BalancesTrackBillingMethod", - "BalancesTrackBreakdown", - "BalancesTrackBreakdownTypedDict", - "BalancesTrackCreditSchema", - "BalancesTrackCreditSchemaTypedDict", - "BalancesTrackDisplay", - "BalancesTrackDisplayTypedDict", - "BalancesTrackFeature", - "BalancesTrackFeatureTypedDict", - "BalancesTrackGlobals", - "BalancesTrackGlobalsTypedDict", - "BalancesTrackIntervalEnum", - "BalancesTrackIntervalUnion", - "BalancesTrackIntervalUnionTypedDict", - "BalancesTrackPrice", - "BalancesTrackPriceTypedDict", - "BalancesTrackRequest", - "BalancesTrackRequestTypedDict", - "BalancesTrackReset", - "BalancesTrackResetTypedDict", - "BalancesTrackResponse", - "BalancesTrackResponseTypedDict", - "BalancesTrackRollover", - "BalancesTrackRolloverTypedDict", - "BalancesTrackTier", - "BalancesTrackTierTypedDict", - "BalancesTrackTo", - "BalancesTrackToTypedDict", - "BalancesTrackType", "BalancesTypedDict", - "BalancesUpdateGlobals", - "BalancesUpdateGlobalsTypedDict", - "BalancesUpdateInterval", - "BalancesUpdateRequest", - "BalancesUpdateRequestTypedDict", - "BalancesUpdateResponse", - "BalancesUpdateResponseTypedDict", "BillingAttachBillingBehavior", "BillingAttachBillingMethod", "BillingAttachCode", @@ -764,8 +732,8 @@ __all__ = [ "BillingAttachDiscountUnionTypedDict", "BillingAttachDurationType", "BillingAttachExpiryDurationType", - "BillingAttachFeatureQuantities", - "BillingAttachFeatureQuantitiesTypedDict", + "BillingAttachFeatureQuantity", + "BillingAttachFeatureQuantityTypedDict", "BillingAttachFreeTrial", "BillingAttachFreeTrialTypedDict", "BillingAttachGlobals", @@ -787,9 +755,6 @@ __all__ = [ "BillingAttachPriceTypedDict", "BillingAttachProration", "BillingAttachProrationTypedDict", - "BillingAttachRedirectMode", - "BillingAttachRequest", - "BillingAttachRequestTypedDict", "BillingAttachRequiredAction", "BillingAttachRequiredActionTypedDict", "BillingAttachReset", @@ -803,127 +768,6 @@ __all__ = [ "BillingAttachTierTypedDict", "BillingAttachTo", "BillingAttachToTypedDict", - "BillingPreviewAttachBillingBehavior", - "BillingPreviewAttachBillingMethodRequest", - "BillingPreviewAttachCustomize", - "BillingPreviewAttachCustomizeReset", - "BillingPreviewAttachCustomizeResetTypedDict", - "BillingPreviewAttachCustomizeTypedDict", - "BillingPreviewAttachDiscountRequest1", - "BillingPreviewAttachDiscountRequest1TypedDict", - "BillingPreviewAttachDiscountRequest2", - "BillingPreviewAttachDiscountRequest2TypedDict", - "BillingPreviewAttachDiscountResponse", - "BillingPreviewAttachDiscountResponseTypedDict", - "BillingPreviewAttachDiscountUnion", - "BillingPreviewAttachDiscountUnionTypedDict", - "BillingPreviewAttachDurationType", - "BillingPreviewAttachEffectivePeriod", - "BillingPreviewAttachEffectivePeriodTypedDict", - "BillingPreviewAttachExpiryDurationType", - "BillingPreviewAttachFeatureQuantities", - "BillingPreviewAttachFeatureQuantitiesTypedDict", - "BillingPreviewAttachFreeTrial", - "BillingPreviewAttachFreeTrialTypedDict", - "BillingPreviewAttachGlobals", - "BillingPreviewAttachGlobalsTypedDict", - "BillingPreviewAttachInvoiceMode", - "BillingPreviewAttachInvoiceModeTypedDict", - "BillingPreviewAttachItem", - "BillingPreviewAttachItemPrice", - "BillingPreviewAttachItemPriceInterval", - "BillingPreviewAttachItemPriceTypedDict", - "BillingPreviewAttachItemResetInterval", - "BillingPreviewAttachItemTypedDict", - "BillingPreviewAttachLineItem", - "BillingPreviewAttachLineItemTypedDict", - "BillingPreviewAttachNextCycle", - "BillingPreviewAttachNextCycleDiscount", - "BillingPreviewAttachNextCycleDiscountTypedDict", - "BillingPreviewAttachNextCycleEffectivePeriod", - "BillingPreviewAttachNextCycleEffectivePeriodTypedDict", - "BillingPreviewAttachNextCycleLineItem", - "BillingPreviewAttachNextCycleLineItemTypedDict", - "BillingPreviewAttachNextCycleTypedDict", - "BillingPreviewAttachOnDecrease", - "BillingPreviewAttachOnIncrease", - "BillingPreviewAttachPlanSchedule", - "BillingPreviewAttachPriceInterval", - "BillingPreviewAttachPriceRequest", - "BillingPreviewAttachPriceRequestTypedDict", - "BillingPreviewAttachProration", - "BillingPreviewAttachProrationTypedDict", - "BillingPreviewAttachRedirectMode", - "BillingPreviewAttachRequest", - "BillingPreviewAttachRequestTypedDict", - "BillingPreviewAttachResponse", - "BillingPreviewAttachResponseTypedDict", - "BillingPreviewAttachRolloverRequest", - "BillingPreviewAttachRolloverRequestTypedDict", - "BillingPreviewAttachTierRequest", - "BillingPreviewAttachTierRequestTypedDict", - "BillingPreviewAttachTo", - "BillingPreviewAttachToTypedDict", - "BillingPreviewUpdateBillingBehavior", - "BillingPreviewUpdateBillingMethod", - "BillingPreviewUpdateCancelAction", - "BillingPreviewUpdateCustomize", - "BillingPreviewUpdateCustomizeTypedDict", - "BillingPreviewUpdateDiscount", - "BillingPreviewUpdateDiscountTypedDict", - "BillingPreviewUpdateDurationType", - "BillingPreviewUpdateEffectivePeriod", - "BillingPreviewUpdateEffectivePeriodTypedDict", - "BillingPreviewUpdateExpiryDurationType", - "BillingPreviewUpdateFeatureQuantities", - "BillingPreviewUpdateFeatureQuantitiesTypedDict", - "BillingPreviewUpdateFreeTrial", - "BillingPreviewUpdateFreeTrialTypedDict", - "BillingPreviewUpdateGlobals", - "BillingPreviewUpdateGlobalsTypedDict", - "BillingPreviewUpdateInvoiceMode", - "BillingPreviewUpdateInvoiceModeTypedDict", - "BillingPreviewUpdateItem", - "BillingPreviewUpdateItemPrice", - "BillingPreviewUpdateItemPriceInterval", - "BillingPreviewUpdateItemPriceTypedDict", - "BillingPreviewUpdateItemTypedDict", - "BillingPreviewUpdateLineItem", - "BillingPreviewUpdateLineItemTypedDict", - "BillingPreviewUpdateNextCycle", - "BillingPreviewUpdateNextCycleDiscount", - "BillingPreviewUpdateNextCycleDiscountTypedDict", - "BillingPreviewUpdateNextCycleEffectivePeriod", - "BillingPreviewUpdateNextCycleEffectivePeriodTypedDict", - "BillingPreviewUpdateNextCycleLineItem", - "BillingPreviewUpdateNextCycleLineItemTypedDict", - "BillingPreviewUpdateNextCycleTypedDict", - "BillingPreviewUpdateOnDecrease", - "BillingPreviewUpdateOnIncrease", - "BillingPreviewUpdatePrice", - "BillingPreviewUpdatePriceInterval", - "BillingPreviewUpdatePriceTypedDict", - "BillingPreviewUpdateProration", - "BillingPreviewUpdateProrationTypedDict", - "BillingPreviewUpdateRequest", - "BillingPreviewUpdateRequestTypedDict", - "BillingPreviewUpdateReset", - "BillingPreviewUpdateResetInterval", - "BillingPreviewUpdateResetTypedDict", - "BillingPreviewUpdateResponse", - "BillingPreviewUpdateResponseTypedDict", - "BillingPreviewUpdateRollover", - "BillingPreviewUpdateRolloverTypedDict", - "BillingPreviewUpdateTier", - "BillingPreviewUpdateTierTypedDict", - "BillingPreviewUpdateTo", - "BillingPreviewUpdateToTypedDict", - "BillingSetupPaymentGlobals", - "BillingSetupPaymentGlobalsTypedDict", - "BillingSetupPaymentRequest", - "BillingSetupPaymentRequestTypedDict", - "BillingSetupPaymentResponse", - "BillingSetupPaymentResponseTypedDict", "BillingUpdateBillingBehavior", "BillingUpdateBillingMethod", "BillingUpdateCancelAction", @@ -932,8 +776,8 @@ __all__ = [ "BillingUpdateCustomizeTypedDict", "BillingUpdateDurationType", "BillingUpdateExpiryDurationType", - "BillingUpdateFeatureQuantities", - "BillingUpdateFeatureQuantitiesTypedDict", + "BillingUpdateFeatureQuantity", + "BillingUpdateFeatureQuantityTypedDict", "BillingUpdateFreeTrial", "BillingUpdateFreeTrialTypedDict", "BillingUpdateGlobals", @@ -954,8 +798,6 @@ __all__ = [ "BillingUpdatePriceTypedDict", "BillingUpdateProration", "BillingUpdateProrationTypedDict", - "BillingUpdateRequest", - "BillingUpdateRequestTypedDict", "BillingUpdateRequiredAction", "BillingUpdateRequiredActionTypedDict", "BillingUpdateReset", @@ -969,12 +811,108 @@ __all__ = [ "BillingUpdateTierTypedDict", "BillingUpdateTo", "BillingUpdateToTypedDict", + "BinSize", "Breakdown", "BreakdownTypedDict", + "CheckBalance", + "CheckBalanceDisplay", + "CheckBalanceDisplayTypedDict", + "CheckBalanceIntervalEnum", + "CheckBalanceRollover", + "CheckBalanceRolloverTypedDict", + "CheckBalanceTo", + "CheckBalanceToTypedDict", + "CheckBalanceType", + "CheckBalanceTypedDict", + "CheckBillingMethod", + "CheckBreakdown", + "CheckBreakdownTypedDict", + "CheckCreditSchema", + "CheckCreditSchemaTypedDict", + "CheckEnv", + "CheckFeature", + "CheckFeatureTypedDict", + "CheckFreeTrial", + "CheckFreeTrialTypedDict", + "CheckGlobals", + "CheckGlobalsTypedDict", + "CheckIntervalUnion", + "CheckIntervalUnionTypedDict", + "CheckItem", + "CheckItemTypedDict", + "CheckOnDecrease", + "CheckOnIncrease", + "CheckParams", + "CheckParamsTypedDict", + "CheckPrice", + "CheckPriceTypedDict", + "CheckProperties", + "CheckPropertiesTypedDict", + "CheckReset", + "CheckResetTypedDict", + "CheckResponse", + "CheckResponseTypedDict", + "CheckScenario", + "CheckTier", + "CheckTierTypedDict", "Config", "ConfigRollover", "ConfigRolloverTypedDict", "ConfigTypedDict", + "CreateBalanceGlobals", + "CreateBalanceGlobalsTypedDict", + "CreateBalanceInterval", + "CreateBalanceParams", + "CreateBalanceParamsTypedDict", + "CreateBalanceReset", + "CreateBalanceResetTypedDict", + "CreateBalanceResponse", + "CreateBalanceResponseTypedDict", + "CreateEntityBalances", + "CreateEntityBalancesTypedDict", + "CreateEntityBillingMethod", + "CreateEntityBreakdown", + "CreateEntityBreakdownTypedDict", + "CreateEntityCreditSchema", + "CreateEntityCreditSchemaTypedDict", + "CreateEntityDisplay", + "CreateEntityDisplayTypedDict", + "CreateEntityEnv", + "CreateEntityFeature", + "CreateEntityFeatureTypedDict", + "CreateEntityGlobals", + "CreateEntityGlobalsTypedDict", + "CreateEntityIntervalEnum", + "CreateEntityIntervalUnion", + "CreateEntityIntervalUnionTypedDict", + "CreateEntityInvoice", + "CreateEntityInvoiceTypedDict", + "CreateEntityParams", + "CreateEntityParamsTypedDict", + "CreateEntityPrice", + "CreateEntityPriceTypedDict", + "CreateEntityPurchase", + "CreateEntityPurchaseTypedDict", + "CreateEntityReset", + "CreateEntityResetTypedDict", + "CreateEntityResponse", + "CreateEntityResponseTypedDict", + "CreateEntityRollover", + "CreateEntityRolloverTypedDict", + "CreateEntityStatus", + "CreateEntitySubscription", + "CreateEntitySubscriptionTypedDict", + "CreateEntityTier", + "CreateEntityTierTypedDict", + "CreateEntityTo", + "CreateEntityToTypedDict", + "CreateEntityType", + "CreateReferralCodeGlobals", + "CreateReferralCodeGlobalsTypedDict", + "CreateReferralCodeParams", + "CreateReferralCodeParamsTypedDict", + "CreateReferralCodeResponse", + "CreateReferralCodeResponseTypedDict", "Customer", "CustomerBalancesType", "CustomerBillingMethod", @@ -1011,50 +949,71 @@ __all__ = [ "DeleteCustomerParamsTypedDict", "DeleteCustomerResponse", "DeleteCustomerResponseTypedDict", + "DeleteEntityGlobals", + "DeleteEntityGlobalsTypedDict", + "DeleteEntityParams", + "DeleteEntityParamsTypedDict", + "DeleteEntityResponse", + "DeleteEntityResponseTypedDict", "Discount", "DiscountTypedDict", "Entity", "EntityEnv", "EntityTypedDict", + "EventsAggregateParams", + "EventsAggregateParamsTypedDict", + "EventsListParams", + "EventsListParamsTypedDict", "ExpiryDurationType", "FeatureType", "FreeTrial", "FreeTrialDuration", "FreeTrialTypedDict", + "GetEntityBalances", + "GetEntityBalancesTypedDict", + "GetEntityBillingMethod", + "GetEntityBreakdown", + "GetEntityBreakdownTypedDict", + "GetEntityCreditSchema", + "GetEntityCreditSchemaTypedDict", + "GetEntityDisplay", + "GetEntityDisplayTypedDict", + "GetEntityEnv", + "GetEntityFeature", + "GetEntityFeatureTypedDict", + "GetEntityGlobals", + "GetEntityGlobalsTypedDict", + "GetEntityIntervalEnum", + "GetEntityIntervalUnion", + "GetEntityIntervalUnionTypedDict", + "GetEntityInvoice", + "GetEntityInvoiceTypedDict", + "GetEntityParams", + "GetEntityParamsTypedDict", + "GetEntityPrice", + "GetEntityPriceTypedDict", + "GetEntityPurchase", + "GetEntityPurchaseTypedDict", + "GetEntityReset", + "GetEntityResetTypedDict", + "GetEntityResponse", + "GetEntityResponseTypedDict", + "GetEntityRollover", + "GetEntityRolloverTypedDict", + "GetEntityStatus", + "GetEntitySubscription", + "GetEntitySubscriptionTypedDict", + "GetEntityTier", + "GetEntityTierTypedDict", + "GetEntityTo", + "GetEntityToTypedDict", + "GetEntityType", "GetOrCreateCustomerGlobals", "GetOrCreateCustomerGlobalsTypedDict", "GetOrCreateCustomerParams", "GetOrCreateCustomerParamsTypedDict", "IncludedUsage", "IncludedUsageTypedDict", - "Incoming", - "IncomingBalances", - "IncomingBalancesTypedDict", - "IncomingBillingMethod", - "IncomingBreakdown", - "IncomingBreakdownTypedDict", - "IncomingCreditSchema", - "IncomingCreditSchemaTypedDict", - "IncomingDisplay", - "IncomingDisplayTypedDict", - "IncomingFeature", - "IncomingFeatureQuantity", - "IncomingFeatureQuantityTypedDict", - "IncomingFeatureTypedDict", - "IncomingIntervalUnion", - "IncomingIntervalUnionTypedDict", - "IncomingPrice", - "IncomingPriceTypedDict", - "IncomingReset", - "IncomingResetTypedDict", - "IncomingRollover", - "IncomingRolloverTypedDict", - "IncomingTier", - "IncomingTierTypedDict", - "IncomingType", - "IncomingTypedDict", - "IntervalIncomingEnum", - "IntervalOutgoingEnum", "Invoice", "InvoiceTypedDict", "Item", @@ -1076,6 +1035,8 @@ __all__ = [ "ListCustomersIntervalEnum", "ListCustomersIntervalUnion", "ListCustomersIntervalUnionTypedDict", + "ListCustomersList", + "ListCustomersListTypedDict", "ListCustomersParams", "ListCustomersParamsTypedDict", "ListCustomersPlan", @@ -1096,42 +1057,32 @@ __all__ = [ "ListCustomersTier", "ListCustomersTierTypedDict", "ListCustomersType", + "ListEventsCustomRange", + "ListEventsCustomRangeTypedDict", + "ListEventsFeatureID", + "ListEventsFeatureIDTypedDict", + "ListEventsGlobals", + "ListEventsGlobalsTypedDict", + "ListEventsList", + "ListEventsListTypedDict", + "ListEventsProperties", + "ListEventsPropertiesTypedDict", + "ListEventsResponse", + "ListEventsResponseTypedDict", "ListPlansGlobals", "ListPlansGlobalsTypedDict", "ListPlansRequest", "ListPlansRequestTypedDict", "ListPlansResponse", "ListPlansResponseTypedDict", - "ListT", - "ListTTypedDict", "OnDecrease", "OnIncrease", - "Outgoing", - "OutgoingBalances", - "OutgoingBalancesTypedDict", - "OutgoingBillingMethod", - "OutgoingBreakdown", - "OutgoingBreakdownTypedDict", - "OutgoingCreditSchema", - "OutgoingCreditSchemaTypedDict", - "OutgoingDisplay", - "OutgoingDisplayTypedDict", - "OutgoingFeature", - "OutgoingFeatureQuantity", - "OutgoingFeatureQuantityTypedDict", - "OutgoingFeatureTypedDict", - "OutgoingIntervalUnion", - "OutgoingIntervalUnionTypedDict", - "OutgoingPrice", - "OutgoingPriceTypedDict", - "OutgoingReset", - "OutgoingResetTypedDict", - "OutgoingRollover", - "OutgoingRolloverTypedDict", - "OutgoingTier", - "OutgoingTierTypedDict", - "OutgoingType", - "OutgoingTypedDict", + "OpenCustomerPortalGlobals", + "OpenCustomerPortalGlobalsTypedDict", + "OpenCustomerPortalParams", + "OpenCustomerPortalParamsTypedDict", + "OpenCustomerPortalResponse", + "OpenCustomerPortalResponseTypedDict", "Plan", "PlanBillingMethod", "PlanCreditSchema", @@ -1162,7 +1113,105 @@ __all__ = [ "PlanType", "PlanTypedDict", "Preview", + "PreviewAttachBillingBehavior", + "PreviewAttachBillingMethod", + "PreviewAttachCustomize", + "PreviewAttachCustomizeTypedDict", + "PreviewAttachDiscountRequest1", + "PreviewAttachDiscountRequest1TypedDict", + "PreviewAttachDiscountRequest2", + "PreviewAttachDiscountRequest2TypedDict", + "PreviewAttachDiscountResponse", + "PreviewAttachDiscountResponseTypedDict", + "PreviewAttachDiscountUnion", + "PreviewAttachDiscountUnionTypedDict", + "PreviewAttachDurationType", + "PreviewAttachExpiryDurationType", + "PreviewAttachFeatureQuantity", + "PreviewAttachFeatureQuantityTypedDict", + "PreviewAttachFreeTrial", + "PreviewAttachFreeTrialTypedDict", + "PreviewAttachGlobals", + "PreviewAttachGlobalsTypedDict", + "PreviewAttachInvoiceMode", + "PreviewAttachInvoiceModeTypedDict", + "PreviewAttachItem", + "PreviewAttachItemPrice", + "PreviewAttachItemPriceInterval", + "PreviewAttachItemPriceTypedDict", + "PreviewAttachItemTypedDict", + "PreviewAttachLineItem", + "PreviewAttachLineItemTypedDict", + "PreviewAttachNextCycle", + "PreviewAttachNextCycleTypedDict", + "PreviewAttachOnDecrease", + "PreviewAttachOnIncrease", + "PreviewAttachParams", + "PreviewAttachParamsTypedDict", + "PreviewAttachPlanSchedule", + "PreviewAttachPrice", + "PreviewAttachPriceInterval", + "PreviewAttachPriceTypedDict", + "PreviewAttachProration", + "PreviewAttachProrationTypedDict", + "PreviewAttachReset", + "PreviewAttachResetInterval", + "PreviewAttachResetTypedDict", + "PreviewAttachResponse", + "PreviewAttachResponseTypedDict", + "PreviewAttachRollover", + "PreviewAttachRolloverTypedDict", + "PreviewAttachTier", + "PreviewAttachTierTypedDict", + "PreviewAttachTo", + "PreviewAttachToTypedDict", "PreviewTypedDict", + "PreviewUpdateBillingBehavior", + "PreviewUpdateBillingMethod", + "PreviewUpdateCancelAction", + "PreviewUpdateCustomize", + "PreviewUpdateCustomizeTypedDict", + "PreviewUpdateDiscount", + "PreviewUpdateDiscountTypedDict", + "PreviewUpdateDurationType", + "PreviewUpdateExpiryDurationType", + "PreviewUpdateFeatureQuantity", + "PreviewUpdateFeatureQuantityTypedDict", + "PreviewUpdateFreeTrial", + "PreviewUpdateFreeTrialTypedDict", + "PreviewUpdateGlobals", + "PreviewUpdateGlobalsTypedDict", + "PreviewUpdateInvoiceMode", + "PreviewUpdateInvoiceModeTypedDict", + "PreviewUpdateItem", + "PreviewUpdateItemPrice", + "PreviewUpdateItemPriceInterval", + "PreviewUpdateItemPriceTypedDict", + "PreviewUpdateItemTypedDict", + "PreviewUpdateLineItem", + "PreviewUpdateLineItemTypedDict", + "PreviewUpdateNextCycle", + "PreviewUpdateNextCycleTypedDict", + "PreviewUpdateOnDecrease", + "PreviewUpdateOnIncrease", + "PreviewUpdateParams", + "PreviewUpdateParamsTypedDict", + "PreviewUpdatePrice", + "PreviewUpdatePriceInterval", + "PreviewUpdatePriceTypedDict", + "PreviewUpdateProration", + "PreviewUpdateProrationTypedDict", + "PreviewUpdateReset", + "PreviewUpdateResetInterval", + "PreviewUpdateResetTypedDict", + "PreviewUpdateResponse", + "PreviewUpdateResponseTypedDict", + "PreviewUpdateRollover", + "PreviewUpdateRolloverTypedDict", + "PreviewUpdateTier", + "PreviewUpdateTierTypedDict", + "PreviewUpdateTo", + "PreviewUpdateToTypedDict", "PriceDisplay", "PriceDisplayTypedDict", "Product", @@ -1172,13 +1221,17 @@ __all__ = [ "ProductScenario", "ProductType", "ProductTypedDict", - "Properties", - "PropertiesTypedDict", "Proration", "ProrationTypedDict", "Purchase", "PurchaseTypedDict", - "RedirectType", + "Range", + "RedeemReferralCodeGlobals", + "RedeemReferralCodeGlobalsTypedDict", + "RedeemReferralCodeParams", + "RedeemReferralCodeParamsTypedDict", + "RedeemReferralCodeResponse", + "RedeemReferralCodeResponseTypedDict", "Referral", "ReferralCustomer", "ReferralCustomerTypedDict", @@ -1198,8 +1251,73 @@ __all__ = [ "TiersTo", "TiersToTypedDict", "TiersTypedDict", + "Total", + "TotalTypedDict", + "TrackBalance", + "TrackBalanceBillingMethod", + "TrackBalanceBreakdown", + "TrackBalanceBreakdownTypedDict", + "TrackBalanceCreditSchema", + "TrackBalanceCreditSchemaTypedDict", + "TrackBalanceDisplay", + "TrackBalanceDisplayTypedDict", + "TrackBalanceFeature", + "TrackBalanceFeatureTypedDict", + "TrackBalanceIntervalEnum", + "TrackBalanceIntervalUnion", + "TrackBalanceIntervalUnionTypedDict", + "TrackBalancePrice", + "TrackBalancePriceTypedDict", + "TrackBalanceReset", + "TrackBalanceResetTypedDict", + "TrackBalanceRollover", + "TrackBalanceRolloverTypedDict", + "TrackBalanceTier", + "TrackBalanceTierTypedDict", + "TrackBalanceTo", + "TrackBalanceToTypedDict", + "TrackBalanceType", + "TrackBalanceTypedDict", + "TrackBalances", + "TrackBalancesBillingMethod", + "TrackBalancesBreakdown", + "TrackBalancesBreakdownTypedDict", + "TrackBalancesCreditSchema", + "TrackBalancesCreditSchemaTypedDict", + "TrackBalancesDisplay", + "TrackBalancesDisplayTypedDict", + "TrackBalancesFeature", + "TrackBalancesFeatureTypedDict", + "TrackBalancesIntervalUnion", + "TrackBalancesIntervalUnionTypedDict", + "TrackBalancesPrice", + "TrackBalancesPriceTypedDict", + "TrackBalancesReset", + "TrackBalancesResetTypedDict", + "TrackBalancesRollover", + "TrackBalancesRolloverTypedDict", + "TrackBalancesTier", + "TrackBalancesTierTypedDict", + "TrackBalancesTo", + "TrackBalancesToTypedDict", + "TrackBalancesType", + "TrackBalancesTypedDict", + "TrackGlobals", + "TrackGlobalsTypedDict", + "TrackIntervalBalancesEnum", + "TrackParams", + "TrackParamsTypedDict", + "TrackResponse", + "TrackResponseTypedDict", "TrialsUsed", "TrialsUsedTypedDict", + "UpdateBalanceGlobals", + "UpdateBalanceGlobalsTypedDict", + "UpdateBalanceInterval", + "UpdateBalanceParams", + "UpdateBalanceParamsTypedDict", + "UpdateBalanceResponse", + "UpdateBalanceResponseTypedDict", "UpdateCustomerBalances", "UpdateCustomerBalancesTypedDict", "UpdateCustomerBillingMethod", @@ -1237,146 +1355,30 @@ __all__ = [ "UpdateCustomerTo", "UpdateCustomerToTypedDict", "UpdateCustomerType", + "UpdateSubscriptionParams", + "UpdateSubscriptionParamsTypedDict", "UsageModel", ] _dynamic_imports: dict[str, str] = { - "BalancesCheckBalance": ".balancescheckop", - "BalancesCheckBalanceDisplay": ".balancescheckop", - "BalancesCheckBalanceDisplayTypedDict": ".balancescheckop", - "BalancesCheckBalanceIntervalEnum": ".balancescheckop", - "BalancesCheckBalanceRollover": ".balancescheckop", - "BalancesCheckBalanceRolloverTypedDict": ".balancescheckop", - "BalancesCheckBalanceTo": ".balancescheckop", - "BalancesCheckBalanceToTypedDict": ".balancescheckop", - "BalancesCheckBalanceType": ".balancescheckop", - "BalancesCheckBalanceTypedDict": ".balancescheckop", - "BalancesCheckBillingMethod": ".balancescheckop", - "BalancesCheckBreakdown": ".balancescheckop", - "BalancesCheckBreakdownTypedDict": ".balancescheckop", - "BalancesCheckCreditSchema": ".balancescheckop", - "BalancesCheckCreditSchemaTypedDict": ".balancescheckop", - "BalancesCheckEnv": ".balancescheckop", - "BalancesCheckFeature": ".balancescheckop", - "BalancesCheckFeatureTypedDict": ".balancescheckop", - "BalancesCheckFreeTrial": ".balancescheckop", - "BalancesCheckFreeTrialTypedDict": ".balancescheckop", - "BalancesCheckGlobals": ".balancescheckop", - "BalancesCheckGlobalsTypedDict": ".balancescheckop", - "BalancesCheckIntervalUnion": ".balancescheckop", - "BalancesCheckIntervalUnionTypedDict": ".balancescheckop", - "BalancesCheckItem": ".balancescheckop", - "BalancesCheckItemTypedDict": ".balancescheckop", - "BalancesCheckOnDecrease": ".balancescheckop", - "BalancesCheckOnIncrease": ".balancescheckop", - "BalancesCheckPrice": ".balancescheckop", - "BalancesCheckPriceTypedDict": ".balancescheckop", - "BalancesCheckRequest": ".balancescheckop", - "BalancesCheckRequestTypedDict": ".balancescheckop", - "BalancesCheckReset": ".balancescheckop", - "BalancesCheckResetTypedDict": ".balancescheckop", - "BalancesCheckResponse": ".balancescheckop", - "BalancesCheckResponseTypedDict": ".balancescheckop", - "BalancesCheckScenario": ".balancescheckop", - "BalancesCheckTier": ".balancescheckop", - "BalancesCheckTierTypedDict": ".balancescheckop", - "Config": ".balancescheckop", - "ConfigRollover": ".balancescheckop", - "ConfigRolloverTypedDict": ".balancescheckop", - "ConfigTypedDict": ".balancescheckop", - "FeatureType": ".balancescheckop", - "FreeTrialDuration": ".balancescheckop", - "IncludedUsage": ".balancescheckop", - "IncludedUsageTypedDict": ".balancescheckop", - "Preview": ".balancescheckop", - "PreviewTypedDict": ".balancescheckop", - "Product": ".balancescheckop", - "ProductDisplay": ".balancescheckop", - "ProductDisplayTypedDict": ".balancescheckop", - "ProductInterval": ".balancescheckop", - "ProductScenario": ".balancescheckop", - "ProductType": ".balancescheckop", - "ProductTypedDict": ".balancescheckop", - "Properties": ".balancescheckop", - "PropertiesTypedDict": ".balancescheckop", - "RolloverDuration": ".balancescheckop", - "Tiers": ".balancescheckop", - "TiersTo": ".balancescheckop", - "TiersToTypedDict": ".balancescheckop", - "TiersTypedDict": ".balancescheckop", - "UsageModel": ".balancescheckop", - "BalancesCreateGlobals": ".balancescreateop", - "BalancesCreateGlobalsTypedDict": ".balancescreateop", - "BalancesCreateInterval": ".balancescreateop", - "BalancesCreateRequest": ".balancescreateop", - "BalancesCreateRequestTypedDict": ".balancescreateop", - "BalancesCreateReset": ".balancescreateop", - "BalancesCreateResetTypedDict": ".balancescreateop", - "BalancesCreateResponse": ".balancescreateop", - "BalancesCreateResponseTypedDict": ".balancescreateop", - "BalancesTrackBalance": ".balancestrackop", - "BalancesTrackBalanceBillingMethod": ".balancestrackop", - "BalancesTrackBalanceBreakdown": ".balancestrackop", - "BalancesTrackBalanceBreakdownTypedDict": ".balancestrackop", - "BalancesTrackBalanceCreditSchema": ".balancestrackop", - "BalancesTrackBalanceCreditSchemaTypedDict": ".balancestrackop", - "BalancesTrackBalanceDisplay": ".balancestrackop", - "BalancesTrackBalanceDisplayTypedDict": ".balancestrackop", - "BalancesTrackBalanceFeature": ".balancestrackop", - "BalancesTrackBalanceFeatureTypedDict": ".balancestrackop", - "BalancesTrackBalanceIntervalEnum": ".balancestrackop", - "BalancesTrackBalanceIntervalUnion": ".balancestrackop", - "BalancesTrackBalanceIntervalUnionTypedDict": ".balancestrackop", - "BalancesTrackBalancePrice": ".balancestrackop", - "BalancesTrackBalancePriceTypedDict": ".balancestrackop", - "BalancesTrackBalanceReset": ".balancestrackop", - "BalancesTrackBalanceResetTypedDict": ".balancestrackop", - "BalancesTrackBalanceRollover": ".balancestrackop", - "BalancesTrackBalanceRolloverTypedDict": ".balancestrackop", - "BalancesTrackBalanceTier": ".balancestrackop", - "BalancesTrackBalanceTierTypedDict": ".balancestrackop", - "BalancesTrackBalanceTo": ".balancestrackop", - "BalancesTrackBalanceToTypedDict": ".balancestrackop", - "BalancesTrackBalanceType": ".balancestrackop", - "BalancesTrackBalanceTypedDict": ".balancestrackop", - "BalancesTrackBalances": ".balancestrackop", - "BalancesTrackBalancesTypedDict": ".balancestrackop", - "BalancesTrackBillingMethod": ".balancestrackop", - "BalancesTrackBreakdown": ".balancestrackop", - "BalancesTrackBreakdownTypedDict": ".balancestrackop", - "BalancesTrackCreditSchema": ".balancestrackop", - "BalancesTrackCreditSchemaTypedDict": ".balancestrackop", - "BalancesTrackDisplay": ".balancestrackop", - "BalancesTrackDisplayTypedDict": ".balancestrackop", - "BalancesTrackFeature": ".balancestrackop", - "BalancesTrackFeatureTypedDict": ".balancestrackop", - "BalancesTrackGlobals": ".balancestrackop", - "BalancesTrackGlobalsTypedDict": ".balancestrackop", - "BalancesTrackIntervalEnum": ".balancestrackop", - "BalancesTrackIntervalUnion": ".balancestrackop", - "BalancesTrackIntervalUnionTypedDict": ".balancestrackop", - "BalancesTrackPrice": ".balancestrackop", - "BalancesTrackPriceTypedDict": ".balancestrackop", - "BalancesTrackRequest": ".balancestrackop", - "BalancesTrackRequestTypedDict": ".balancestrackop", - "BalancesTrackReset": ".balancestrackop", - "BalancesTrackResetTypedDict": ".balancestrackop", - "BalancesTrackResponse": ".balancestrackop", - "BalancesTrackResponseTypedDict": ".balancestrackop", - "BalancesTrackRollover": ".balancestrackop", - "BalancesTrackRolloverTypedDict": ".balancestrackop", - "BalancesTrackTier": ".balancestrackop", - "BalancesTrackTierTypedDict": ".balancestrackop", - "BalancesTrackTo": ".balancestrackop", - "BalancesTrackToTypedDict": ".balancestrackop", - "BalancesTrackType": ".balancestrackop", - "BalancesUpdateGlobals": ".balancesupdateop", - "BalancesUpdateGlobalsTypedDict": ".balancesupdateop", - "BalancesUpdateInterval": ".balancesupdateop", - "BalancesUpdateRequest": ".balancesupdateop", - "BalancesUpdateRequestTypedDict": ".balancesupdateop", - "BalancesUpdateResponse": ".balancesupdateop", - "BalancesUpdateResponseTypedDict": ".balancesupdateop", + "AggregateEventsCustomRange": ".aggregateeventsop", + "AggregateEventsCustomRangeTypedDict": ".aggregateeventsop", + "AggregateEventsFeatureID": ".aggregateeventsop", + "AggregateEventsFeatureIDTypedDict": ".aggregateeventsop", + "AggregateEventsGlobals": ".aggregateeventsop", + "AggregateEventsGlobalsTypedDict": ".aggregateeventsop", + "AggregateEventsList": ".aggregateeventsop", + "AggregateEventsListTypedDict": ".aggregateeventsop", + "AggregateEventsResponse": ".aggregateeventsop", + "AggregateEventsResponseTypedDict": ".aggregateeventsop", + "BinSize": ".aggregateeventsop", + "EventsAggregateParams": ".aggregateeventsop", + "EventsAggregateParamsTypedDict": ".aggregateeventsop", + "Range": ".aggregateeventsop", + "Total": ".aggregateeventsop", + "TotalTypedDict": ".aggregateeventsop", + "AttachParams": ".billingattachop", + "AttachParamsTypedDict": ".billingattachop", "BillingAttachBillingBehavior": ".billingattachop", "BillingAttachBillingMethod": ".billingattachop", "BillingAttachCode": ".billingattachop", @@ -1390,8 +1392,8 @@ _dynamic_imports: dict[str, str] = { "BillingAttachDiscountUnionTypedDict": ".billingattachop", "BillingAttachDurationType": ".billingattachop", "BillingAttachExpiryDurationType": ".billingattachop", - "BillingAttachFeatureQuantities": ".billingattachop", - "BillingAttachFeatureQuantitiesTypedDict": ".billingattachop", + "BillingAttachFeatureQuantity": ".billingattachop", + "BillingAttachFeatureQuantityTypedDict": ".billingattachop", "BillingAttachFreeTrial": ".billingattachop", "BillingAttachFreeTrialTypedDict": ".billingattachop", "BillingAttachGlobals": ".billingattachop", @@ -1413,9 +1415,6 @@ _dynamic_imports: dict[str, str] = { "BillingAttachPriceTypedDict": ".billingattachop", "BillingAttachProration": ".billingattachop", "BillingAttachProrationTypedDict": ".billingattachop", - "BillingAttachRedirectMode": ".billingattachop", - "BillingAttachRequest": ".billingattachop", - "BillingAttachRequestTypedDict": ".billingattachop", "BillingAttachRequiredAction": ".billingattachop", "BillingAttachRequiredActionTypedDict": ".billingattachop", "BillingAttachReset": ".billingattachop", @@ -1429,182 +1428,6 @@ _dynamic_imports: dict[str, str] = { "BillingAttachTierTypedDict": ".billingattachop", "BillingAttachTo": ".billingattachop", "BillingAttachToTypedDict": ".billingattachop", - "BillingPreviewAttachBillingBehavior": ".billingpreviewattachop", - "BillingPreviewAttachBillingMethodRequest": ".billingpreviewattachop", - "BillingPreviewAttachCustomize": ".billingpreviewattachop", - "BillingPreviewAttachCustomizeReset": ".billingpreviewattachop", - "BillingPreviewAttachCustomizeResetTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachCustomizeTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachDiscountRequest1": ".billingpreviewattachop", - "BillingPreviewAttachDiscountRequest1TypedDict": ".billingpreviewattachop", - "BillingPreviewAttachDiscountRequest2": ".billingpreviewattachop", - "BillingPreviewAttachDiscountRequest2TypedDict": ".billingpreviewattachop", - "BillingPreviewAttachDiscountResponse": ".billingpreviewattachop", - "BillingPreviewAttachDiscountResponseTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachDiscountUnion": ".billingpreviewattachop", - "BillingPreviewAttachDiscountUnionTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachDurationType": ".billingpreviewattachop", - "BillingPreviewAttachEffectivePeriod": ".billingpreviewattachop", - "BillingPreviewAttachEffectivePeriodTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachExpiryDurationType": ".billingpreviewattachop", - "BillingPreviewAttachFeatureQuantities": ".billingpreviewattachop", - "BillingPreviewAttachFeatureQuantitiesTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachFreeTrial": ".billingpreviewattachop", - "BillingPreviewAttachFreeTrialTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachGlobals": ".billingpreviewattachop", - "BillingPreviewAttachGlobalsTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachInvoiceMode": ".billingpreviewattachop", - "BillingPreviewAttachInvoiceModeTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachItem": ".billingpreviewattachop", - "BillingPreviewAttachItemPrice": ".billingpreviewattachop", - "BillingPreviewAttachItemPriceInterval": ".billingpreviewattachop", - "BillingPreviewAttachItemPriceTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachItemResetInterval": ".billingpreviewattachop", - "BillingPreviewAttachItemTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachLineItem": ".billingpreviewattachop", - "BillingPreviewAttachLineItemTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachNextCycle": ".billingpreviewattachop", - "BillingPreviewAttachNextCycleDiscount": ".billingpreviewattachop", - "BillingPreviewAttachNextCycleDiscountTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachNextCycleEffectivePeriod": ".billingpreviewattachop", - "BillingPreviewAttachNextCycleEffectivePeriodTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachNextCycleLineItem": ".billingpreviewattachop", - "BillingPreviewAttachNextCycleLineItemTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachNextCycleTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachOnDecrease": ".billingpreviewattachop", - "BillingPreviewAttachOnIncrease": ".billingpreviewattachop", - "BillingPreviewAttachPlanSchedule": ".billingpreviewattachop", - "BillingPreviewAttachPriceInterval": ".billingpreviewattachop", - "BillingPreviewAttachPriceRequest": ".billingpreviewattachop", - "BillingPreviewAttachPriceRequestTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachProration": ".billingpreviewattachop", - "BillingPreviewAttachProrationTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachRedirectMode": ".billingpreviewattachop", - "BillingPreviewAttachRequest": ".billingpreviewattachop", - "BillingPreviewAttachRequestTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachResponse": ".billingpreviewattachop", - "BillingPreviewAttachResponseTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachRolloverRequest": ".billingpreviewattachop", - "BillingPreviewAttachRolloverRequestTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachTierRequest": ".billingpreviewattachop", - "BillingPreviewAttachTierRequestTypedDict": ".billingpreviewattachop", - "BillingPreviewAttachTo": ".billingpreviewattachop", - "BillingPreviewAttachToTypedDict": ".billingpreviewattachop", - "Incoming": ".billingpreviewattachop", - "IncomingBalances": ".billingpreviewattachop", - "IncomingBalancesTypedDict": ".billingpreviewattachop", - "IncomingBillingMethod": ".billingpreviewattachop", - "IncomingBreakdown": ".billingpreviewattachop", - "IncomingBreakdownTypedDict": ".billingpreviewattachop", - "IncomingCreditSchema": ".billingpreviewattachop", - "IncomingCreditSchemaTypedDict": ".billingpreviewattachop", - "IncomingDisplay": ".billingpreviewattachop", - "IncomingDisplayTypedDict": ".billingpreviewattachop", - "IncomingFeature": ".billingpreviewattachop", - "IncomingFeatureQuantity": ".billingpreviewattachop", - "IncomingFeatureQuantityTypedDict": ".billingpreviewattachop", - "IncomingFeatureTypedDict": ".billingpreviewattachop", - "IncomingIntervalUnion": ".billingpreviewattachop", - "IncomingIntervalUnionTypedDict": ".billingpreviewattachop", - "IncomingPrice": ".billingpreviewattachop", - "IncomingPriceTypedDict": ".billingpreviewattachop", - "IncomingReset": ".billingpreviewattachop", - "IncomingResetTypedDict": ".billingpreviewattachop", - "IncomingRollover": ".billingpreviewattachop", - "IncomingRolloverTypedDict": ".billingpreviewattachop", - "IncomingTier": ".billingpreviewattachop", - "IncomingTierTypedDict": ".billingpreviewattachop", - "IncomingType": ".billingpreviewattachop", - "IncomingTypedDict": ".billingpreviewattachop", - "IntervalIncomingEnum": ".billingpreviewattachop", - "IntervalOutgoingEnum": ".billingpreviewattachop", - "Outgoing": ".billingpreviewattachop", - "OutgoingBalances": ".billingpreviewattachop", - "OutgoingBalancesTypedDict": ".billingpreviewattachop", - "OutgoingBillingMethod": ".billingpreviewattachop", - "OutgoingBreakdown": ".billingpreviewattachop", - "OutgoingBreakdownTypedDict": ".billingpreviewattachop", - "OutgoingCreditSchema": ".billingpreviewattachop", - "OutgoingCreditSchemaTypedDict": ".billingpreviewattachop", - "OutgoingDisplay": ".billingpreviewattachop", - "OutgoingDisplayTypedDict": ".billingpreviewattachop", - "OutgoingFeature": ".billingpreviewattachop", - "OutgoingFeatureQuantity": ".billingpreviewattachop", - "OutgoingFeatureQuantityTypedDict": ".billingpreviewattachop", - "OutgoingFeatureTypedDict": ".billingpreviewattachop", - "OutgoingIntervalUnion": ".billingpreviewattachop", - "OutgoingIntervalUnionTypedDict": ".billingpreviewattachop", - "OutgoingPrice": ".billingpreviewattachop", - "OutgoingPriceTypedDict": ".billingpreviewattachop", - "OutgoingReset": ".billingpreviewattachop", - "OutgoingResetTypedDict": ".billingpreviewattachop", - "OutgoingRollover": ".billingpreviewattachop", - "OutgoingRolloverTypedDict": ".billingpreviewattachop", - "OutgoingTier": ".billingpreviewattachop", - "OutgoingTierTypedDict": ".billingpreviewattachop", - "OutgoingType": ".billingpreviewattachop", - "OutgoingTypedDict": ".billingpreviewattachop", - "RedirectType": ".billingpreviewattachop", - "BillingPreviewUpdateBillingBehavior": ".billingpreviewupdateop", - "BillingPreviewUpdateBillingMethod": ".billingpreviewupdateop", - "BillingPreviewUpdateCancelAction": ".billingpreviewupdateop", - "BillingPreviewUpdateCustomize": ".billingpreviewupdateop", - "BillingPreviewUpdateCustomizeTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateDiscount": ".billingpreviewupdateop", - "BillingPreviewUpdateDiscountTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateDurationType": ".billingpreviewupdateop", - "BillingPreviewUpdateEffectivePeriod": ".billingpreviewupdateop", - "BillingPreviewUpdateEffectivePeriodTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateExpiryDurationType": ".billingpreviewupdateop", - "BillingPreviewUpdateFeatureQuantities": ".billingpreviewupdateop", - "BillingPreviewUpdateFeatureQuantitiesTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateFreeTrial": ".billingpreviewupdateop", - "BillingPreviewUpdateFreeTrialTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateGlobals": ".billingpreviewupdateop", - "BillingPreviewUpdateGlobalsTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateInvoiceMode": ".billingpreviewupdateop", - "BillingPreviewUpdateInvoiceModeTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateItem": ".billingpreviewupdateop", - "BillingPreviewUpdateItemPrice": ".billingpreviewupdateop", - "BillingPreviewUpdateItemPriceInterval": ".billingpreviewupdateop", - "BillingPreviewUpdateItemPriceTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateItemTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateLineItem": ".billingpreviewupdateop", - "BillingPreviewUpdateLineItemTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateNextCycle": ".billingpreviewupdateop", - "BillingPreviewUpdateNextCycleDiscount": ".billingpreviewupdateop", - "BillingPreviewUpdateNextCycleDiscountTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateNextCycleEffectivePeriod": ".billingpreviewupdateop", - "BillingPreviewUpdateNextCycleEffectivePeriodTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateNextCycleLineItem": ".billingpreviewupdateop", - "BillingPreviewUpdateNextCycleLineItemTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateNextCycleTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateOnDecrease": ".billingpreviewupdateop", - "BillingPreviewUpdateOnIncrease": ".billingpreviewupdateop", - "BillingPreviewUpdatePrice": ".billingpreviewupdateop", - "BillingPreviewUpdatePriceInterval": ".billingpreviewupdateop", - "BillingPreviewUpdatePriceTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateProration": ".billingpreviewupdateop", - "BillingPreviewUpdateProrationTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateRequest": ".billingpreviewupdateop", - "BillingPreviewUpdateRequestTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateReset": ".billingpreviewupdateop", - "BillingPreviewUpdateResetInterval": ".billingpreviewupdateop", - "BillingPreviewUpdateResetTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateResponse": ".billingpreviewupdateop", - "BillingPreviewUpdateResponseTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateRollover": ".billingpreviewupdateop", - "BillingPreviewUpdateRolloverTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateTier": ".billingpreviewupdateop", - "BillingPreviewUpdateTierTypedDict": ".billingpreviewupdateop", - "BillingPreviewUpdateTo": ".billingpreviewupdateop", - "BillingPreviewUpdateToTypedDict": ".billingpreviewupdateop", - "BillingSetupPaymentGlobals": ".billingsetuppaymentop", - "BillingSetupPaymentGlobalsTypedDict": ".billingsetuppaymentop", - "BillingSetupPaymentRequest": ".billingsetuppaymentop", - "BillingSetupPaymentRequestTypedDict": ".billingsetuppaymentop", - "BillingSetupPaymentResponse": ".billingsetuppaymentop", - "BillingSetupPaymentResponseTypedDict": ".billingsetuppaymentop", "BillingUpdateBillingBehavior": ".billingupdateop", "BillingUpdateBillingMethod": ".billingupdateop", "BillingUpdateCancelAction": ".billingupdateop", @@ -1613,8 +1436,8 @@ _dynamic_imports: dict[str, str] = { "BillingUpdateCustomizeTypedDict": ".billingupdateop", "BillingUpdateDurationType": ".billingupdateop", "BillingUpdateExpiryDurationType": ".billingupdateop", - "BillingUpdateFeatureQuantities": ".billingupdateop", - "BillingUpdateFeatureQuantitiesTypedDict": ".billingupdateop", + "BillingUpdateFeatureQuantity": ".billingupdateop", + "BillingUpdateFeatureQuantityTypedDict": ".billingupdateop", "BillingUpdateFreeTrial": ".billingupdateop", "BillingUpdateFreeTrialTypedDict": ".billingupdateop", "BillingUpdateGlobals": ".billingupdateop", @@ -1635,8 +1458,6 @@ _dynamic_imports: dict[str, str] = { "BillingUpdatePriceTypedDict": ".billingupdateop", "BillingUpdateProration": ".billingupdateop", "BillingUpdateProrationTypedDict": ".billingupdateop", - "BillingUpdateRequest": ".billingupdateop", - "BillingUpdateRequestTypedDict": ".billingupdateop", "BillingUpdateRequiredAction": ".billingupdateop", "BillingUpdateRequiredActionTypedDict": ".billingupdateop", "BillingUpdateReset": ".billingupdateop", @@ -1650,6 +1471,126 @@ _dynamic_imports: dict[str, str] = { "BillingUpdateTierTypedDict": ".billingupdateop", "BillingUpdateTo": ".billingupdateop", "BillingUpdateToTypedDict": ".billingupdateop", + "UpdateSubscriptionParams": ".billingupdateop", + "UpdateSubscriptionParamsTypedDict": ".billingupdateop", + "CheckBalance": ".checkop", + "CheckBalanceDisplay": ".checkop", + "CheckBalanceDisplayTypedDict": ".checkop", + "CheckBalanceIntervalEnum": ".checkop", + "CheckBalanceRollover": ".checkop", + "CheckBalanceRolloverTypedDict": ".checkop", + "CheckBalanceTo": ".checkop", + "CheckBalanceToTypedDict": ".checkop", + "CheckBalanceType": ".checkop", + "CheckBalanceTypedDict": ".checkop", + "CheckBillingMethod": ".checkop", + "CheckBreakdown": ".checkop", + "CheckBreakdownTypedDict": ".checkop", + "CheckCreditSchema": ".checkop", + "CheckCreditSchemaTypedDict": ".checkop", + "CheckEnv": ".checkop", + "CheckFeature": ".checkop", + "CheckFeatureTypedDict": ".checkop", + "CheckFreeTrial": ".checkop", + "CheckFreeTrialTypedDict": ".checkop", + "CheckGlobals": ".checkop", + "CheckGlobalsTypedDict": ".checkop", + "CheckIntervalUnion": ".checkop", + "CheckIntervalUnionTypedDict": ".checkop", + "CheckItem": ".checkop", + "CheckItemTypedDict": ".checkop", + "CheckOnDecrease": ".checkop", + "CheckOnIncrease": ".checkop", + "CheckParams": ".checkop", + "CheckParamsTypedDict": ".checkop", + "CheckPrice": ".checkop", + "CheckPriceTypedDict": ".checkop", + "CheckProperties": ".checkop", + "CheckPropertiesTypedDict": ".checkop", + "CheckReset": ".checkop", + "CheckResetTypedDict": ".checkop", + "CheckResponse": ".checkop", + "CheckResponseTypedDict": ".checkop", + "CheckScenario": ".checkop", + "CheckTier": ".checkop", + "CheckTierTypedDict": ".checkop", + "Config": ".checkop", + "ConfigRollover": ".checkop", + "ConfigRolloverTypedDict": ".checkop", + "ConfigTypedDict": ".checkop", + "FeatureType": ".checkop", + "FreeTrialDuration": ".checkop", + "IncludedUsage": ".checkop", + "IncludedUsageTypedDict": ".checkop", + "Preview": ".checkop", + "PreviewTypedDict": ".checkop", + "Product": ".checkop", + "ProductDisplay": ".checkop", + "ProductDisplayTypedDict": ".checkop", + "ProductInterval": ".checkop", + "ProductScenario": ".checkop", + "ProductType": ".checkop", + "ProductTypedDict": ".checkop", + "RolloverDuration": ".checkop", + "Tiers": ".checkop", + "TiersTo": ".checkop", + "TiersToTypedDict": ".checkop", + "TiersTypedDict": ".checkop", + "UsageModel": ".checkop", + "CreateBalanceGlobals": ".createbalanceop", + "CreateBalanceGlobalsTypedDict": ".createbalanceop", + "CreateBalanceInterval": ".createbalanceop", + "CreateBalanceParams": ".createbalanceop", + "CreateBalanceParamsTypedDict": ".createbalanceop", + "CreateBalanceReset": ".createbalanceop", + "CreateBalanceResetTypedDict": ".createbalanceop", + "CreateBalanceResponse": ".createbalanceop", + "CreateBalanceResponseTypedDict": ".createbalanceop", + "CreateEntityBalances": ".createentityop", + "CreateEntityBalancesTypedDict": ".createentityop", + "CreateEntityBillingMethod": ".createentityop", + "CreateEntityBreakdown": ".createentityop", + "CreateEntityBreakdownTypedDict": ".createentityop", + "CreateEntityCreditSchema": ".createentityop", + "CreateEntityCreditSchemaTypedDict": ".createentityop", + "CreateEntityDisplay": ".createentityop", + "CreateEntityDisplayTypedDict": ".createentityop", + "CreateEntityEnv": ".createentityop", + "CreateEntityFeature": ".createentityop", + "CreateEntityFeatureTypedDict": ".createentityop", + "CreateEntityGlobals": ".createentityop", + "CreateEntityGlobalsTypedDict": ".createentityop", + "CreateEntityIntervalEnum": ".createentityop", + "CreateEntityIntervalUnion": ".createentityop", + "CreateEntityIntervalUnionTypedDict": ".createentityop", + "CreateEntityInvoice": ".createentityop", + "CreateEntityInvoiceTypedDict": ".createentityop", + "CreateEntityParams": ".createentityop", + "CreateEntityParamsTypedDict": ".createentityop", + "CreateEntityPrice": ".createentityop", + "CreateEntityPriceTypedDict": ".createentityop", + "CreateEntityPurchase": ".createentityop", + "CreateEntityPurchaseTypedDict": ".createentityop", + "CreateEntityReset": ".createentityop", + "CreateEntityResetTypedDict": ".createentityop", + "CreateEntityResponse": ".createentityop", + "CreateEntityResponseTypedDict": ".createentityop", + "CreateEntityRollover": ".createentityop", + "CreateEntityRolloverTypedDict": ".createentityop", + "CreateEntityStatus": ".createentityop", + "CreateEntitySubscription": ".createentityop", + "CreateEntitySubscriptionTypedDict": ".createentityop", + "CreateEntityTier": ".createentityop", + "CreateEntityTierTypedDict": ".createentityop", + "CreateEntityTo": ".createentityop", + "CreateEntityToTypedDict": ".createentityop", + "CreateEntityType": ".createentityop", + "CreateReferralCodeGlobals": ".createreferralcodeop", + "CreateReferralCodeGlobalsTypedDict": ".createreferralcodeop", + "CreateReferralCodeParams": ".createreferralcodeop", + "CreateReferralCodeParamsTypedDict": ".createreferralcodeop", + "CreateReferralCodeResponse": ".createreferralcodeop", + "CreateReferralCodeResponseTypedDict": ".createreferralcodeop", "Balances": ".customer", "BalancesTypedDict": ".customer", "Breakdown": ".customer", @@ -1709,6 +1650,51 @@ _dynamic_imports: dict[str, str] = { "DeleteCustomerParamsTypedDict": ".deletecustomerop", "DeleteCustomerResponse": ".deletecustomerop", "DeleteCustomerResponseTypedDict": ".deletecustomerop", + "DeleteEntityGlobals": ".deleteentityop", + "DeleteEntityGlobalsTypedDict": ".deleteentityop", + "DeleteEntityParams": ".deleteentityop", + "DeleteEntityParamsTypedDict": ".deleteentityop", + "DeleteEntityResponse": ".deleteentityop", + "DeleteEntityResponseTypedDict": ".deleteentityop", + "GetEntityBalances": ".getentityop", + "GetEntityBalancesTypedDict": ".getentityop", + "GetEntityBillingMethod": ".getentityop", + "GetEntityBreakdown": ".getentityop", + "GetEntityBreakdownTypedDict": ".getentityop", + "GetEntityCreditSchema": ".getentityop", + "GetEntityCreditSchemaTypedDict": ".getentityop", + "GetEntityDisplay": ".getentityop", + "GetEntityDisplayTypedDict": ".getentityop", + "GetEntityEnv": ".getentityop", + "GetEntityFeature": ".getentityop", + "GetEntityFeatureTypedDict": ".getentityop", + "GetEntityGlobals": ".getentityop", + "GetEntityGlobalsTypedDict": ".getentityop", + "GetEntityIntervalEnum": ".getentityop", + "GetEntityIntervalUnion": ".getentityop", + "GetEntityIntervalUnionTypedDict": ".getentityop", + "GetEntityInvoice": ".getentityop", + "GetEntityInvoiceTypedDict": ".getentityop", + "GetEntityParams": ".getentityop", + "GetEntityParamsTypedDict": ".getentityop", + "GetEntityPrice": ".getentityop", + "GetEntityPriceTypedDict": ".getentityop", + "GetEntityPurchase": ".getentityop", + "GetEntityPurchaseTypedDict": ".getentityop", + "GetEntityReset": ".getentityop", + "GetEntityResetTypedDict": ".getentityop", + "GetEntityResponse": ".getentityop", + "GetEntityResponseTypedDict": ".getentityop", + "GetEntityRollover": ".getentityop", + "GetEntityRolloverTypedDict": ".getentityop", + "GetEntityStatus": ".getentityop", + "GetEntitySubscription": ".getentityop", + "GetEntitySubscriptionTypedDict": ".getentityop", + "GetEntityTier": ".getentityop", + "GetEntityTierTypedDict": ".getentityop", + "GetEntityTo": ".getentityop", + "GetEntityToTypedDict": ".getentityop", + "GetEntityType": ".getentityop", "GetOrCreateCustomerGlobals": ".getorcreatecustomerop", "GetOrCreateCustomerGlobalsTypedDict": ".getorcreatecustomerop", "GetOrCreateCustomerParams": ".getorcreatecustomerop", @@ -1730,6 +1716,8 @@ _dynamic_imports: dict[str, str] = { "ListCustomersIntervalEnum": ".listcustomersop", "ListCustomersIntervalUnion": ".listcustomersop", "ListCustomersIntervalUnionTypedDict": ".listcustomersop", + "ListCustomersList": ".listcustomersop", + "ListCustomersListTypedDict": ".listcustomersop", "ListCustomersParams": ".listcustomersop", "ListCustomersParamsTypedDict": ".listcustomersop", "ListCustomersPlan": ".listcustomersop", @@ -1750,15 +1738,33 @@ _dynamic_imports: dict[str, str] = { "ListCustomersTier": ".listcustomersop", "ListCustomersTierTypedDict": ".listcustomersop", "ListCustomersType": ".listcustomersop", - "ListT": ".listcustomersop", - "ListTTypedDict": ".listcustomersop", "SubscriptionStatus": ".listcustomersop", + "EventsListParams": ".listeventsop", + "EventsListParamsTypedDict": ".listeventsop", + "ListEventsCustomRange": ".listeventsop", + "ListEventsCustomRangeTypedDict": ".listeventsop", + "ListEventsFeatureID": ".listeventsop", + "ListEventsFeatureIDTypedDict": ".listeventsop", + "ListEventsGlobals": ".listeventsop", + "ListEventsGlobalsTypedDict": ".listeventsop", + "ListEventsList": ".listeventsop", + "ListEventsListTypedDict": ".listeventsop", + "ListEventsProperties": ".listeventsop", + "ListEventsPropertiesTypedDict": ".listeventsop", + "ListEventsResponse": ".listeventsop", + "ListEventsResponseTypedDict": ".listeventsop", "ListPlansGlobals": ".listplansop", "ListPlansGlobalsTypedDict": ".listplansop", "ListPlansRequest": ".listplansop", "ListPlansRequestTypedDict": ".listplansop", "ListPlansResponse": ".listplansop", "ListPlansResponseTypedDict": ".listplansop", + "OpenCustomerPortalGlobals": ".opencustomerportalop", + "OpenCustomerPortalGlobalsTypedDict": ".opencustomerportalop", + "OpenCustomerPortalParams": ".opencustomerportalop", + "OpenCustomerPortalParamsTypedDict": ".opencustomerportalop", + "OpenCustomerPortalResponse": ".opencustomerportalop", + "OpenCustomerPortalResponseTypedDict": ".opencustomerportalop", "CustomerEligibility": ".plan", "CustomerEligibilityTypedDict": ".plan", "ExpiryDurationType": ".plan", @@ -1802,8 +1808,175 @@ _dynamic_imports: dict[str, str] = { "Proration": ".plan", "ProrationTypedDict": ".plan", "Scenario": ".plan", + "PreviewAttachBillingBehavior": ".previewattachop", + "PreviewAttachBillingMethod": ".previewattachop", + "PreviewAttachCustomize": ".previewattachop", + "PreviewAttachCustomizeTypedDict": ".previewattachop", + "PreviewAttachDiscountRequest1": ".previewattachop", + "PreviewAttachDiscountRequest1TypedDict": ".previewattachop", + "PreviewAttachDiscountRequest2": ".previewattachop", + "PreviewAttachDiscountRequest2TypedDict": ".previewattachop", + "PreviewAttachDiscountResponse": ".previewattachop", + "PreviewAttachDiscountResponseTypedDict": ".previewattachop", + "PreviewAttachDiscountUnion": ".previewattachop", + "PreviewAttachDiscountUnionTypedDict": ".previewattachop", + "PreviewAttachDurationType": ".previewattachop", + "PreviewAttachExpiryDurationType": ".previewattachop", + "PreviewAttachFeatureQuantity": ".previewattachop", + "PreviewAttachFeatureQuantityTypedDict": ".previewattachop", + "PreviewAttachFreeTrial": ".previewattachop", + "PreviewAttachFreeTrialTypedDict": ".previewattachop", + "PreviewAttachGlobals": ".previewattachop", + "PreviewAttachGlobalsTypedDict": ".previewattachop", + "PreviewAttachInvoiceMode": ".previewattachop", + "PreviewAttachInvoiceModeTypedDict": ".previewattachop", + "PreviewAttachItem": ".previewattachop", + "PreviewAttachItemPrice": ".previewattachop", + "PreviewAttachItemPriceInterval": ".previewattachop", + "PreviewAttachItemPriceTypedDict": ".previewattachop", + "PreviewAttachItemTypedDict": ".previewattachop", + "PreviewAttachLineItem": ".previewattachop", + "PreviewAttachLineItemTypedDict": ".previewattachop", + "PreviewAttachNextCycle": ".previewattachop", + "PreviewAttachNextCycleTypedDict": ".previewattachop", + "PreviewAttachOnDecrease": ".previewattachop", + "PreviewAttachOnIncrease": ".previewattachop", + "PreviewAttachParams": ".previewattachop", + "PreviewAttachParamsTypedDict": ".previewattachop", + "PreviewAttachPlanSchedule": ".previewattachop", + "PreviewAttachPrice": ".previewattachop", + "PreviewAttachPriceInterval": ".previewattachop", + "PreviewAttachPriceTypedDict": ".previewattachop", + "PreviewAttachProration": ".previewattachop", + "PreviewAttachProrationTypedDict": ".previewattachop", + "PreviewAttachReset": ".previewattachop", + "PreviewAttachResetInterval": ".previewattachop", + "PreviewAttachResetTypedDict": ".previewattachop", + "PreviewAttachResponse": ".previewattachop", + "PreviewAttachResponseTypedDict": ".previewattachop", + "PreviewAttachRollover": ".previewattachop", + "PreviewAttachRolloverTypedDict": ".previewattachop", + "PreviewAttachTier": ".previewattachop", + "PreviewAttachTierTypedDict": ".previewattachop", + "PreviewAttachTo": ".previewattachop", + "PreviewAttachToTypedDict": ".previewattachop", + "PreviewUpdateBillingBehavior": ".previewupdateop", + "PreviewUpdateBillingMethod": ".previewupdateop", + "PreviewUpdateCancelAction": ".previewupdateop", + "PreviewUpdateCustomize": ".previewupdateop", + "PreviewUpdateCustomizeTypedDict": ".previewupdateop", + "PreviewUpdateDiscount": ".previewupdateop", + "PreviewUpdateDiscountTypedDict": ".previewupdateop", + "PreviewUpdateDurationType": ".previewupdateop", + "PreviewUpdateExpiryDurationType": ".previewupdateop", + "PreviewUpdateFeatureQuantity": ".previewupdateop", + "PreviewUpdateFeatureQuantityTypedDict": ".previewupdateop", + "PreviewUpdateFreeTrial": ".previewupdateop", + "PreviewUpdateFreeTrialTypedDict": ".previewupdateop", + "PreviewUpdateGlobals": ".previewupdateop", + "PreviewUpdateGlobalsTypedDict": ".previewupdateop", + "PreviewUpdateInvoiceMode": ".previewupdateop", + "PreviewUpdateInvoiceModeTypedDict": ".previewupdateop", + "PreviewUpdateItem": ".previewupdateop", + "PreviewUpdateItemPrice": ".previewupdateop", + "PreviewUpdateItemPriceInterval": ".previewupdateop", + "PreviewUpdateItemPriceTypedDict": ".previewupdateop", + "PreviewUpdateItemTypedDict": ".previewupdateop", + "PreviewUpdateLineItem": ".previewupdateop", + "PreviewUpdateLineItemTypedDict": ".previewupdateop", + "PreviewUpdateNextCycle": ".previewupdateop", + "PreviewUpdateNextCycleTypedDict": ".previewupdateop", + "PreviewUpdateOnDecrease": ".previewupdateop", + "PreviewUpdateOnIncrease": ".previewupdateop", + "PreviewUpdateParams": ".previewupdateop", + "PreviewUpdateParamsTypedDict": ".previewupdateop", + "PreviewUpdatePrice": ".previewupdateop", + "PreviewUpdatePriceInterval": ".previewupdateop", + "PreviewUpdatePriceTypedDict": ".previewupdateop", + "PreviewUpdateProration": ".previewupdateop", + "PreviewUpdateProrationTypedDict": ".previewupdateop", + "PreviewUpdateReset": ".previewupdateop", + "PreviewUpdateResetInterval": ".previewupdateop", + "PreviewUpdateResetTypedDict": ".previewupdateop", + "PreviewUpdateResponse": ".previewupdateop", + "PreviewUpdateResponseTypedDict": ".previewupdateop", + "PreviewUpdateRollover": ".previewupdateop", + "PreviewUpdateRolloverTypedDict": ".previewupdateop", + "PreviewUpdateTier": ".previewupdateop", + "PreviewUpdateTierTypedDict": ".previewupdateop", + "PreviewUpdateTo": ".previewupdateop", + "PreviewUpdateToTypedDict": ".previewupdateop", + "RedeemReferralCodeGlobals": ".redeemreferralcodeop", + "RedeemReferralCodeGlobalsTypedDict": ".redeemreferralcodeop", + "RedeemReferralCodeParams": ".redeemreferralcodeop", + "RedeemReferralCodeParamsTypedDict": ".redeemreferralcodeop", + "RedeemReferralCodeResponse": ".redeemreferralcodeop", + "RedeemReferralCodeResponseTypedDict": ".redeemreferralcodeop", "Security": ".security", "SecurityTypedDict": ".security", + "TrackBalance": ".trackop", + "TrackBalanceBillingMethod": ".trackop", + "TrackBalanceBreakdown": ".trackop", + "TrackBalanceBreakdownTypedDict": ".trackop", + "TrackBalanceCreditSchema": ".trackop", + "TrackBalanceCreditSchemaTypedDict": ".trackop", + "TrackBalanceDisplay": ".trackop", + "TrackBalanceDisplayTypedDict": ".trackop", + "TrackBalanceFeature": ".trackop", + "TrackBalanceFeatureTypedDict": ".trackop", + "TrackBalanceIntervalEnum": ".trackop", + "TrackBalanceIntervalUnion": ".trackop", + "TrackBalanceIntervalUnionTypedDict": ".trackop", + "TrackBalancePrice": ".trackop", + "TrackBalancePriceTypedDict": ".trackop", + "TrackBalanceReset": ".trackop", + "TrackBalanceResetTypedDict": ".trackop", + "TrackBalanceRollover": ".trackop", + "TrackBalanceRolloverTypedDict": ".trackop", + "TrackBalanceTier": ".trackop", + "TrackBalanceTierTypedDict": ".trackop", + "TrackBalanceTo": ".trackop", + "TrackBalanceToTypedDict": ".trackop", + "TrackBalanceType": ".trackop", + "TrackBalanceTypedDict": ".trackop", + "TrackBalances": ".trackop", + "TrackBalancesBillingMethod": ".trackop", + "TrackBalancesBreakdown": ".trackop", + "TrackBalancesBreakdownTypedDict": ".trackop", + "TrackBalancesCreditSchema": ".trackop", + "TrackBalancesCreditSchemaTypedDict": ".trackop", + "TrackBalancesDisplay": ".trackop", + "TrackBalancesDisplayTypedDict": ".trackop", + "TrackBalancesFeature": ".trackop", + "TrackBalancesFeatureTypedDict": ".trackop", + "TrackBalancesIntervalUnion": ".trackop", + "TrackBalancesIntervalUnionTypedDict": ".trackop", + "TrackBalancesPrice": ".trackop", + "TrackBalancesPriceTypedDict": ".trackop", + "TrackBalancesReset": ".trackop", + "TrackBalancesResetTypedDict": ".trackop", + "TrackBalancesRollover": ".trackop", + "TrackBalancesRolloverTypedDict": ".trackop", + "TrackBalancesTier": ".trackop", + "TrackBalancesTierTypedDict": ".trackop", + "TrackBalancesTo": ".trackop", + "TrackBalancesToTypedDict": ".trackop", + "TrackBalancesType": ".trackop", + "TrackBalancesTypedDict": ".trackop", + "TrackGlobals": ".trackop", + "TrackGlobalsTypedDict": ".trackop", + "TrackIntervalBalancesEnum": ".trackop", + "TrackParams": ".trackop", + "TrackParamsTypedDict": ".trackop", + "TrackResponse": ".trackop", + "TrackResponseTypedDict": ".trackop", + "UpdateBalanceGlobals": ".updatebalanceop", + "UpdateBalanceGlobalsTypedDict": ".updatebalanceop", + "UpdateBalanceInterval": ".updatebalanceop", + "UpdateBalanceParams": ".updatebalanceop", + "UpdateBalanceParamsTypedDict": ".updatebalanceop", + "UpdateBalanceResponse": ".updatebalanceop", + "UpdateBalanceResponseTypedDict": ".updatebalanceop", "UpdateCustomerBalances": ".updatecustomerop", "UpdateCustomerBalancesTypedDict": ".updatecustomerop", "UpdateCustomerBillingMethod": ".updatecustomerop", diff --git a/others/python-sdk/src/autumn_sdk/models/aggregateeventsop.py b/others/python-sdk/src/autumn_sdk/models/aggregateeventsop.py new file mode 100644 index 000000000..0cfe4b589 --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/aggregateeventsop.py @@ -0,0 +1,205 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from autumn_sdk.types import BaseModel, UNSET_SENTINEL +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import Dict, List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class AggregateEventsGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class AggregateEventsGlobals(BaseModel): + x_api_version: Annotated[ + Optional[str], + pydantic.Field(alias="x-api-version"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = "2.1" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["x-api-version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +AggregateEventsFeatureIDTypedDict = TypeAliasType( + "AggregateEventsFeatureIDTypedDict", Union[str, List[str]] +) +r"""Feature ID(s) to aggregate events for""" + + +AggregateEventsFeatureID = TypeAliasType( + "AggregateEventsFeatureID", Union[str, List[str]] +) +r"""Feature ID(s) to aggregate events for""" + + +Range = Literal[ + "24h", + "7d", + "30d", + "90d", + "last_cycle", + "1bc", + "3bc", +] +r"""Time range to aggregate events for. Either range or custom_range must be provided""" + + +BinSize = Literal[ + "day", + "hour", + "month", +] +r"""Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day""" + + +class AggregateEventsCustomRangeTypedDict(TypedDict): + r"""Custom time range to aggregate events for. If provided, range must not be provided""" + + start: float + end: float + + +class AggregateEventsCustomRange(BaseModel): + r"""Custom time range to aggregate events for. If provided, range must not be provided""" + + start: float + + end: float + + +class EventsAggregateParamsTypedDict(TypedDict): + customer_id: str + r"""Customer ID to aggregate events for""" + feature_id: AggregateEventsFeatureIDTypedDict + r"""Feature ID(s) to aggregate events for""" + group_by: NotRequired[str] + r"""Property to group events by. If provided, each key in the response will be an object with distinct groups as the keys""" + range: NotRequired[Range] + r"""Time range to aggregate events for. Either range or custom_range must be provided""" + bin_size: NotRequired[BinSize] + r"""Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day""" + custom_range: NotRequired[AggregateEventsCustomRangeTypedDict] + r"""Custom time range to aggregate events for. If provided, range must not be provided""" + + +class EventsAggregateParams(BaseModel): + customer_id: str + r"""Customer ID to aggregate events for""" + + feature_id: AggregateEventsFeatureID + r"""Feature ID(s) to aggregate events for""" + + group_by: Optional[str] = None + r"""Property to group events by. If provided, each key in the response will be an object with distinct groups as the keys""" + + range: Optional[Range] = None + r"""Time range to aggregate events for. Either range or custom_range must be provided""" + + bin_size: Optional[BinSize] = "day" + r"""Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day""" + + custom_range: Optional[AggregateEventsCustomRange] = None + r"""Custom time range to aggregate events for. If provided, range must not be provided""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["group_by", "range", "bin_size", "custom_range"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class AggregateEventsListTypedDict(TypedDict): + period: float + r"""Unix timestamp (epoch ms) for this time period""" + values: Dict[str, float] + r"""Aggregated values per feature: { [featureId]: number }""" + grouped_values: NotRequired[Dict[str, Dict[str, float]]] + r"""Values broken down by group (only present when group_by is used): { [featureId]: { [groupValue]: number } }""" + + +class AggregateEventsList(BaseModel): + period: float + r"""Unix timestamp (epoch ms) for this time period""" + + values: Dict[str, float] + r"""Aggregated values per feature: { [featureId]: number }""" + + grouped_values: Optional[Dict[str, Dict[str, float]]] = None + r"""Values broken down by group (only present when group_by is used): { [featureId]: { [groupValue]: number } }""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["grouped_values"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class TotalTypedDict(TypedDict): + count: float + r"""Number of events for this feature""" + sum: float + r"""Sum of event values for this feature""" + + +class Total(BaseModel): + count: float + r"""Number of events for this feature""" + + sum: float + r"""Sum of event values for this feature""" + + +class AggregateEventsResponseTypedDict(TypedDict): + r"""OK""" + + list: List[AggregateEventsListTypedDict] + r"""Array of time periods with aggregated values""" + total: Dict[str, TotalTypedDict] + r"""Total aggregations per feature. Keys are feature IDs, values contain count and sum.""" + + +class AggregateEventsResponse(BaseModel): + r"""OK""" + + list: List[AggregateEventsList] + r"""Array of time periods with aggregated values""" + + total: Dict[str, Total] + r"""Total aggregations per feature. Keys are feature IDs, values contain count and sum.""" diff --git a/others/python-sdk/src/autumn_sdk/models/billingattachop.py b/others/python-sdk/src/autumn_sdk/models/billingattachop.py index aba5fb54b..c1b7c3cee 100644 --- a/others/python-sdk/src/autumn_sdk/models/billingattachop.py +++ b/others/python-sdk/src/autumn_sdk/models/billingattachop.py @@ -44,13 +44,13 @@ class BillingAttachGlobals(BaseModel): return m -class BillingAttachFeatureQuantitiesTypedDict(TypedDict): +class BillingAttachFeatureQuantityTypedDict(TypedDict): feature_id: str quantity: NotRequired[float] adjustable: NotRequired[bool] -class BillingAttachFeatureQuantities(BaseModel): +class BillingAttachFeatureQuantity(BaseModel): feature_id: str quantity: Optional[float] = None @@ -417,17 +417,27 @@ class BillingAttachCustomize(BaseModel): class BillingAttachInvoiceModeTypedDict(TypedDict): + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" + enabled: bool + r"""When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method.""" enable_plan_immediately: NotRequired[bool] + r"""If true, enables the plan immediately even though the invoice is not paid yet.""" finalize: NotRequired[bool] + r"""If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.""" class BillingAttachInvoiceMode(BaseModel): + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" + enabled: bool + r"""When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method.""" enable_plan_immediately: Optional[bool] = False + r"""If true, enables the plan immediately even though the invoice is not paid yet.""" finalize: Optional[bool] = True + r"""If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -446,109 +456,121 @@ class BillingAttachInvoiceMode(BaseModel): return m +BillingAttachBillingBehavior = Literal[ + "prorate_immediately", + "next_cycle_only", +] +r"""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.""" + + class BillingAttachDiscount2TypedDict(TypedDict): promotion_code: str + r"""The promotion code to apply as a discount.""" class BillingAttachDiscount2(BaseModel): promotion_code: str + r"""The promotion code to apply as a discount.""" class BillingAttachDiscount1TypedDict(TypedDict): reward_id: str + r"""The ID of the reward to apply as a discount.""" class BillingAttachDiscount1(BaseModel): reward_id: str + r"""The ID of the reward to apply as a discount.""" BillingAttachDiscountUnionTypedDict = TypeAliasType( "BillingAttachDiscountUnionTypedDict", Union[BillingAttachDiscount1TypedDict, BillingAttachDiscount2TypedDict], ) +r"""A discount to apply. Can be either a reward ID or a promotion code.""" BillingAttachDiscountUnion = TypeAliasType( "BillingAttachDiscountUnion", Union[BillingAttachDiscount1, BillingAttachDiscount2] ) - - -BillingAttachRedirectMode = Literal[ - "always", - "if_required", - "never", -] +r"""A discount to apply. Can be either a reward ID or a promotion code.""" BillingAttachPlanSchedule = Literal[ "immediate", "end_of_cycle", ] +r"""When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.""" -BillingAttachBillingBehavior = Literal[ - "prorate_immediately", - "next_cycle_only", -] - - -class BillingAttachRequestTypedDict(TypedDict): +class AttachParamsTypedDict(TypedDict): customer_id: str r"""The ID of the customer to attach the plan to.""" plan_id: str - entity_id: NotRequired[Nullable[str]] + r"""The ID of the plan.""" + entity_id: NotRequired[str] r"""The ID of the entity to attach the plan to.""" - feature_quantities: NotRequired[ - Nullable[List[BillingAttachFeatureQuantitiesTypedDict]] - ] + feature_quantities: NotRequired[List[BillingAttachFeatureQuantityTypedDict]] r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan.""" version: NotRequired[float] r"""The version of the plan to attach.""" free_trial: NotRequired[Nullable[BillingAttachFreeTrialTypedDict]] + r"""Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.""" customize: NotRequired[BillingAttachCustomizeTypedDict] r"""Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.""" invoice_mode: NotRequired[BillingAttachInvoiceModeTypedDict] - discounts: NotRequired[List[BillingAttachDiscountUnionTypedDict]] - redirect_mode: NotRequired[BillingAttachRedirectMode] - success_url: NotRequired[str] - new_billing_subscription: NotRequired[bool] - plan_schedule: NotRequired[BillingAttachPlanSchedule] + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" billing_behavior: NotRequired[BillingAttachBillingBehavior] + r"""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.""" + discounts: NotRequired[List[BillingAttachDiscountUnionTypedDict]] + r"""List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.""" + success_url: NotRequired[str] + r"""URL to redirect to after successful checkout.""" + new_billing_subscription: NotRequired[bool] + r"""Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.""" + plan_schedule: NotRequired[BillingAttachPlanSchedule] + r"""When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.""" -class BillingAttachRequest(BaseModel): +class AttachParams(BaseModel): customer_id: str r"""The ID of the customer to attach the plan to.""" plan_id: str + r"""The ID of the plan.""" - entity_id: OptionalNullable[str] = UNSET + entity_id: Optional[str] = None r"""The ID of the entity to attach the plan to.""" - feature_quantities: OptionalNullable[List[BillingAttachFeatureQuantities]] = UNSET + feature_quantities: Optional[List[BillingAttachFeatureQuantity]] = None r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan.""" version: Optional[float] = None r"""The version of the plan to attach.""" free_trial: OptionalNullable[BillingAttachFreeTrial] = UNSET + r"""Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.""" customize: Optional[BillingAttachCustomize] = None r"""Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.""" invoice_mode: Optional[BillingAttachInvoiceMode] = None - - discounts: Optional[List[BillingAttachDiscountUnion]] = None - - redirect_mode: Optional[BillingAttachRedirectMode] = "always" - - success_url: Optional[str] = None - - new_billing_subscription: Optional[bool] = None - - plan_schedule: Optional[BillingAttachPlanSchedule] = None + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" billing_behavior: Optional[BillingAttachBillingBehavior] = None + r"""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.""" + + discounts: Optional[List[BillingAttachDiscountUnion]] = None + r"""List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.""" + + success_url: Optional[str] = None + r"""URL to redirect to after successful checkout.""" + + new_billing_subscription: Optional[bool] = None + r"""Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.""" + + plan_schedule: Optional[BillingAttachPlanSchedule] = None + r"""When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -560,15 +582,14 @@ class BillingAttachRequest(BaseModel): "free_trial", "customize", "invoice_mode", + "billing_behavior", "discounts", - "redirect_mode", "success_url", "new_billing_subscription", "plan_schedule", - "billing_behavior", ] ) - nullable_fields = set(["entity_id", "feature_quantities", "free_trial"]) + nullable_fields = set(["free_trial"]) serialized = handler(self) m = {} @@ -592,23 +613,37 @@ class BillingAttachRequest(BaseModel): class BillingAttachInvoiceTypedDict(TypedDict): + r"""Invoice details if an invoice was created. Only present when a charge was made.""" + status: Nullable[str] + r"""The status of the invoice (e.g., 'paid', 'open', 'draft').""" stripe_id: str + r"""The Stripe invoice ID.""" total: float + r"""The total amount of the invoice in cents.""" currency: str + r"""The three-letter ISO currency code (e.g., 'usd').""" hosted_invoice_url: Nullable[str] + r"""URL to the hosted invoice page where the customer can view and pay the invoice.""" class BillingAttachInvoice(BaseModel): + r"""Invoice details if an invoice was created. Only present when a charge was made.""" + status: Nullable[str] + r"""The status of the invoice (e.g., 'paid', 'open', 'draft').""" stripe_id: str + r"""The Stripe invoice ID.""" total: float + r"""The total amount of the invoice in cents.""" currency: str + r"""The three-letter ISO currency code (e.g., 'usd').""" hosted_invoice_url: Nullable[str] + r"""URL to the hosted invoice page where the customer can view and pay the invoice.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -633,41 +668,60 @@ BillingAttachCode = Union[ ], UnrecognizedStr, ] +r"""The type of action required to complete the payment.""" class BillingAttachRequiredActionTypedDict(TypedDict): + r"""Details about any action required to complete the payment. Present when the payment could not be processed automatically.""" + code: BillingAttachCode + r"""The type of action required to complete the payment.""" reason: str + r"""A human-readable explanation of why this action is required.""" class BillingAttachRequiredAction(BaseModel): + r"""Details about any action required to complete the payment. Present when the payment could not be processed automatically.""" + code: BillingAttachCode + r"""The type of action required to complete the payment.""" reason: str + r"""A human-readable explanation of why this action is required.""" class BillingAttachResponseTypedDict(TypedDict): r"""OK""" customer_id: str + r"""The ID of the customer.""" payment_url: Nullable[str] + r"""URL to redirect the customer to complete payment. Null if no payment action is required.""" entity_id: NotRequired[str] + r"""The ID of the entity, if the plan was attached to an entity.""" invoice: NotRequired[BillingAttachInvoiceTypedDict] + r"""Invoice details if an invoice was created. Only present when a charge was made.""" required_action: NotRequired[BillingAttachRequiredActionTypedDict] + r"""Details about any action required to complete the payment. Present when the payment could not be processed automatically.""" class BillingAttachResponse(BaseModel): r"""OK""" customer_id: str + r"""The ID of the customer.""" payment_url: Nullable[str] + r"""URL to redirect the customer to complete payment. Null if no payment action is required.""" entity_id: Optional[str] = None + r"""The ID of the entity, if the plan was attached to an entity.""" invoice: Optional[BillingAttachInvoice] = None + r"""Invoice details if an invoice was created. Only present when a charge was made.""" required_action: Optional[BillingAttachRequiredAction] = None + r"""Details about any action required to complete the payment. Present when the payment could not be processed automatically.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/others/python-sdk/src/autumn_sdk/models/billingpreviewattachop.py b/others/python-sdk/src/autumn_sdk/models/billingpreviewattachop.py deleted file mode 100644 index f20d47336..000000000 --- a/others/python-sdk/src/autumn_sdk/models/billingpreviewattachop.py +++ /dev/null @@ -1,1753 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .plan import Plan, PlanTypedDict -from autumn_sdk.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, - UnrecognizedStr, -) -from autumn_sdk.utils import FieldMetadata, HeaderMetadata -import pydantic -from pydantic import model_serializer -from typing import Any, Dict, List, Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict - - -class BillingPreviewAttachGlobalsTypedDict(TypedDict): - x_api_version: NotRequired[str] - - -class BillingPreviewAttachGlobals(BaseModel): - x_api_version: Annotated[ - Optional[str], - pydantic.Field(alias="x-api-version"), - FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), - ] = "2.1" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["x-api-version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class BillingPreviewAttachFeatureQuantitiesTypedDict(TypedDict): - feature_id: str - quantity: NotRequired[float] - adjustable: NotRequired[bool] - - -class BillingPreviewAttachFeatureQuantities(BaseModel): - feature_id: str - - quantity: Optional[float] = None - - adjustable: Optional[bool] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["quantity", "adjustable"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -BillingPreviewAttachDurationType = Literal[ - "day", - "month", - "year", -] - - -class BillingPreviewAttachFreeTrialTypedDict(TypedDict): - duration_length: float - duration_type: NotRequired[BillingPreviewAttachDurationType] - card_required: NotRequired[bool] - - -class BillingPreviewAttachFreeTrial(BaseModel): - duration_length: float - - duration_type: Optional[BillingPreviewAttachDurationType] = "month" - - card_required: Optional[bool] = True - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["duration_type", "card_required"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -BillingPreviewAttachPriceInterval = Literal[ - "one_off", - "week", - "month", - "quarter", - "semi_annual", - "year", -] - - -class BillingPreviewAttachPriceRequestTypedDict(TypedDict): - amount: float - interval: BillingPreviewAttachPriceInterval - interval_count: NotRequired[float] - - -class BillingPreviewAttachPriceRequest(BaseModel): - amount: float - - interval: BillingPreviewAttachPriceInterval - - interval_count: Optional[float] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["interval_count"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -BillingPreviewAttachItemResetInterval = Literal[ - "one_off", - "minute", - "hour", - "day", - "week", - "month", - "quarter", - "semi_annual", - "year", -] - - -class BillingPreviewAttachCustomizeResetTypedDict(TypedDict): - interval: BillingPreviewAttachItemResetInterval - interval_count: NotRequired[float] - - -class BillingPreviewAttachCustomizeReset(BaseModel): - interval: BillingPreviewAttachItemResetInterval - - interval_count: Optional[float] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["interval_count"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -BillingPreviewAttachToTypedDict = TypeAliasType( - "BillingPreviewAttachToTypedDict", Union[float, str] -) - - -BillingPreviewAttachTo = TypeAliasType("BillingPreviewAttachTo", Union[float, str]) - - -class BillingPreviewAttachTierRequestTypedDict(TypedDict): - to: BillingPreviewAttachToTypedDict - amount: float - - -class BillingPreviewAttachTierRequest(BaseModel): - to: BillingPreviewAttachTo - - amount: float - - -BillingPreviewAttachItemPriceInterval = Literal[ - "one_off", - "week", - "month", - "quarter", - "semi_annual", - "year", -] - - -BillingPreviewAttachBillingMethodRequest = Literal[ - "prepaid", - "usage_based", -] - - -class BillingPreviewAttachItemPriceTypedDict(TypedDict): - interval: BillingPreviewAttachItemPriceInterval - billing_method: BillingPreviewAttachBillingMethodRequest - amount: NotRequired[float] - tiers: NotRequired[List[BillingPreviewAttachTierRequestTypedDict]] - interval_count: NotRequired[float] - billing_units: NotRequired[float] - max_purchase: NotRequired[float] - - -class BillingPreviewAttachItemPrice(BaseModel): - interval: BillingPreviewAttachItemPriceInterval - - billing_method: BillingPreviewAttachBillingMethodRequest - - amount: Optional[float] = None - - tiers: Optional[List[BillingPreviewAttachTierRequest]] = None - - interval_count: Optional[float] = 1 - - billing_units: Optional[float] = 1 - - max_purchase: Optional[float] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["amount", "tiers", "interval_count", "billing_units", "max_purchase"] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -BillingPreviewAttachOnIncrease = Literal[ - "bill_immediately", - "prorate_immediately", - "prorate_next_cycle", - "bill_next_cycle", -] - - -BillingPreviewAttachOnDecrease = Literal[ - "prorate", - "prorate_immediately", - "prorate_next_cycle", - "none", - "no_prorations", -] - - -class BillingPreviewAttachProrationTypedDict(TypedDict): - on_increase: BillingPreviewAttachOnIncrease - on_decrease: BillingPreviewAttachOnDecrease - - -class BillingPreviewAttachProration(BaseModel): - on_increase: BillingPreviewAttachOnIncrease - - on_decrease: BillingPreviewAttachOnDecrease - - -BillingPreviewAttachExpiryDurationType = Literal[ - "month", - "forever", -] - - -class BillingPreviewAttachRolloverRequestTypedDict(TypedDict): - expiry_duration_type: BillingPreviewAttachExpiryDurationType - max: NotRequired[float] - expiry_duration_length: NotRequired[float] - - -class BillingPreviewAttachRolloverRequest(BaseModel): - expiry_duration_type: BillingPreviewAttachExpiryDurationType - - max: Optional[float] = None - - expiry_duration_length: Optional[float] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["max", "expiry_duration_length"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class BillingPreviewAttachItemTypedDict(TypedDict): - feature_id: str - included: NotRequired[float] - unlimited: NotRequired[bool] - reset: NotRequired[BillingPreviewAttachCustomizeResetTypedDict] - price: NotRequired[BillingPreviewAttachItemPriceTypedDict] - proration: NotRequired[BillingPreviewAttachProrationTypedDict] - rollover: NotRequired[BillingPreviewAttachRolloverRequestTypedDict] - - -class BillingPreviewAttachItem(BaseModel): - feature_id: str - - included: Optional[float] = None - - unlimited: Optional[bool] = None - - reset: Optional[BillingPreviewAttachCustomizeReset] = None - - price: Optional[BillingPreviewAttachItemPrice] = None - - proration: Optional[BillingPreviewAttachProration] = None - - rollover: Optional[BillingPreviewAttachRolloverRequest] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["included", "unlimited", "reset", "price", "proration", "rollover"] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class BillingPreviewAttachCustomizeTypedDict(TypedDict): - r"""Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.""" - - price: NotRequired[Nullable[BillingPreviewAttachPriceRequestTypedDict]] - items: NotRequired[List[BillingPreviewAttachItemTypedDict]] - - -class BillingPreviewAttachCustomize(BaseModel): - r"""Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.""" - - price: OptionalNullable[BillingPreviewAttachPriceRequest] = UNSET - - items: Optional[List[BillingPreviewAttachItem]] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["price", "items"]) - nullable_fields = set(["price"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class BillingPreviewAttachInvoiceModeTypedDict(TypedDict): - enabled: bool - enable_plan_immediately: NotRequired[bool] - finalize: NotRequired[bool] - - -class BillingPreviewAttachInvoiceMode(BaseModel): - enabled: bool - - enable_plan_immediately: Optional[bool] = False - - finalize: Optional[bool] = True - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["enable_plan_immediately", "finalize"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class BillingPreviewAttachDiscountRequest2TypedDict(TypedDict): - promotion_code: str - - -class BillingPreviewAttachDiscountRequest2(BaseModel): - promotion_code: str - - -class BillingPreviewAttachDiscountRequest1TypedDict(TypedDict): - reward_id: str - - -class BillingPreviewAttachDiscountRequest1(BaseModel): - reward_id: str - - -BillingPreviewAttachDiscountUnionTypedDict = TypeAliasType( - "BillingPreviewAttachDiscountUnionTypedDict", - Union[ - BillingPreviewAttachDiscountRequest1TypedDict, - BillingPreviewAttachDiscountRequest2TypedDict, - ], -) - - -BillingPreviewAttachDiscountUnion = TypeAliasType( - "BillingPreviewAttachDiscountUnion", - Union[BillingPreviewAttachDiscountRequest1, BillingPreviewAttachDiscountRequest2], -) - - -BillingPreviewAttachRedirectMode = Literal[ - "always", - "if_required", - "never", -] - - -BillingPreviewAttachPlanSchedule = Literal[ - "immediate", - "end_of_cycle", -] - - -BillingPreviewAttachBillingBehavior = Literal[ - "prorate_immediately", - "next_cycle_only", -] - - -class BillingPreviewAttachRequestTypedDict(TypedDict): - customer_id: str - r"""The ID of the customer to attach the plan to.""" - plan_id: str - entity_id: NotRequired[Nullable[str]] - r"""The ID of the entity to attach the plan to.""" - feature_quantities: NotRequired[ - Nullable[List[BillingPreviewAttachFeatureQuantitiesTypedDict]] - ] - r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan.""" - version: NotRequired[float] - r"""The version of the plan to attach.""" - free_trial: NotRequired[Nullable[BillingPreviewAttachFreeTrialTypedDict]] - customize: NotRequired[BillingPreviewAttachCustomizeTypedDict] - r"""Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.""" - invoice_mode: NotRequired[BillingPreviewAttachInvoiceModeTypedDict] - discounts: NotRequired[List[BillingPreviewAttachDiscountUnionTypedDict]] - redirect_mode: NotRequired[BillingPreviewAttachRedirectMode] - success_url: NotRequired[str] - new_billing_subscription: NotRequired[bool] - plan_schedule: NotRequired[BillingPreviewAttachPlanSchedule] - billing_behavior: NotRequired[BillingPreviewAttachBillingBehavior] - - -class BillingPreviewAttachRequest(BaseModel): - customer_id: str - r"""The ID of the customer to attach the plan to.""" - - plan_id: str - - entity_id: OptionalNullable[str] = UNSET - r"""The ID of the entity to attach the plan to.""" - - feature_quantities: OptionalNullable[ - List[BillingPreviewAttachFeatureQuantities] - ] = UNSET - r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan.""" - - version: Optional[float] = None - r"""The version of the plan to attach.""" - - free_trial: OptionalNullable[BillingPreviewAttachFreeTrial] = UNSET - - customize: Optional[BillingPreviewAttachCustomize] = None - r"""Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.""" - - invoice_mode: Optional[BillingPreviewAttachInvoiceMode] = None - - discounts: Optional[List[BillingPreviewAttachDiscountUnion]] = None - - redirect_mode: Optional[BillingPreviewAttachRedirectMode] = "always" - - success_url: Optional[str] = None - - new_billing_subscription: Optional[bool] = None - - plan_schedule: Optional[BillingPreviewAttachPlanSchedule] = None - - billing_behavior: Optional[BillingPreviewAttachBillingBehavior] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "entity_id", - "feature_quantities", - "version", - "free_trial", - "customize", - "invoice_mode", - "discounts", - "redirect_mode", - "success_url", - "new_billing_subscription", - "plan_schedule", - "billing_behavior", - ] - ) - nullable_fields = set(["entity_id", "feature_quantities", "free_trial"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class BillingPreviewAttachDiscountResponseTypedDict(TypedDict): - amount_off: float - percent_off: NotRequired[float] - stripe_coupon_id: NotRequired[str] - coupon_name: NotRequired[str] - - -class BillingPreviewAttachDiscountResponse(BaseModel): - amount_off: Annotated[float, pydantic.Field(alias="amountOff")] - - percent_off: Annotated[Optional[float], pydantic.Field(alias="percentOff")] = None - - stripe_coupon_id: Annotated[ - Optional[str], pydantic.Field(alias="stripeCouponId") - ] = None - - coupon_name: Annotated[Optional[str], pydantic.Field(alias="couponName")] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["percentOff", "stripeCouponId", "couponName"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class BillingPreviewAttachEffectivePeriodTypedDict(TypedDict): - start: float - end: float - - -class BillingPreviewAttachEffectivePeriod(BaseModel): - start: float - - end: float - - -class BillingPreviewAttachLineItemTypedDict(TypedDict): - title: str - description: str - amount: float - plan_id: str - total_quantity: float - paid_quantity: float - discounts: NotRequired[List[BillingPreviewAttachDiscountResponseTypedDict]] - deferred_for_trial: NotRequired[bool] - effective_period: NotRequired[BillingPreviewAttachEffectivePeriodTypedDict] - is_base: NotRequired[bool] - - -class BillingPreviewAttachLineItem(BaseModel): - title: str - - description: str - - amount: float - - plan_id: str - - total_quantity: float - - paid_quantity: float - - discounts: Optional[List[BillingPreviewAttachDiscountResponse]] = None - - deferred_for_trial: Optional[bool] = None - - effective_period: Optional[BillingPreviewAttachEffectivePeriod] = None - - is_base: Optional[bool] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["discounts", "deferred_for_trial", "effective_period", "is_base"] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class BillingPreviewAttachNextCycleDiscountTypedDict(TypedDict): - amount_off: float - percent_off: NotRequired[float] - stripe_coupon_id: NotRequired[str] - coupon_name: NotRequired[str] - - -class BillingPreviewAttachNextCycleDiscount(BaseModel): - amount_off: Annotated[float, pydantic.Field(alias="amountOff")] - - percent_off: Annotated[Optional[float], pydantic.Field(alias="percentOff")] = None - - stripe_coupon_id: Annotated[ - Optional[str], pydantic.Field(alias="stripeCouponId") - ] = None - - coupon_name: Annotated[Optional[str], pydantic.Field(alias="couponName")] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["percentOff", "stripeCouponId", "couponName"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class BillingPreviewAttachNextCycleEffectivePeriodTypedDict(TypedDict): - start: float - end: float - - -class BillingPreviewAttachNextCycleEffectivePeriod(BaseModel): - start: float - - end: float - - -class BillingPreviewAttachNextCycleLineItemTypedDict(TypedDict): - title: str - description: str - amount: float - plan_id: str - total_quantity: float - paid_quantity: float - discounts: NotRequired[List[BillingPreviewAttachNextCycleDiscountTypedDict]] - deferred_for_trial: NotRequired[bool] - effective_period: NotRequired[BillingPreviewAttachNextCycleEffectivePeriodTypedDict] - is_base: NotRequired[bool] - - -class BillingPreviewAttachNextCycleLineItem(BaseModel): - title: str - - description: str - - amount: float - - plan_id: str - - total_quantity: float - - paid_quantity: float - - discounts: Optional[List[BillingPreviewAttachNextCycleDiscount]] = None - - deferred_for_trial: Optional[bool] = None - - effective_period: Optional[BillingPreviewAttachNextCycleEffectivePeriod] = None - - is_base: Optional[bool] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["discounts", "deferred_for_trial", "effective_period", "is_base"] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class BillingPreviewAttachNextCycleTypedDict(TypedDict): - starts_at: float - total: float - line_items: List[BillingPreviewAttachNextCycleLineItemTypedDict] - - -class BillingPreviewAttachNextCycle(BaseModel): - starts_at: float - - total: float - - line_items: List[BillingPreviewAttachNextCycleLineItem] - - -class IncomingFeatureQuantityTypedDict(TypedDict): - feature_id: str - quantity: float - - -class IncomingFeatureQuantity(BaseModel): - feature_id: str - - quantity: float - - -IncomingType = Union[ - Literal[ - "boolean", - "metered", - "credit_system", - ], - UnrecognizedStr, -] - - -class IncomingCreditSchemaTypedDict(TypedDict): - metered_feature_id: str - credit_cost: float - - -class IncomingCreditSchema(BaseModel): - metered_feature_id: str - - credit_cost: float - - -class IncomingDisplayTypedDict(TypedDict): - singular: NotRequired[Nullable[str]] - plural: NotRequired[Nullable[str]] - - -class IncomingDisplay(BaseModel): - singular: OptionalNullable[str] = UNSET - - plural: OptionalNullable[str] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["singular", "plural"]) - nullable_fields = set(["singular", "plural"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class IncomingFeatureTypedDict(TypedDict): - id: str - name: str - type: IncomingType - consumable: bool - archived: bool - event_names: NotRequired[List[str]] - credit_schema: NotRequired[List[IncomingCreditSchemaTypedDict]] - display: NotRequired[IncomingDisplayTypedDict] - - -class IncomingFeature(BaseModel): - id: str - - name: str - - type: IncomingType - - consumable: bool - - archived: bool - - event_names: Optional[List[str]] = None - - credit_schema: Optional[List[IncomingCreditSchema]] = None - - display: Optional[IncomingDisplay] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["event_names", "credit_schema", "display"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -IntervalIncomingEnum = Union[ - Literal[ - "one_off", - "minute", - "hour", - "day", - "week", - "month", - "quarter", - "semi_annual", - "year", - ], - UnrecognizedStr, -] - - -IncomingIntervalUnionTypedDict = TypeAliasType( - "IncomingIntervalUnionTypedDict", Union[IntervalIncomingEnum, str] -) - - -IncomingIntervalUnion = TypeAliasType( - "IncomingIntervalUnion", Union[IntervalIncomingEnum, str] -) - - -class IncomingResetTypedDict(TypedDict): - interval: IncomingIntervalUnionTypedDict - resets_at: Nullable[float] - interval_count: NotRequired[float] - - -class IncomingReset(BaseModel): - interval: IncomingIntervalUnion - - resets_at: Nullable[float] - - interval_count: Optional[float] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["interval_count"]) - nullable_fields = set(["resets_at"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class IncomingTierTypedDict(TypedDict): - amount: float - to: NotRequired[Any] - - -class IncomingTier(BaseModel): - amount: float - - to: Optional[Any] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["to"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -IncomingBillingMethod = Union[ - Literal[ - "prepaid", - "usage_based", - ], - UnrecognizedStr, -] - - -class IncomingPriceTypedDict(TypedDict): - billing_units: float - billing_method: IncomingBillingMethod - max_purchase: Nullable[float] - amount: NotRequired[float] - tiers: NotRequired[List[IncomingTierTypedDict]] - - -class IncomingPrice(BaseModel): - billing_units: float - - billing_method: IncomingBillingMethod - - max_purchase: Nullable[float] - - amount: Optional[float] = None - - tiers: Optional[List[IncomingTier]] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["amount", "tiers"]) - nullable_fields = set(["max_purchase"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class IncomingBreakdownTypedDict(TypedDict): - plan_id: Nullable[str] - included_grant: float - prepaid_grant: float - remaining: float - usage: float - unlimited: bool - reset: Nullable[IncomingResetTypedDict] - price: Nullable[IncomingPriceTypedDict] - expires_at: Nullable[float] - id: NotRequired[str] - - -class IncomingBreakdown(BaseModel): - plan_id: Nullable[str] - - included_grant: float - - prepaid_grant: float - - remaining: float - - usage: float - - unlimited: bool - - reset: Nullable[IncomingReset] - - price: Nullable[IncomingPrice] - - expires_at: Nullable[float] - - id: Optional[str] = "" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["id"]) - nullable_fields = set(["plan_id", "reset", "price", "expires_at"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class IncomingRolloverTypedDict(TypedDict): - balance: float - expires_at: float - - -class IncomingRollover(BaseModel): - balance: float - - expires_at: float - - -class IncomingBalancesTypedDict(TypedDict): - feature_id: str - granted: float - remaining: float - usage: float - unlimited: bool - overage_allowed: bool - max_purchase: Nullable[float] - next_reset_at: Nullable[float] - feature: NotRequired[IncomingFeatureTypedDict] - breakdown: NotRequired[List[IncomingBreakdownTypedDict]] - rollovers: NotRequired[List[IncomingRolloverTypedDict]] - - -class IncomingBalances(BaseModel): - feature_id: str - - granted: float - - remaining: float - - usage: float - - unlimited: bool - - overage_allowed: bool - - max_purchase: Nullable[float] - - next_reset_at: Nullable[float] - - feature: Optional[IncomingFeature] = None - - breakdown: Optional[List[IncomingBreakdown]] = None - - rollovers: Optional[List[IncomingRollover]] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["feature", "breakdown", "rollovers"]) - nullable_fields = set(["max_purchase", "next_reset_at"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class IncomingTypedDict(TypedDict): - plan: PlanTypedDict - feature_quantities: List[IncomingFeatureQuantityTypedDict] - balances: Dict[str, IncomingBalancesTypedDict] - period_start: NotRequired[float] - period_end: NotRequired[float] - - -class Incoming(BaseModel): - plan: Plan - - feature_quantities: List[IncomingFeatureQuantity] - - balances: Dict[str, IncomingBalances] - - period_start: Optional[float] = None - - period_end: Optional[float] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["period_start", "period_end"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class OutgoingFeatureQuantityTypedDict(TypedDict): - feature_id: str - quantity: float - - -class OutgoingFeatureQuantity(BaseModel): - feature_id: str - - quantity: float - - -OutgoingType = Union[ - Literal[ - "boolean", - "metered", - "credit_system", - ], - UnrecognizedStr, -] - - -class OutgoingCreditSchemaTypedDict(TypedDict): - metered_feature_id: str - credit_cost: float - - -class OutgoingCreditSchema(BaseModel): - metered_feature_id: str - - credit_cost: float - - -class OutgoingDisplayTypedDict(TypedDict): - singular: NotRequired[Nullable[str]] - plural: NotRequired[Nullable[str]] - - -class OutgoingDisplay(BaseModel): - singular: OptionalNullable[str] = UNSET - - plural: OptionalNullable[str] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["singular", "plural"]) - nullable_fields = set(["singular", "plural"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class OutgoingFeatureTypedDict(TypedDict): - id: str - name: str - type: OutgoingType - consumable: bool - archived: bool - event_names: NotRequired[List[str]] - credit_schema: NotRequired[List[OutgoingCreditSchemaTypedDict]] - display: NotRequired[OutgoingDisplayTypedDict] - - -class OutgoingFeature(BaseModel): - id: str - - name: str - - type: OutgoingType - - consumable: bool - - archived: bool - - event_names: Optional[List[str]] = None - - credit_schema: Optional[List[OutgoingCreditSchema]] = None - - display: Optional[OutgoingDisplay] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["event_names", "credit_schema", "display"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -IntervalOutgoingEnum = Union[ - Literal[ - "one_off", - "minute", - "hour", - "day", - "week", - "month", - "quarter", - "semi_annual", - "year", - ], - UnrecognizedStr, -] - - -OutgoingIntervalUnionTypedDict = TypeAliasType( - "OutgoingIntervalUnionTypedDict", Union[IntervalOutgoingEnum, str] -) - - -OutgoingIntervalUnion = TypeAliasType( - "OutgoingIntervalUnion", Union[IntervalOutgoingEnum, str] -) - - -class OutgoingResetTypedDict(TypedDict): - interval: OutgoingIntervalUnionTypedDict - resets_at: Nullable[float] - interval_count: NotRequired[float] - - -class OutgoingReset(BaseModel): - interval: OutgoingIntervalUnion - - resets_at: Nullable[float] - - interval_count: Optional[float] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["interval_count"]) - nullable_fields = set(["resets_at"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class OutgoingTierTypedDict(TypedDict): - amount: float - to: NotRequired[Any] - - -class OutgoingTier(BaseModel): - amount: float - - to: Optional[Any] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["to"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -OutgoingBillingMethod = Union[ - Literal[ - "prepaid", - "usage_based", - ], - UnrecognizedStr, -] - - -class OutgoingPriceTypedDict(TypedDict): - billing_units: float - billing_method: OutgoingBillingMethod - max_purchase: Nullable[float] - amount: NotRequired[float] - tiers: NotRequired[List[OutgoingTierTypedDict]] - - -class OutgoingPrice(BaseModel): - billing_units: float - - billing_method: OutgoingBillingMethod - - max_purchase: Nullable[float] - - amount: Optional[float] = None - - tiers: Optional[List[OutgoingTier]] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["amount", "tiers"]) - nullable_fields = set(["max_purchase"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class OutgoingBreakdownTypedDict(TypedDict): - plan_id: Nullable[str] - included_grant: float - prepaid_grant: float - remaining: float - usage: float - unlimited: bool - reset: Nullable[OutgoingResetTypedDict] - price: Nullable[OutgoingPriceTypedDict] - expires_at: Nullable[float] - id: NotRequired[str] - - -class OutgoingBreakdown(BaseModel): - plan_id: Nullable[str] - - included_grant: float - - prepaid_grant: float - - remaining: float - - usage: float - - unlimited: bool - - reset: Nullable[OutgoingReset] - - price: Nullable[OutgoingPrice] - - expires_at: Nullable[float] - - id: Optional[str] = "" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["id"]) - nullable_fields = set(["plan_id", "reset", "price", "expires_at"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class OutgoingRolloverTypedDict(TypedDict): - balance: float - expires_at: float - - -class OutgoingRollover(BaseModel): - balance: float - - expires_at: float - - -class OutgoingBalancesTypedDict(TypedDict): - feature_id: str - granted: float - remaining: float - usage: float - unlimited: bool - overage_allowed: bool - max_purchase: Nullable[float] - next_reset_at: Nullable[float] - feature: NotRequired[OutgoingFeatureTypedDict] - breakdown: NotRequired[List[OutgoingBreakdownTypedDict]] - rollovers: NotRequired[List[OutgoingRolloverTypedDict]] - - -class OutgoingBalances(BaseModel): - feature_id: str - - granted: float - - remaining: float - - usage: float - - unlimited: bool - - overage_allowed: bool - - max_purchase: Nullable[float] - - next_reset_at: Nullable[float] - - feature: Optional[OutgoingFeature] = None - - breakdown: Optional[List[OutgoingBreakdown]] = None - - rollovers: Optional[List[OutgoingRollover]] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["feature", "breakdown", "rollovers"]) - nullable_fields = set(["max_purchase", "next_reset_at"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class OutgoingTypedDict(TypedDict): - plan: PlanTypedDict - feature_quantities: List[OutgoingFeatureQuantityTypedDict] - balances: Dict[str, OutgoingBalancesTypedDict] - period_start: NotRequired[float] - period_end: NotRequired[float] - - -class Outgoing(BaseModel): - plan: Plan - - feature_quantities: List[OutgoingFeatureQuantity] - - balances: Dict[str, OutgoingBalances] - - period_start: Optional[float] = None - - period_end: Optional[float] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["period_start", "period_end"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -RedirectType = Union[ - Literal[ - "stripe_checkout", - "autumn_checkout", - ], - UnrecognizedStr, -] - - -class BillingPreviewAttachResponseTypedDict(TypedDict): - r"""OK""" - - customer_id: str - line_items: List[BillingPreviewAttachLineItemTypedDict] - total: float - currency: str - incoming: List[IncomingTypedDict] - outgoing: List[OutgoingTypedDict] - redirect_type: Nullable[RedirectType] - period_start: NotRequired[float] - period_end: NotRequired[float] - next_cycle: NotRequired[BillingPreviewAttachNextCycleTypedDict] - - -class BillingPreviewAttachResponse(BaseModel): - r"""OK""" - - customer_id: str - - line_items: List[BillingPreviewAttachLineItem] - - total: float - - currency: str - - incoming: List[Incoming] - - outgoing: List[Outgoing] - - redirect_type: Nullable[RedirectType] - - period_start: Optional[float] = None - - period_end: Optional[float] = None - - next_cycle: Optional[BillingPreviewAttachNextCycle] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["period_start", "period_end", "next_cycle"]) - nullable_fields = set(["redirect_type"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - BillingPreviewAttachDiscountResponse.model_rebuild() -except NameError: - pass -try: - BillingPreviewAttachNextCycleDiscount.model_rebuild() -except NameError: - pass diff --git a/others/python-sdk/src/autumn_sdk/models/billingupdateop.py b/others/python-sdk/src/autumn_sdk/models/billingupdateop.py index 04c0e11b2..c96d4631e 100644 --- a/others/python-sdk/src/autumn_sdk/models/billingupdateop.py +++ b/others/python-sdk/src/autumn_sdk/models/billingupdateop.py @@ -44,13 +44,13 @@ class BillingUpdateGlobals(BaseModel): return m -class BillingUpdateFeatureQuantitiesTypedDict(TypedDict): +class BillingUpdateFeatureQuantityTypedDict(TypedDict): feature_id: str quantity: NotRequired[float] adjustable: NotRequired[bool] -class BillingUpdateFeatureQuantities(BaseModel): +class BillingUpdateFeatureQuantity(BaseModel): feature_id: str quantity: Optional[float] = None @@ -417,17 +417,27 @@ class BillingUpdateCustomize(BaseModel): class BillingUpdateInvoiceModeTypedDict(TypedDict): + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" + enabled: bool + r"""When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method.""" enable_plan_immediately: NotRequired[bool] + r"""If true, enables the plan immediately even though the invoice is not paid yet.""" finalize: NotRequired[bool] + r"""If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.""" class BillingUpdateInvoiceMode(BaseModel): + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" + enabled: bool + r"""When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method.""" enable_plan_immediately: Optional[bool] = False + r"""If true, enables the plan immediately even though the invoice is not paid yet.""" finalize: Optional[bool] = True + r"""If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -446,64 +456,74 @@ class BillingUpdateInvoiceMode(BaseModel): return m +BillingUpdateBillingBehavior = Literal[ + "prorate_immediately", + "next_cycle_only", +] +r"""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.""" + + BillingUpdateCancelAction = Literal[ "cancel_immediately", "cancel_end_of_cycle", "uncancel", ] +r"""Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation.""" -BillingUpdateBillingBehavior = Literal[ - "prorate_immediately", - "next_cycle_only", -] - - -class BillingUpdateRequestTypedDict(TypedDict): +class UpdateSubscriptionParamsTypedDict(TypedDict): customer_id: str r"""The ID of the customer to attach the plan to.""" - entity_id: NotRequired[Nullable[str]] + plan_id: str + r"""The ID of the plan.""" + entity_id: NotRequired[str] r"""The ID of the entity to attach the plan to.""" - feature_quantities: NotRequired[ - Nullable[List[BillingUpdateFeatureQuantitiesTypedDict]] - ] + feature_quantities: NotRequired[List[BillingUpdateFeatureQuantityTypedDict]] r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan.""" version: NotRequired[float] r"""The version of the plan to attach.""" free_trial: NotRequired[Nullable[BillingUpdateFreeTrialTypedDict]] + r"""Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.""" customize: NotRequired[BillingUpdateCustomizeTypedDict] r"""Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.""" - plan_id: NotRequired[str] invoice_mode: NotRequired[BillingUpdateInvoiceModeTypedDict] - cancel_action: NotRequired[BillingUpdateCancelAction] + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" billing_behavior: NotRequired[BillingUpdateBillingBehavior] + r"""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.""" + cancel_action: NotRequired[BillingUpdateCancelAction] + r"""Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation.""" -class BillingUpdateRequest(BaseModel): +class UpdateSubscriptionParams(BaseModel): customer_id: str r"""The ID of the customer to attach the plan to.""" - entity_id: OptionalNullable[str] = UNSET + plan_id: str + r"""The ID of the plan.""" + + entity_id: Optional[str] = None r"""The ID of the entity to attach the plan to.""" - feature_quantities: OptionalNullable[List[BillingUpdateFeatureQuantities]] = UNSET + feature_quantities: Optional[List[BillingUpdateFeatureQuantity]] = None r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan.""" version: Optional[float] = None r"""The version of the plan to attach.""" free_trial: OptionalNullable[BillingUpdateFreeTrial] = UNSET + r"""Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.""" customize: Optional[BillingUpdateCustomize] = None r"""Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.""" - plan_id: Optional[str] = None - invoice_mode: Optional[BillingUpdateInvoiceMode] = None - - cancel_action: Optional[BillingUpdateCancelAction] = None + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" billing_behavior: Optional[BillingUpdateBillingBehavior] = None + r"""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.""" + + cancel_action: Optional[BillingUpdateCancelAction] = None + r"""Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -514,13 +534,12 @@ class BillingUpdateRequest(BaseModel): "version", "free_trial", "customize", - "plan_id", "invoice_mode", - "cancel_action", "billing_behavior", + "cancel_action", ] ) - nullable_fields = set(["entity_id", "feature_quantities", "free_trial"]) + nullable_fields = set(["free_trial"]) serialized = handler(self) m = {} @@ -544,23 +563,37 @@ class BillingUpdateRequest(BaseModel): class BillingUpdateInvoiceTypedDict(TypedDict): + r"""Invoice details if an invoice was created. Only present when a charge was made.""" + status: Nullable[str] + r"""The status of the invoice (e.g., 'paid', 'open', 'draft').""" stripe_id: str + r"""The Stripe invoice ID.""" total: float + r"""The total amount of the invoice in cents.""" currency: str + r"""The three-letter ISO currency code (e.g., 'usd').""" hosted_invoice_url: Nullable[str] + r"""URL to the hosted invoice page where the customer can view and pay the invoice.""" class BillingUpdateInvoice(BaseModel): + r"""Invoice details if an invoice was created. Only present when a charge was made.""" + status: Nullable[str] + r"""The status of the invoice (e.g., 'paid', 'open', 'draft').""" stripe_id: str + r"""The Stripe invoice ID.""" total: float + r"""The total amount of the invoice in cents.""" currency: str + r"""The three-letter ISO currency code (e.g., 'usd').""" hosted_invoice_url: Nullable[str] + r"""URL to the hosted invoice page where the customer can view and pay the invoice.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -585,41 +618,60 @@ BillingUpdateCode = Union[ ], UnrecognizedStr, ] +r"""The type of action required to complete the payment.""" class BillingUpdateRequiredActionTypedDict(TypedDict): + r"""Details about any action required to complete the payment. Present when the payment could not be processed automatically.""" + code: BillingUpdateCode + r"""The type of action required to complete the payment.""" reason: str + r"""A human-readable explanation of why this action is required.""" class BillingUpdateRequiredAction(BaseModel): + r"""Details about any action required to complete the payment. Present when the payment could not be processed automatically.""" + code: BillingUpdateCode + r"""The type of action required to complete the payment.""" reason: str + r"""A human-readable explanation of why this action is required.""" class BillingUpdateResponseTypedDict(TypedDict): r"""OK""" customer_id: str + r"""The ID of the customer.""" payment_url: Nullable[str] + r"""URL to redirect the customer to complete payment. Null if no payment action is required.""" entity_id: NotRequired[str] + r"""The ID of the entity, if the plan was attached to an entity.""" invoice: NotRequired[BillingUpdateInvoiceTypedDict] + r"""Invoice details if an invoice was created. Only present when a charge was made.""" required_action: NotRequired[BillingUpdateRequiredActionTypedDict] + r"""Details about any action required to complete the payment. Present when the payment could not be processed automatically.""" class BillingUpdateResponse(BaseModel): r"""OK""" customer_id: str + r"""The ID of the customer.""" payment_url: Nullable[str] + r"""URL to redirect the customer to complete payment. Null if no payment action is required.""" entity_id: Optional[str] = None + r"""The ID of the entity, if the plan was attached to an entity.""" invoice: Optional[BillingUpdateInvoice] = None + r"""Invoice details if an invoice was created. Only present when a charge was made.""" required_action: Optional[BillingUpdateRequiredAction] = None + r"""Details about any action required to complete the payment. Present when the payment could not be processed automatically.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/others/python-sdk/src/autumn_sdk/models/balancescheckop.py b/others/python-sdk/src/autumn_sdk/models/checkop.py similarity index 71% rename from others/python-sdk/src/autumn_sdk/models/balancescheckop.py rename to others/python-sdk/src/autumn_sdk/models/checkop.py index 23ee9fc6c..10f0044f5 100644 --- a/others/python-sdk/src/autumn_sdk/models/balancescheckop.py +++ b/others/python-sdk/src/autumn_sdk/models/checkop.py @@ -16,11 +16,11 @@ from typing import Any, Dict, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -class BalancesCheckGlobalsTypedDict(TypedDict): +class CheckGlobalsTypedDict(TypedDict): x_api_version: NotRequired[str] -class BalancesCheckGlobals(BaseModel): +class CheckGlobals(BaseModel): x_api_version: Annotated[ Optional[str], pydantic.Field(alias="x-api-version"), @@ -44,42 +44,44 @@ class BalancesCheckGlobals(BaseModel): return m -class BalancesCheckRequestTypedDict(TypedDict): +class CheckParamsTypedDict(TypedDict): customer_id: str - r"""ID which you provided when creating the customer""" + r"""The ID of the customer.""" feature_id: str - r"""ID of the feature to check access to.""" + r"""The ID of the feature.""" entity_id: NotRequired[str] - r"""If using entity balances (eg, seats), the entity ID to check access for.""" + r"""The ID of the entity for entity-scoped balances (e.g., per-seat limits).""" required_balance: NotRequired[float] - r"""If you know the amount of the feature the end user is consuming in advance. If their balance is below this quantity, allowed will be false.""" + r"""Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1.""" properties: NotRequired[Dict[str, Any]] + r"""Additional properties to attach to the usage event if send_event is true.""" send_event: NotRequired[bool] - r"""If true, a usage event will be recorded together with checking access. The required_balance field will be used as the usage value.""" + r"""If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call.""" with_preview: NotRequired[bool] - r"""If true, the response will include a preview object, which can be used to display information such as a paywall or upgrade confirmation.""" + r"""If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls.""" -class BalancesCheckRequest(BaseModel): +class CheckParams(BaseModel): customer_id: str - r"""ID which you provided when creating the customer""" + r"""The ID of the customer.""" feature_id: str - r"""ID of the feature to check access to.""" + r"""The ID of the feature.""" entity_id: Optional[str] = None - r"""If using entity balances (eg, seats), the entity ID to check access for.""" + r"""The ID of the entity for entity-scoped balances (e.g., per-seat limits).""" required_balance: Optional[float] = None - r"""If you know the amount of the feature the end user is consuming in advance. If their balance is below this quantity, allowed will be false.""" + r"""Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1.""" properties: Optional[Dict[str, Any]] = None + r"""Additional properties to attach to the usage event if send_event is true.""" send_event: Optional[bool] = None - r"""If true, a usage event will be recorded together with checking access. The required_balance field will be used as the usage value.""" + r"""If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call.""" with_preview: Optional[bool] = None - r"""If true, the response will include a preview object, which can be used to display information such as a paywall or upgrade confirmation.""" + r"""If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -106,7 +108,7 @@ class BalancesCheckRequest(BaseModel): return m -BalancesCheckBalanceType = Union[ +CheckBalanceType = Union[ Literal[ "boolean", "metered", @@ -116,23 +118,23 @@ BalancesCheckBalanceType = Union[ ] -class BalancesCheckCreditSchemaTypedDict(TypedDict): +class CheckCreditSchemaTypedDict(TypedDict): metered_feature_id: str credit_cost: float -class BalancesCheckCreditSchema(BaseModel): +class CheckCreditSchema(BaseModel): metered_feature_id: str credit_cost: float -class BalancesCheckBalanceDisplayTypedDict(TypedDict): +class CheckBalanceDisplayTypedDict(TypedDict): singular: NotRequired[Nullable[str]] plural: NotRequired[Nullable[str]] -class BalancesCheckBalanceDisplay(BaseModel): +class CheckBalanceDisplay(BaseModel): singular: OptionalNullable[str] = UNSET plural: OptionalNullable[str] = UNSET @@ -163,23 +165,27 @@ class BalancesCheckBalanceDisplay(BaseModel): return m -class BalancesCheckFeatureTypedDict(TypedDict): +class CheckFeatureTypedDict(TypedDict): + r"""The full feature object if expanded.""" + id: str name: str - type: BalancesCheckBalanceType + type: CheckBalanceType consumable: bool archived: bool event_names: NotRequired[List[str]] - credit_schema: NotRequired[List[BalancesCheckCreditSchemaTypedDict]] - display: NotRequired[BalancesCheckBalanceDisplayTypedDict] + credit_schema: NotRequired[List[CheckCreditSchemaTypedDict]] + display: NotRequired[CheckBalanceDisplayTypedDict] -class BalancesCheckFeature(BaseModel): +class CheckFeature(BaseModel): + r"""The full feature object if expanded.""" + id: str name: str - type: BalancesCheckBalanceType + type: CheckBalanceType consumable: bool @@ -187,9 +193,9 @@ class BalancesCheckFeature(BaseModel): event_names: Optional[List[str]] = None - credit_schema: Optional[List[BalancesCheckCreditSchema]] = None + credit_schema: Optional[List[CheckCreditSchema]] = None - display: Optional[BalancesCheckBalanceDisplay] = None + display: Optional[CheckBalanceDisplay] = None @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -208,7 +214,7 @@ class BalancesCheckFeature(BaseModel): return m -BalancesCheckBalanceIntervalEnum = Union[ +CheckBalanceIntervalEnum = Union[ Literal[ "one_off", "minute", @@ -224,28 +230,36 @@ BalancesCheckBalanceIntervalEnum = Union[ ] -BalancesCheckIntervalUnionTypedDict = TypeAliasType( - "BalancesCheckIntervalUnionTypedDict", Union[BalancesCheckBalanceIntervalEnum, str] +CheckIntervalUnionTypedDict = TypeAliasType( + "CheckIntervalUnionTypedDict", Union[CheckBalanceIntervalEnum, str] ) +r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" -BalancesCheckIntervalUnion = TypeAliasType( - "BalancesCheckIntervalUnion", Union[BalancesCheckBalanceIntervalEnum, str] +CheckIntervalUnion = TypeAliasType( + "CheckIntervalUnion", Union[CheckBalanceIntervalEnum, str] ) +r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" -class BalancesCheckResetTypedDict(TypedDict): - interval: BalancesCheckIntervalUnionTypedDict +class CheckResetTypedDict(TypedDict): + interval: CheckIntervalUnionTypedDict + r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" resets_at: Nullable[float] + r"""Timestamp when the balance will next reset.""" interval_count: NotRequired[float] + r"""Number of intervals between resets (eg. 2 for bi-monthly).""" -class BalancesCheckReset(BaseModel): - interval: BalancesCheckIntervalUnion +class CheckReset(BaseModel): + interval: CheckIntervalUnion + r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" resets_at: Nullable[float] + r"""Timestamp when the balance will next reset.""" interval_count: Optional[float] = None + r"""Number of intervals between resets (eg. 2 for bi-monthly).""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -273,52 +287,61 @@ class BalancesCheckReset(BaseModel): return m -BalancesCheckBalanceToTypedDict = TypeAliasType( - "BalancesCheckBalanceToTypedDict", Union[float, str] -) +CheckBalanceToTypedDict = TypeAliasType("CheckBalanceToTypedDict", Union[float, str]) -BalancesCheckBalanceTo = TypeAliasType("BalancesCheckBalanceTo", Union[float, str]) +CheckBalanceTo = TypeAliasType("CheckBalanceTo", Union[float, str]) -class BalancesCheckTierTypedDict(TypedDict): - to: BalancesCheckBalanceToTypedDict +class CheckTierTypedDict(TypedDict): + to: CheckBalanceToTypedDict amount: float -class BalancesCheckTier(BaseModel): - to: BalancesCheckBalanceTo +class CheckTier(BaseModel): + to: CheckBalanceTo amount: float -BalancesCheckBillingMethod = Union[ +CheckBillingMethod = Union[ Literal[ "prepaid", "usage_based", ], UnrecognizedStr, ] +r"""Whether usage is prepaid or billed pay-per-use.""" -class BalancesCheckPriceTypedDict(TypedDict): +class CheckPriceTypedDict(TypedDict): billing_units: float - billing_method: BalancesCheckBillingMethod + r"""The number of units per billing increment (eg. $9 / 250 units).""" + billing_method: CheckBillingMethod + r"""Whether usage is prepaid or billed pay-per-use.""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased, or null for unlimited.""" amount: NotRequired[float] - tiers: NotRequired[List[BalancesCheckTierTypedDict]] + r"""The per-unit price amount.""" + tiers: NotRequired[List[CheckTierTypedDict]] + r"""Tiered pricing configuration if applicable.""" -class BalancesCheckPrice(BaseModel): +class CheckPrice(BaseModel): billing_units: float + r"""The number of units per billing increment (eg. $9 / 250 units).""" - billing_method: BalancesCheckBillingMethod + billing_method: CheckBillingMethod + r"""Whether usage is prepaid or billed pay-per-use.""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased, or null for unlimited.""" amount: Optional[float] = None + r"""The per-unit price amount.""" - tiers: Optional[List[BalancesCheckTier]] = None + tiers: Optional[List[CheckTier]] = None + r"""Tiered pricing configuration if applicable.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -346,39 +369,59 @@ class BalancesCheckPrice(BaseModel): return m -class BalancesCheckBreakdownTypedDict(TypedDict): +class CheckBreakdownTypedDict(TypedDict): plan_id: Nullable[str] + r"""The plan ID this balance originates from, or null for standalone balances.""" included_grant: float + r"""Amount granted from the plan's included usage.""" prepaid_grant: float + r"""Amount granted from prepaid purchases or top-ups.""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Amount consumed in the current period.""" unlimited: bool - reset: Nullable[BalancesCheckResetTypedDict] - price: Nullable[BalancesCheckPriceTypedDict] + r"""Whether this balance has unlimited usage.""" + reset: Nullable[CheckResetTypedDict] + r"""Reset configuration for this balance, or null if no reset.""" + price: Nullable[CheckPriceTypedDict] + r"""Pricing configuration if this balance has usage-based pricing.""" expires_at: Nullable[float] + r"""Timestamp when this balance expires, or null for no expiration.""" id: NotRequired[str] + r"""The unique identifier for this balance breakdown.""" -class BalancesCheckBreakdown(BaseModel): +class CheckBreakdown(BaseModel): plan_id: Nullable[str] + r"""The plan ID this balance originates from, or null for standalone balances.""" included_grant: float + r"""Amount granted from the plan's included usage.""" prepaid_grant: float + r"""Amount granted from prepaid purchases or top-ups.""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Amount consumed in the current period.""" unlimited: bool + r"""Whether this balance has unlimited usage.""" - reset: Nullable[BalancesCheckReset] + reset: Nullable[CheckReset] + r"""Reset configuration for this balance, or null if no reset.""" - price: Nullable[BalancesCheckPrice] + price: Nullable[CheckPrice] + r"""Pricing configuration if this balance has usage-based pricing.""" expires_at: Nullable[float] + r"""Timestamp when this balance expires, or null for no expiration.""" id: Optional[str] = "" + r"""The unique identifier for this balance breakdown.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -406,53 +449,79 @@ class BalancesCheckBreakdown(BaseModel): return m -class BalancesCheckBalanceRolloverTypedDict(TypedDict): +class CheckBalanceRolloverTypedDict(TypedDict): balance: float + r"""Amount of balance rolled over from a previous period.""" expires_at: float + r"""Timestamp when the rollover balance expires.""" -class BalancesCheckBalanceRollover(BaseModel): +class CheckBalanceRollover(BaseModel): balance: float + r"""Amount of balance rolled over from a previous period.""" expires_at: float + r"""Timestamp when the rollover balance expires.""" -class BalancesCheckBalanceTypedDict(TypedDict): +class CheckBalanceTypedDict(TypedDict): feature_id: str + r"""The feature ID this balance is for.""" granted: float + r"""Total balance granted (included + prepaid).""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Total usage consumed in the current period.""" unlimited: bool + r"""Whether this feature has unlimited usage.""" overage_allowed: bool + r"""Whether usage beyond the granted balance is allowed (with overage charges).""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased as a top-up, or null for unlimited.""" next_reset_at: Nullable[float] - feature: NotRequired[BalancesCheckFeatureTypedDict] - breakdown: NotRequired[List[BalancesCheckBreakdownTypedDict]] - rollovers: NotRequired[List[BalancesCheckBalanceRolloverTypedDict]] + r"""Timestamp when the balance will reset, or null for no reset.""" + feature: NotRequired[CheckFeatureTypedDict] + r"""The full feature object if expanded.""" + breakdown: NotRequired[List[CheckBreakdownTypedDict]] + r"""Detailed breakdown of balance sources when stacking multiple plans or grants.""" + rollovers: NotRequired[List[CheckBalanceRolloverTypedDict]] + r"""Rollover balances carried over from previous periods.""" -class BalancesCheckBalance(BaseModel): +class CheckBalance(BaseModel): feature_id: str + r"""The feature ID this balance is for.""" granted: float + r"""Total balance granted (included + prepaid).""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Total usage consumed in the current period.""" unlimited: bool + r"""Whether this feature has unlimited usage.""" overage_allowed: bool + r"""Whether usage beyond the granted balance is allowed (with overage charges).""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased as a top-up, or null for unlimited.""" next_reset_at: Nullable[float] + r"""Timestamp when the balance will reset, or null for no reset.""" - feature: Optional[BalancesCheckFeature] = None + feature: Optional[CheckFeature] = None + r"""The full feature object if expanded.""" - breakdown: Optional[List[BalancesCheckBreakdown]] = None + breakdown: Optional[List[CheckBreakdown]] = None + r"""Detailed breakdown of balance sources when stacking multiple plans or grants.""" - rollovers: Optional[List[BalancesCheckBalanceRollover]] = None + rollovers: Optional[List[CheckBalanceRollover]] = None + r"""Rollover balances carried over from previous periods.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -480,16 +549,17 @@ class BalancesCheckBalance(BaseModel): return m -BalancesCheckScenario = Union[ +CheckScenario = Union[ Literal[ "usage_limit", "feature_flag", ], UnrecognizedStr, ] +r"""The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan.""" -BalancesCheckEnv = Union[ +CheckEnv = Union[ Literal[ "sandbox", "live", @@ -657,7 +727,7 @@ class ConfigRollover(BaseModel): return m -BalancesCheckOnIncrease = Union[ +CheckOnIncrease = Union[ Literal[ "bill_immediately", "prorate_immediately", @@ -668,7 +738,7 @@ BalancesCheckOnIncrease = Union[ ] -BalancesCheckOnDecrease = Union[ +CheckOnDecrease = Union[ Literal[ "prorate", "prorate_immediately", @@ -682,16 +752,16 @@ BalancesCheckOnDecrease = Union[ class ConfigTypedDict(TypedDict): rollover: NotRequired[Nullable[ConfigRolloverTypedDict]] - on_increase: NotRequired[Nullable[BalancesCheckOnIncrease]] - on_decrease: NotRequired[Nullable[BalancesCheckOnDecrease]] + on_increase: NotRequired[Nullable[CheckOnIncrease]] + on_decrease: NotRequired[Nullable[CheckOnDecrease]] class Config(BaseModel): rollover: OptionalNullable[ConfigRollover] = UNSET - on_increase: OptionalNullable[BalancesCheckOnIncrease] = UNSET + on_increase: OptionalNullable[CheckOnIncrease] = UNSET - on_decrease: OptionalNullable[BalancesCheckOnDecrease] = UNSET + on_decrease: OptionalNullable[CheckOnDecrease] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -719,7 +789,7 @@ class Config(BaseModel): return m -class BalancesCheckItemTypedDict(TypedDict): +class CheckItemTypedDict(TypedDict): r"""Product item defining features and pricing within a product""" type: NotRequired[Nullable[ProductType]] @@ -756,7 +826,7 @@ class BalancesCheckItemTypedDict(TypedDict): r"""Configuration for rollover and proration behavior of the feature.""" -class BalancesCheckItem(BaseModel): +class CheckItem(BaseModel): r"""Product item defining features and pricing within a product""" type: OptionalNullable[ProductType] = UNSET @@ -882,7 +952,7 @@ FreeTrialDuration = Union[ r"""The duration type of the free trial""" -class BalancesCheckFreeTrialTypedDict(TypedDict): +class CheckFreeTrialTypedDict(TypedDict): duration: FreeTrialDuration r"""The duration type of the free trial""" length: float @@ -895,7 +965,7 @@ class BalancesCheckFreeTrialTypedDict(TypedDict): r"""Used in customer context. Whether the free trial is available for the customer if they were to attach the product.""" -class BalancesCheckFreeTrial(BaseModel): +class CheckFreeTrial(BaseModel): duration: FreeTrialDuration r"""The duration type of the free trial""" @@ -954,7 +1024,7 @@ ProductScenario = Union[ r"""Scenario for when this product is used in attach flows""" -class PropertiesTypedDict(TypedDict): +class CheckPropertiesTypedDict(TypedDict): is_free: bool r"""True if the product has no base price or usage prices""" is_one_off: bool @@ -967,7 +1037,7 @@ class PropertiesTypedDict(TypedDict): r"""True if the product can be updated after creation (only applicable if there are prepaid recurring prices)""" -class Properties(BaseModel): +class CheckProperties(BaseModel): is_free: bool r"""True if the product has no base price or usage prices""" @@ -1016,7 +1086,7 @@ class ProductTypedDict(TypedDict): r"""The name of the product""" group: Nullable[str] r"""Product group which this product belongs to""" - env: BalancesCheckEnv + env: CheckEnv r"""The environment of the product""" is_add_on: bool r"""Whether the product is an add-on and can be purchased alongside other products""" @@ -1028,15 +1098,15 @@ class ProductTypedDict(TypedDict): r"""The current version of the product""" created_at: float r"""The timestamp of when the product was created in milliseconds since epoch""" - items: List[BalancesCheckItemTypedDict] + items: List[CheckItemTypedDict] r"""Array of product items that define the product's features and pricing""" - free_trial: Nullable[BalancesCheckFreeTrialTypedDict] + free_trial: Nullable[CheckFreeTrialTypedDict] r"""Free trial configuration for this product, if available""" base_variant_id: Nullable[str] r"""ID of the base variant this product is derived from""" scenario: NotRequired[ProductScenario] r"""Scenario for when this product is used in attach flows""" - properties: NotRequired[PropertiesTypedDict] + properties: NotRequired[CheckPropertiesTypedDict] class Product(BaseModel): @@ -1049,7 +1119,7 @@ class Product(BaseModel): group: Nullable[str] r"""Product group which this product belongs to""" - env: BalancesCheckEnv + env: CheckEnv r"""The environment of the product""" is_add_on: bool @@ -1067,10 +1137,10 @@ class Product(BaseModel): created_at: float r"""The timestamp of when the product was created in milliseconds since epoch""" - items: List[BalancesCheckItem] + items: List[CheckItem] r"""Array of product items that define the product's features and pricing""" - free_trial: Nullable[BalancesCheckFreeTrial] + free_trial: Nullable[CheckFreeTrial] r"""Free trial configuration for this product, if available""" base_variant_id: Nullable[str] @@ -1079,7 +1149,7 @@ class Product(BaseModel): scenario: Optional[ProductScenario] = None r"""Scenario for when this product is used in attach flows""" - properties: Optional[Properties] = None + properties: Optional[CheckProperties] = None @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -1108,53 +1178,81 @@ class Product(BaseModel): class PreviewTypedDict(TypedDict): - scenario: BalancesCheckScenario + r"""Upgrade/upsell information when access is denied. Only present if with_preview was true and allowed is false.""" + + scenario: CheckScenario + r"""The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan.""" title: str + r"""A title suitable for displaying in a paywall or upgrade modal.""" message: str + r"""A message explaining why access was denied.""" feature_id: str + r"""The ID of the feature that was checked.""" feature_name: str + r"""The display name of the feature.""" products: List[ProductTypedDict] + r"""Products that would grant access to this feature. Use to display upgrade options.""" class Preview(BaseModel): - scenario: BalancesCheckScenario + r"""Upgrade/upsell information when access is denied. Only present if with_preview was true and allowed is false.""" + + scenario: CheckScenario + r"""The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan.""" title: str + r"""A title suitable for displaying in a paywall or upgrade modal.""" message: str + r"""A message explaining why access was denied.""" feature_id: str + r"""The ID of the feature that was checked.""" feature_name: str + r"""The display name of the feature.""" products: List[Product] + r"""Products that would grant access to this feature. Use to display upgrade options.""" -class BalancesCheckResponseTypedDict(TypedDict): +class CheckResponseTypedDict(TypedDict): r"""OK""" allowed: bool + r"""Whether the customer is allowed to use the feature. True if they have sufficient balance or the feature is unlimited/boolean.""" customer_id: str - balance: Nullable[BalancesCheckBalanceTypedDict] + r"""The ID of the customer that was checked.""" + balance: Nullable[CheckBalanceTypedDict] + r"""The customer's balance for this feature. Null if the customer has no balance for this feature.""" entity_id: NotRequired[Nullable[str]] + r"""The ID of the entity, if an entity-scoped check was performed.""" required_balance: NotRequired[float] + r"""The required balance that was checked against.""" preview: NotRequired[PreviewTypedDict] + r"""Upgrade/upsell information when access is denied. Only present if with_preview was true and allowed is false.""" -class BalancesCheckResponse(BaseModel): +class CheckResponse(BaseModel): r"""OK""" allowed: bool + r"""Whether the customer is allowed to use the feature. True if they have sufficient balance or the feature is unlimited/boolean.""" customer_id: str + r"""The ID of the customer that was checked.""" - balance: Nullable[BalancesCheckBalance] + balance: Nullable[CheckBalance] + r"""The customer's balance for this feature. Null if the customer has no balance for this feature.""" entity_id: OptionalNullable[str] = UNSET + r"""The ID of the entity, if an entity-scoped check was performed.""" required_balance: Optional[float] = None + r"""The required balance that was checked against.""" preview: Optional[Preview] = None + r"""Upgrade/upsell information when access is denied. Only present if with_preview was true and allowed is false.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/others/python-sdk/src/autumn_sdk/models/balancescreateop.py b/others/python-sdk/src/autumn_sdk/models/createbalanceop.py similarity index 54% rename from others/python-sdk/src/autumn_sdk/models/balancescreateop.py rename to others/python-sdk/src/autumn_sdk/models/createbalanceop.py index cfec2c9f9..e600cfde9 100644 --- a/others/python-sdk/src/autumn_sdk/models/balancescreateop.py +++ b/others/python-sdk/src/autumn_sdk/models/createbalanceop.py @@ -9,11 +9,11 @@ from typing import Literal, Optional from typing_extensions import Annotated, NotRequired, TypedDict -class BalancesCreateGlobalsTypedDict(TypedDict): +class CreateBalanceGlobalsTypedDict(TypedDict): x_api_version: NotRequired[str] -class BalancesCreateGlobals(BaseModel): +class CreateBalanceGlobals(BaseModel): x_api_version: Annotated[ Optional[str], pydantic.Field(alias="x-api-version"), @@ -37,7 +37,7 @@ class BalancesCreateGlobals(BaseModel): return m -BalancesCreateInterval = Literal[ +CreateBalanceInterval = Literal[ "one_off", "minute", "hour", @@ -48,21 +48,26 @@ BalancesCreateInterval = Literal[ "semi_annual", "year", ] +r"""The interval at which the balance resets (e.g., 'month', 'day', 'year').""" -class BalancesCreateResetTypedDict(TypedDict): - r"""Reset configuration for the balance""" +class CreateBalanceResetTypedDict(TypedDict): + r"""Reset configuration for the balance. If not provided, the balance is a one-time grant that never resets.""" - interval: BalancesCreateInterval + interval: CreateBalanceInterval + r"""The interval at which the balance resets (e.g., 'month', 'day', 'year').""" interval_count: NotRequired[float] + r"""Number of intervals between resets. Defaults to 1 (e.g., interval_count: 2 with interval: 'month' resets every 2 months).""" -class BalancesCreateReset(BaseModel): - r"""Reset configuration for the balance""" +class CreateBalanceReset(BaseModel): + r"""Reset configuration for the balance. If not provided, the balance is a one-time grant that never resets.""" - interval: BalancesCreateInterval + interval: CreateBalanceInterval + r"""The interval at which the balance resets (e.g., 'month', 'day', 'year').""" interval_count: Optional[float] = None + r"""Number of intervals between resets. Defaults to 1 (e.g., interval_count: 2 with interval: 'month' resets every 2 months).""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -81,45 +86,45 @@ class BalancesCreateReset(BaseModel): return m -class BalancesCreateRequestTypedDict(TypedDict): - feature_id: str - r"""The feature ID to create the balance for""" +class CreateBalanceParamsTypedDict(TypedDict): customer_id: str - r"""The customer ID to assign the balance to""" + r"""The ID of the customer.""" + feature_id: str + r"""The ID of the feature.""" entity_id: NotRequired[str] - r"""Entity ID for entity-scoped balances""" + r"""The ID of the entity for entity-scoped balances (e.g., per-seat limits).""" included: NotRequired[float] - r"""The initial balance amount to grant""" + r"""The initial balance amount to grant. For metered features, this is the number of units the customer can use.""" unlimited: NotRequired[bool] - r"""Whether the balance is unlimited""" - reset: NotRequired[BalancesCreateResetTypedDict] - r"""Reset configuration for the balance""" + r"""If true, the balance has unlimited usage. Cannot be combined with 'included'.""" + reset: NotRequired[CreateBalanceResetTypedDict] + r"""Reset configuration for the balance. If not provided, the balance is a one-time grant that never resets.""" expires_at: NotRequired[float] - r"""Unix timestamp (milliseconds) when the balance expires""" + r"""Unix timestamp (milliseconds) when the balance expires. Mutually exclusive with reset.""" granted_balance: NotRequired[float] -class BalancesCreateRequest(BaseModel): - feature_id: str - r"""The feature ID to create the balance for""" - +class CreateBalanceParams(BaseModel): customer_id: str - r"""The customer ID to assign the balance to""" + r"""The ID of the customer.""" + + feature_id: str + r"""The ID of the feature.""" entity_id: Optional[str] = None - r"""Entity ID for entity-scoped balances""" + r"""The ID of the entity for entity-scoped balances (e.g., per-seat limits).""" included: Optional[float] = None - r"""The initial balance amount to grant""" + r"""The initial balance amount to grant. For metered features, this is the number of units the customer can use.""" unlimited: Optional[bool] = None - r"""Whether the balance is unlimited""" + r"""If true, the balance has unlimited usage. Cannot be combined with 'included'.""" - reset: Optional[BalancesCreateReset] = None - r"""Reset configuration for the balance""" + reset: Optional[CreateBalanceReset] = None + r"""Reset configuration for the balance. If not provided, the balance is a one-time grant that never resets.""" expires_at: Optional[float] = None - r"""Unix timestamp (milliseconds) when the balance expires""" + r"""Unix timestamp (milliseconds) when the balance expires. Mutually exclusive with reset.""" granted_balance: Optional[float] = None @@ -149,13 +154,13 @@ class BalancesCreateRequest(BaseModel): return m -class BalancesCreateResponseTypedDict(TypedDict): +class CreateBalanceResponseTypedDict(TypedDict): r"""OK""" success: bool -class BalancesCreateResponse(BaseModel): +class CreateBalanceResponse(BaseModel): r"""OK""" success: bool diff --git a/others/python-sdk/src/autumn_sdk/models/createentityop.py b/others/python-sdk/src/autumn_sdk/models/createentityop.py new file mode 100644 index 000000000..8823595c0 --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/createentityop.py @@ -0,0 +1,862 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .customerdata import CustomerData, CustomerDataTypedDict +from .plan import Plan, PlanTypedDict +from autumn_sdk.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import Dict, List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class CreateEntityGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class CreateEntityGlobals(BaseModel): + x_api_version: Annotated[ + Optional[str], + pydantic.Field(alias="x-api-version"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = "2.1" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["x-api-version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class CreateEntityParamsTypedDict(TypedDict): + feature_id: str + r"""The ID of the feature this entity is associated with""" + customer_id: str + r"""The ID of the customer to create the entity for.""" + entity_id: str + r"""The ID of the entity.""" + name: NotRequired[Nullable[str]] + r"""The name of the entity""" + customer_data: NotRequired[CustomerDataTypedDict] + r"""Customer details to set when creating a customer""" + + +class CreateEntityParams(BaseModel): + feature_id: str + r"""The ID of the feature this entity is associated with""" + + customer_id: str + r"""The ID of the customer to create the entity for.""" + + entity_id: str + r"""The ID of the entity.""" + + name: OptionalNullable[str] = UNSET + r"""The name of the entity""" + + customer_data: Optional[CustomerData] = None + r"""Customer details to set when creating a customer""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["name", "customer_data"]) + nullable_fields = set(["name"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +CreateEntityEnv = Union[ + Literal[ + "sandbox", + "live", + ], + UnrecognizedStr, +] +r"""The environment (sandbox/live)""" + + +CreateEntityStatus = Union[ + Literal[ + "active", + "scheduled", + ], + UnrecognizedStr, +] +r"""Current status of the subscription.""" + + +class CreateEntitySubscriptionTypedDict(TypedDict): + plan_id: str + r"""The unique identifier of the subscribed plan.""" + auto_enable: bool + r"""Whether the plan was automatically enabled for the customer.""" + add_on: bool + r"""Whether this is an add-on plan rather than a base subscription.""" + status: CreateEntityStatus + r"""Current status of the subscription.""" + past_due: bool + r"""Whether the subscription has overdue payments.""" + canceled_at: Nullable[float] + r"""Timestamp when the subscription was canceled, or null if not canceled.""" + expires_at: Nullable[float] + r"""Timestamp when the subscription will expire, or null if no expiry set.""" + trial_ends_at: Nullable[float] + r"""Timestamp when the trial period ends, or null if not on trial.""" + started_at: float + r"""Timestamp when the subscription started.""" + current_period_start: Nullable[float] + r"""Start timestamp of the current billing period.""" + current_period_end: Nullable[float] + r"""End timestamp of the current billing period.""" + quantity: float + r"""Number of units of this subscription (for per-seat plans).""" + plan: NotRequired[PlanTypedDict] + + +class CreateEntitySubscription(BaseModel): + plan_id: str + r"""The unique identifier of the subscribed plan.""" + + auto_enable: bool + r"""Whether the plan was automatically enabled for the customer.""" + + add_on: bool + r"""Whether this is an add-on plan rather than a base subscription.""" + + status: CreateEntityStatus + r"""Current status of the subscription.""" + + past_due: bool + r"""Whether the subscription has overdue payments.""" + + canceled_at: Nullable[float] + r"""Timestamp when the subscription was canceled, or null if not canceled.""" + + expires_at: Nullable[float] + r"""Timestamp when the subscription will expire, or null if no expiry set.""" + + trial_ends_at: Nullable[float] + r"""Timestamp when the trial period ends, or null if not on trial.""" + + started_at: float + r"""Timestamp when the subscription started.""" + + current_period_start: Nullable[float] + r"""Start timestamp of the current billing period.""" + + current_period_end: Nullable[float] + r"""End timestamp of the current billing period.""" + + quantity: float + r"""Number of units of this subscription (for per-seat plans).""" + + plan: Optional[Plan] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["plan"]) + nullable_fields = set( + [ + "canceled_at", + "expires_at", + "trial_ends_at", + "current_period_start", + "current_period_end", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class CreateEntityPurchaseTypedDict(TypedDict): + plan_id: str + r"""The unique identifier of the purchased plan.""" + expires_at: Nullable[float] + r"""Timestamp when the purchase expires, or null for lifetime access.""" + started_at: float + r"""Timestamp when the purchase was made.""" + quantity: float + r"""Number of units purchased.""" + plan: NotRequired[PlanTypedDict] + + +class CreateEntityPurchase(BaseModel): + plan_id: str + r"""The unique identifier of the purchased plan.""" + + expires_at: Nullable[float] + r"""Timestamp when the purchase expires, or null for lifetime access.""" + + started_at: float + r"""Timestamp when the purchase was made.""" + + quantity: float + r"""Number of units purchased.""" + + plan: Optional[Plan] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["plan"]) + nullable_fields = set(["expires_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +CreateEntityType = Union[ + Literal[ + "boolean", + "metered", + "credit_system", + ], + UnrecognizedStr, +] + + +class CreateEntityCreditSchemaTypedDict(TypedDict): + metered_feature_id: str + credit_cost: float + + +class CreateEntityCreditSchema(BaseModel): + metered_feature_id: str + + credit_cost: float + + +class CreateEntityDisplayTypedDict(TypedDict): + singular: NotRequired[Nullable[str]] + plural: NotRequired[Nullable[str]] + + +class CreateEntityDisplay(BaseModel): + singular: OptionalNullable[str] = UNSET + + plural: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["singular", "plural"]) + nullable_fields = set(["singular", "plural"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class CreateEntityFeatureTypedDict(TypedDict): + r"""The full feature object if expanded.""" + + id: str + name: str + type: CreateEntityType + consumable: bool + archived: bool + event_names: NotRequired[List[str]] + credit_schema: NotRequired[List[CreateEntityCreditSchemaTypedDict]] + display: NotRequired[CreateEntityDisplayTypedDict] + + +class CreateEntityFeature(BaseModel): + r"""The full feature object if expanded.""" + + id: str + + name: str + + type: CreateEntityType + + consumable: bool + + archived: bool + + event_names: Optional[List[str]] = None + + credit_schema: Optional[List[CreateEntityCreditSchema]] = None + + display: Optional[CreateEntityDisplay] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["event_names", "credit_schema", "display"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +CreateEntityIntervalEnum = Union[ + Literal[ + "one_off", + "minute", + "hour", + "day", + "week", + "month", + "quarter", + "semi_annual", + "year", + ], + UnrecognizedStr, +] + + +CreateEntityIntervalUnionTypedDict = TypeAliasType( + "CreateEntityIntervalUnionTypedDict", Union[CreateEntityIntervalEnum, str] +) +r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" + + +CreateEntityIntervalUnion = TypeAliasType( + "CreateEntityIntervalUnion", Union[CreateEntityIntervalEnum, str] +) +r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" + + +class CreateEntityResetTypedDict(TypedDict): + interval: CreateEntityIntervalUnionTypedDict + r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" + resets_at: Nullable[float] + r"""Timestamp when the balance will next reset.""" + interval_count: NotRequired[float] + r"""Number of intervals between resets (eg. 2 for bi-monthly).""" + + +class CreateEntityReset(BaseModel): + interval: CreateEntityIntervalUnion + r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" + + resets_at: Nullable[float] + r"""Timestamp when the balance will next reset.""" + + interval_count: Optional[float] = None + r"""Number of intervals between resets (eg. 2 for bi-monthly).""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count"]) + nullable_fields = set(["resets_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +CreateEntityToTypedDict = TypeAliasType("CreateEntityToTypedDict", Union[float, str]) + + +CreateEntityTo = TypeAliasType("CreateEntityTo", Union[float, str]) + + +class CreateEntityTierTypedDict(TypedDict): + to: CreateEntityToTypedDict + amount: float + + +class CreateEntityTier(BaseModel): + to: CreateEntityTo + + amount: float + + +CreateEntityBillingMethod = Union[ + Literal[ + "prepaid", + "usage_based", + ], + UnrecognizedStr, +] +r"""Whether usage is prepaid or billed pay-per-use.""" + + +class CreateEntityPriceTypedDict(TypedDict): + billing_units: float + r"""The number of units per billing increment (eg. $9 / 250 units).""" + billing_method: CreateEntityBillingMethod + r"""Whether usage is prepaid or billed pay-per-use.""" + max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased, or null for unlimited.""" + amount: NotRequired[float] + r"""The per-unit price amount.""" + tiers: NotRequired[List[CreateEntityTierTypedDict]] + r"""Tiered pricing configuration if applicable.""" + + +class CreateEntityPrice(BaseModel): + billing_units: float + r"""The number of units per billing increment (eg. $9 / 250 units).""" + + billing_method: CreateEntityBillingMethod + r"""Whether usage is prepaid or billed pay-per-use.""" + + max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased, or null for unlimited.""" + + amount: Optional[float] = None + r"""The per-unit price amount.""" + + tiers: Optional[List[CreateEntityTier]] = None + r"""Tiered pricing configuration if applicable.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["amount", "tiers"]) + nullable_fields = set(["max_purchase"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class CreateEntityBreakdownTypedDict(TypedDict): + plan_id: Nullable[str] + r"""The plan ID this balance originates from, or null for standalone balances.""" + included_grant: float + r"""Amount granted from the plan's included usage.""" + prepaid_grant: float + r"""Amount granted from prepaid purchases or top-ups.""" + remaining: float + r"""Remaining balance available for use.""" + usage: float + r"""Amount consumed in the current period.""" + unlimited: bool + r"""Whether this balance has unlimited usage.""" + reset: Nullable[CreateEntityResetTypedDict] + r"""Reset configuration for this balance, or null if no reset.""" + price: Nullable[CreateEntityPriceTypedDict] + r"""Pricing configuration if this balance has usage-based pricing.""" + expires_at: Nullable[float] + r"""Timestamp when this balance expires, or null for no expiration.""" + id: NotRequired[str] + r"""The unique identifier for this balance breakdown.""" + + +class CreateEntityBreakdown(BaseModel): + plan_id: Nullable[str] + r"""The plan ID this balance originates from, or null for standalone balances.""" + + included_grant: float + r"""Amount granted from the plan's included usage.""" + + prepaid_grant: float + r"""Amount granted from prepaid purchases or top-ups.""" + + remaining: float + r"""Remaining balance available for use.""" + + usage: float + r"""Amount consumed in the current period.""" + + unlimited: bool + r"""Whether this balance has unlimited usage.""" + + reset: Nullable[CreateEntityReset] + r"""Reset configuration for this balance, or null if no reset.""" + + price: Nullable[CreateEntityPrice] + r"""Pricing configuration if this balance has usage-based pricing.""" + + expires_at: Nullable[float] + r"""Timestamp when this balance expires, or null for no expiration.""" + + id: Optional[str] = "" + r"""The unique identifier for this balance breakdown.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["id"]) + nullable_fields = set(["plan_id", "reset", "price", "expires_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class CreateEntityRolloverTypedDict(TypedDict): + balance: float + r"""Amount of balance rolled over from a previous period.""" + expires_at: float + r"""Timestamp when the rollover balance expires.""" + + +class CreateEntityRollover(BaseModel): + balance: float + r"""Amount of balance rolled over from a previous period.""" + + expires_at: float + r"""Timestamp when the rollover balance expires.""" + + +class CreateEntityBalancesTypedDict(TypedDict): + feature_id: str + r"""The feature ID this balance is for.""" + granted: float + r"""Total balance granted (included + prepaid).""" + remaining: float + r"""Remaining balance available for use.""" + usage: float + r"""Total usage consumed in the current period.""" + unlimited: bool + r"""Whether this feature has unlimited usage.""" + overage_allowed: bool + r"""Whether usage beyond the granted balance is allowed (with overage charges).""" + max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased as a top-up, or null for unlimited.""" + next_reset_at: Nullable[float] + r"""Timestamp when the balance will reset, or null for no reset.""" + feature: NotRequired[CreateEntityFeatureTypedDict] + r"""The full feature object if expanded.""" + breakdown: NotRequired[List[CreateEntityBreakdownTypedDict]] + r"""Detailed breakdown of balance sources when stacking multiple plans or grants.""" + rollovers: NotRequired[List[CreateEntityRolloverTypedDict]] + r"""Rollover balances carried over from previous periods.""" + + +class CreateEntityBalances(BaseModel): + feature_id: str + r"""The feature ID this balance is for.""" + + granted: float + r"""Total balance granted (included + prepaid).""" + + remaining: float + r"""Remaining balance available for use.""" + + usage: float + r"""Total usage consumed in the current period.""" + + unlimited: bool + r"""Whether this feature has unlimited usage.""" + + overage_allowed: bool + r"""Whether usage beyond the granted balance is allowed (with overage charges).""" + + max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased as a top-up, or null for unlimited.""" + + next_reset_at: Nullable[float] + r"""Timestamp when the balance will reset, or null for no reset.""" + + feature: Optional[CreateEntityFeature] = None + r"""The full feature object if expanded.""" + + breakdown: Optional[List[CreateEntityBreakdown]] = None + r"""Detailed breakdown of balance sources when stacking multiple plans or grants.""" + + rollovers: Optional[List[CreateEntityRollover]] = None + r"""Rollover balances carried over from previous periods.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["feature", "breakdown", "rollovers"]) + nullable_fields = set(["max_purchase", "next_reset_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class CreateEntityInvoiceTypedDict(TypedDict): + plan_ids: List[str] + r"""Array of plan IDs included in this invoice""" + stripe_id: str + r"""The Stripe invoice ID""" + status: str + r"""The status of the invoice""" + total: float + r"""The total amount of the invoice""" + currency: str + r"""The currency code for the invoice""" + created_at: float + r"""Timestamp when the invoice was created""" + hosted_invoice_url: NotRequired[Nullable[str]] + r"""URL to the Stripe-hosted invoice page""" + + +class CreateEntityInvoice(BaseModel): + plan_ids: List[str] + r"""Array of plan IDs included in this invoice""" + + stripe_id: str + r"""The Stripe invoice ID""" + + status: str + r"""The status of the invoice""" + + total: float + r"""The total amount of the invoice""" + + currency: str + r"""The currency code for the invoice""" + + created_at: float + r"""Timestamp when the invoice was created""" + + hosted_invoice_url: OptionalNullable[str] = UNSET + r"""URL to the Stripe-hosted invoice page""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["hosted_invoice_url"]) + nullable_fields = set(["hosted_invoice_url"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class CreateEntityResponseTypedDict(TypedDict): + r"""OK""" + + id: Nullable[str] + r"""The unique identifier of the entity""" + name: Nullable[str] + r"""The name of the entity""" + created_at: float + r"""Unix timestamp when the entity was created""" + env: CreateEntityEnv + r"""The environment (sandbox/live)""" + subscriptions: List[CreateEntitySubscriptionTypedDict] + purchases: List[CreateEntityPurchaseTypedDict] + balances: Dict[str, CreateEntityBalancesTypedDict] + autumn_id: NotRequired[str] + customer_id: NotRequired[Nullable[str]] + r"""The customer ID this entity belongs to""" + feature_id: NotRequired[Nullable[str]] + r"""The feature ID this entity belongs to""" + invoices: NotRequired[List[CreateEntityInvoiceTypedDict]] + r"""Invoices for this entity (only included when expand=invoices)""" + + +class CreateEntityResponse(BaseModel): + r"""OK""" + + id: Nullable[str] + r"""The unique identifier of the entity""" + + name: Nullable[str] + r"""The name of the entity""" + + created_at: float + r"""Unix timestamp when the entity was created""" + + env: CreateEntityEnv + r"""The environment (sandbox/live)""" + + subscriptions: List[CreateEntitySubscription] + + purchases: List[CreateEntityPurchase] + + balances: Dict[str, CreateEntityBalances] + + autumn_id: Optional[str] = None + + customer_id: OptionalNullable[str] = UNSET + r"""The customer ID this entity belongs to""" + + feature_id: OptionalNullable[str] = UNSET + r"""The feature ID this entity belongs to""" + + invoices: Optional[List[CreateEntityInvoice]] = None + r"""Invoices for this entity (only included when expand=invoices)""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["autumn_id", "customer_id", "feature_id", "invoices"]) + nullable_fields = set(["id", "name", "customer_id", "feature_id"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/others/python-sdk/src/autumn_sdk/models/createreferralcodeop.py b/others/python-sdk/src/autumn_sdk/models/createreferralcodeop.py new file mode 100644 index 000000000..7f399161d --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/createreferralcodeop.py @@ -0,0 +1,76 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from autumn_sdk.types import BaseModel, UNSET_SENTINEL +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateReferralCodeGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class CreateReferralCodeGlobals(BaseModel): + x_api_version: Annotated[ + Optional[str], + pydantic.Field(alias="x-api-version"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = "2.1" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["x-api-version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class CreateReferralCodeParamsTypedDict(TypedDict): + customer_id: str + r"""The unique identifier of the customer""" + program_id: str + r"""ID of your referral program""" + + +class CreateReferralCodeParams(BaseModel): + customer_id: str + r"""The unique identifier of the customer""" + + program_id: str + r"""ID of your referral program""" + + +class CreateReferralCodeResponseTypedDict(TypedDict): + r"""OK""" + + code: str + r"""The referral code that can be shared with customers""" + customer_id: str + r"""Your unique identifier for the customer""" + created_at: float + r"""The timestamp of when the referral code was created""" + + +class CreateReferralCodeResponse(BaseModel): + r"""OK""" + + code: str + r"""The referral code that can be shared with customers""" + + customer_id: str + r"""Your unique identifier for the customer""" + + created_at: float + r"""The timestamp of when the referral code was created""" diff --git a/others/python-sdk/src/autumn_sdk/models/customer.py b/others/python-sdk/src/autumn_sdk/models/customer.py index 91ead7f80..4d42f73bf 100644 --- a/others/python-sdk/src/autumn_sdk/models/customer.py +++ b/others/python-sdk/src/autumn_sdk/models/customer.py @@ -29,52 +29,76 @@ Status = Union[ Literal[ "active", "scheduled", - "expired", ], UnrecognizedStr, ] +r"""Current status of the subscription.""" class SubscriptionTypedDict(TypedDict): plan_id: str + r"""The unique identifier of the subscribed plan.""" auto_enable: bool + r"""Whether the plan was automatically enabled for the customer.""" add_on: bool + r"""Whether this is an add-on plan rather than a base subscription.""" status: Status + r"""Current status of the subscription.""" past_due: bool + r"""Whether the subscription has overdue payments.""" canceled_at: Nullable[float] + r"""Timestamp when the subscription was canceled, or null if not canceled.""" expires_at: Nullable[float] + r"""Timestamp when the subscription will expire, or null if no expiry set.""" trial_ends_at: Nullable[float] + r"""Timestamp when the trial period ends, or null if not on trial.""" started_at: float + r"""Timestamp when the subscription started.""" current_period_start: Nullable[float] + r"""Start timestamp of the current billing period.""" current_period_end: Nullable[float] + r"""End timestamp of the current billing period.""" quantity: float + r"""Number of units of this subscription (for per-seat plans).""" plan: NotRequired[PlanTypedDict] class Subscription(BaseModel): plan_id: str + r"""The unique identifier of the subscribed plan.""" auto_enable: bool + r"""Whether the plan was automatically enabled for the customer.""" add_on: bool + r"""Whether this is an add-on plan rather than a base subscription.""" status: Status + r"""Current status of the subscription.""" past_due: bool + r"""Whether the subscription has overdue payments.""" canceled_at: Nullable[float] + r"""Timestamp when the subscription was canceled, or null if not canceled.""" expires_at: Nullable[float] + r"""Timestamp when the subscription will expire, or null if no expiry set.""" trial_ends_at: Nullable[float] + r"""Timestamp when the trial period ends, or null if not on trial.""" started_at: float + r"""Timestamp when the subscription started.""" current_period_start: Nullable[float] + r"""Start timestamp of the current billing period.""" current_period_end: Nullable[float] + r"""End timestamp of the current billing period.""" quantity: float + r"""Number of units of this subscription (for per-seat plans).""" plan: Optional[Plan] = None @@ -114,20 +138,28 @@ class Subscription(BaseModel): class PurchaseTypedDict(TypedDict): plan_id: str + r"""The unique identifier of the purchased plan.""" expires_at: Nullable[float] + r"""Timestamp when the purchase expires, or null for lifetime access.""" started_at: float + r"""Timestamp when the purchase was made.""" quantity: float + r"""Number of units purchased.""" plan: NotRequired[PlanTypedDict] class Purchase(BaseModel): plan_id: str + r"""The unique identifier of the purchased plan.""" expires_at: Nullable[float] + r"""Timestamp when the purchase expires, or null for lifetime access.""" started_at: float + r"""Timestamp when the purchase was made.""" quantity: float + r"""Number of units purchased.""" plan: Optional[Plan] = None @@ -215,6 +247,8 @@ class CustomerDisplay(BaseModel): class CustomerFeatureTypedDict(TypedDict): + r"""The full feature object if expanded.""" + id: str name: str type: CustomerBalancesType @@ -226,6 +260,8 @@ class CustomerFeatureTypedDict(TypedDict): class CustomerFeature(BaseModel): + r"""The full feature object if expanded.""" + id: str name: str @@ -278,25 +314,33 @@ CustomerIntervalEnum = Union[ CustomerIntervalUnionTypedDict = TypeAliasType( "CustomerIntervalUnionTypedDict", Union[CustomerIntervalEnum, str] ) +r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" CustomerIntervalUnion = TypeAliasType( "CustomerIntervalUnion", Union[CustomerIntervalEnum, str] ) +r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" class CustomerResetTypedDict(TypedDict): interval: CustomerIntervalUnionTypedDict + r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" resets_at: Nullable[float] + r"""Timestamp when the balance will next reset.""" interval_count: NotRequired[float] + r"""Number of intervals between resets (eg. 2 for bi-monthly).""" class CustomerReset(BaseModel): interval: CustomerIntervalUnion + r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" resets_at: Nullable[float] + r"""Timestamp when the balance will next reset.""" interval_count: Optional[float] = None + r"""Number of intervals between resets (eg. 2 for bi-monthly).""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -348,26 +392,37 @@ CustomerBillingMethod = Union[ ], UnrecognizedStr, ] +r"""Whether usage is prepaid or billed pay-per-use.""" class CustomerPriceTypedDict(TypedDict): billing_units: float + r"""The number of units per billing increment (eg. $9 / 250 units).""" billing_method: CustomerBillingMethod + r"""Whether usage is prepaid or billed pay-per-use.""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased, or null for unlimited.""" amount: NotRequired[float] + r"""The per-unit price amount.""" tiers: NotRequired[List[CustomerTierTypedDict]] + r"""Tiered pricing configuration if applicable.""" class CustomerPrice(BaseModel): billing_units: float + r"""The number of units per billing increment (eg. $9 / 250 units).""" billing_method: CustomerBillingMethod + r"""Whether usage is prepaid or billed pay-per-use.""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased, or null for unlimited.""" amount: Optional[float] = None + r"""The per-unit price amount.""" tiers: Optional[List[CustomerTier]] = None + r"""Tiered pricing configuration if applicable.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -397,37 +452,57 @@ class CustomerPrice(BaseModel): class BreakdownTypedDict(TypedDict): plan_id: Nullable[str] + r"""The plan ID this balance originates from, or null for standalone balances.""" included_grant: float + r"""Amount granted from the plan's included usage.""" prepaid_grant: float + r"""Amount granted from prepaid purchases or top-ups.""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Amount consumed in the current period.""" unlimited: bool + r"""Whether this balance has unlimited usage.""" reset: Nullable[CustomerResetTypedDict] + r"""Reset configuration for this balance, or null if no reset.""" price: Nullable[CustomerPriceTypedDict] + r"""Pricing configuration if this balance has usage-based pricing.""" expires_at: Nullable[float] + r"""Timestamp when this balance expires, or null for no expiration.""" id: NotRequired[str] + r"""The unique identifier for this balance breakdown.""" class Breakdown(BaseModel): plan_id: Nullable[str] + r"""The plan ID this balance originates from, or null for standalone balances.""" included_grant: float + r"""Amount granted from the plan's included usage.""" prepaid_grant: float + r"""Amount granted from prepaid purchases or top-ups.""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Amount consumed in the current period.""" unlimited: bool + r"""Whether this balance has unlimited usage.""" reset: Nullable[CustomerReset] + r"""Reset configuration for this balance, or null if no reset.""" price: Nullable[CustomerPrice] + r"""Pricing configuration if this balance has usage-based pricing.""" expires_at: Nullable[float] + r"""Timestamp when this balance expires, or null for no expiration.""" id: Optional[str] = "" + r"""The unique identifier for this balance breakdown.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -457,51 +532,77 @@ class Breakdown(BaseModel): class CustomerRolloverTypedDict(TypedDict): balance: float + r"""Amount of balance rolled over from a previous period.""" expires_at: float + r"""Timestamp when the rollover balance expires.""" class CustomerRollover(BaseModel): balance: float + r"""Amount of balance rolled over from a previous period.""" expires_at: float + r"""Timestamp when the rollover balance expires.""" class BalancesTypedDict(TypedDict): feature_id: str + r"""The feature ID this balance is for.""" granted: float + r"""Total balance granted (included + prepaid).""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Total usage consumed in the current period.""" unlimited: bool + r"""Whether this feature has unlimited usage.""" overage_allowed: bool + r"""Whether usage beyond the granted balance is allowed (with overage charges).""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased as a top-up, or null for unlimited.""" next_reset_at: Nullable[float] + r"""Timestamp when the balance will reset, or null for no reset.""" feature: NotRequired[CustomerFeatureTypedDict] + r"""The full feature object if expanded.""" breakdown: NotRequired[List[BreakdownTypedDict]] + r"""Detailed breakdown of balance sources when stacking multiple plans or grants.""" rollovers: NotRequired[List[CustomerRolloverTypedDict]] + r"""Rollover balances carried over from previous periods.""" class Balances(BaseModel): feature_id: str + r"""The feature ID this balance is for.""" granted: float + r"""Total balance granted (included + prepaid).""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Total usage consumed in the current period.""" unlimited: bool + r"""Whether this feature has unlimited usage.""" overage_allowed: bool + r"""Whether usage beyond the granted balance is allowed (with overage charges).""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased as a top-up, or null for unlimited.""" next_reset_at: Nullable[float] + r"""Timestamp when the balance will reset, or null for no reset.""" feature: Optional[CustomerFeature] = None + r"""The full feature object if expanded.""" breakdown: Optional[List[Breakdown]] = None + r"""Detailed breakdown of balance sources when stacking multiple plans or grants.""" rollovers: Optional[List[CustomerRollover]] = None + r"""Rollover balances carried over from previous periods.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -918,8 +1019,11 @@ class CustomerTypedDict(TypedDict): send_email_receipts: bool r"""Whether to send email receipts to the customer.""" subscriptions: List[SubscriptionTypedDict] + r"""Active and scheduled recurring plans that this customer has attached.""" purchases: List[PurchaseTypedDict] + r"""One-time purchases made by the customer.""" balances: Dict[str, BalancesTypedDict] + r"""Feature balances keyed by feature ID, showing usage limits and remaining amounts.""" invoices: NotRequired[List[InvoiceTypedDict]] entities: NotRequired[List[EntityTypedDict]] trials_used: NotRequired[List[TrialsUsedTypedDict]] @@ -957,10 +1061,13 @@ class Customer(BaseModel): r"""Whether to send email receipts to the customer.""" subscriptions: List[Subscription] + r"""Active and scheduled recurring plans that this customer has attached.""" purchases: List[Purchase] + r"""One-time purchases made by the customer.""" balances: Dict[str, Balances] + r"""Feature balances keyed by feature ID, showing usage limits and remaining amounts.""" invoices: Optional[List[Invoice]] = None diff --git a/others/python-sdk/src/autumn_sdk/models/deleteentityop.py b/others/python-sdk/src/autumn_sdk/models/deleteentityop.py new file mode 100644 index 000000000..39acecf3f --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/deleteentityop.py @@ -0,0 +1,80 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from autumn_sdk.types import BaseModel, UNSET_SENTINEL +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class DeleteEntityGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class DeleteEntityGlobals(BaseModel): + x_api_version: Annotated[ + Optional[str], + pydantic.Field(alias="x-api-version"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = "2.1" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["x-api-version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class DeleteEntityParamsTypedDict(TypedDict): + entity_id: str + r"""The ID of the entity.""" + customer_id: NotRequired[str] + r"""The ID of the customer.""" + + +class DeleteEntityParams(BaseModel): + entity_id: str + r"""The ID of the entity.""" + + customer_id: Optional[str] = None + r"""The ID of the customer.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["customer_id"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class DeleteEntityResponseTypedDict(TypedDict): + r"""OK""" + + success: bool + + +class DeleteEntityResponse(BaseModel): + r"""OK""" + + success: bool diff --git a/others/python-sdk/src/autumn_sdk/models/getentityop.py b/others/python-sdk/src/autumn_sdk/models/getentityop.py new file mode 100644 index 000000000..f6c039650 --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/getentityop.py @@ -0,0 +1,837 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .plan import Plan, PlanTypedDict +from autumn_sdk.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import Dict, List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class GetEntityGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class GetEntityGlobals(BaseModel): + x_api_version: Annotated[ + Optional[str], + pydantic.Field(alias="x-api-version"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = "2.1" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["x-api-version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class GetEntityParamsTypedDict(TypedDict): + entity_id: str + r"""The ID of the entity.""" + customer_id: NotRequired[str] + r"""The ID of the customer to create the entity for.""" + + +class GetEntityParams(BaseModel): + entity_id: str + r"""The ID of the entity.""" + + customer_id: Optional[str] = None + r"""The ID of the customer to create the entity for.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["customer_id"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +GetEntityEnv = Union[ + Literal[ + "sandbox", + "live", + ], + UnrecognizedStr, +] +r"""The environment (sandbox/live)""" + + +GetEntityStatus = Union[ + Literal[ + "active", + "scheduled", + ], + UnrecognizedStr, +] +r"""Current status of the subscription.""" + + +class GetEntitySubscriptionTypedDict(TypedDict): + plan_id: str + r"""The unique identifier of the subscribed plan.""" + auto_enable: bool + r"""Whether the plan was automatically enabled for the customer.""" + add_on: bool + r"""Whether this is an add-on plan rather than a base subscription.""" + status: GetEntityStatus + r"""Current status of the subscription.""" + past_due: bool + r"""Whether the subscription has overdue payments.""" + canceled_at: Nullable[float] + r"""Timestamp when the subscription was canceled, or null if not canceled.""" + expires_at: Nullable[float] + r"""Timestamp when the subscription will expire, or null if no expiry set.""" + trial_ends_at: Nullable[float] + r"""Timestamp when the trial period ends, or null if not on trial.""" + started_at: float + r"""Timestamp when the subscription started.""" + current_period_start: Nullable[float] + r"""Start timestamp of the current billing period.""" + current_period_end: Nullable[float] + r"""End timestamp of the current billing period.""" + quantity: float + r"""Number of units of this subscription (for per-seat plans).""" + plan: NotRequired[PlanTypedDict] + + +class GetEntitySubscription(BaseModel): + plan_id: str + r"""The unique identifier of the subscribed plan.""" + + auto_enable: bool + r"""Whether the plan was automatically enabled for the customer.""" + + add_on: bool + r"""Whether this is an add-on plan rather than a base subscription.""" + + status: GetEntityStatus + r"""Current status of the subscription.""" + + past_due: bool + r"""Whether the subscription has overdue payments.""" + + canceled_at: Nullable[float] + r"""Timestamp when the subscription was canceled, or null if not canceled.""" + + expires_at: Nullable[float] + r"""Timestamp when the subscription will expire, or null if no expiry set.""" + + trial_ends_at: Nullable[float] + r"""Timestamp when the trial period ends, or null if not on trial.""" + + started_at: float + r"""Timestamp when the subscription started.""" + + current_period_start: Nullable[float] + r"""Start timestamp of the current billing period.""" + + current_period_end: Nullable[float] + r"""End timestamp of the current billing period.""" + + quantity: float + r"""Number of units of this subscription (for per-seat plans).""" + + plan: Optional[Plan] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["plan"]) + nullable_fields = set( + [ + "canceled_at", + "expires_at", + "trial_ends_at", + "current_period_start", + "current_period_end", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class GetEntityPurchaseTypedDict(TypedDict): + plan_id: str + r"""The unique identifier of the purchased plan.""" + expires_at: Nullable[float] + r"""Timestamp when the purchase expires, or null for lifetime access.""" + started_at: float + r"""Timestamp when the purchase was made.""" + quantity: float + r"""Number of units purchased.""" + plan: NotRequired[PlanTypedDict] + + +class GetEntityPurchase(BaseModel): + plan_id: str + r"""The unique identifier of the purchased plan.""" + + expires_at: Nullable[float] + r"""Timestamp when the purchase expires, or null for lifetime access.""" + + started_at: float + r"""Timestamp when the purchase was made.""" + + quantity: float + r"""Number of units purchased.""" + + plan: Optional[Plan] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["plan"]) + nullable_fields = set(["expires_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +GetEntityType = Union[ + Literal[ + "boolean", + "metered", + "credit_system", + ], + UnrecognizedStr, +] + + +class GetEntityCreditSchemaTypedDict(TypedDict): + metered_feature_id: str + credit_cost: float + + +class GetEntityCreditSchema(BaseModel): + metered_feature_id: str + + credit_cost: float + + +class GetEntityDisplayTypedDict(TypedDict): + singular: NotRequired[Nullable[str]] + plural: NotRequired[Nullable[str]] + + +class GetEntityDisplay(BaseModel): + singular: OptionalNullable[str] = UNSET + + plural: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["singular", "plural"]) + nullable_fields = set(["singular", "plural"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class GetEntityFeatureTypedDict(TypedDict): + r"""The full feature object if expanded.""" + + id: str + name: str + type: GetEntityType + consumable: bool + archived: bool + event_names: NotRequired[List[str]] + credit_schema: NotRequired[List[GetEntityCreditSchemaTypedDict]] + display: NotRequired[GetEntityDisplayTypedDict] + + +class GetEntityFeature(BaseModel): + r"""The full feature object if expanded.""" + + id: str + + name: str + + type: GetEntityType + + consumable: bool + + archived: bool + + event_names: Optional[List[str]] = None + + credit_schema: Optional[List[GetEntityCreditSchema]] = None + + display: Optional[GetEntityDisplay] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["event_names", "credit_schema", "display"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +GetEntityIntervalEnum = Union[ + Literal[ + "one_off", + "minute", + "hour", + "day", + "week", + "month", + "quarter", + "semi_annual", + "year", + ], + UnrecognizedStr, +] + + +GetEntityIntervalUnionTypedDict = TypeAliasType( + "GetEntityIntervalUnionTypedDict", Union[GetEntityIntervalEnum, str] +) +r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" + + +GetEntityIntervalUnion = TypeAliasType( + "GetEntityIntervalUnion", Union[GetEntityIntervalEnum, str] +) +r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" + + +class GetEntityResetTypedDict(TypedDict): + interval: GetEntityIntervalUnionTypedDict + r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" + resets_at: Nullable[float] + r"""Timestamp when the balance will next reset.""" + interval_count: NotRequired[float] + r"""Number of intervals between resets (eg. 2 for bi-monthly).""" + + +class GetEntityReset(BaseModel): + interval: GetEntityIntervalUnion + r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" + + resets_at: Nullable[float] + r"""Timestamp when the balance will next reset.""" + + interval_count: Optional[float] = None + r"""Number of intervals between resets (eg. 2 for bi-monthly).""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count"]) + nullable_fields = set(["resets_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +GetEntityToTypedDict = TypeAliasType("GetEntityToTypedDict", Union[float, str]) + + +GetEntityTo = TypeAliasType("GetEntityTo", Union[float, str]) + + +class GetEntityTierTypedDict(TypedDict): + to: GetEntityToTypedDict + amount: float + + +class GetEntityTier(BaseModel): + to: GetEntityTo + + amount: float + + +GetEntityBillingMethod = Union[ + Literal[ + "prepaid", + "usage_based", + ], + UnrecognizedStr, +] +r"""Whether usage is prepaid or billed pay-per-use.""" + + +class GetEntityPriceTypedDict(TypedDict): + billing_units: float + r"""The number of units per billing increment (eg. $9 / 250 units).""" + billing_method: GetEntityBillingMethod + r"""Whether usage is prepaid or billed pay-per-use.""" + max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased, or null for unlimited.""" + amount: NotRequired[float] + r"""The per-unit price amount.""" + tiers: NotRequired[List[GetEntityTierTypedDict]] + r"""Tiered pricing configuration if applicable.""" + + +class GetEntityPrice(BaseModel): + billing_units: float + r"""The number of units per billing increment (eg. $9 / 250 units).""" + + billing_method: GetEntityBillingMethod + r"""Whether usage is prepaid or billed pay-per-use.""" + + max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased, or null for unlimited.""" + + amount: Optional[float] = None + r"""The per-unit price amount.""" + + tiers: Optional[List[GetEntityTier]] = None + r"""Tiered pricing configuration if applicable.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["amount", "tiers"]) + nullable_fields = set(["max_purchase"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class GetEntityBreakdownTypedDict(TypedDict): + plan_id: Nullable[str] + r"""The plan ID this balance originates from, or null for standalone balances.""" + included_grant: float + r"""Amount granted from the plan's included usage.""" + prepaid_grant: float + r"""Amount granted from prepaid purchases or top-ups.""" + remaining: float + r"""Remaining balance available for use.""" + usage: float + r"""Amount consumed in the current period.""" + unlimited: bool + r"""Whether this balance has unlimited usage.""" + reset: Nullable[GetEntityResetTypedDict] + r"""Reset configuration for this balance, or null if no reset.""" + price: Nullable[GetEntityPriceTypedDict] + r"""Pricing configuration if this balance has usage-based pricing.""" + expires_at: Nullable[float] + r"""Timestamp when this balance expires, or null for no expiration.""" + id: NotRequired[str] + r"""The unique identifier for this balance breakdown.""" + + +class GetEntityBreakdown(BaseModel): + plan_id: Nullable[str] + r"""The plan ID this balance originates from, or null for standalone balances.""" + + included_grant: float + r"""Amount granted from the plan's included usage.""" + + prepaid_grant: float + r"""Amount granted from prepaid purchases or top-ups.""" + + remaining: float + r"""Remaining balance available for use.""" + + usage: float + r"""Amount consumed in the current period.""" + + unlimited: bool + r"""Whether this balance has unlimited usage.""" + + reset: Nullable[GetEntityReset] + r"""Reset configuration for this balance, or null if no reset.""" + + price: Nullable[GetEntityPrice] + r"""Pricing configuration if this balance has usage-based pricing.""" + + expires_at: Nullable[float] + r"""Timestamp when this balance expires, or null for no expiration.""" + + id: Optional[str] = "" + r"""The unique identifier for this balance breakdown.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["id"]) + nullable_fields = set(["plan_id", "reset", "price", "expires_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class GetEntityRolloverTypedDict(TypedDict): + balance: float + r"""Amount of balance rolled over from a previous period.""" + expires_at: float + r"""Timestamp when the rollover balance expires.""" + + +class GetEntityRollover(BaseModel): + balance: float + r"""Amount of balance rolled over from a previous period.""" + + expires_at: float + r"""Timestamp when the rollover balance expires.""" + + +class GetEntityBalancesTypedDict(TypedDict): + feature_id: str + r"""The feature ID this balance is for.""" + granted: float + r"""Total balance granted (included + prepaid).""" + remaining: float + r"""Remaining balance available for use.""" + usage: float + r"""Total usage consumed in the current period.""" + unlimited: bool + r"""Whether this feature has unlimited usage.""" + overage_allowed: bool + r"""Whether usage beyond the granted balance is allowed (with overage charges).""" + max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased as a top-up, or null for unlimited.""" + next_reset_at: Nullable[float] + r"""Timestamp when the balance will reset, or null for no reset.""" + feature: NotRequired[GetEntityFeatureTypedDict] + r"""The full feature object if expanded.""" + breakdown: NotRequired[List[GetEntityBreakdownTypedDict]] + r"""Detailed breakdown of balance sources when stacking multiple plans or grants.""" + rollovers: NotRequired[List[GetEntityRolloverTypedDict]] + r"""Rollover balances carried over from previous periods.""" + + +class GetEntityBalances(BaseModel): + feature_id: str + r"""The feature ID this balance is for.""" + + granted: float + r"""Total balance granted (included + prepaid).""" + + remaining: float + r"""Remaining balance available for use.""" + + usage: float + r"""Total usage consumed in the current period.""" + + unlimited: bool + r"""Whether this feature has unlimited usage.""" + + overage_allowed: bool + r"""Whether usage beyond the granted balance is allowed (with overage charges).""" + + max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased as a top-up, or null for unlimited.""" + + next_reset_at: Nullable[float] + r"""Timestamp when the balance will reset, or null for no reset.""" + + feature: Optional[GetEntityFeature] = None + r"""The full feature object if expanded.""" + + breakdown: Optional[List[GetEntityBreakdown]] = None + r"""Detailed breakdown of balance sources when stacking multiple plans or grants.""" + + rollovers: Optional[List[GetEntityRollover]] = None + r"""Rollover balances carried over from previous periods.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["feature", "breakdown", "rollovers"]) + nullable_fields = set(["max_purchase", "next_reset_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class GetEntityInvoiceTypedDict(TypedDict): + plan_ids: List[str] + r"""Array of plan IDs included in this invoice""" + stripe_id: str + r"""The Stripe invoice ID""" + status: str + r"""The status of the invoice""" + total: float + r"""The total amount of the invoice""" + currency: str + r"""The currency code for the invoice""" + created_at: float + r"""Timestamp when the invoice was created""" + hosted_invoice_url: NotRequired[Nullable[str]] + r"""URL to the Stripe-hosted invoice page""" + + +class GetEntityInvoice(BaseModel): + plan_ids: List[str] + r"""Array of plan IDs included in this invoice""" + + stripe_id: str + r"""The Stripe invoice ID""" + + status: str + r"""The status of the invoice""" + + total: float + r"""The total amount of the invoice""" + + currency: str + r"""The currency code for the invoice""" + + created_at: float + r"""Timestamp when the invoice was created""" + + hosted_invoice_url: OptionalNullable[str] = UNSET + r"""URL to the Stripe-hosted invoice page""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["hosted_invoice_url"]) + nullable_fields = set(["hosted_invoice_url"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class GetEntityResponseTypedDict(TypedDict): + r"""OK""" + + id: Nullable[str] + r"""The unique identifier of the entity""" + name: Nullable[str] + r"""The name of the entity""" + created_at: float + r"""Unix timestamp when the entity was created""" + env: GetEntityEnv + r"""The environment (sandbox/live)""" + subscriptions: List[GetEntitySubscriptionTypedDict] + purchases: List[GetEntityPurchaseTypedDict] + balances: Dict[str, GetEntityBalancesTypedDict] + autumn_id: NotRequired[str] + customer_id: NotRequired[Nullable[str]] + r"""The customer ID this entity belongs to""" + feature_id: NotRequired[Nullable[str]] + r"""The feature ID this entity belongs to""" + invoices: NotRequired[List[GetEntityInvoiceTypedDict]] + r"""Invoices for this entity (only included when expand=invoices)""" + + +class GetEntityResponse(BaseModel): + r"""OK""" + + id: Nullable[str] + r"""The unique identifier of the entity""" + + name: Nullable[str] + r"""The name of the entity""" + + created_at: float + r"""Unix timestamp when the entity was created""" + + env: GetEntityEnv + r"""The environment (sandbox/live)""" + + subscriptions: List[GetEntitySubscription] + + purchases: List[GetEntityPurchase] + + balances: Dict[str, GetEntityBalances] + + autumn_id: Optional[str] = None + + customer_id: OptionalNullable[str] = UNSET + r"""The customer ID this entity belongs to""" + + feature_id: OptionalNullable[str] = UNSET + r"""The feature ID this entity belongs to""" + + invoices: Optional[List[GetEntityInvoice]] = None + r"""Invoices for this entity (only included when expand=invoices)""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["autumn_id", "customer_id", "feature_id", "invoices"]) + nullable_fields = set(["id", "name", "customer_id", "feature_id"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m diff --git a/others/python-sdk/src/autumn_sdk/models/listcustomersop.py b/others/python-sdk/src/autumn_sdk/models/listcustomersop.py index 7be0ab37e..3f5f64f50 100644 --- a/others/python-sdk/src/autumn_sdk/models/listcustomersop.py +++ b/others/python-sdk/src/autumn_sdk/models/listcustomersop.py @@ -141,52 +141,76 @@ ListCustomersStatus = Union[ Literal[ "active", "scheduled", - "expired", ], UnrecognizedStr, ] +r"""Current status of the subscription.""" class ListCustomersSubscriptionTypedDict(TypedDict): plan_id: str + r"""The unique identifier of the subscribed plan.""" auto_enable: bool + r"""Whether the plan was automatically enabled for the customer.""" add_on: bool + r"""Whether this is an add-on plan rather than a base subscription.""" status: ListCustomersStatus + r"""Current status of the subscription.""" past_due: bool + r"""Whether the subscription has overdue payments.""" canceled_at: Nullable[float] + r"""Timestamp when the subscription was canceled, or null if not canceled.""" expires_at: Nullable[float] + r"""Timestamp when the subscription will expire, or null if no expiry set.""" trial_ends_at: Nullable[float] + r"""Timestamp when the trial period ends, or null if not on trial.""" started_at: float + r"""Timestamp when the subscription started.""" current_period_start: Nullable[float] + r"""Start timestamp of the current billing period.""" current_period_end: Nullable[float] + r"""End timestamp of the current billing period.""" quantity: float + r"""Number of units of this subscription (for per-seat plans).""" plan: NotRequired[PlanTypedDict] class ListCustomersSubscription(BaseModel): plan_id: str + r"""The unique identifier of the subscribed plan.""" auto_enable: bool + r"""Whether the plan was automatically enabled for the customer.""" add_on: bool + r"""Whether this is an add-on plan rather than a base subscription.""" status: ListCustomersStatus + r"""Current status of the subscription.""" past_due: bool + r"""Whether the subscription has overdue payments.""" canceled_at: Nullable[float] + r"""Timestamp when the subscription was canceled, or null if not canceled.""" expires_at: Nullable[float] + r"""Timestamp when the subscription will expire, or null if no expiry set.""" trial_ends_at: Nullable[float] + r"""Timestamp when the trial period ends, or null if not on trial.""" started_at: float + r"""Timestamp when the subscription started.""" current_period_start: Nullable[float] + r"""Start timestamp of the current billing period.""" current_period_end: Nullable[float] + r"""End timestamp of the current billing period.""" quantity: float + r"""Number of units of this subscription (for per-seat plans).""" plan: Optional[Plan] = None @@ -226,20 +250,28 @@ class ListCustomersSubscription(BaseModel): class ListCustomersPurchaseTypedDict(TypedDict): plan_id: str + r"""The unique identifier of the purchased plan.""" expires_at: Nullable[float] + r"""Timestamp when the purchase expires, or null for lifetime access.""" started_at: float + r"""Timestamp when the purchase was made.""" quantity: float + r"""Number of units purchased.""" plan: NotRequired[PlanTypedDict] class ListCustomersPurchase(BaseModel): plan_id: str + r"""The unique identifier of the purchased plan.""" expires_at: Nullable[float] + r"""Timestamp when the purchase expires, or null for lifetime access.""" started_at: float + r"""Timestamp when the purchase was made.""" quantity: float + r"""Number of units purchased.""" plan: Optional[Plan] = None @@ -327,6 +359,8 @@ class ListCustomersDisplay(BaseModel): class ListCustomersFeatureTypedDict(TypedDict): + r"""The full feature object if expanded.""" + id: str name: str type: ListCustomersType @@ -338,6 +372,8 @@ class ListCustomersFeatureTypedDict(TypedDict): class ListCustomersFeature(BaseModel): + r"""The full feature object if expanded.""" + id: str name: str @@ -390,25 +426,33 @@ ListCustomersIntervalEnum = Union[ ListCustomersIntervalUnionTypedDict = TypeAliasType( "ListCustomersIntervalUnionTypedDict", Union[ListCustomersIntervalEnum, str] ) +r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" ListCustomersIntervalUnion = TypeAliasType( "ListCustomersIntervalUnion", Union[ListCustomersIntervalEnum, str] ) +r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" class ListCustomersResetTypedDict(TypedDict): interval: ListCustomersIntervalUnionTypedDict + r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" resets_at: Nullable[float] + r"""Timestamp when the balance will next reset.""" interval_count: NotRequired[float] + r"""Number of intervals between resets (eg. 2 for bi-monthly).""" class ListCustomersReset(BaseModel): interval: ListCustomersIntervalUnion + r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" resets_at: Nullable[float] + r"""Timestamp when the balance will next reset.""" interval_count: Optional[float] = None + r"""Number of intervals between resets (eg. 2 for bi-monthly).""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -470,26 +514,37 @@ ListCustomersBillingMethod = Union[ ], UnrecognizedStr, ] +r"""Whether usage is prepaid or billed pay-per-use.""" class ListCustomersPriceTypedDict(TypedDict): billing_units: float + r"""The number of units per billing increment (eg. $9 / 250 units).""" billing_method: ListCustomersBillingMethod + r"""Whether usage is prepaid or billed pay-per-use.""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased, or null for unlimited.""" amount: NotRequired[float] + r"""The per-unit price amount.""" tiers: NotRequired[List[ListCustomersTierTypedDict]] + r"""Tiered pricing configuration if applicable.""" class ListCustomersPrice(BaseModel): billing_units: float + r"""The number of units per billing increment (eg. $9 / 250 units).""" billing_method: ListCustomersBillingMethod + r"""Whether usage is prepaid or billed pay-per-use.""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased, or null for unlimited.""" amount: Optional[float] = None + r"""The per-unit price amount.""" tiers: Optional[List[ListCustomersTier]] = None + r"""Tiered pricing configuration if applicable.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -519,37 +574,57 @@ class ListCustomersPrice(BaseModel): class ListCustomersBreakdownTypedDict(TypedDict): plan_id: Nullable[str] + r"""The plan ID this balance originates from, or null for standalone balances.""" included_grant: float + r"""Amount granted from the plan's included usage.""" prepaid_grant: float + r"""Amount granted from prepaid purchases or top-ups.""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Amount consumed in the current period.""" unlimited: bool + r"""Whether this balance has unlimited usage.""" reset: Nullable[ListCustomersResetTypedDict] + r"""Reset configuration for this balance, or null if no reset.""" price: Nullable[ListCustomersPriceTypedDict] + r"""Pricing configuration if this balance has usage-based pricing.""" expires_at: Nullable[float] + r"""Timestamp when this balance expires, or null for no expiration.""" id: NotRequired[str] + r"""The unique identifier for this balance breakdown.""" class ListCustomersBreakdown(BaseModel): plan_id: Nullable[str] + r"""The plan ID this balance originates from, or null for standalone balances.""" included_grant: float + r"""Amount granted from the plan's included usage.""" prepaid_grant: float + r"""Amount granted from prepaid purchases or top-ups.""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Amount consumed in the current period.""" unlimited: bool + r"""Whether this balance has unlimited usage.""" reset: Nullable[ListCustomersReset] + r"""Reset configuration for this balance, or null if no reset.""" price: Nullable[ListCustomersPrice] + r"""Pricing configuration if this balance has usage-based pricing.""" expires_at: Nullable[float] + r"""Timestamp when this balance expires, or null for no expiration.""" id: Optional[str] = "" + r"""The unique identifier for this balance breakdown.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -579,51 +654,77 @@ class ListCustomersBreakdown(BaseModel): class ListCustomersRolloverTypedDict(TypedDict): balance: float + r"""Amount of balance rolled over from a previous period.""" expires_at: float + r"""Timestamp when the rollover balance expires.""" class ListCustomersRollover(BaseModel): balance: float + r"""Amount of balance rolled over from a previous period.""" expires_at: float + r"""Timestamp when the rollover balance expires.""" class ListCustomersBalancesTypedDict(TypedDict): feature_id: str + r"""The feature ID this balance is for.""" granted: float + r"""Total balance granted (included + prepaid).""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Total usage consumed in the current period.""" unlimited: bool + r"""Whether this feature has unlimited usage.""" overage_allowed: bool + r"""Whether usage beyond the granted balance is allowed (with overage charges).""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased as a top-up, or null for unlimited.""" next_reset_at: Nullable[float] + r"""Timestamp when the balance will reset, or null for no reset.""" feature: NotRequired[ListCustomersFeatureTypedDict] + r"""The full feature object if expanded.""" breakdown: NotRequired[List[ListCustomersBreakdownTypedDict]] + r"""Detailed breakdown of balance sources when stacking multiple plans or grants.""" rollovers: NotRequired[List[ListCustomersRolloverTypedDict]] + r"""Rollover balances carried over from previous periods.""" class ListCustomersBalances(BaseModel): feature_id: str + r"""The feature ID this balance is for.""" granted: float + r"""Total balance granted (included + prepaid).""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Total usage consumed in the current period.""" unlimited: bool + r"""Whether this feature has unlimited usage.""" overage_allowed: bool + r"""Whether usage beyond the granted balance is allowed (with overage charges).""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased as a top-up, or null for unlimited.""" next_reset_at: Nullable[float] + r"""Timestamp when the balance will reset, or null for no reset.""" feature: Optional[ListCustomersFeature] = None + r"""The full feature object if expanded.""" breakdown: Optional[List[ListCustomersBreakdown]] = None + r"""Detailed breakdown of balance sources when stacking multiple plans or grants.""" rollovers: Optional[List[ListCustomersRollover]] = None + r"""Rollover balances carried over from previous periods.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -651,7 +752,7 @@ class ListCustomersBalances(BaseModel): return m -class ListTTypedDict(TypedDict): +class ListCustomersListTypedDict(TypedDict): id: Nullable[str] r"""Your unique identifier for the customer.""" name: Nullable[str] @@ -671,11 +772,14 @@ class ListTTypedDict(TypedDict): send_email_receipts: bool r"""Whether to send email receipts to the customer.""" subscriptions: List[ListCustomersSubscriptionTypedDict] + r"""Active and scheduled recurring plans that this customer has attached.""" purchases: List[ListCustomersPurchaseTypedDict] + r"""One-time purchases made by the customer.""" balances: Dict[str, ListCustomersBalancesTypedDict] + r"""Feature balances keyed by feature ID, showing usage limits and remaining amounts.""" -class ListT(BaseModel): +class ListCustomersList(BaseModel): id: Nullable[str] r"""Your unique identifier for the customer.""" @@ -704,10 +808,13 @@ class ListT(BaseModel): r"""Whether to send email receipts to the customer.""" subscriptions: List[ListCustomersSubscription] + r"""Active and scheduled recurring plans that this customer has attached.""" purchases: List[ListCustomersPurchase] + r"""One-time purchases made by the customer.""" balances: Dict[str, ListCustomersBalances] + r"""Feature balances keyed by feature ID, showing usage limits and remaining amounts.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -727,7 +834,7 @@ class ListT(BaseModel): class ListCustomersResponseTypedDict(TypedDict): r"""OK""" - list: List[ListTTypedDict] + list: List[ListCustomersListTypedDict] r"""Array of items for current page""" has_more: bool r"""Whether more results exist after this page""" @@ -742,7 +849,7 @@ class ListCustomersResponseTypedDict(TypedDict): class ListCustomersResponse(BaseModel): r"""OK""" - list: List[ListT] + list: List[ListCustomersList] r"""Array of items for current page""" has_more: bool diff --git a/others/python-sdk/src/autumn_sdk/models/listeventsop.py b/others/python-sdk/src/autumn_sdk/models/listeventsop.py new file mode 100644 index 000000000..0cacf2f51 --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/listeventsop.py @@ -0,0 +1,207 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from autumn_sdk.types import BaseModel, UNSET_SENTINEL +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import List, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class ListEventsGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class ListEventsGlobals(BaseModel): + x_api_version: Annotated[ + Optional[str], + pydantic.Field(alias="x-api-version"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = "2.1" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["x-api-version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +ListEventsFeatureIDTypedDict = TypeAliasType( + "ListEventsFeatureIDTypedDict", Union[str, List[str]] +) +r"""Filter by specific feature ID(s)""" + + +ListEventsFeatureID = TypeAliasType("ListEventsFeatureID", Union[str, List[str]]) +r"""Filter by specific feature ID(s)""" + + +class ListEventsCustomRangeTypedDict(TypedDict): + r"""Filter events by time range""" + + start: NotRequired[float] + r"""Filter events after this timestamp (epoch milliseconds)""" + end: NotRequired[float] + r"""Filter events before this timestamp (epoch milliseconds)""" + + +class ListEventsCustomRange(BaseModel): + r"""Filter events by time range""" + + start: Optional[float] = None + r"""Filter events after this timestamp (epoch milliseconds)""" + + end: Optional[float] = None + r"""Filter events before this timestamp (epoch milliseconds)""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["start", "end"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class EventsListParamsTypedDict(TypedDict): + offset: NotRequired[int] + r"""Number of items to skip""" + limit: NotRequired[int] + r"""Number of items to return. Default 100, max 1000.""" + customer_id: NotRequired[str] + r"""Filter events by customer ID""" + feature_id: NotRequired[ListEventsFeatureIDTypedDict] + r"""Filter by specific feature ID(s)""" + custom_range: NotRequired[ListEventsCustomRangeTypedDict] + r"""Filter events by time range""" + + +class EventsListParams(BaseModel): + offset: Optional[int] = 0 + r"""Number of items to skip""" + + limit: Optional[int] = 100 + r"""Number of items to return. Default 100, max 1000.""" + + customer_id: Optional[str] = None + r"""Filter events by customer ID""" + + feature_id: Optional[ListEventsFeatureID] = None + r"""Filter by specific feature ID(s)""" + + custom_range: Optional[ListEventsCustomRange] = None + r"""Filter events by time range""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["offset", "limit", "customer_id", "feature_id", "custom_range"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ListEventsPropertiesTypedDict(TypedDict): + r"""Event properties (JSONB)""" + + +class ListEventsProperties(BaseModel): + r"""Event properties (JSONB)""" + + +class ListEventsListTypedDict(TypedDict): + id: str + r"""Event ID (KSUID)""" + timestamp: float + r"""Event timestamp (epoch milliseconds)""" + feature_id: str + r"""ID of the feature that the event belongs to""" + customer_id: str + r"""Customer identifier""" + value: float + r"""Event value/count""" + properties: ListEventsPropertiesTypedDict + r"""Event properties (JSONB)""" + + +class ListEventsList(BaseModel): + id: str + r"""Event ID (KSUID)""" + + timestamp: float + r"""Event timestamp (epoch milliseconds)""" + + feature_id: str + r"""ID of the feature that the event belongs to""" + + customer_id: str + r"""Customer identifier""" + + value: float + r"""Event value/count""" + + properties: ListEventsProperties + r"""Event properties (JSONB)""" + + +class ListEventsResponseTypedDict(TypedDict): + r"""OK""" + + list: List[ListEventsListTypedDict] + r"""Array of items for current page""" + has_more: bool + r"""Whether more results exist after this page""" + offset: float + r"""Current offset position""" + limit: float + r"""Limit passed in the request""" + total: float + r"""Total number of items returned in the current page""" + + +class ListEventsResponse(BaseModel): + r"""OK""" + + list: List[ListEventsList] + r"""Array of items for current page""" + + has_more: bool + r"""Whether more results exist after this page""" + + offset: float + r"""Current offset position""" + + limit: float + r"""Limit passed in the request""" + + total: float + r"""Total number of items returned in the current page""" diff --git a/others/python-sdk/src/autumn_sdk/models/billingsetuppaymentop.py b/others/python-sdk/src/autumn_sdk/models/opencustomerportalop.py similarity index 51% rename from others/python-sdk/src/autumn_sdk/models/billingsetuppaymentop.py rename to others/python-sdk/src/autumn_sdk/models/opencustomerportalop.py index a9b4b8fb0..b27e54cf4 100644 --- a/others/python-sdk/src/autumn_sdk/models/billingsetuppaymentop.py +++ b/others/python-sdk/src/autumn_sdk/models/opencustomerportalop.py @@ -1,20 +1,19 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .customerdata import CustomerData, CustomerDataTypedDict from autumn_sdk.types import BaseModel, UNSET_SENTINEL from autumn_sdk.utils import FieldMetadata, HeaderMetadata import pydantic from pydantic import model_serializer -from typing import Any, Dict, Optional +from typing import Optional from typing_extensions import Annotated, NotRequired, TypedDict -class BillingSetupPaymentGlobalsTypedDict(TypedDict): +class OpenCustomerPortalGlobalsTypedDict(TypedDict): x_api_version: NotRequired[str] -class BillingSetupPaymentGlobals(BaseModel): +class OpenCustomerPortalGlobals(BaseModel): x_api_version: Annotated[ Optional[str], pydantic.Field(alias="x-api-version"), @@ -38,35 +37,28 @@ class BillingSetupPaymentGlobals(BaseModel): return m -class BillingSetupPaymentRequestTypedDict(TypedDict): +class OpenCustomerPortalParamsTypedDict(TypedDict): customer_id: str - r"""The ID of the customer""" - success_url: NotRequired[str] - r"""URL to redirect to after successful payment setup. Must start with either http:// or https://""" - customer_data: NotRequired[CustomerDataTypedDict] - r"""Customer details to set when creating a customer""" - checkout_session_params: NotRequired[Dict[str, Any]] - r"""Additional parameters for the checkout session""" + r"""The ID of the customer to open the billing portal for.""" + configuration_id: NotRequired[str] + r"""Stripe billing portal configuration ID. Create configurations in your Stripe dashboard.""" + return_url: NotRequired[str] + r"""URL to redirect to when back button is clicked in the billing portal""" -class BillingSetupPaymentRequest(BaseModel): +class OpenCustomerPortalParams(BaseModel): customer_id: str - r"""The ID of the customer""" + r"""The ID of the customer to open the billing portal for.""" - success_url: Optional[str] = None - r"""URL to redirect to after successful payment setup. Must start with either http:// or https://""" + configuration_id: Optional[str] = None + r"""Stripe billing portal configuration ID. Create configurations in your Stripe dashboard.""" - customer_data: Optional[CustomerData] = None - r"""Customer details to set when creating a customer""" - - checkout_session_params: Optional[Dict[str, Any]] = None - r"""Additional parameters for the checkout session""" + return_url: Optional[str] = None + r"""URL to redirect to when back button is clicked in the billing portal""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set( - ["success_url", "customer_data", "checkout_session_params"] - ) + optional_fields = set(["configuration_id", "return_url"]) serialized = handler(self) m = {} @@ -81,20 +73,20 @@ class BillingSetupPaymentRequest(BaseModel): return m -class BillingSetupPaymentResponseTypedDict(TypedDict): +class OpenCustomerPortalResponseTypedDict(TypedDict): r"""OK""" customer_id: str - r"""The ID of the customer""" + r"""The ID of the billing portal session""" url: str - r"""URL to the payment setup page""" + r"""URL to the billing portal""" -class BillingSetupPaymentResponse(BaseModel): +class OpenCustomerPortalResponse(BaseModel): r"""OK""" customer_id: str - r"""The ID of the customer""" + r"""The ID of the billing portal session""" url: str - r"""URL to the payment setup page""" + r"""URL to the billing portal""" diff --git a/others/python-sdk/src/autumn_sdk/models/previewattachop.py b/others/python-sdk/src/autumn_sdk/models/previewattachop.py new file mode 100644 index 000000000..56792db8f --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/previewattachop.py @@ -0,0 +1,765 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from autumn_sdk.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class PreviewAttachGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class PreviewAttachGlobals(BaseModel): + x_api_version: Annotated[ + Optional[str], + pydantic.Field(alias="x-api-version"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = "2.1" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["x-api-version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class PreviewAttachFeatureQuantityTypedDict(TypedDict): + feature_id: str + quantity: NotRequired[float] + adjustable: NotRequired[bool] + + +class PreviewAttachFeatureQuantity(BaseModel): + feature_id: str + + quantity: Optional[float] = None + + adjustable: Optional[bool] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["quantity", "adjustable"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +PreviewAttachDurationType = Literal[ + "day", + "month", + "year", +] + + +class PreviewAttachFreeTrialTypedDict(TypedDict): + duration_length: float + duration_type: NotRequired[PreviewAttachDurationType] + card_required: NotRequired[bool] + + +class PreviewAttachFreeTrial(BaseModel): + duration_length: float + + duration_type: Optional[PreviewAttachDurationType] = "month" + + card_required: Optional[bool] = True + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["duration_type", "card_required"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +PreviewAttachPriceInterval = Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", +] + + +class PreviewAttachPriceTypedDict(TypedDict): + amount: float + interval: PreviewAttachPriceInterval + interval_count: NotRequired[float] + + +class PreviewAttachPrice(BaseModel): + amount: float + + interval: PreviewAttachPriceInterval + + interval_count: Optional[float] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +PreviewAttachResetInterval = Literal[ + "one_off", + "minute", + "hour", + "day", + "week", + "month", + "quarter", + "semi_annual", + "year", +] + + +class PreviewAttachResetTypedDict(TypedDict): + interval: PreviewAttachResetInterval + interval_count: NotRequired[float] + + +class PreviewAttachReset(BaseModel): + interval: PreviewAttachResetInterval + + interval_count: Optional[float] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +PreviewAttachToTypedDict = TypeAliasType("PreviewAttachToTypedDict", Union[float, str]) + + +PreviewAttachTo = TypeAliasType("PreviewAttachTo", Union[float, str]) + + +class PreviewAttachTierTypedDict(TypedDict): + to: PreviewAttachToTypedDict + amount: float + + +class PreviewAttachTier(BaseModel): + to: PreviewAttachTo + + amount: float + + +PreviewAttachItemPriceInterval = Literal[ + "one_off", + "week", + "month", + "quarter", + "semi_annual", + "year", +] + + +PreviewAttachBillingMethod = Literal[ + "prepaid", + "usage_based", +] + + +class PreviewAttachItemPriceTypedDict(TypedDict): + interval: PreviewAttachItemPriceInterval + billing_method: PreviewAttachBillingMethod + amount: NotRequired[float] + tiers: NotRequired[List[PreviewAttachTierTypedDict]] + interval_count: NotRequired[float] + billing_units: NotRequired[float] + max_purchase: NotRequired[float] + + +class PreviewAttachItemPrice(BaseModel): + interval: PreviewAttachItemPriceInterval + + billing_method: PreviewAttachBillingMethod + + amount: Optional[float] = None + + tiers: Optional[List[PreviewAttachTier]] = None + + interval_count: Optional[float] = 1 + + billing_units: Optional[float] = 1 + + max_purchase: Optional[float] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["amount", "tiers", "interval_count", "billing_units", "max_purchase"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +PreviewAttachOnIncrease = Literal[ + "bill_immediately", + "prorate_immediately", + "prorate_next_cycle", + "bill_next_cycle", +] + + +PreviewAttachOnDecrease = Literal[ + "prorate", + "prorate_immediately", + "prorate_next_cycle", + "none", + "no_prorations", +] + + +class PreviewAttachProrationTypedDict(TypedDict): + on_increase: PreviewAttachOnIncrease + on_decrease: PreviewAttachOnDecrease + + +class PreviewAttachProration(BaseModel): + on_increase: PreviewAttachOnIncrease + + on_decrease: PreviewAttachOnDecrease + + +PreviewAttachExpiryDurationType = Literal[ + "month", + "forever", +] + + +class PreviewAttachRolloverTypedDict(TypedDict): + expiry_duration_type: PreviewAttachExpiryDurationType + max: NotRequired[float] + expiry_duration_length: NotRequired[float] + + +class PreviewAttachRollover(BaseModel): + expiry_duration_type: PreviewAttachExpiryDurationType + + max: Optional[float] = None + + expiry_duration_length: Optional[float] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["max", "expiry_duration_length"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class PreviewAttachItemTypedDict(TypedDict): + feature_id: str + included: NotRequired[float] + unlimited: NotRequired[bool] + reset: NotRequired[PreviewAttachResetTypedDict] + price: NotRequired[PreviewAttachItemPriceTypedDict] + proration: NotRequired[PreviewAttachProrationTypedDict] + rollover: NotRequired[PreviewAttachRolloverTypedDict] + + +class PreviewAttachItem(BaseModel): + feature_id: str + + included: Optional[float] = None + + unlimited: Optional[bool] = None + + reset: Optional[PreviewAttachReset] = None + + price: Optional[PreviewAttachItemPrice] = None + + proration: Optional[PreviewAttachProration] = None + + rollover: Optional[PreviewAttachRollover] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["included", "unlimited", "reset", "price", "proration", "rollover"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class PreviewAttachCustomizeTypedDict(TypedDict): + r"""Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.""" + + price: NotRequired[Nullable[PreviewAttachPriceTypedDict]] + items: NotRequired[List[PreviewAttachItemTypedDict]] + + +class PreviewAttachCustomize(BaseModel): + r"""Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.""" + + price: OptionalNullable[PreviewAttachPrice] = UNSET + + items: Optional[List[PreviewAttachItem]] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["price", "items"]) + nullable_fields = set(["price"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class PreviewAttachInvoiceModeTypedDict(TypedDict): + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" + + enabled: bool + r"""When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method.""" + enable_plan_immediately: NotRequired[bool] + r"""If true, enables the plan immediately even though the invoice is not paid yet.""" + finalize: NotRequired[bool] + r"""If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.""" + + +class PreviewAttachInvoiceMode(BaseModel): + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" + + enabled: bool + r"""When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method.""" + + enable_plan_immediately: Optional[bool] = False + r"""If true, enables the plan immediately even though the invoice is not paid yet.""" + + finalize: Optional[bool] = True + r"""If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["enable_plan_immediately", "finalize"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +PreviewAttachBillingBehavior = Literal[ + "prorate_immediately", + "next_cycle_only", +] +r"""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.""" + + +class PreviewAttachDiscountRequest2TypedDict(TypedDict): + promotion_code: str + r"""The promotion code to apply as a discount.""" + + +class PreviewAttachDiscountRequest2(BaseModel): + promotion_code: str + r"""The promotion code to apply as a discount.""" + + +class PreviewAttachDiscountRequest1TypedDict(TypedDict): + reward_id: str + r"""The ID of the reward to apply as a discount.""" + + +class PreviewAttachDiscountRequest1(BaseModel): + reward_id: str + r"""The ID of the reward to apply as a discount.""" + + +PreviewAttachDiscountUnionTypedDict = TypeAliasType( + "PreviewAttachDiscountUnionTypedDict", + Union[ + PreviewAttachDiscountRequest1TypedDict, PreviewAttachDiscountRequest2TypedDict + ], +) +r"""A discount to apply. Can be either a reward ID or a promotion code.""" + + +PreviewAttachDiscountUnion = TypeAliasType( + "PreviewAttachDiscountUnion", + Union[PreviewAttachDiscountRequest1, PreviewAttachDiscountRequest2], +) +r"""A discount to apply. Can be either a reward ID or a promotion code.""" + + +PreviewAttachPlanSchedule = Literal[ + "immediate", + "end_of_cycle", +] +r"""When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.""" + + +class PreviewAttachParamsTypedDict(TypedDict): + customer_id: str + r"""The ID of the customer to attach the plan to.""" + plan_id: str + r"""The ID of the plan.""" + entity_id: NotRequired[str] + r"""The ID of the entity to attach the plan to.""" + feature_quantities: NotRequired[List[PreviewAttachFeatureQuantityTypedDict]] + r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan.""" + version: NotRequired[float] + r"""The version of the plan to attach.""" + free_trial: NotRequired[Nullable[PreviewAttachFreeTrialTypedDict]] + r"""Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.""" + customize: NotRequired[PreviewAttachCustomizeTypedDict] + r"""Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.""" + invoice_mode: NotRequired[PreviewAttachInvoiceModeTypedDict] + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" + billing_behavior: NotRequired[PreviewAttachBillingBehavior] + r"""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.""" + discounts: NotRequired[List[PreviewAttachDiscountUnionTypedDict]] + r"""List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.""" + success_url: NotRequired[str] + r"""URL to redirect to after successful checkout.""" + new_billing_subscription: NotRequired[bool] + r"""Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.""" + plan_schedule: NotRequired[PreviewAttachPlanSchedule] + r"""When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.""" + + +class PreviewAttachParams(BaseModel): + customer_id: str + r"""The ID of the customer to attach the plan to.""" + + plan_id: str + r"""The ID of the plan.""" + + entity_id: Optional[str] = None + r"""The ID of the entity to attach the plan to.""" + + feature_quantities: Optional[List[PreviewAttachFeatureQuantity]] = None + r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan.""" + + version: Optional[float] = None + r"""The version of the plan to attach.""" + + free_trial: OptionalNullable[PreviewAttachFreeTrial] = UNSET + r"""Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.""" + + customize: Optional[PreviewAttachCustomize] = None + r"""Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.""" + + invoice_mode: Optional[PreviewAttachInvoiceMode] = None + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" + + billing_behavior: Optional[PreviewAttachBillingBehavior] = None + r"""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.""" + + discounts: Optional[List[PreviewAttachDiscountUnion]] = None + r"""List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.""" + + success_url: Optional[str] = None + r"""URL to redirect to after successful checkout.""" + + new_billing_subscription: Optional[bool] = None + r"""Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.""" + + plan_schedule: Optional[PreviewAttachPlanSchedule] = None + r"""When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "entity_id", + "feature_quantities", + "version", + "free_trial", + "customize", + "invoice_mode", + "billing_behavior", + "discounts", + "success_url", + "new_billing_subscription", + "plan_schedule", + ] + ) + nullable_fields = set(["free_trial"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class PreviewAttachDiscountResponseTypedDict(TypedDict): + amount_off: float + percent_off: NotRequired[float] + stripe_coupon_id: NotRequired[str] + coupon_name: NotRequired[str] + + +class PreviewAttachDiscountResponse(BaseModel): + amount_off: Annotated[float, pydantic.Field(alias="amountOff")] + + percent_off: Annotated[Optional[float], pydantic.Field(alias="percentOff")] = None + + stripe_coupon_id: Annotated[ + Optional[str], pydantic.Field(alias="stripeCouponId") + ] = None + + coupon_name: Annotated[Optional[str], pydantic.Field(alias="couponName")] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["percentOff", "stripeCouponId", "couponName"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class PreviewAttachLineItemTypedDict(TypedDict): + title: str + r"""The title of the line item.""" + description: str + r"""A detailed description of the line item.""" + amount: float + r"""The amount in cents for this line item.""" + discounts: NotRequired[List[PreviewAttachDiscountResponseTypedDict]] + r"""List of discounts applied to this line item.""" + + +class PreviewAttachLineItem(BaseModel): + title: str + r"""The title of the line item.""" + + description: str + r"""A detailed description of the line item.""" + + amount: float + r"""The amount in cents for this line item.""" + + discounts: Optional[List[PreviewAttachDiscountResponse]] = None + r"""List of discounts applied to this line item.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["discounts"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class PreviewAttachNextCycleTypedDict(TypedDict): + r"""Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles.""" + + starts_at: float + r"""Unix timestamp (milliseconds) when the next billing cycle starts.""" + total: float + r"""The total amount in cents for the next cycle.""" + + +class PreviewAttachNextCycle(BaseModel): + r"""Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles.""" + + starts_at: float + r"""Unix timestamp (milliseconds) when the next billing cycle starts.""" + + total: float + r"""The total amount in cents for the next cycle.""" + + +class PreviewAttachResponseTypedDict(TypedDict): + r"""OK""" + + customer_id: str + r"""The ID of the customer.""" + line_items: List[PreviewAttachLineItemTypedDict] + r"""List of line items for the current billing period.""" + total: float + r"""The total amount in cents for the current billing period.""" + currency: str + r"""The three-letter ISO currency code (e.g., 'usd').""" + next_cycle: NotRequired[PreviewAttachNextCycleTypedDict] + r"""Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles.""" + + +class PreviewAttachResponse(BaseModel): + r"""OK""" + + customer_id: str + r"""The ID of the customer.""" + + line_items: List[PreviewAttachLineItem] + r"""List of line items for the current billing period.""" + + total: float + r"""The total amount in cents for the current billing period.""" + + currency: str + r"""The three-letter ISO currency code (e.g., 'usd').""" + + next_cycle: Optional[PreviewAttachNextCycle] = None + r"""Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["next_cycle"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +try: + PreviewAttachDiscountResponse.model_rebuild() +except NameError: + pass diff --git a/others/python-sdk/src/autumn_sdk/models/billingpreviewupdateop.py b/others/python-sdk/src/autumn_sdk/models/previewupdateop.py similarity index 56% rename from others/python-sdk/src/autumn_sdk/models/billingpreviewupdateop.py rename to others/python-sdk/src/autumn_sdk/models/previewupdateop.py index bf3fa23cd..a313a711b 100644 --- a/others/python-sdk/src/autumn_sdk/models/billingpreviewupdateop.py +++ b/others/python-sdk/src/autumn_sdk/models/previewupdateop.py @@ -15,11 +15,11 @@ from typing import List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -class BillingPreviewUpdateGlobalsTypedDict(TypedDict): +class PreviewUpdateGlobalsTypedDict(TypedDict): x_api_version: NotRequired[str] -class BillingPreviewUpdateGlobals(BaseModel): +class PreviewUpdateGlobals(BaseModel): x_api_version: Annotated[ Optional[str], pydantic.Field(alias="x-api-version"), @@ -43,13 +43,13 @@ class BillingPreviewUpdateGlobals(BaseModel): return m -class BillingPreviewUpdateFeatureQuantitiesTypedDict(TypedDict): +class PreviewUpdateFeatureQuantityTypedDict(TypedDict): feature_id: str quantity: NotRequired[float] adjustable: NotRequired[bool] -class BillingPreviewUpdateFeatureQuantities(BaseModel): +class PreviewUpdateFeatureQuantity(BaseModel): feature_id: str quantity: Optional[float] = None @@ -73,23 +73,23 @@ class BillingPreviewUpdateFeatureQuantities(BaseModel): return m -BillingPreviewUpdateDurationType = Literal[ +PreviewUpdateDurationType = Literal[ "day", "month", "year", ] -class BillingPreviewUpdateFreeTrialTypedDict(TypedDict): +class PreviewUpdateFreeTrialTypedDict(TypedDict): duration_length: float - duration_type: NotRequired[BillingPreviewUpdateDurationType] + duration_type: NotRequired[PreviewUpdateDurationType] card_required: NotRequired[bool] -class BillingPreviewUpdateFreeTrial(BaseModel): +class PreviewUpdateFreeTrial(BaseModel): duration_length: float - duration_type: Optional[BillingPreviewUpdateDurationType] = "month" + duration_type: Optional[PreviewUpdateDurationType] = "month" card_required: Optional[bool] = True @@ -110,7 +110,7 @@ class BillingPreviewUpdateFreeTrial(BaseModel): return m -BillingPreviewUpdatePriceInterval = Literal[ +PreviewUpdatePriceInterval = Literal[ "one_off", "week", "month", @@ -120,16 +120,16 @@ BillingPreviewUpdatePriceInterval = Literal[ ] -class BillingPreviewUpdatePriceTypedDict(TypedDict): +class PreviewUpdatePriceTypedDict(TypedDict): amount: float - interval: BillingPreviewUpdatePriceInterval + interval: PreviewUpdatePriceInterval interval_count: NotRequired[float] -class BillingPreviewUpdatePrice(BaseModel): +class PreviewUpdatePrice(BaseModel): amount: float - interval: BillingPreviewUpdatePriceInterval + interval: PreviewUpdatePriceInterval interval_count: Optional[float] = None @@ -150,7 +150,7 @@ class BillingPreviewUpdatePrice(BaseModel): return m -BillingPreviewUpdateResetInterval = Literal[ +PreviewUpdateResetInterval = Literal[ "one_off", "minute", "hour", @@ -163,13 +163,13 @@ BillingPreviewUpdateResetInterval = Literal[ ] -class BillingPreviewUpdateResetTypedDict(TypedDict): - interval: BillingPreviewUpdateResetInterval +class PreviewUpdateResetTypedDict(TypedDict): + interval: PreviewUpdateResetInterval interval_count: NotRequired[float] -class BillingPreviewUpdateReset(BaseModel): - interval: BillingPreviewUpdateResetInterval +class PreviewUpdateReset(BaseModel): + interval: PreviewUpdateResetInterval interval_count: Optional[float] = None @@ -190,26 +190,24 @@ class BillingPreviewUpdateReset(BaseModel): return m -BillingPreviewUpdateToTypedDict = TypeAliasType( - "BillingPreviewUpdateToTypedDict", Union[float, str] -) +PreviewUpdateToTypedDict = TypeAliasType("PreviewUpdateToTypedDict", Union[float, str]) -BillingPreviewUpdateTo = TypeAliasType("BillingPreviewUpdateTo", Union[float, str]) +PreviewUpdateTo = TypeAliasType("PreviewUpdateTo", Union[float, str]) -class BillingPreviewUpdateTierTypedDict(TypedDict): - to: BillingPreviewUpdateToTypedDict +class PreviewUpdateTierTypedDict(TypedDict): + to: PreviewUpdateToTypedDict amount: float -class BillingPreviewUpdateTier(BaseModel): - to: BillingPreviewUpdateTo +class PreviewUpdateTier(BaseModel): + to: PreviewUpdateTo amount: float -BillingPreviewUpdateItemPriceInterval = Literal[ +PreviewUpdateItemPriceInterval = Literal[ "one_off", "week", "month", @@ -219,30 +217,30 @@ BillingPreviewUpdateItemPriceInterval = Literal[ ] -BillingPreviewUpdateBillingMethod = Literal[ +PreviewUpdateBillingMethod = Literal[ "prepaid", "usage_based", ] -class BillingPreviewUpdateItemPriceTypedDict(TypedDict): - interval: BillingPreviewUpdateItemPriceInterval - billing_method: BillingPreviewUpdateBillingMethod +class PreviewUpdateItemPriceTypedDict(TypedDict): + interval: PreviewUpdateItemPriceInterval + billing_method: PreviewUpdateBillingMethod amount: NotRequired[float] - tiers: NotRequired[List[BillingPreviewUpdateTierTypedDict]] + tiers: NotRequired[List[PreviewUpdateTierTypedDict]] interval_count: NotRequired[float] billing_units: NotRequired[float] max_purchase: NotRequired[float] -class BillingPreviewUpdateItemPrice(BaseModel): - interval: BillingPreviewUpdateItemPriceInterval +class PreviewUpdateItemPrice(BaseModel): + interval: PreviewUpdateItemPriceInterval - billing_method: BillingPreviewUpdateBillingMethod + billing_method: PreviewUpdateBillingMethod amount: Optional[float] = None - tiers: Optional[List[BillingPreviewUpdateTier]] = None + tiers: Optional[List[PreviewUpdateTier]] = None interval_count: Optional[float] = 1 @@ -269,7 +267,7 @@ class BillingPreviewUpdateItemPrice(BaseModel): return m -BillingPreviewUpdateOnIncrease = Literal[ +PreviewUpdateOnIncrease = Literal[ "bill_immediately", "prorate_immediately", "prorate_next_cycle", @@ -277,7 +275,7 @@ BillingPreviewUpdateOnIncrease = Literal[ ] -BillingPreviewUpdateOnDecrease = Literal[ +PreviewUpdateOnDecrease = Literal[ "prorate", "prorate_immediately", "prorate_next_cycle", @@ -286,31 +284,31 @@ BillingPreviewUpdateOnDecrease = Literal[ ] -class BillingPreviewUpdateProrationTypedDict(TypedDict): - on_increase: BillingPreviewUpdateOnIncrease - on_decrease: BillingPreviewUpdateOnDecrease +class PreviewUpdateProrationTypedDict(TypedDict): + on_increase: PreviewUpdateOnIncrease + on_decrease: PreviewUpdateOnDecrease -class BillingPreviewUpdateProration(BaseModel): - on_increase: BillingPreviewUpdateOnIncrease +class PreviewUpdateProration(BaseModel): + on_increase: PreviewUpdateOnIncrease - on_decrease: BillingPreviewUpdateOnDecrease + on_decrease: PreviewUpdateOnDecrease -BillingPreviewUpdateExpiryDurationType = Literal[ +PreviewUpdateExpiryDurationType = Literal[ "month", "forever", ] -class BillingPreviewUpdateRolloverTypedDict(TypedDict): - expiry_duration_type: BillingPreviewUpdateExpiryDurationType +class PreviewUpdateRolloverTypedDict(TypedDict): + expiry_duration_type: PreviewUpdateExpiryDurationType max: NotRequired[float] expiry_duration_length: NotRequired[float] -class BillingPreviewUpdateRollover(BaseModel): - expiry_duration_type: BillingPreviewUpdateExpiryDurationType +class PreviewUpdateRollover(BaseModel): + expiry_duration_type: PreviewUpdateExpiryDurationType max: Optional[float] = None @@ -333,30 +331,30 @@ class BillingPreviewUpdateRollover(BaseModel): return m -class BillingPreviewUpdateItemTypedDict(TypedDict): +class PreviewUpdateItemTypedDict(TypedDict): feature_id: str included: NotRequired[float] unlimited: NotRequired[bool] - reset: NotRequired[BillingPreviewUpdateResetTypedDict] - price: NotRequired[BillingPreviewUpdateItemPriceTypedDict] - proration: NotRequired[BillingPreviewUpdateProrationTypedDict] - rollover: NotRequired[BillingPreviewUpdateRolloverTypedDict] + reset: NotRequired[PreviewUpdateResetTypedDict] + price: NotRequired[PreviewUpdateItemPriceTypedDict] + proration: NotRequired[PreviewUpdateProrationTypedDict] + rollover: NotRequired[PreviewUpdateRolloverTypedDict] -class BillingPreviewUpdateItem(BaseModel): +class PreviewUpdateItem(BaseModel): feature_id: str included: Optional[float] = None unlimited: Optional[bool] = None - reset: Optional[BillingPreviewUpdateReset] = None + reset: Optional[PreviewUpdateReset] = None - price: Optional[BillingPreviewUpdateItemPrice] = None + price: Optional[PreviewUpdateItemPrice] = None - proration: Optional[BillingPreviewUpdateProration] = None + proration: Optional[PreviewUpdateProration] = None - rollover: Optional[BillingPreviewUpdateRollover] = None + rollover: Optional[PreviewUpdateRollover] = None @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -377,19 +375,19 @@ class BillingPreviewUpdateItem(BaseModel): return m -class BillingPreviewUpdateCustomizeTypedDict(TypedDict): +class PreviewUpdateCustomizeTypedDict(TypedDict): r"""Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.""" - price: NotRequired[Nullable[BillingPreviewUpdatePriceTypedDict]] - items: NotRequired[List[BillingPreviewUpdateItemTypedDict]] + price: NotRequired[Nullable[PreviewUpdatePriceTypedDict]] + items: NotRequired[List[PreviewUpdateItemTypedDict]] -class BillingPreviewUpdateCustomize(BaseModel): +class PreviewUpdateCustomize(BaseModel): r"""Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.""" - price: OptionalNullable[BillingPreviewUpdatePrice] = UNSET + price: OptionalNullable[PreviewUpdatePrice] = UNSET - items: Optional[List[BillingPreviewUpdateItem]] = None + items: Optional[List[PreviewUpdateItem]] = None @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -417,18 +415,28 @@ class BillingPreviewUpdateCustomize(BaseModel): return m -class BillingPreviewUpdateInvoiceModeTypedDict(TypedDict): +class PreviewUpdateInvoiceModeTypedDict(TypedDict): + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" + enabled: bool + r"""When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method.""" enable_plan_immediately: NotRequired[bool] + r"""If true, enables the plan immediately even though the invoice is not paid yet.""" finalize: NotRequired[bool] + r"""If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.""" -class BillingPreviewUpdateInvoiceMode(BaseModel): +class PreviewUpdateInvoiceMode(BaseModel): + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" + enabled: bool + r"""When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method.""" enable_plan_immediately: Optional[bool] = False + r"""If true, enables the plan immediately even though the invoice is not paid yet.""" finalize: Optional[bool] = True + r"""If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -447,66 +455,74 @@ class BillingPreviewUpdateInvoiceMode(BaseModel): return m -BillingPreviewUpdateCancelAction = Literal[ +PreviewUpdateBillingBehavior = Literal[ + "prorate_immediately", + "next_cycle_only", +] +r"""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.""" + + +PreviewUpdateCancelAction = Literal[ "cancel_immediately", "cancel_end_of_cycle", "uncancel", ] +r"""Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation.""" -BillingPreviewUpdateBillingBehavior = Literal[ - "prorate_immediately", - "next_cycle_only", -] - - -class BillingPreviewUpdateRequestTypedDict(TypedDict): +class PreviewUpdateParamsTypedDict(TypedDict): customer_id: str r"""The ID of the customer to attach the plan to.""" - entity_id: NotRequired[Nullable[str]] + plan_id: str + r"""The ID of the plan.""" + entity_id: NotRequired[str] r"""The ID of the entity to attach the plan to.""" - feature_quantities: NotRequired[ - Nullable[List[BillingPreviewUpdateFeatureQuantitiesTypedDict]] - ] + feature_quantities: NotRequired[List[PreviewUpdateFeatureQuantityTypedDict]] r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan.""" version: NotRequired[float] r"""The version of the plan to attach.""" - free_trial: NotRequired[Nullable[BillingPreviewUpdateFreeTrialTypedDict]] - customize: NotRequired[BillingPreviewUpdateCustomizeTypedDict] + free_trial: NotRequired[Nullable[PreviewUpdateFreeTrialTypedDict]] + r"""Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.""" + customize: NotRequired[PreviewUpdateCustomizeTypedDict] r"""Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.""" - plan_id: NotRequired[str] - invoice_mode: NotRequired[BillingPreviewUpdateInvoiceModeTypedDict] - cancel_action: NotRequired[BillingPreviewUpdateCancelAction] - billing_behavior: NotRequired[BillingPreviewUpdateBillingBehavior] + invoice_mode: NotRequired[PreviewUpdateInvoiceModeTypedDict] + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" + billing_behavior: NotRequired[PreviewUpdateBillingBehavior] + r"""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.""" + cancel_action: NotRequired[PreviewUpdateCancelAction] + r"""Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation.""" -class BillingPreviewUpdateRequest(BaseModel): +class PreviewUpdateParams(BaseModel): customer_id: str r"""The ID of the customer to attach the plan to.""" - entity_id: OptionalNullable[str] = UNSET + plan_id: str + r"""The ID of the plan.""" + + entity_id: Optional[str] = None r"""The ID of the entity to attach the plan to.""" - feature_quantities: OptionalNullable[ - List[BillingPreviewUpdateFeatureQuantities] - ] = UNSET + feature_quantities: Optional[List[PreviewUpdateFeatureQuantity]] = None r"""If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan.""" version: Optional[float] = None r"""The version of the plan to attach.""" - free_trial: OptionalNullable[BillingPreviewUpdateFreeTrial] = UNSET + free_trial: OptionalNullable[PreviewUpdateFreeTrial] = UNSET + r"""Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.""" - customize: Optional[BillingPreviewUpdateCustomize] = None + customize: Optional[PreviewUpdateCustomize] = None r"""Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.""" - plan_id: Optional[str] = None + invoice_mode: Optional[PreviewUpdateInvoiceMode] = None + r"""Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.""" - invoice_mode: Optional[BillingPreviewUpdateInvoiceMode] = None + billing_behavior: Optional[PreviewUpdateBillingBehavior] = None + r"""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.""" - cancel_action: Optional[BillingPreviewUpdateCancelAction] = None - - billing_behavior: Optional[BillingPreviewUpdateBillingBehavior] = None + cancel_action: Optional[PreviewUpdateCancelAction] = None + r"""Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -517,13 +533,12 @@ class BillingPreviewUpdateRequest(BaseModel): "version", "free_trial", "customize", - "plan_id", "invoice_mode", - "cancel_action", "billing_behavior", + "cancel_action", ] ) - nullable_fields = set(["entity_id", "feature_quantities", "free_trial"]) + nullable_fields = set(["free_trial"]) serialized = handler(self) m = {} @@ -546,14 +561,14 @@ class BillingPreviewUpdateRequest(BaseModel): return m -class BillingPreviewUpdateDiscountTypedDict(TypedDict): +class PreviewUpdateDiscountTypedDict(TypedDict): amount_off: float percent_off: NotRequired[float] stripe_coupon_id: NotRequired[str] coupon_name: NotRequired[str] -class BillingPreviewUpdateDiscount(BaseModel): +class PreviewUpdateDiscount(BaseModel): amount_off: Annotated[float, pydantic.Field(alias="amountOff")] percent_off: Annotated[Optional[float], pydantic.Field(alias="percentOff")] = None @@ -581,56 +596,33 @@ class BillingPreviewUpdateDiscount(BaseModel): return m -class BillingPreviewUpdateEffectivePeriodTypedDict(TypedDict): - start: float - end: float - - -class BillingPreviewUpdateEffectivePeriod(BaseModel): - start: float - - end: float - - -class BillingPreviewUpdateLineItemTypedDict(TypedDict): +class PreviewUpdateLineItemTypedDict(TypedDict): title: str + r"""The title of the line item.""" description: str + r"""A detailed description of the line item.""" amount: float - plan_id: str - total_quantity: float - paid_quantity: float - discounts: NotRequired[List[BillingPreviewUpdateDiscountTypedDict]] - deferred_for_trial: NotRequired[bool] - effective_period: NotRequired[BillingPreviewUpdateEffectivePeriodTypedDict] - is_base: NotRequired[bool] + r"""The amount in cents for this line item.""" + discounts: NotRequired[List[PreviewUpdateDiscountTypedDict]] + r"""List of discounts applied to this line item.""" -class BillingPreviewUpdateLineItem(BaseModel): +class PreviewUpdateLineItem(BaseModel): title: str + r"""The title of the line item.""" description: str + r"""A detailed description of the line item.""" amount: float + r"""The amount in cents for this line item.""" - plan_id: str - - total_quantity: float - - paid_quantity: float - - discounts: Optional[List[BillingPreviewUpdateDiscount]] = None - - deferred_for_trial: Optional[bool] = None - - effective_period: Optional[BillingPreviewUpdateEffectivePeriod] = None - - is_base: Optional[bool] = None + discounts: Optional[List[PreviewUpdateDiscount]] = None + r"""List of discounts applied to this line item.""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set( - ["discounts", "deferred_for_trial", "effective_period", "is_base"] - ) + optional_fields = set(["discounts"]) serialized = handler(self) m = {} @@ -645,151 +637,61 @@ class BillingPreviewUpdateLineItem(BaseModel): return m -class BillingPreviewUpdateNextCycleDiscountTypedDict(TypedDict): - amount_off: float - percent_off: NotRequired[float] - stripe_coupon_id: NotRequired[str] - coupon_name: NotRequired[str] +class PreviewUpdateNextCycleTypedDict(TypedDict): + r"""Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles.""" - -class BillingPreviewUpdateNextCycleDiscount(BaseModel): - amount_off: Annotated[float, pydantic.Field(alias="amountOff")] - - percent_off: Annotated[Optional[float], pydantic.Field(alias="percentOff")] = None - - stripe_coupon_id: Annotated[ - Optional[str], pydantic.Field(alias="stripeCouponId") - ] = None - - coupon_name: Annotated[Optional[str], pydantic.Field(alias="couponName")] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["percentOff", "stripeCouponId", "couponName"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class BillingPreviewUpdateNextCycleEffectivePeriodTypedDict(TypedDict): - start: float - end: float - - -class BillingPreviewUpdateNextCycleEffectivePeriod(BaseModel): - start: float - - end: float - - -class BillingPreviewUpdateNextCycleLineItemTypedDict(TypedDict): - title: str - description: str - amount: float - plan_id: str - total_quantity: float - paid_quantity: float - discounts: NotRequired[List[BillingPreviewUpdateNextCycleDiscountTypedDict]] - deferred_for_trial: NotRequired[bool] - effective_period: NotRequired[BillingPreviewUpdateNextCycleEffectivePeriodTypedDict] - is_base: NotRequired[bool] - - -class BillingPreviewUpdateNextCycleLineItem(BaseModel): - title: str - - description: str - - amount: float - - plan_id: str - - total_quantity: float - - paid_quantity: float - - discounts: Optional[List[BillingPreviewUpdateNextCycleDiscount]] = None - - deferred_for_trial: Optional[bool] = None - - effective_period: Optional[BillingPreviewUpdateNextCycleEffectivePeriod] = None - - is_base: Optional[bool] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["discounts", "deferred_for_trial", "effective_period", "is_base"] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class BillingPreviewUpdateNextCycleTypedDict(TypedDict): starts_at: float + r"""Unix timestamp (milliseconds) when the next billing cycle starts.""" total: float - line_items: List[BillingPreviewUpdateNextCycleLineItemTypedDict] + r"""The total amount in cents for the next cycle.""" -class BillingPreviewUpdateNextCycle(BaseModel): +class PreviewUpdateNextCycle(BaseModel): + r"""Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles.""" + starts_at: float + r"""Unix timestamp (milliseconds) when the next billing cycle starts.""" total: float - - line_items: List[BillingPreviewUpdateNextCycleLineItem] + r"""The total amount in cents for the next cycle.""" -class BillingPreviewUpdateResponseTypedDict(TypedDict): +class PreviewUpdateResponseTypedDict(TypedDict): r"""OK""" customer_id: str - line_items: List[BillingPreviewUpdateLineItemTypedDict] + r"""The ID of the customer.""" + line_items: List[PreviewUpdateLineItemTypedDict] + r"""List of line items for the current billing period.""" total: float + r"""The total amount in cents for the current billing period.""" currency: str - period_start: NotRequired[float] - period_end: NotRequired[float] - next_cycle: NotRequired[BillingPreviewUpdateNextCycleTypedDict] + r"""The three-letter ISO currency code (e.g., 'usd').""" + next_cycle: NotRequired[PreviewUpdateNextCycleTypedDict] + r"""Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles.""" -class BillingPreviewUpdateResponse(BaseModel): +class PreviewUpdateResponse(BaseModel): r"""OK""" customer_id: str + r"""The ID of the customer.""" - line_items: List[BillingPreviewUpdateLineItem] + line_items: List[PreviewUpdateLineItem] + r"""List of line items for the current billing period.""" total: float + r"""The total amount in cents for the current billing period.""" currency: str + r"""The three-letter ISO currency code (e.g., 'usd').""" - period_start: Optional[float] = None - - period_end: Optional[float] = None - - next_cycle: Optional[BillingPreviewUpdateNextCycle] = None + next_cycle: Optional[PreviewUpdateNextCycle] = None + r"""Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles.""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["period_start", "period_end", "next_cycle"]) + optional_fields = set(["next_cycle"]) serialized = handler(self) m = {} @@ -805,10 +707,6 @@ class BillingPreviewUpdateResponse(BaseModel): try: - BillingPreviewUpdateDiscount.model_rebuild() -except NameError: - pass -try: - BillingPreviewUpdateNextCycleDiscount.model_rebuild() + PreviewUpdateDiscount.model_rebuild() except NameError: pass diff --git a/others/python-sdk/src/autumn_sdk/models/redeemreferralcodeop.py b/others/python-sdk/src/autumn_sdk/models/redeemreferralcodeop.py new file mode 100644 index 000000000..be1f39aba --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/redeemreferralcodeop.py @@ -0,0 +1,76 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from autumn_sdk.types import BaseModel, UNSET_SENTINEL +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class RedeemReferralCodeGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class RedeemReferralCodeGlobals(BaseModel): + x_api_version: Annotated[ + Optional[str], + pydantic.Field(alias="x-api-version"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = "2.1" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["x-api-version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class RedeemReferralCodeParamsTypedDict(TypedDict): + code: str + r"""The referral code to redeem""" + customer_id: str + r"""The unique identifier of the customer redeeming the code""" + + +class RedeemReferralCodeParams(BaseModel): + code: str + r"""The referral code to redeem""" + + customer_id: str + r"""The unique identifier of the customer redeeming the code""" + + +class RedeemReferralCodeResponseTypedDict(TypedDict): + r"""OK""" + + id: str + r"""The ID of the redemption event""" + customer_id: str + r"""Your unique identifier for the customer""" + reward_id: str + r"""The ID of the reward that will be granted""" + + +class RedeemReferralCodeResponse(BaseModel): + r"""OK""" + + id: str + r"""The ID of the redemption event""" + + customer_id: str + r"""Your unique identifier for the customer""" + + reward_id: str + r"""The ID of the reward that will be granted""" diff --git a/others/python-sdk/src/autumn_sdk/models/balancestrackop.py b/others/python-sdk/src/autumn_sdk/models/trackop.py similarity index 51% rename from others/python-sdk/src/autumn_sdk/models/balancestrackop.py rename to others/python-sdk/src/autumn_sdk/models/trackop.py index 84737f2b4..b5c528316 100644 --- a/others/python-sdk/src/autumn_sdk/models/balancestrackop.py +++ b/others/python-sdk/src/autumn_sdk/models/trackop.py @@ -16,11 +16,11 @@ from typing import Any, Dict, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -class BalancesTrackGlobalsTypedDict(TypedDict): +class TrackGlobalsTypedDict(TypedDict): x_api_version: NotRequired[str] -class BalancesTrackGlobals(BaseModel): +class TrackGlobals(BaseModel): x_api_version: Annotated[ Optional[str], pydantic.Field(alias="x-api-version"), @@ -44,56 +44,44 @@ class BalancesTrackGlobals(BaseModel): return m -class BalancesTrackRequestTypedDict(TypedDict): +class TrackParamsTypedDict(TypedDict): customer_id: str - r"""ID which you provided when creating the customer""" + r"""The ID of the customer.""" feature_id: NotRequired[str] - r"""ID of the feature to track usage for. Required if event_name is not provided. Use this for direct feature tracking.""" + r"""The ID of the feature to track usage for. Required if event_name is not provided.""" + entity_id: NotRequired[str] + r"""The ID of the entity for entity-scoped balances (e.g., per-seat limits).""" event_name: NotRequired[str] - r"""An [event name](/features/tracking-usage#using-event-names) can be used in place of feature_id. This can be used if multiple features are tracked in the same event.""" + r"""Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event.""" value: NotRequired[float] - r"""The amount of usage to record. Defaults to 1. Can be negative to increase the balance (e.g., when removing a seat).""" + r"""The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat).""" properties: NotRequired[Dict[str, Any]] r"""Additional properties to attach to this usage event.""" - idempotency_key: NotRequired[str] - r"""Unique key to prevent duplicate event recording. Use this to safely retry requests without creating duplicate usage records.""" - entity_id: NotRequired[str] - r"""If using [entity balances](/features/feature-entities) (eg, seats), the entity ID to track usage for.""" -class BalancesTrackRequest(BaseModel): +class TrackParams(BaseModel): customer_id: str - r"""ID which you provided when creating the customer""" + r"""The ID of the customer.""" feature_id: Optional[str] = None - r"""ID of the feature to track usage for. Required if event_name is not provided. Use this for direct feature tracking.""" + r"""The ID of the feature to track usage for. Required if event_name is not provided.""" + + entity_id: Optional[str] = None + r"""The ID of the entity for entity-scoped balances (e.g., per-seat limits).""" event_name: Optional[str] = None - r"""An [event name](/features/tracking-usage#using-event-names) can be used in place of feature_id. This can be used if multiple features are tracked in the same event.""" + r"""Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event.""" value: Optional[float] = None - r"""The amount of usage to record. Defaults to 1. Can be negative to increase the balance (e.g., when removing a seat).""" + r"""The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat).""" properties: Optional[Dict[str, Any]] = None r"""Additional properties to attach to this usage event.""" - idempotency_key: Optional[str] = None - r"""Unique key to prevent duplicate event recording. Use this to safely retry requests without creating duplicate usage records.""" - - entity_id: Optional[str] = None - r"""If using [entity balances](/features/feature-entities) (eg, seats), the entity ID to track usage for.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - [ - "feature_id", - "event_name", - "value", - "properties", - "idempotency_key", - "entity_id", - ] + ["feature_id", "entity_id", "event_name", "value", "properties"] ) serialized = handler(self) m = {} @@ -109,7 +97,7 @@ class BalancesTrackRequest(BaseModel): return m -BalancesTrackBalanceType = Union[ +TrackBalanceType = Union[ Literal[ "boolean", "metered", @@ -119,23 +107,23 @@ BalancesTrackBalanceType = Union[ ] -class BalancesTrackBalanceCreditSchemaTypedDict(TypedDict): +class TrackBalanceCreditSchemaTypedDict(TypedDict): metered_feature_id: str credit_cost: float -class BalancesTrackBalanceCreditSchema(BaseModel): +class TrackBalanceCreditSchema(BaseModel): metered_feature_id: str credit_cost: float -class BalancesTrackBalanceDisplayTypedDict(TypedDict): +class TrackBalanceDisplayTypedDict(TypedDict): singular: NotRequired[Nullable[str]] plural: NotRequired[Nullable[str]] -class BalancesTrackBalanceDisplay(BaseModel): +class TrackBalanceDisplay(BaseModel): singular: OptionalNullable[str] = UNSET plural: OptionalNullable[str] = UNSET @@ -166,23 +154,27 @@ class BalancesTrackBalanceDisplay(BaseModel): return m -class BalancesTrackBalanceFeatureTypedDict(TypedDict): +class TrackBalanceFeatureTypedDict(TypedDict): + r"""The full feature object if expanded.""" + id: str name: str - type: BalancesTrackBalanceType + type: TrackBalanceType consumable: bool archived: bool event_names: NotRequired[List[str]] - credit_schema: NotRequired[List[BalancesTrackBalanceCreditSchemaTypedDict]] - display: NotRequired[BalancesTrackBalanceDisplayTypedDict] + credit_schema: NotRequired[List[TrackBalanceCreditSchemaTypedDict]] + display: NotRequired[TrackBalanceDisplayTypedDict] -class BalancesTrackBalanceFeature(BaseModel): +class TrackBalanceFeature(BaseModel): + r"""The full feature object if expanded.""" + id: str name: str - type: BalancesTrackBalanceType + type: TrackBalanceType consumable: bool @@ -190,9 +182,9 @@ class BalancesTrackBalanceFeature(BaseModel): event_names: Optional[List[str]] = None - credit_schema: Optional[List[BalancesTrackBalanceCreditSchema]] = None + credit_schema: Optional[List[TrackBalanceCreditSchema]] = None - display: Optional[BalancesTrackBalanceDisplay] = None + display: Optional[TrackBalanceDisplay] = None @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -211,7 +203,7 @@ class BalancesTrackBalanceFeature(BaseModel): return m -BalancesTrackBalanceIntervalEnum = Union[ +TrackBalanceIntervalEnum = Union[ Literal[ "one_off", "minute", @@ -227,29 +219,36 @@ BalancesTrackBalanceIntervalEnum = Union[ ] -BalancesTrackBalanceIntervalUnionTypedDict = TypeAliasType( - "BalancesTrackBalanceIntervalUnionTypedDict", - Union[BalancesTrackBalanceIntervalEnum, str], +TrackBalanceIntervalUnionTypedDict = TypeAliasType( + "TrackBalanceIntervalUnionTypedDict", Union[TrackBalanceIntervalEnum, str] ) +r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" -BalancesTrackBalanceIntervalUnion = TypeAliasType( - "BalancesTrackBalanceIntervalUnion", Union[BalancesTrackBalanceIntervalEnum, str] +TrackBalanceIntervalUnion = TypeAliasType( + "TrackBalanceIntervalUnion", Union[TrackBalanceIntervalEnum, str] ) +r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" -class BalancesTrackBalanceResetTypedDict(TypedDict): - interval: BalancesTrackBalanceIntervalUnionTypedDict +class TrackBalanceResetTypedDict(TypedDict): + interval: TrackBalanceIntervalUnionTypedDict + r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" resets_at: Nullable[float] + r"""Timestamp when the balance will next reset.""" interval_count: NotRequired[float] + r"""Number of intervals between resets (eg. 2 for bi-monthly).""" -class BalancesTrackBalanceReset(BaseModel): - interval: BalancesTrackBalanceIntervalUnion +class TrackBalanceReset(BaseModel): + interval: TrackBalanceIntervalUnion + r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" resets_at: Nullable[float] + r"""Timestamp when the balance will next reset.""" interval_count: Optional[float] = None + r"""Number of intervals between resets (eg. 2 for bi-monthly).""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -277,52 +276,61 @@ class BalancesTrackBalanceReset(BaseModel): return m -BalancesTrackBalanceToTypedDict = TypeAliasType( - "BalancesTrackBalanceToTypedDict", Union[float, str] -) +TrackBalanceToTypedDict = TypeAliasType("TrackBalanceToTypedDict", Union[float, str]) -BalancesTrackBalanceTo = TypeAliasType("BalancesTrackBalanceTo", Union[float, str]) +TrackBalanceTo = TypeAliasType("TrackBalanceTo", Union[float, str]) -class BalancesTrackBalanceTierTypedDict(TypedDict): - to: BalancesTrackBalanceToTypedDict +class TrackBalanceTierTypedDict(TypedDict): + to: TrackBalanceToTypedDict amount: float -class BalancesTrackBalanceTier(BaseModel): - to: BalancesTrackBalanceTo +class TrackBalanceTier(BaseModel): + to: TrackBalanceTo amount: float -BalancesTrackBalanceBillingMethod = Union[ +TrackBalanceBillingMethod = Union[ Literal[ "prepaid", "usage_based", ], UnrecognizedStr, ] +r"""Whether usage is prepaid or billed pay-per-use.""" -class BalancesTrackBalancePriceTypedDict(TypedDict): +class TrackBalancePriceTypedDict(TypedDict): billing_units: float - billing_method: BalancesTrackBalanceBillingMethod + r"""The number of units per billing increment (eg. $9 / 250 units).""" + billing_method: TrackBalanceBillingMethod + r"""Whether usage is prepaid or billed pay-per-use.""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased, or null for unlimited.""" amount: NotRequired[float] - tiers: NotRequired[List[BalancesTrackBalanceTierTypedDict]] + r"""The per-unit price amount.""" + tiers: NotRequired[List[TrackBalanceTierTypedDict]] + r"""Tiered pricing configuration if applicable.""" -class BalancesTrackBalancePrice(BaseModel): +class TrackBalancePrice(BaseModel): billing_units: float + r"""The number of units per billing increment (eg. $9 / 250 units).""" - billing_method: BalancesTrackBalanceBillingMethod + billing_method: TrackBalanceBillingMethod + r"""Whether usage is prepaid or billed pay-per-use.""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased, or null for unlimited.""" amount: Optional[float] = None + r"""The per-unit price amount.""" - tiers: Optional[List[BalancesTrackBalanceTier]] = None + tiers: Optional[List[TrackBalanceTier]] = None + r"""Tiered pricing configuration if applicable.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -350,39 +358,59 @@ class BalancesTrackBalancePrice(BaseModel): return m -class BalancesTrackBalanceBreakdownTypedDict(TypedDict): +class TrackBalanceBreakdownTypedDict(TypedDict): plan_id: Nullable[str] + r"""The plan ID this balance originates from, or null for standalone balances.""" included_grant: float + r"""Amount granted from the plan's included usage.""" prepaid_grant: float + r"""Amount granted from prepaid purchases or top-ups.""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Amount consumed in the current period.""" unlimited: bool - reset: Nullable[BalancesTrackBalanceResetTypedDict] - price: Nullable[BalancesTrackBalancePriceTypedDict] + r"""Whether this balance has unlimited usage.""" + reset: Nullable[TrackBalanceResetTypedDict] + r"""Reset configuration for this balance, or null if no reset.""" + price: Nullable[TrackBalancePriceTypedDict] + r"""Pricing configuration if this balance has usage-based pricing.""" expires_at: Nullable[float] + r"""Timestamp when this balance expires, or null for no expiration.""" id: NotRequired[str] + r"""The unique identifier for this balance breakdown.""" -class BalancesTrackBalanceBreakdown(BaseModel): +class TrackBalanceBreakdown(BaseModel): plan_id: Nullable[str] + r"""The plan ID this balance originates from, or null for standalone balances.""" included_grant: float + r"""Amount granted from the plan's included usage.""" prepaid_grant: float + r"""Amount granted from prepaid purchases or top-ups.""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Amount consumed in the current period.""" unlimited: bool + r"""Whether this balance has unlimited usage.""" - reset: Nullable[BalancesTrackBalanceReset] + reset: Nullable[TrackBalanceReset] + r"""Reset configuration for this balance, or null if no reset.""" - price: Nullable[BalancesTrackBalancePrice] + price: Nullable[TrackBalancePrice] + r"""Pricing configuration if this balance has usage-based pricing.""" expires_at: Nullable[float] + r"""Timestamp when this balance expires, or null for no expiration.""" id: Optional[str] = "" + r"""The unique identifier for this balance breakdown.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -410,53 +438,79 @@ class BalancesTrackBalanceBreakdown(BaseModel): return m -class BalancesTrackBalanceRolloverTypedDict(TypedDict): +class TrackBalanceRolloverTypedDict(TypedDict): balance: float + r"""Amount of balance rolled over from a previous period.""" expires_at: float + r"""Timestamp when the rollover balance expires.""" -class BalancesTrackBalanceRollover(BaseModel): +class TrackBalanceRollover(BaseModel): balance: float + r"""Amount of balance rolled over from a previous period.""" expires_at: float + r"""Timestamp when the rollover balance expires.""" -class BalancesTrackBalanceTypedDict(TypedDict): +class TrackBalanceTypedDict(TypedDict): feature_id: str + r"""The feature ID this balance is for.""" granted: float + r"""Total balance granted (included + prepaid).""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Total usage consumed in the current period.""" unlimited: bool + r"""Whether this feature has unlimited usage.""" overage_allowed: bool + r"""Whether usage beyond the granted balance is allowed (with overage charges).""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased as a top-up, or null for unlimited.""" next_reset_at: Nullable[float] - feature: NotRequired[BalancesTrackBalanceFeatureTypedDict] - breakdown: NotRequired[List[BalancesTrackBalanceBreakdownTypedDict]] - rollovers: NotRequired[List[BalancesTrackBalanceRolloverTypedDict]] + r"""Timestamp when the balance will reset, or null for no reset.""" + feature: NotRequired[TrackBalanceFeatureTypedDict] + r"""The full feature object if expanded.""" + breakdown: NotRequired[List[TrackBalanceBreakdownTypedDict]] + r"""Detailed breakdown of balance sources when stacking multiple plans or grants.""" + rollovers: NotRequired[List[TrackBalanceRolloverTypedDict]] + r"""Rollover balances carried over from previous periods.""" -class BalancesTrackBalance(BaseModel): +class TrackBalance(BaseModel): feature_id: str + r"""The feature ID this balance is for.""" granted: float + r"""Total balance granted (included + prepaid).""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Total usage consumed in the current period.""" unlimited: bool + r"""Whether this feature has unlimited usage.""" overage_allowed: bool + r"""Whether usage beyond the granted balance is allowed (with overage charges).""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased as a top-up, or null for unlimited.""" next_reset_at: Nullable[float] + r"""Timestamp when the balance will reset, or null for no reset.""" - feature: Optional[BalancesTrackBalanceFeature] = None + feature: Optional[TrackBalanceFeature] = None + r"""The full feature object if expanded.""" - breakdown: Optional[List[BalancesTrackBalanceBreakdown]] = None + breakdown: Optional[List[TrackBalanceBreakdown]] = None + r"""Detailed breakdown of balance sources when stacking multiple plans or grants.""" - rollovers: Optional[List[BalancesTrackBalanceRollover]] = None + rollovers: Optional[List[TrackBalanceRollover]] = None + r"""Rollover balances carried over from previous periods.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -484,7 +538,7 @@ class BalancesTrackBalance(BaseModel): return m -BalancesTrackType = Union[ +TrackBalancesType = Union[ Literal[ "boolean", "metered", @@ -494,23 +548,23 @@ BalancesTrackType = Union[ ] -class BalancesTrackCreditSchemaTypedDict(TypedDict): +class TrackBalancesCreditSchemaTypedDict(TypedDict): metered_feature_id: str credit_cost: float -class BalancesTrackCreditSchema(BaseModel): +class TrackBalancesCreditSchema(BaseModel): metered_feature_id: str credit_cost: float -class BalancesTrackDisplayTypedDict(TypedDict): +class TrackBalancesDisplayTypedDict(TypedDict): singular: NotRequired[Nullable[str]] plural: NotRequired[Nullable[str]] -class BalancesTrackDisplay(BaseModel): +class TrackBalancesDisplay(BaseModel): singular: OptionalNullable[str] = UNSET plural: OptionalNullable[str] = UNSET @@ -541,23 +595,27 @@ class BalancesTrackDisplay(BaseModel): return m -class BalancesTrackFeatureTypedDict(TypedDict): +class TrackBalancesFeatureTypedDict(TypedDict): + r"""The full feature object if expanded.""" + id: str name: str - type: BalancesTrackType + type: TrackBalancesType consumable: bool archived: bool event_names: NotRequired[List[str]] - credit_schema: NotRequired[List[BalancesTrackCreditSchemaTypedDict]] - display: NotRequired[BalancesTrackDisplayTypedDict] + credit_schema: NotRequired[List[TrackBalancesCreditSchemaTypedDict]] + display: NotRequired[TrackBalancesDisplayTypedDict] -class BalancesTrackFeature(BaseModel): +class TrackBalancesFeature(BaseModel): + r"""The full feature object if expanded.""" + id: str name: str - type: BalancesTrackType + type: TrackBalancesType consumable: bool @@ -565,9 +623,9 @@ class BalancesTrackFeature(BaseModel): event_names: Optional[List[str]] = None - credit_schema: Optional[List[BalancesTrackCreditSchema]] = None + credit_schema: Optional[List[TrackBalancesCreditSchema]] = None - display: Optional[BalancesTrackDisplay] = None + display: Optional[TrackBalancesDisplay] = None @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -586,7 +644,7 @@ class BalancesTrackFeature(BaseModel): return m -BalancesTrackIntervalEnum = Union[ +TrackIntervalBalancesEnum = Union[ Literal[ "one_off", "minute", @@ -602,28 +660,36 @@ BalancesTrackIntervalEnum = Union[ ] -BalancesTrackIntervalUnionTypedDict = TypeAliasType( - "BalancesTrackIntervalUnionTypedDict", Union[BalancesTrackIntervalEnum, str] +TrackBalancesIntervalUnionTypedDict = TypeAliasType( + "TrackBalancesIntervalUnionTypedDict", Union[TrackIntervalBalancesEnum, str] ) +r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" -BalancesTrackIntervalUnion = TypeAliasType( - "BalancesTrackIntervalUnion", Union[BalancesTrackIntervalEnum, str] +TrackBalancesIntervalUnion = TypeAliasType( + "TrackBalancesIntervalUnion", Union[TrackIntervalBalancesEnum, str] ) +r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" -class BalancesTrackResetTypedDict(TypedDict): - interval: BalancesTrackIntervalUnionTypedDict +class TrackBalancesResetTypedDict(TypedDict): + interval: TrackBalancesIntervalUnionTypedDict + r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" resets_at: Nullable[float] + r"""Timestamp when the balance will next reset.""" interval_count: NotRequired[float] + r"""Number of intervals between resets (eg. 2 for bi-monthly).""" -class BalancesTrackReset(BaseModel): - interval: BalancesTrackIntervalUnion +class TrackBalancesReset(BaseModel): + interval: TrackBalancesIntervalUnion + r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" resets_at: Nullable[float] + r"""Timestamp when the balance will next reset.""" interval_count: Optional[float] = None + r"""Number of intervals between resets (eg. 2 for bi-monthly).""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -651,50 +717,61 @@ class BalancesTrackReset(BaseModel): return m -BalancesTrackToTypedDict = TypeAliasType("BalancesTrackToTypedDict", Union[float, str]) +TrackBalancesToTypedDict = TypeAliasType("TrackBalancesToTypedDict", Union[float, str]) -BalancesTrackTo = TypeAliasType("BalancesTrackTo", Union[float, str]) +TrackBalancesTo = TypeAliasType("TrackBalancesTo", Union[float, str]) -class BalancesTrackTierTypedDict(TypedDict): - to: BalancesTrackToTypedDict +class TrackBalancesTierTypedDict(TypedDict): + to: TrackBalancesToTypedDict amount: float -class BalancesTrackTier(BaseModel): - to: BalancesTrackTo +class TrackBalancesTier(BaseModel): + to: TrackBalancesTo amount: float -BalancesTrackBillingMethod = Union[ +TrackBalancesBillingMethod = Union[ Literal[ "prepaid", "usage_based", ], UnrecognizedStr, ] +r"""Whether usage is prepaid or billed pay-per-use.""" -class BalancesTrackPriceTypedDict(TypedDict): +class TrackBalancesPriceTypedDict(TypedDict): billing_units: float - billing_method: BalancesTrackBillingMethod + r"""The number of units per billing increment (eg. $9 / 250 units).""" + billing_method: TrackBalancesBillingMethod + r"""Whether usage is prepaid or billed pay-per-use.""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased, or null for unlimited.""" amount: NotRequired[float] - tiers: NotRequired[List[BalancesTrackTierTypedDict]] + r"""The per-unit price amount.""" + tiers: NotRequired[List[TrackBalancesTierTypedDict]] + r"""Tiered pricing configuration if applicable.""" -class BalancesTrackPrice(BaseModel): +class TrackBalancesPrice(BaseModel): billing_units: float + r"""The number of units per billing increment (eg. $9 / 250 units).""" - billing_method: BalancesTrackBillingMethod + billing_method: TrackBalancesBillingMethod + r"""Whether usage is prepaid or billed pay-per-use.""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased, or null for unlimited.""" amount: Optional[float] = None + r"""The per-unit price amount.""" - tiers: Optional[List[BalancesTrackTier]] = None + tiers: Optional[List[TrackBalancesTier]] = None + r"""Tiered pricing configuration if applicable.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -722,39 +799,59 @@ class BalancesTrackPrice(BaseModel): return m -class BalancesTrackBreakdownTypedDict(TypedDict): +class TrackBalancesBreakdownTypedDict(TypedDict): plan_id: Nullable[str] + r"""The plan ID this balance originates from, or null for standalone balances.""" included_grant: float + r"""Amount granted from the plan's included usage.""" prepaid_grant: float + r"""Amount granted from prepaid purchases or top-ups.""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Amount consumed in the current period.""" unlimited: bool - reset: Nullable[BalancesTrackResetTypedDict] - price: Nullable[BalancesTrackPriceTypedDict] + r"""Whether this balance has unlimited usage.""" + reset: Nullable[TrackBalancesResetTypedDict] + r"""Reset configuration for this balance, or null if no reset.""" + price: Nullable[TrackBalancesPriceTypedDict] + r"""Pricing configuration if this balance has usage-based pricing.""" expires_at: Nullable[float] + r"""Timestamp when this balance expires, or null for no expiration.""" id: NotRequired[str] + r"""The unique identifier for this balance breakdown.""" -class BalancesTrackBreakdown(BaseModel): +class TrackBalancesBreakdown(BaseModel): plan_id: Nullable[str] + r"""The plan ID this balance originates from, or null for standalone balances.""" included_grant: float + r"""Amount granted from the plan's included usage.""" prepaid_grant: float + r"""Amount granted from prepaid purchases or top-ups.""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Amount consumed in the current period.""" unlimited: bool + r"""Whether this balance has unlimited usage.""" - reset: Nullable[BalancesTrackReset] + reset: Nullable[TrackBalancesReset] + r"""Reset configuration for this balance, or null if no reset.""" - price: Nullable[BalancesTrackPrice] + price: Nullable[TrackBalancesPrice] + r"""Pricing configuration if this balance has usage-based pricing.""" expires_at: Nullable[float] + r"""Timestamp when this balance expires, or null for no expiration.""" id: Optional[str] = "" + r"""The unique identifier for this balance breakdown.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -782,53 +879,79 @@ class BalancesTrackBreakdown(BaseModel): return m -class BalancesTrackRolloverTypedDict(TypedDict): +class TrackBalancesRolloverTypedDict(TypedDict): balance: float + r"""Amount of balance rolled over from a previous period.""" expires_at: float + r"""Timestamp when the rollover balance expires.""" -class BalancesTrackRollover(BaseModel): +class TrackBalancesRollover(BaseModel): balance: float + r"""Amount of balance rolled over from a previous period.""" expires_at: float + r"""Timestamp when the rollover balance expires.""" -class BalancesTrackBalancesTypedDict(TypedDict): +class TrackBalancesTypedDict(TypedDict): feature_id: str + r"""The feature ID this balance is for.""" granted: float + r"""Total balance granted (included + prepaid).""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Total usage consumed in the current period.""" unlimited: bool + r"""Whether this feature has unlimited usage.""" overage_allowed: bool + r"""Whether usage beyond the granted balance is allowed (with overage charges).""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased as a top-up, or null for unlimited.""" next_reset_at: Nullable[float] - feature: NotRequired[BalancesTrackFeatureTypedDict] - breakdown: NotRequired[List[BalancesTrackBreakdownTypedDict]] - rollovers: NotRequired[List[BalancesTrackRolloverTypedDict]] + r"""Timestamp when the balance will reset, or null for no reset.""" + feature: NotRequired[TrackBalancesFeatureTypedDict] + r"""The full feature object if expanded.""" + breakdown: NotRequired[List[TrackBalancesBreakdownTypedDict]] + r"""Detailed breakdown of balance sources when stacking multiple plans or grants.""" + rollovers: NotRequired[List[TrackBalancesRolloverTypedDict]] + r"""Rollover balances carried over from previous periods.""" -class BalancesTrackBalances(BaseModel): +class TrackBalances(BaseModel): feature_id: str + r"""The feature ID this balance is for.""" granted: float + r"""Total balance granted (included + prepaid).""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Total usage consumed in the current period.""" unlimited: bool + r"""Whether this feature has unlimited usage.""" overage_allowed: bool + r"""Whether usage beyond the granted balance is allowed (with overage charges).""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased as a top-up, or null for unlimited.""" next_reset_at: Nullable[float] + r"""Timestamp when the balance will reset, or null for no reset.""" - feature: Optional[BalancesTrackFeature] = None + feature: Optional[TrackBalancesFeature] = None + r"""The full feature object if expanded.""" - breakdown: Optional[List[BalancesTrackBreakdown]] = None + breakdown: Optional[List[TrackBalancesBreakdown]] = None + r"""Detailed breakdown of balance sources when stacking multiple plans or grants.""" - rollovers: Optional[List[BalancesTrackRollover]] = None + rollovers: Optional[List[TrackBalancesRollover]] = None + r"""Rollover balances carried over from previous periods.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -856,37 +979,43 @@ class BalancesTrackBalances(BaseModel): return m -class BalancesTrackResponseTypedDict(TypedDict): +class TrackResponseTypedDict(TypedDict): r"""OK""" customer_id: str - r"""The ID of the customer""" + r"""The ID of the customer whose usage was tracked.""" value: float - balance: Nullable[BalancesTrackBalanceTypedDict] + r"""The amount of usage that was recorded.""" + balance: Nullable[TrackBalanceTypedDict] + r"""The updated balance for the tracked feature. Null if tracking by event_name that affects multiple features.""" entity_id: NotRequired[str] - r"""The ID of the entity (if provided)""" + r"""The ID of the entity, if entity-scoped tracking was performed.""" event_name: NotRequired[str] - r"""The name of the event""" - balances: NotRequired[Dict[str, BalancesTrackBalancesTypedDict]] + r"""The event name that was tracked, if event_name was used instead of feature_id.""" + balances: NotRequired[Dict[str, TrackBalancesTypedDict]] + r"""Map of feature_id to updated balance when tracking by event_name affects multiple features.""" -class BalancesTrackResponse(BaseModel): +class TrackResponse(BaseModel): r"""OK""" customer_id: str - r"""The ID of the customer""" + r"""The ID of the customer whose usage was tracked.""" value: float + r"""The amount of usage that was recorded.""" - balance: Nullable[BalancesTrackBalance] + balance: Nullable[TrackBalance] + r"""The updated balance for the tracked feature. Null if tracking by event_name that affects multiple features.""" entity_id: Optional[str] = None - r"""The ID of the entity (if provided)""" + r"""The ID of the entity, if entity-scoped tracking was performed.""" event_name: Optional[str] = None - r"""The name of the event""" + r"""The event name that was tracked, if event_name was used instead of feature_id.""" - balances: Optional[Dict[str, BalancesTrackBalances]] = None + balances: Optional[Dict[str, TrackBalances]] = None + r"""Map of feature_id to updated balance when tracking by event_name affects multiple features.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/others/python-sdk/src/autumn_sdk/models/balancesupdateop.py b/others/python-sdk/src/autumn_sdk/models/updatebalanceop.py similarity index 53% rename from others/python-sdk/src/autumn_sdk/models/balancesupdateop.py rename to others/python-sdk/src/autumn_sdk/models/updatebalanceop.py index 10c472b90..7f7e11503 100644 --- a/others/python-sdk/src/autumn_sdk/models/balancesupdateop.py +++ b/others/python-sdk/src/autumn_sdk/models/updatebalanceop.py @@ -9,11 +9,11 @@ from typing import Literal, Optional from typing_extensions import Annotated, NotRequired, TypedDict -class BalancesUpdateGlobalsTypedDict(TypedDict): +class UpdateBalanceGlobalsTypedDict(TypedDict): x_api_version: NotRequired[str] -class BalancesUpdateGlobals(BaseModel): +class UpdateBalanceGlobals(BaseModel): x_api_version: Annotated[ Optional[str], pydantic.Field(alias="x-api-version"), @@ -37,7 +37,7 @@ class BalancesUpdateGlobals(BaseModel): return m -BalancesUpdateInterval = Literal[ +UpdateBalanceInterval = Literal[ "one_off", "minute", "hour", @@ -48,67 +48,46 @@ BalancesUpdateInterval = Literal[ "semi_annual", "year", ] -r"""The interval to update balance for.""" +r"""Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals.""" -class BalancesUpdateRequestTypedDict(TypedDict): +class UpdateBalanceParamsTypedDict(TypedDict): customer_id: str r"""The ID of the customer.""" feature_id: str - r"""The ID of the feature to update balance for.""" + r"""The ID of the feature.""" entity_id: NotRequired[str] - r"""The ID of the entity to update balance for (if using entity balances).""" - current_balance: NotRequired[float] - r"""The new balance value to set.""" - interval: NotRequired[BalancesUpdateInterval] - r"""The interval to update balance for.""" - granted_balance: NotRequired[float] - usage: NotRequired[float] - customer_entitlement_id: NotRequired[str] - next_reset_at: NotRequired[float] + r"""The ID of the entity for entity-scoped balances (e.g., per-seat limits).""" + remaining: NotRequired[float] + r"""Set the remaining balance to this exact value. Cannot be combined with add_to_balance.""" add_to_balance: NotRequired[float] + r"""Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance.""" + interval: NotRequired[UpdateBalanceInterval] + r"""Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals.""" -class BalancesUpdateRequest(BaseModel): +class UpdateBalanceParams(BaseModel): customer_id: str r"""The ID of the customer.""" feature_id: str - r"""The ID of the feature to update balance for.""" + r"""The ID of the feature.""" entity_id: Optional[str] = None - r"""The ID of the entity to update balance for (if using entity balances).""" + r"""The ID of the entity for entity-scoped balances (e.g., per-seat limits).""" - current_balance: Optional[float] = None - r"""The new balance value to set.""" - - interval: Optional[BalancesUpdateInterval] = None - r"""The interval to update balance for.""" - - granted_balance: Optional[float] = None - - usage: Optional[float] = None - - customer_entitlement_id: Optional[str] = None - - next_reset_at: Optional[float] = None + remaining: Optional[float] = None + r"""Set the remaining balance to this exact value. Cannot be combined with add_to_balance.""" add_to_balance: Optional[float] = None + r"""Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance.""" + + interval: Optional[UpdateBalanceInterval] = None + r"""Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals.""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set( - [ - "entity_id", - "current_balance", - "interval", - "granted_balance", - "usage", - "customer_entitlement_id", - "next_reset_at", - "add_to_balance", - ] - ) + optional_fields = set(["entity_id", "remaining", "add_to_balance", "interval"]) serialized = handler(self) m = {} @@ -123,13 +102,13 @@ class BalancesUpdateRequest(BaseModel): return m -class BalancesUpdateResponseTypedDict(TypedDict): +class UpdateBalanceResponseTypedDict(TypedDict): r"""OK""" success: bool -class BalancesUpdateResponse(BaseModel): +class UpdateBalanceResponse(BaseModel): r"""OK""" success: bool diff --git a/others/python-sdk/src/autumn_sdk/models/updatecustomerop.py b/others/python-sdk/src/autumn_sdk/models/updatecustomerop.py index b501c3f8b..26ab15e1c 100644 --- a/others/python-sdk/src/autumn_sdk/models/updatecustomerop.py +++ b/others/python-sdk/src/autumn_sdk/models/updatecustomerop.py @@ -139,52 +139,76 @@ UpdateCustomerStatus = Union[ Literal[ "active", "scheduled", - "expired", ], UnrecognizedStr, ] +r"""Current status of the subscription.""" class UpdateCustomerSubscriptionTypedDict(TypedDict): plan_id: str + r"""The unique identifier of the subscribed plan.""" auto_enable: bool + r"""Whether the plan was automatically enabled for the customer.""" add_on: bool + r"""Whether this is an add-on plan rather than a base subscription.""" status: UpdateCustomerStatus + r"""Current status of the subscription.""" past_due: bool + r"""Whether the subscription has overdue payments.""" canceled_at: Nullable[float] + r"""Timestamp when the subscription was canceled, or null if not canceled.""" expires_at: Nullable[float] + r"""Timestamp when the subscription will expire, or null if no expiry set.""" trial_ends_at: Nullable[float] + r"""Timestamp when the trial period ends, or null if not on trial.""" started_at: float + r"""Timestamp when the subscription started.""" current_period_start: Nullable[float] + r"""Start timestamp of the current billing period.""" current_period_end: Nullable[float] + r"""End timestamp of the current billing period.""" quantity: float + r"""Number of units of this subscription (for per-seat plans).""" plan: NotRequired[PlanTypedDict] class UpdateCustomerSubscription(BaseModel): plan_id: str + r"""The unique identifier of the subscribed plan.""" auto_enable: bool + r"""Whether the plan was automatically enabled for the customer.""" add_on: bool + r"""Whether this is an add-on plan rather than a base subscription.""" status: UpdateCustomerStatus + r"""Current status of the subscription.""" past_due: bool + r"""Whether the subscription has overdue payments.""" canceled_at: Nullable[float] + r"""Timestamp when the subscription was canceled, or null if not canceled.""" expires_at: Nullable[float] + r"""Timestamp when the subscription will expire, or null if no expiry set.""" trial_ends_at: Nullable[float] + r"""Timestamp when the trial period ends, or null if not on trial.""" started_at: float + r"""Timestamp when the subscription started.""" current_period_start: Nullable[float] + r"""Start timestamp of the current billing period.""" current_period_end: Nullable[float] + r"""End timestamp of the current billing period.""" quantity: float + r"""Number of units of this subscription (for per-seat plans).""" plan: Optional[Plan] = None @@ -224,20 +248,28 @@ class UpdateCustomerSubscription(BaseModel): class UpdateCustomerPurchaseTypedDict(TypedDict): plan_id: str + r"""The unique identifier of the purchased plan.""" expires_at: Nullable[float] + r"""Timestamp when the purchase expires, or null for lifetime access.""" started_at: float + r"""Timestamp when the purchase was made.""" quantity: float + r"""Number of units purchased.""" plan: NotRequired[PlanTypedDict] class UpdateCustomerPurchase(BaseModel): plan_id: str + r"""The unique identifier of the purchased plan.""" expires_at: Nullable[float] + r"""Timestamp when the purchase expires, or null for lifetime access.""" started_at: float + r"""Timestamp when the purchase was made.""" quantity: float + r"""Number of units purchased.""" plan: Optional[Plan] = None @@ -325,6 +357,8 @@ class UpdateCustomerDisplay(BaseModel): class UpdateCustomerFeatureTypedDict(TypedDict): + r"""The full feature object if expanded.""" + id: str name: str type: UpdateCustomerType @@ -336,6 +370,8 @@ class UpdateCustomerFeatureTypedDict(TypedDict): class UpdateCustomerFeature(BaseModel): + r"""The full feature object if expanded.""" + id: str name: str @@ -388,25 +424,33 @@ UpdateCustomerIntervalEnum = Union[ UpdateCustomerIntervalUnionTypedDict = TypeAliasType( "UpdateCustomerIntervalUnionTypedDict", Union[UpdateCustomerIntervalEnum, str] ) +r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" UpdateCustomerIntervalUnion = TypeAliasType( "UpdateCustomerIntervalUnion", Union[UpdateCustomerIntervalEnum, str] ) +r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" class UpdateCustomerResetTypedDict(TypedDict): interval: UpdateCustomerIntervalUnionTypedDict + r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" resets_at: Nullable[float] + r"""Timestamp when the balance will next reset.""" interval_count: NotRequired[float] + r"""Number of intervals between resets (eg. 2 for bi-monthly).""" class UpdateCustomerReset(BaseModel): interval: UpdateCustomerIntervalUnion + r"""The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.""" resets_at: Nullable[float] + r"""Timestamp when the balance will next reset.""" interval_count: Optional[float] = None + r"""Number of intervals between resets (eg. 2 for bi-monthly).""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -460,26 +504,37 @@ UpdateCustomerBillingMethod = Union[ ], UnrecognizedStr, ] +r"""Whether usage is prepaid or billed pay-per-use.""" class UpdateCustomerPriceTypedDict(TypedDict): billing_units: float + r"""The number of units per billing increment (eg. $9 / 250 units).""" billing_method: UpdateCustomerBillingMethod + r"""Whether usage is prepaid or billed pay-per-use.""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased, or null for unlimited.""" amount: NotRequired[float] + r"""The per-unit price amount.""" tiers: NotRequired[List[UpdateCustomerTierTypedDict]] + r"""Tiered pricing configuration if applicable.""" class UpdateCustomerPrice(BaseModel): billing_units: float + r"""The number of units per billing increment (eg. $9 / 250 units).""" billing_method: UpdateCustomerBillingMethod + r"""Whether usage is prepaid or billed pay-per-use.""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased, or null for unlimited.""" amount: Optional[float] = None + r"""The per-unit price amount.""" tiers: Optional[List[UpdateCustomerTier]] = None + r"""Tiered pricing configuration if applicable.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -509,37 +564,57 @@ class UpdateCustomerPrice(BaseModel): class UpdateCustomerBreakdownTypedDict(TypedDict): plan_id: Nullable[str] + r"""The plan ID this balance originates from, or null for standalone balances.""" included_grant: float + r"""Amount granted from the plan's included usage.""" prepaid_grant: float + r"""Amount granted from prepaid purchases or top-ups.""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Amount consumed in the current period.""" unlimited: bool + r"""Whether this balance has unlimited usage.""" reset: Nullable[UpdateCustomerResetTypedDict] + r"""Reset configuration for this balance, or null if no reset.""" price: Nullable[UpdateCustomerPriceTypedDict] + r"""Pricing configuration if this balance has usage-based pricing.""" expires_at: Nullable[float] + r"""Timestamp when this balance expires, or null for no expiration.""" id: NotRequired[str] + r"""The unique identifier for this balance breakdown.""" class UpdateCustomerBreakdown(BaseModel): plan_id: Nullable[str] + r"""The plan ID this balance originates from, or null for standalone balances.""" included_grant: float + r"""Amount granted from the plan's included usage.""" prepaid_grant: float + r"""Amount granted from prepaid purchases or top-ups.""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Amount consumed in the current period.""" unlimited: bool + r"""Whether this balance has unlimited usage.""" reset: Nullable[UpdateCustomerReset] + r"""Reset configuration for this balance, or null if no reset.""" price: Nullable[UpdateCustomerPrice] + r"""Pricing configuration if this balance has usage-based pricing.""" expires_at: Nullable[float] + r"""Timestamp when this balance expires, or null for no expiration.""" id: Optional[str] = "" + r"""The unique identifier for this balance breakdown.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -569,51 +644,77 @@ class UpdateCustomerBreakdown(BaseModel): class UpdateCustomerRolloverTypedDict(TypedDict): balance: float + r"""Amount of balance rolled over from a previous period.""" expires_at: float + r"""Timestamp when the rollover balance expires.""" class UpdateCustomerRollover(BaseModel): balance: float + r"""Amount of balance rolled over from a previous period.""" expires_at: float + r"""Timestamp when the rollover balance expires.""" class UpdateCustomerBalancesTypedDict(TypedDict): feature_id: str + r"""The feature ID this balance is for.""" granted: float + r"""Total balance granted (included + prepaid).""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Total usage consumed in the current period.""" unlimited: bool + r"""Whether this feature has unlimited usage.""" overage_allowed: bool + r"""Whether usage beyond the granted balance is allowed (with overage charges).""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased as a top-up, or null for unlimited.""" next_reset_at: Nullable[float] + r"""Timestamp when the balance will reset, or null for no reset.""" feature: NotRequired[UpdateCustomerFeatureTypedDict] + r"""The full feature object if expanded.""" breakdown: NotRequired[List[UpdateCustomerBreakdownTypedDict]] + r"""Detailed breakdown of balance sources when stacking multiple plans or grants.""" rollovers: NotRequired[List[UpdateCustomerRolloverTypedDict]] + r"""Rollover balances carried over from previous periods.""" class UpdateCustomerBalances(BaseModel): feature_id: str + r"""The feature ID this balance is for.""" granted: float + r"""Total balance granted (included + prepaid).""" remaining: float + r"""Remaining balance available for use.""" usage: float + r"""Total usage consumed in the current period.""" unlimited: bool + r"""Whether this feature has unlimited usage.""" overage_allowed: bool + r"""Whether usage beyond the granted balance is allowed (with overage charges).""" max_purchase: Nullable[float] + r"""Maximum quantity that can be purchased as a top-up, or null for unlimited.""" next_reset_at: Nullable[float] + r"""Timestamp when the balance will reset, or null for no reset.""" feature: Optional[UpdateCustomerFeature] = None + r"""The full feature object if expanded.""" breakdown: Optional[List[UpdateCustomerBreakdown]] = None + r"""Detailed breakdown of balance sources when stacking multiple plans or grants.""" rollovers: Optional[List[UpdateCustomerRollover]] = None + r"""Rollover balances carried over from previous periods.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -663,8 +764,11 @@ class UpdateCustomerResponseTypedDict(TypedDict): send_email_receipts: bool r"""Whether to send email receipts to the customer.""" subscriptions: List[UpdateCustomerSubscriptionTypedDict] + r"""Active and scheduled recurring plans that this customer has attached.""" purchases: List[UpdateCustomerPurchaseTypedDict] + r"""One-time purchases made by the customer.""" balances: Dict[str, UpdateCustomerBalancesTypedDict] + r"""Feature balances keyed by feature ID, showing usage limits and remaining amounts.""" class UpdateCustomerResponse(BaseModel): @@ -698,10 +802,13 @@ class UpdateCustomerResponse(BaseModel): r"""Whether to send email receipts to the customer.""" subscriptions: List[UpdateCustomerSubscription] + r"""Active and scheduled recurring plans that this customer has attached.""" purchases: List[UpdateCustomerPurchase] + r"""One-time purchases made by the customer.""" balances: Dict[str, UpdateCustomerBalances] + r"""Feature balances keyed by feature ID, showing usage limits and remaining amounts.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/others/python-sdk/src/autumn_sdk/referrals.py b/others/python-sdk/src/autumn_sdk/referrals.py new file mode 100644 index 000000000..4fde94822 --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/referrals.py @@ -0,0 +1,382 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from autumn_sdk import errors, models, utils +from autumn_sdk._hooks import HookContext +from autumn_sdk.types import OptionalNullable, UNSET +from autumn_sdk.utils.unmarshal_json_response import unmarshal_json_response +from typing import Mapping, Optional + + +class Referrals(BaseSDK): + def create_code( + self, + *, + customer_id: str, + program_id: str, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.CreateReferralCodeResponse: + r"""Create or fetch a referral code for a customer in a referral program. + + :param customer_id: The unique identifier of the customer + :param program_id: ID of your referral program + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.CreateReferralCodeParams( + customer_id=customer_id, + program_id=program_id, + ) + + req = self._build_request( + method="POST", + path="/v1/referrals.create_code", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.CreateReferralCodeGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.CreateReferralCodeParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="createReferralCode", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.CreateReferralCodeResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def create_code_async( + self, + *, + customer_id: str, + program_id: str, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.CreateReferralCodeResponse: + r"""Create or fetch a referral code for a customer in a referral program. + + :param customer_id: The unique identifier of the customer + :param program_id: ID of your referral program + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.CreateReferralCodeParams( + customer_id=customer_id, + program_id=program_id, + ) + + req = self._build_request_async( + method="POST", + path="/v1/referrals.create_code", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.CreateReferralCodeGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.CreateReferralCodeParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="createReferralCode", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.CreateReferralCodeResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + def redeem_code( + self, + *, + code: str, + customer_id: str, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.RedeemReferralCodeResponse: + r"""Redeem a referral code for a customer. + + :param code: The referral code to redeem + :param customer_id: The unique identifier of the customer redeeming the code + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.RedeemReferralCodeParams( + code=code, + customer_id=customer_id, + ) + + req = self._build_request( + method="POST", + path="/v1/referrals.redeem_code", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.RedeemReferralCodeGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.RedeemReferralCodeParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="redeemReferralCode", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.RedeemReferralCodeResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def redeem_code_async( + self, + *, + code: str, + customer_id: str, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.RedeemReferralCodeResponse: + r"""Redeem a referral code for a customer. + + :param code: The referral code to redeem + :param customer_id: The unique identifier of the customer redeeming the code + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.RedeemReferralCodeParams( + code=code, + customer_id=customer_id, + ) + + req = self._build_request_async( + method="POST", + path="/v1/referrals.redeem_code", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.RedeemReferralCodeGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.RedeemReferralCodeParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="redeemReferralCode", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.RedeemReferralCodeResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) diff --git a/others/python-sdk/src/autumn_sdk/sdk.py b/others/python-sdk/src/autumn_sdk/sdk.py index 144feea66..17b5cdf8b 100644 --- a/others/python-sdk/src/autumn_sdk/sdk.py +++ b/others/python-sdk/src/autumn_sdk/sdk.py @@ -5,21 +5,25 @@ from .httpclient import AsyncHttpClient, ClientOwner, HttpClient, close_clients from .sdkconfiguration import SDKConfiguration from .utils.logger import Logger, get_default_logger from .utils.retries import RetryConfig -from autumn_sdk import models, utils -from autumn_sdk._hooks import SDKHooks +from autumn_sdk import errors, models, utils +from autumn_sdk._hooks import HookContext, SDKHooks from autumn_sdk.models import internal from autumn_sdk.types import OptionalNullable, UNSET +from autumn_sdk.utils.unmarshal_json_response import unmarshal_json_response import httpx import importlib import sys -from typing import Any, Callable, Dict, Optional, TYPE_CHECKING, Union, cast +from typing import Any, Callable, Dict, Mapping, Optional, TYPE_CHECKING, Union, cast import weakref if TYPE_CHECKING: from autumn_sdk.balances_sdk import BalancesSDK from autumn_sdk.billing import Billing from autumn_sdk.customers import Customers + from autumn_sdk.entities import Entities + from autumn_sdk.events import Events from autumn_sdk.plans import Plans + from autumn_sdk.referrals import Referrals class Autumn(BaseSDK): @@ -27,11 +31,17 @@ class Autumn(BaseSDK): plans: "Plans" billing: "Billing" balances: "BalancesSDK" + events: "Events" + entities: "Entities" + referrals: "Referrals" _sub_sdk_map = { "customers": ("autumn_sdk.customers", "Customers"), "plans": ("autumn_sdk.plans", "Plans"), "billing": ("autumn_sdk.billing", "Billing"), "balances": ("autumn_sdk.balances_sdk", "BalancesSDK"), + "events": ("autumn_sdk.events", "Events"), + "entities": ("autumn_sdk.entities", "Entities"), + "referrals": ("autumn_sdk.referrals", "Referrals"), } def __init__( @@ -188,3 +198,437 @@ class Autumn(BaseSDK): ): await self.sdk_configuration.async_client.aclose() self.sdk_configuration.async_client = None + + def check( + self, + *, + customer_id: str, + feature_id: str, + entity_id: Optional[str] = None, + required_balance: Optional[float] = None, + properties: Optional[Dict[str, Any]] = None, + send_event: Optional[bool] = None, + with_preview: Optional[bool] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.CheckResponse: + r"""Checks whether a customer currently has enough balance to use a feature. + + Use this to gate access before a feature action. Enable sendEvent when you want to check and consume balance atomically in one request. + + :param customer_id: The ID of the customer. + :param feature_id: The ID of the feature. + :param entity_id: The ID of the entity for entity-scoped balances (e.g., per-seat limits). + :param required_balance: Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1. + :param properties: Additional properties to attach to the usage event if send_event is true. + :param send_event: If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. + :param with_preview: If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.CheckParams( + customer_id=customer_id, + feature_id=feature_id, + entity_id=entity_id, + required_balance=required_balance, + properties=properties, + send_event=send_event, + with_preview=with_preview, + ) + + req = self._build_request( + method="POST", + path="/v1/balances.check", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.CheckGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.CheckParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="check", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.CheckResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def check_async( + self, + *, + customer_id: str, + feature_id: str, + entity_id: Optional[str] = None, + required_balance: Optional[float] = None, + properties: Optional[Dict[str, Any]] = None, + send_event: Optional[bool] = None, + with_preview: Optional[bool] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.CheckResponse: + r"""Checks whether a customer currently has enough balance to use a feature. + + Use this to gate access before a feature action. Enable sendEvent when you want to check and consume balance atomically in one request. + + :param customer_id: The ID of the customer. + :param feature_id: The ID of the feature. + :param entity_id: The ID of the entity for entity-scoped balances (e.g., per-seat limits). + :param required_balance: Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1. + :param properties: Additional properties to attach to the usage event if send_event is true. + :param send_event: If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. + :param with_preview: If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.CheckParams( + customer_id=customer_id, + feature_id=feature_id, + entity_id=entity_id, + required_balance=required_balance, + properties=properties, + send_event=send_event, + with_preview=with_preview, + ) + + req = self._build_request_async( + method="POST", + path="/v1/balances.check", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.CheckGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.CheckParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="check", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.CheckResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + def track( + self, + *, + customer_id: str, + feature_id: Optional[str] = None, + entity_id: Optional[str] = None, + event_name: Optional[str] = None, + value: Optional[float] = None, + properties: Optional[Dict[str, Any]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.TrackResponse: + r"""Records usage for a customer feature and returns updated balances. + + Use this after an action happens to decrement usage, or send a negative value to credit balance back. + + :param customer_id: The ID of the customer. + :param feature_id: The ID of the feature to track usage for. Required if event_name is not provided. + :param entity_id: The ID of the entity for entity-scoped balances (e.g., per-seat limits). + :param event_name: Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. + :param value: The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). + :param properties: Additional properties to attach to this usage event. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.TrackParams( + customer_id=customer_id, + feature_id=feature_id, + entity_id=entity_id, + event_name=event_name, + value=value, + properties=properties, + ) + + req = self._build_request( + method="POST", + path="/v1/balances.track", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.TrackGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.TrackParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="track", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.TrackResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def track_async( + self, + *, + customer_id: str, + feature_id: Optional[str] = None, + entity_id: Optional[str] = None, + event_name: Optional[str] = None, + value: Optional[float] = None, + properties: Optional[Dict[str, Any]] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.TrackResponse: + r"""Records usage for a customer feature and returns updated balances. + + Use this after an action happens to decrement usage, or send a negative value to credit balance back. + + :param customer_id: The ID of the customer. + :param feature_id: The ID of the feature to track usage for. Required if event_name is not provided. + :param entity_id: The ID of the entity for entity-scoped balances (e.g., per-seat limits). + :param event_name: Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. + :param value: The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). + :param properties: Additional properties to attach to this usage event. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.TrackParams( + customer_id=customer_id, + feature_id=feature_id, + entity_id=entity_id, + event_name=event_name, + value=value, + properties=properties, + ) + + req = self._build_request_async( + method="POST", + path="/v1/balances.track", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + _globals=models.TrackGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.TrackParams + ), + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="track", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.TrackResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) diff --git a/others/python-sdk/uv.lock b/others/python-sdk/uv.lock index c4e2a912c..a2245e2e4 100644 --- a/others/python-sdk/uv.lock +++ b/others/python-sdk/uv.lock @@ -44,7 +44,7 @@ wheels = [ [[package]] name = "autumn-sdk" -version = "0.2.23" +version = "0.4.4" source = { editable = "." } dependencies = [ { name = "httpcore" }, diff --git a/packages/autumn-js/src/backend/core/routes/routeConfigs.ts b/packages/autumn-js/src/backend/core/routes/routeConfigs.ts index 45b766bb8..e3938cfef 100644 --- a/packages/autumn-js/src/backend/core/routes/routeConfigs.ts +++ b/packages/autumn-js/src/backend/core/routes/routeConfigs.ts @@ -1,8 +1,13 @@ -import { CustomerExpand } from "@sdk"; +import { CustomerExpand } from "@useautumn/sdk"; import { z } from "zod/v4"; import { - billingAttachRequestSchema, + attachParamsSchema, + createReferralCodeParamsSchema, + eventsAggregateParamsSchema, + eventsListParamsSchema, listPlansRequestSchema, + openCustomerPortalParamsSchema, + redeemReferralCodeParamsSchema, } from "../../../generated"; import type { RouteDefinition, RouteName } from "../types"; import { backendError, backendSuccess, sanitizeBody } from "../utils"; @@ -50,7 +55,22 @@ export const routeConfigs: RouteDefinition[] = [ { route: "attach", sdkMethod: (autumn, args) => autumn.billing.attach(args), - bodySchema: billingAttachRequestSchema, + bodySchema: attachParamsSchema, + }, + { + route: "openCustomerPortal", + sdkMethod: (autumn, args) => autumn.billing.openCustomerPortal(args), + bodySchema: openCustomerPortalParamsSchema, + }, + { + route: "createReferralCode", + sdkMethod: (autumn, args) => autumn.referrals.createCode(args), + bodySchema: createReferralCodeParamsSchema, + }, + { + route: "redeemReferralCode", + sdkMethod: (autumn, args) => autumn.referrals.redeemCode(args), + bodySchema: redeemReferralCodeParamsSchema, }, { route: "listPlans", @@ -58,4 +78,14 @@ export const routeConfigs: RouteDefinition[] = [ requireCustomer: false, bodySchema: listPlansRequestSchema.optional(), }, + { + route: "listEvents", + sdkMethod: (autumn, args) => autumn.events.list(args), + bodySchema: eventsListParamsSchema.optional(), + }, + { + route: "aggregateEvents", + sdkMethod: (autumn, args) => autumn.events.aggregate(args), + bodySchema: eventsAggregateParamsSchema.omit({ customerId: true }), + }, ]; diff --git a/packages/autumn-js/src/backend/core/types/routeTypes.ts b/packages/autumn-js/src/backend/core/types/routeTypes.ts index f05099729..0fe64622e 100644 --- a/packages/autumn-js/src/backend/core/types/routeTypes.ts +++ b/packages/autumn-js/src/backend/core/types/routeTypes.ts @@ -7,7 +7,12 @@ import type { BackendResult } from "./responseTypes"; export const ROUTE_NAMES = { getOrCreateCustomer: "getOrCreateCustomer", attach: "attach", + openCustomerPortal: "openCustomerPortal", + createReferralCode: "createReferralCode", + redeemReferralCode: "redeemReferralCode", listPlans: "listPlans", + listEvents: "listEvents", + aggregateEvents: "aggregateEvents", } as const; /** Union of all route names */ diff --git a/packages/autumn-js/src/better-auth/index.ts b/packages/autumn-js/src/better-auth/index.ts index 8dba8d9a8..63867279c 100644 --- a/packages/autumn-js/src/better-auth/index.ts +++ b/packages/autumn-js/src/better-auth/index.ts @@ -35,7 +35,12 @@ export function autumn(options: AutumnOptions = {}): AutumnPlugin { handleRoute, ), attach: createAutumnEndpoint("attach", handleRoute), + openCustomerPortal: createAutumnEndpoint("openCustomerPortal", handleRoute), + createReferralCode: createAutumnEndpoint("createReferralCode", handleRoute), + redeemReferralCode: createAutumnEndpoint("redeemReferralCode", handleRoute), listPlans: createAutumnEndpoint("listPlans", handleRoute), + listEvents: createAutumnEndpoint("listEvents", handleRoute), + aggregateEvents: createAutumnEndpoint("aggregateEvents", handleRoute), }; return { diff --git a/packages/autumn-js/src/generated/aggregateEventsSchemas.ts b/packages/autumn-js/src/generated/aggregateEventsSchemas.ts new file mode 100644 index 000000000..3e1d591de --- /dev/null +++ b/packages/autumn-js/src/generated/aggregateEventsSchemas.ts @@ -0,0 +1,60 @@ +// Generated by ts-to-zod +import { z } from "zod/v4"; + +export const aggregateEventsGlobalsSchema = z.object({ + xApiVersion: z.union([z.string(), z.undefined()]).optional() +}); + +export const aggregateEventsFeatureIdSchema = z.union([z.string(), z.array(z.string())]); + +export const aggregateEventsCustomRangeSchema = z.object({ + start: z.number(), + end: z.number() +}); + +export const aggregateEventsListSchema = z.object({ + period: z.number(), + values: z.record(z.string(), z.number()), + groupedValues: z.union([z.record(z.string(), z.record(z.string(), z.number())), z.undefined()]).optional() +}); + +export const totalSchema = z.object({ + count: z.number(), + sum: z.number() +}); + +export const aggregateEventsResponseSchema = z.object({ + list: z.array(aggregateEventsListSchema), + total: z.record(z.string(), totalSchema) +}); + +export const aggregateEventsFeatureIdOutboundSchema = z.union([z.string(), z.array(z.string())]); + +export const aggregateEventsCustomRangeOutboundSchema = z.object({ + start: z.number(), + end: z.number() +}); + +export const eventsAggregateParamsOutboundSchema = z.object({ + customer_id: z.string(), + feature_id: z.union([z.string(), z.array(z.string())]), + group_by: z.union([z.string(), z.undefined()]).optional(), + range: z.union([z.string(), z.undefined()]).optional(), + bin_size: z.string(), + custom_range: z.union([aggregateEventsCustomRangeOutboundSchema, z.undefined()]).optional() +}); + +const closedEnumSchema = z.any(); + +export const rangeSchema = closedEnumSchema; + +export const binSizeSchema = closedEnumSchema; + +export const eventsAggregateParamsSchema = z.object({ + customerId: z.string(), + featureId: z.union([z.string(), z.array(z.string())]), + groupBy: z.union([z.string(), z.undefined()]).optional(), + range: z.union([rangeSchema, z.undefined()]).optional(), + binSize: z.union([binSizeSchema, z.undefined()]).optional(), + customRange: z.union([aggregateEventsCustomRangeSchema, z.undefined()]).optional() +}); diff --git a/packages/autumn-js/src/generated/billingAttachSchemas.ts b/packages/autumn-js/src/generated/billingAttachSchemas.ts index a69366f22..245da7594 100644 --- a/packages/autumn-js/src/generated/billingAttachSchemas.ts +++ b/packages/autumn-js/src/generated/billingAttachSchemas.ts @@ -5,7 +5,7 @@ export const billingAttachGlobalsSchema = z.object({ xApiVersion: z.union([z.string(), z.undefined()]).optional(), }); -export const billingAttachFeatureQuantitiesSchema = z.object({ +export const billingAttachFeatureQuantitySchema = z.object({ featureId: z.string(), quantity: z.union([z.number(), z.undefined()]).optional(), adjustable: z.union([z.boolean(), z.undefined()]).optional(), @@ -45,7 +45,7 @@ export const billingAttachInvoiceSchema = z.object({ hostedInvoiceUrl: z.string().nullable(), }); -export const billingAttachFeatureQuantitiesOutboundSchema = z.object({ +export const billingAttachFeatureQuantityOutboundSchema = z.object({ feature_id: z.string(), quantity: z.union([z.number(), z.undefined()]).optional(), adjustable: z.union([z.boolean(), z.undefined()]).optional(), @@ -143,16 +143,13 @@ export const billingAttachDiscountUnionOutboundSchema = z.union([ billingAttachDiscount2OutboundSchema, ]); -export const billingAttachRequestOutboundSchema = z.object({ +export const attachParamsOutboundSchema = z.object({ customer_id: z.string(), - entity_id: z.union([z.string(), z.undefined()]).optional().nullable(), + entity_id: z.union([z.string(), z.undefined()]).optional(), + plan_id: z.string(), feature_quantities: z - .union([ - z.array(billingAttachFeatureQuantitiesOutboundSchema), - z.undefined(), - ]) - .optional() - .nullable(), + .union([z.array(billingAttachFeatureQuantityOutboundSchema), z.undefined()]) + .optional(), version: z.union([z.number(), z.undefined()]).optional(), free_trial: z .union([billingAttachFreeTrialOutboundSchema, z.undefined()]) @@ -161,10 +158,10 @@ export const billingAttachRequestOutboundSchema = z.object({ customize: z .union([billingAttachCustomizeOutboundSchema, z.undefined()]) .optional(), - plan_id: z.string(), invoice_mode: z .union([billingAttachInvoiceModeOutboundSchema, z.undefined()]) .optional(), + billing_behavior: z.union([z.string(), z.undefined()]).optional(), discounts: z .union([ z.array( @@ -176,11 +173,9 @@ export const billingAttachRequestOutboundSchema = z.object({ z.undefined(), ]) .optional(), - redirect_mode: z.string(), success_url: z.union([z.string(), z.undefined()]).optional(), new_billing_subscription: z.union([z.boolean(), z.undefined()]).optional(), plan_schedule: z.union([z.string(), z.undefined()]).optional(), - billing_behavior: z.union([z.string(), z.undefined()]).optional(), }); const closedEnumSchema = z.any(); @@ -261,29 +256,29 @@ export const billingAttachCustomizeSchema = z.object({ items: z.union([z.array(billingAttachItemSchema), z.undefined()]).optional(), }); -export const billingAttachRedirectModeSchema = closedEnumSchema; +export const billingAttachBillingBehaviorSchema = closedEnumSchema; export const billingAttachPlanScheduleSchema = closedEnumSchema; -export const billingAttachBillingBehaviorSchema = closedEnumSchema; - -export const billingAttachRequestSchema = z.object({ +export const attachParamsSchema = z.object({ customerId: z.string(), - entityId: z.union([z.string(), z.undefined()]).optional().nullable(), + entityId: z.union([z.string(), z.undefined()]).optional(), + planId: z.string(), featureQuantities: z - .union([z.array(billingAttachFeatureQuantitiesSchema), z.undefined()]) - .optional() - .nullable(), + .union([z.array(billingAttachFeatureQuantitySchema), z.undefined()]) + .optional(), version: z.union([z.number(), z.undefined()]).optional(), freeTrial: z .union([billingAttachFreeTrialSchema, z.undefined()]) .optional() .nullable(), customize: z.union([billingAttachCustomizeSchema, z.undefined()]).optional(), - planId: z.string(), invoiceMode: z .union([billingAttachInvoiceModeSchema, z.undefined()]) .optional(), + billingBehavior: z + .union([billingAttachBillingBehaviorSchema, z.undefined()]) + .optional(), discounts: z .union([ z.array( @@ -292,17 +287,11 @@ export const billingAttachRequestSchema = z.object({ z.undefined(), ]) .optional(), - redirectMode: z - .union([billingAttachRedirectModeSchema, z.undefined()]) - .optional(), successUrl: z.union([z.string(), z.undefined()]).optional(), newBillingSubscription: z.union([z.boolean(), z.undefined()]).optional(), planSchedule: z .union([billingAttachPlanScheduleSchema, z.undefined()]) .optional(), - billingBehavior: z - .union([billingAttachBillingBehaviorSchema, z.undefined()]) - .optional(), }); export const billingAttachCodeSchema = openEnumSchema; diff --git a/packages/autumn-js/src/generated/createReferralCodeSchemas.ts b/packages/autumn-js/src/generated/createReferralCodeSchemas.ts new file mode 100644 index 000000000..75098ece2 --- /dev/null +++ b/packages/autumn-js/src/generated/createReferralCodeSchemas.ts @@ -0,0 +1,22 @@ +// Generated by ts-to-zod +import { z } from "zod/v4"; + +export const createReferralCodeGlobalsSchema = z.object({ + xApiVersion: z.union([z.string(), z.undefined()]).optional(), +}); + +export const createReferralCodeParamsSchema = z.object({ + customerId: z.string(), + programId: z.string(), +}); + +export const createReferralCodeResponseSchema = z.object({ + code: z.string(), + customerId: z.string(), + createdAt: z.number(), +}); + +export const createReferralCodeParamsOutboundSchema = z.object({ + customer_id: z.string(), + program_id: z.string(), +}); diff --git a/packages/autumn-js/src/generated/index.ts b/packages/autumn-js/src/generated/index.ts index 403a586d4..8e42b7b2b 100644 --- a/packages/autumn-js/src/generated/index.ts +++ b/packages/autumn-js/src/generated/index.ts @@ -1,6 +1,11 @@ // Generated schemas from Speakeasy SDK types // Run `bun api` to regenerate +export * from "./aggregateEventsSchemas"; export * from "./billingAttachSchemas"; +export * from "./createReferralCodeSchemas"; export * from "./getOrCreateCustomerSchemas"; +export * from "./listEventsSchemas"; export * from "./listPlansSchemas"; +export * from "./openCustomerPortalSchemas"; +export * from "./redeemReferralCodeSchemas"; diff --git a/packages/autumn-js/src/generated/listEventsSchemas.ts b/packages/autumn-js/src/generated/listEventsSchemas.ts new file mode 100644 index 000000000..1b21bba68 --- /dev/null +++ b/packages/autumn-js/src/generated/listEventsSchemas.ts @@ -0,0 +1,55 @@ +// Generated by ts-to-zod +import { z } from "zod/v4"; + +export const listEventsGlobalsSchema = z.object({ + xApiVersion: z.union([z.string(), z.undefined()]).optional() +}); + +export const listEventsFeatureIdSchema = z.union([z.string(), z.array(z.string())]); + +export const listEventsCustomRangeSchema = z.object({ + start: z.union([z.number(), z.undefined()]).optional(), + end: z.union([z.number(), z.undefined()]).optional() +}); + +export const eventsListParamsSchema = z.object({ + offset: z.union([z.number(), z.undefined()]).optional(), + limit: z.union([z.number(), z.undefined()]).optional(), + customerId: z.union([z.string(), z.undefined()]).optional(), + featureId: z.union([z.string(), z.array(z.string()), z.undefined()]).optional(), + customRange: z.union([listEventsCustomRangeSchema, z.undefined()]).optional() +}); + +export const listEventsPropertiesSchema = z.object({}); + +export const listEventsListSchema = z.object({ + id: z.string(), + timestamp: z.number(), + featureId: z.string(), + customerId: z.string(), + value: z.number(), + properties: listEventsPropertiesSchema +}); + +export const listEventsResponseSchema = z.object({ + list: z.array(listEventsListSchema), + hasMore: z.boolean(), + offset: z.number(), + limit: z.number(), + total: z.number() +}); + +export const listEventsFeatureIdOutboundSchema = z.union([z.string(), z.array(z.string())]); + +export const listEventsCustomRangeOutboundSchema = z.object({ + start: z.union([z.number(), z.undefined()]).optional(), + end: z.union([z.number(), z.undefined()]).optional() +}); + +export const eventsListParamsOutboundSchema = z.object({ + offset: z.number(), + limit: z.number(), + customer_id: z.union([z.string(), z.undefined()]).optional(), + feature_id: z.union([z.string(), z.array(z.string()), z.undefined()]).optional(), + custom_range: z.union([listEventsCustomRangeOutboundSchema, z.undefined()]).optional() +}); diff --git a/packages/autumn-js/src/generated/openCustomerPortalSchemas.ts b/packages/autumn-js/src/generated/openCustomerPortalSchemas.ts new file mode 100644 index 000000000..4c15d4d24 --- /dev/null +++ b/packages/autumn-js/src/generated/openCustomerPortalSchemas.ts @@ -0,0 +1,23 @@ +// Generated by ts-to-zod +import { z } from "zod/v4"; + +export const openCustomerPortalGlobalsSchema = z.object({ + xApiVersion: z.union([z.string(), z.undefined()]).optional(), +}); + +export const openCustomerPortalParamsSchema = z.object({ + customerId: z.string(), + configurationId: z.union([z.string(), z.undefined()]).optional(), + returnUrl: z.union([z.string(), z.undefined()]).optional(), +}); + +export const openCustomerPortalResponseSchema = z.object({ + customerId: z.string(), + url: z.string(), +}); + +export const openCustomerPortalParamsOutboundSchema = z.object({ + customer_id: z.string(), + configuration_id: z.union([z.string(), z.undefined()]).optional(), + return_url: z.union([z.string(), z.undefined()]).optional(), +}); diff --git a/packages/autumn-js/src/generated/redeemReferralCodeSchemas.ts b/packages/autumn-js/src/generated/redeemReferralCodeSchemas.ts new file mode 100644 index 000000000..5386ce007 --- /dev/null +++ b/packages/autumn-js/src/generated/redeemReferralCodeSchemas.ts @@ -0,0 +1,22 @@ +// Generated by ts-to-zod +import { z } from "zod/v4"; + +export const redeemReferralCodeGlobalsSchema = z.object({ + xApiVersion: z.union([z.string(), z.undefined()]).optional(), +}); + +export const redeemReferralCodeParamsSchema = z.object({ + code: z.string(), + customerId: z.string(), +}); + +export const redeemReferralCodeResponseSchema = z.object({ + id: z.string(), + customerId: z.string(), + rewardId: z.string(), +}); + +export const redeemReferralCodeParamsOutboundSchema = z.object({ + code: z.string(), + customer_id: z.string(), +}); diff --git a/packages/autumn-js/src/react/client/AutumnClient.ts b/packages/autumn-js/src/react/client/AutumnClient.ts index dddd7b010..2ba5b036b 100644 --- a/packages/autumn-js/src/react/client/AutumnClient.ts +++ b/packages/autumn-js/src/react/client/AutumnClient.ts @@ -1,4 +1,13 @@ -import type { BillingAttachResponse, Customer, Plan } from "@useautumn/sdk"; +import type { + AggregateEventsResponse, + BillingAttachResponse, + CreateReferralCodeResponse, + Customer, + ListEventsResponse, + ListPlansResponse, + OpenCustomerPortalResponse, + RedeemReferralCodeResponse, +} from "@useautumn/sdk"; import type { IAutumnClient } from "./IAutumnClient"; import { createHttpClient } from "./internal/httpClient"; @@ -9,7 +18,9 @@ export type AutumnClientConfig = { includeCredentials?: boolean; }; -export const createAutumnClient = (config: AutumnClientConfig): IAutumnClient => { +export const createAutumnClient = ( + config: AutumnClientConfig, +): IAutumnClient => { const http = createHttpClient({ backendUrl: config.backendUrl, pathPrefix: config.pathPrefix, @@ -27,6 +38,31 @@ export const createAutumnClient = (config: AutumnClientConfig): IAutumnClient => route: "attach", body: params, }), - listPlans: () => http.request({ route: "listPlans" }), + openCustomerPortal: (params) => + http.request({ + route: "openCustomerPortal", + body: params, + }), + createReferralCode: (params) => + http.request({ + route: "createReferralCode", + body: params, + }), + redeemReferralCode: (params) => + http.request({ + route: "redeemReferralCode", + body: params, + }), + listPlans: () => http.request({ route: "listPlans" }), + listEvents: (params) => + http.request({ + route: "listEvents", + body: params, + }), + aggregateEvents: (params) => + http.request({ + route: "aggregateEvents", + body: params, + }), }; }; diff --git a/packages/autumn-js/src/react/client/IAutumnClient.ts b/packages/autumn-js/src/react/client/IAutumnClient.ts index 91a6a3eae..4aa2a4685 100644 --- a/packages/autumn-js/src/react/client/IAutumnClient.ts +++ b/packages/autumn-js/src/react/client/IAutumnClient.ts @@ -1,7 +1,21 @@ -import type { BillingAttachResponse, Customer, Plan } from "@useautumn/sdk"; import type { + AggregateEventsResponse, + BillingAttachResponse, + CreateReferralCodeResponse, + Customer, + ListEventsResponse, + ListPlansResponse, + OpenCustomerPortalResponse, + RedeemReferralCodeResponse, +} from "@useautumn/sdk"; +import type { + AggregateEventsParams, AttachParams, + CreateReferralCodeParams, GetOrCreateCustomerClientParams, + ListEventsParams, + OpenCustomerPortalParams, + RedeemReferralCodeParams, } from "../../types"; /** Client interface matching backend RPC routes */ @@ -10,5 +24,18 @@ export interface IAutumnClient { params?: GetOrCreateCustomerClientParams, ) => Promise; attach: (params: AttachParams) => Promise; - listPlans: () => Promise; + openCustomerPortal: ( + params: OpenCustomerPortalParams, + ) => Promise; + createReferralCode: ( + params: CreateReferralCodeParams, + ) => Promise; + redeemReferralCode: ( + params: RedeemReferralCodeParams, + ) => Promise; + listPlans: () => Promise; + listEvents: (params: ListEventsParams) => Promise; + aggregateEvents: ( + params: AggregateEventsParams, + ) => Promise; } diff --git a/packages/autumn-js/src/react/hooks/internal/useCustomerActions.ts b/packages/autumn-js/src/react/hooks/internal/useCustomerActions.ts index e1eb6d377..513e802a0 100644 --- a/packages/autumn-js/src/react/hooks/internal/useCustomerActions.ts +++ b/packages/autumn-js/src/react/hooks/internal/useCustomerActions.ts @@ -1,12 +1,21 @@ "use client"; import type { - BalancesCheckResponse, BillingAttachResponse, + CheckResponse, + CreateReferralCodeResponse, Customer, + OpenCustomerPortalResponse, + RedeemReferralCodeResponse, } from "@useautumn/sdk"; import { useCallback } from "react"; -import type { AttachParams, CheckParams } from "../../../types"; +import type { + AttachParams, + CheckParams, + CreateReferralCodeParams, + OpenCustomerPortalParams, + RedeemReferralCodeParams, +} from "../../../types"; import type { IAutumnClient } from "../../client/IAutumnClient"; import { getLocalCheckResponse } from "./getLocalCheckResponse"; @@ -54,7 +63,7 @@ export const useCustomerActions = ({ ); const check = useCallback( - (params: CheckParams): BalancesCheckResponse => { + (params: CheckParams): CheckResponse => { return getLocalCheckResponse({ customer, params, @@ -63,10 +72,56 @@ export const useCustomerActions = ({ [customer], ); + const openCustomerPortal = useCallback( + async ( + params: OpenCustomerPortalParams = {}, + ): Promise => { + const response = await client.openCustomerPortal({ + ...params, + returnUrl: params.returnUrl ?? window.location.href, + }); + + redirectToUrl({ + url: response.url, + openInNewTab: params.openInNewTab, + }); + + return response; + }, + [client], + ); + + const createReferralCode = useCallback( + async ( + params: CreateReferralCodeParams, + ): Promise => { + return client.createReferralCode(params); + }, + [client], + ); + + const redeemReferralCode = useCallback( + async ( + params: RedeemReferralCodeParams, + ): Promise => { + return client.redeemReferralCode(params); + }, + [client], + ); + return { attach, check, + createReferralCode, + openCustomerPortal, + redeemReferralCode, }; }; -export type { CheckParams, AttachParams }; +export type { + AttachParams, + CheckParams, + CreateReferralCodeParams, + OpenCustomerPortalParams, + RedeemReferralCodeParams, +}; diff --git a/packages/autumn-js/src/react/hooks/useCustomer.ts b/packages/autumn-js/src/react/hooks/useCustomer.ts index c59708b5a..0c243faf3 100644 --- a/packages/autumn-js/src/react/hooks/useCustomer.ts +++ b/packages/autumn-js/src/react/hooks/useCustomer.ts @@ -2,14 +2,20 @@ import { useQuery } from "@tanstack/react-query"; import type { - BalancesCheckResponse, BillingAttachResponse, + CheckResponse, + CreateReferralCodeResponse, Customer, + OpenCustomerPortalResponse, + RedeemReferralCodeResponse, } from "@useautumn/sdk"; import type { AttachParams, CheckParams, + CreateReferralCodeParams, GetOrCreateCustomerClientParams, + OpenCustomerPortalParams, + RedeemReferralCodeParams, } from "../../types"; import { useAutumnClient } from "../AutumnContext"; import type { AutumnClientError } from "../client/AutumnClientError"; @@ -33,14 +39,29 @@ export type UseCustomerResult = HookResultWithMethods< attach: (params: AttachParams) => Promise; /** Checks feature access and balance for the customer locally (no API call). */ - check: (params: UseCustomerCheckParams) => BalancesCheckResponse; + check: (params: UseCustomerCheckParams) => CheckResponse; + + /** Opens the Stripe customer billing portal for this customer and returns the portal session response. */ + openCustomerPortal: ( + params?: OpenCustomerPortalParams, + ) => Promise; + + /** Creates or fetches a referral code for the current customer in a referral program. */ + createReferralCode: ( + params: CreateReferralCodeParams, + ) => Promise; + + /** Redeems a referral code for the current customer. */ + redeemReferralCode: ( + params: RedeemReferralCodeParams, + ) => Promise; } >; /** * Fetches or creates an Autumn customer and provides billing actions. * - * @returns Customer data along with `attach` and `check` methods for billing operations. + * @returns Customer data along with `attach`, `check`, `openCustomerPortal`, `createReferralCode`, and `redeemReferralCode` action methods. */ export const useCustomer = ( params: UseCustomerParams = {}, diff --git a/packages/autumn-js/src/react/hooks/useListPlans.ts b/packages/autumn-js/src/react/hooks/useListPlans.ts index 5766d73a2..745ba5ce2 100644 --- a/packages/autumn-js/src/react/hooks/useListPlans.ts +++ b/packages/autumn-js/src/react/hooks/useListPlans.ts @@ -14,7 +14,10 @@ export const useListPlans = (params: UseListPlansParams = {}) => { return useQuery({ queryKey: ["autumn", "plans"], - queryFn: () => client.listPlans(), + queryFn: async () => { + const response = await client.listPlans(); + return response.list; + }, ...queryOptions, }); }; diff --git a/packages/autumn-js/src/react/index.ts b/packages/autumn-js/src/react/index.ts index 4a36053e5..36c9129c8 100644 --- a/packages/autumn-js/src/react/index.ts +++ b/packages/autumn-js/src/react/index.ts @@ -1,5 +1,15 @@ // Provider +// Types +export type { + CheckParams, + ClientAttachParams, + ClientCreateReferralCodeParams, + ClientGetOrCreateCustomerParams, + ClientOpenCustomerPortalParams, + ClientRedeemReferralCodeParams, + ProtectedFields, +} from "../types/params"; // Context export { useAutumnClient } from "./AutumnContext"; export { AutumnProvider, type AutumnProviderProps } from "./AutumnProvider"; @@ -18,10 +28,3 @@ export { useCustomer, } from "./hooks/useCustomer"; export { type UseListPlansParams, useListPlans } from "./hooks/useListPlans"; -// Types -export type { - CheckParams, - ClientAttachParams, - ClientGetOrCreateCustomerParams, - ProtectedFields, -} from "../types/params"; diff --git a/packages/autumn-js/src/types/index.ts b/packages/autumn-js/src/types/index.ts index 4e22560e6..395b3afbd 100644 --- a/packages/autumn-js/src/types/index.ts +++ b/packages/autumn-js/src/types/index.ts @@ -1,6 +1,11 @@ export type { CheckParams, + ClientAggregateEventsParams as AggregateEventsParams, ClientAttachParams as AttachParams, + ClientCreateReferralCodeParams as CreateReferralCodeParams, ClientGetOrCreateCustomerParams as GetOrCreateCustomerClientParams, + ClientListEventsParams as ListEventsParams, + ClientOpenCustomerPortalParams as OpenCustomerPortalParams, + ClientRedeemReferralCodeParams as RedeemReferralCodeParams, ProtectedFields, } from "./params"; diff --git a/packages/autumn-js/src/types/params.ts b/packages/autumn-js/src/types/params.ts index e59bb4eee..e9c82ce1b 100644 --- a/packages/autumn-js/src/types/params.ts +++ b/packages/autumn-js/src/types/params.ts @@ -1,7 +1,12 @@ import type { BalancesCheckRequest, BillingAttachRequest, + CreateReferralCodeParams, CustomerExpand, + EventsAggregateParams, + EventsListParams, + OpenCustomerPortalParams, + RedeemReferralCodeParams, } from "@useautumn/sdk"; /** Fields injected by backend - stripped from frontend params */ @@ -23,3 +28,32 @@ export type ClientAttachParams = Omit< > & { openInNewTab?: boolean; }; + +/** Open customer portal params without protected fields (for frontend use) */ +export type ClientOpenCustomerPortalParams = Omit< + OpenCustomerPortalParams, + ProtectedFields +> & { + openInNewTab?: boolean; +}; + +/** Create referral code params without protected fields (for frontend use) */ +export type ClientCreateReferralCodeParams = Omit< + CreateReferralCodeParams, + ProtectedFields +>; + +/** Redeem referral code params without protected fields (for frontend use) */ +export type ClientRedeemReferralCodeParams = Omit< + RedeemReferralCodeParams, + ProtectedFields +>; + +/** List events params without protected fields (for frontend use) */ +export type ClientListEventsParams = Omit; + +/** Aggregate events params without protected fields (for frontend use) */ +export type ClientAggregateEventsParams = Omit< + EventsAggregateParams, + ProtectedFields +>; diff --git a/packages/autumn-js/tsconfig.json b/packages/autumn-js/tsconfig.json index 4b7095718..6127accb3 100644 --- a/packages/autumn-js/tsconfig.json +++ b/packages/autumn-js/tsconfig.json @@ -15,15 +15,12 @@ "lib": ["DOM", "DOM.Iterable", "ESNext"], "skipLibCheck": true, - "baseUrl": ".", "paths": { - "@/*": ["src/libraries/react/*"], - "@/hooks/*": ["src/libraries/react/hooks/*"], - "@sdk": ["src/sdk/index"], - "@sdk/*": ["src/sdk/*"], + "@/*": ["./src/libraries/react/*"], + "@/hooks/*": ["./src/libraries/react/hooks/*"], "@useautumn/sdk": ["../sdk/dist/esm/index.d.ts"], "@useautumn/sdk/*": ["../sdk/dist/esm/*"], - "@utils/*": ["src/utils/*"] + "@utils/*": ["./src/utils/*"] } }, "include": ["src"], diff --git a/packages/openapi/openapi-stripped.yml b/packages/openapi/openapi-stripped.yml index ba3906ed3..07c9f5f83 100644 --- a/packages/openapi/openapi-stripped.yml +++ b/packages/openapi/openapi-stripped.yml @@ -119,43 +119,57 @@ components: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the subscribed plan. auto_enable: type: boolean + description: Whether the plan was automatically enabled for the customer. add_on: type: boolean + description: Whether this is an add-on plan rather than a base subscription. status: enum: - active - scheduled - - expired + description: Current status of the subscription. past_due: type: boolean + description: Whether the subscription has overdue payments. canceled_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription was canceled, or null if not + canceled. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry + set. trial_ends_at: anyOf: - type: number - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. started_at: type: number + description: Timestamp when the subscription started. current_period_start: anyOf: - type: number - type: "null" + description: Start timestamp of the current billing period. current_period_end: anyOf: - type: number - type: "null" + description: End timestamp of the current billing period. quantity: type: number + description: Number of units of this subscription (for per-seat plans). required: - plan_id - auto_enable @@ -169,6 +183,7 @@ components: - current_period_start - current_period_end - quantity + description: Active and scheduled recurring plans that this customer has attached. purchases: type: array items: @@ -176,21 +191,27 @@ components: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the purchased plan. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. started_at: type: number + description: Timestamp when the purchase was made. quantity: type: number + description: Number of units purchased. required: - plan_id - expires_at - started_at - quantity + description: One-time purchases made by the customer. balances: type: object propertyNames: @@ -200,6 +221,7 @@ components: properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -249,25 +271,35 @@ components: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -276,20 +308,28 @@ components: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -307,22 +347,28 @@ components: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -337,25 +383,31 @@ components: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -366,6 +418,8 @@ components: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -373,11 +427,14 @@ components: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -387,6 +444,30 @@ components: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + description: Feature balances keyed by feature ID, showing usage limits and + remaining amounts. invoices: type: array items: @@ -602,30 +683,52 @@ components: - balances examples: - &a2 - id: cus_123 - created_at: 1717000000 - name: John Doe - email: john@example.com - fingerprint: "1234567890" - stripe_id: cus_123 + id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58 + name: Patrick + email: patrick@useautumn.com + createdAt: 1771409161016 + fingerprint: null + stripeId: cus_U0BKxpq1mFhuJO env: sandbox metadata: {} + sendEmailReceipts: false subscriptions: - - id: sub_123 - created_at: 1717000000 - plan_id: plan_123 + - planId: pro_plan + autoEnable: true + addOn: false status: active + pastDue: false + canceledAt: null + expiresAt: null + trialEndsAt: null + startedAt: 1771431921437 + currentPeriodStart: 1771431921437 + currentPeriodEnd: 1771999921437 quantity: 1 - interval: month - interval_count: 1 purchases: [] balances: - balance_1: - id: balance_1 - amount: 100 - currency: USD - created_at: 1717000000 - updated_at: 1717000000 + messages: + featureId: messages + granted: 100 + remaining: 0 + usage: 100 + unlimited: false + overageAllowed: false + maxPurchase: null + nextResetAt: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + planId: pro_plan + includedGrant: 100 + prepaidGrant: 0 + remaining: 0 + usage: 100 + unlimited: false + reset: + interval: month + resetsAt: 1773851121437 + price: null + expiresAt: null Plan: type: object properties: @@ -1012,7 +1115,7 @@ paths: example: *a2 x-speakeasy-name-override: getOrCreate parameters: - - &a4 + - &a5 name: x-api-version in: header required: true @@ -1137,43 +1240,57 @@ paths: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the subscribed plan. auto_enable: type: boolean + description: Whether the plan was automatically enabled for the customer. add_on: type: boolean + description: Whether this is an add-on plan rather than a base subscription. status: enum: - active - scheduled - - expired + description: Current status of the subscription. past_due: type: boolean + description: Whether the subscription has overdue payments. canceled_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription was canceled, or null if not + canceled. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry + set. trial_ends_at: anyOf: - type: number - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. started_at: type: number + description: Timestamp when the subscription started. current_period_start: anyOf: - type: number - type: "null" + description: Start timestamp of the current billing period. current_period_end: anyOf: - type: number - type: "null" + description: End timestamp of the current billing period. quantity: type: number + description: Number of units of this subscription (for per-seat plans). required: - plan_id - auto_enable @@ -1187,6 +1304,8 @@ paths: - current_period_start - current_period_end - quantity + description: Active and scheduled recurring plans that this customer has + attached. purchases: type: array items: @@ -1194,21 +1313,27 @@ paths: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the purchased plan. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. started_at: type: number + description: Timestamp when the purchase was made. quantity: type: number + description: Number of units purchased. required: - plan_id - expires_at - started_at - quantity + description: One-time purchases made by the customer. balances: type: object propertyNames: @@ -1218,6 +1343,7 @@ paths: properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -1267,25 +1393,35 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -1294,20 +1430,28 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -1325,22 +1469,29 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different + intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -1354,25 +1505,31 @@ paths: type: number required: - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -1383,6 +1540,8 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -1390,11 +1549,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -1404,6 +1566,30 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + description: Feature balances keyed by feature ID, showing usage limits and + remaining amounts. required: - id - name @@ -1417,6 +1603,53 @@ paths: - subscriptions - purchases - balances + examples: + - id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58 + name: Patrick + email: patrick@useautumn.com + createdAt: 1771409161016 + fingerprint: null + stripeId: cus_U0BKxpq1mFhuJO + env: sandbox + metadata: {} + sendEmailReceipts: false + subscriptions: + - planId: pro_plan + autoEnable: true + addOn: false + status: active + pastDue: false + canceledAt: null + expiresAt: null + trialEndsAt: null + startedAt: 1771431921437 + currentPeriodStart: 1771431921437 + currentPeriodEnd: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + featureId: messages + granted: 100 + remaining: 0 + usage: 100 + unlimited: false + overageAllowed: false + maxPurchase: null + nextResetAt: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + planId: pro_plan + includedGrant: 100 + prepaidGrant: 0 + remaining: 0 + usage: 100 + unlimited: false + reset: + interval: month + resetsAt: 1773851121437 + price: null + expiresAt: null description: Array of items for current page has_more: type: boolean @@ -1436,9 +1669,63 @@ paths: - offset - limit - total + examples: + - &a4 + list: + - id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58 + name: Patrick + email: patrick@useautumn.com + createdAt: 1771409161016 + fingerprint: null + stripeId: cus_U0BKxpq1mFhuJO + env: sandbox + metadata: {} + sendEmailReceipts: false + subscriptions: + - planId: pro_plan + autoEnable: true + addOn: false + status: active + pastDue: false + canceledAt: null + expiresAt: null + trialEndsAt: null + startedAt: 1771431921437 + currentPeriodStart: 1771431921437 + currentPeriodEnd: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + featureId: messages + granted: 100 + remaining: 0 + usage: 100 + unlimited: false + overageAllowed: false + maxPurchase: null + nextResetAt: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + planId: pro_plan + includedGrant: 100 + prepaidGrant: 0 + remaining: 0 + usage: 100 + unlimited: false + reset: + interval: month + resetsAt: 1773851121437 + price: null + expiresAt: null + has_more: false + offset: 0 + total: 1 + limit: 10 + example: *a4 x-speakeasy-name-override: list parameters: - - *a4 + - *a5 /v1/customers.update: post: operationId: updateCustomer @@ -1496,11 +1783,11 @@ paths: - customer_id title: UpdateCustomerParams examples: - - &a5 + - &a6 customer_id: cus_123 name: Jane Doe email: jane@example.com - example: *a5 + example: *a6 responses: "200": description: OK @@ -1558,43 +1845,57 @@ paths: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the subscribed plan. auto_enable: type: boolean + description: Whether the plan was automatically enabled for the customer. add_on: type: boolean + description: Whether this is an add-on plan rather than a base subscription. status: enum: - active - scheduled - - expired + description: Current status of the subscription. past_due: type: boolean + description: Whether the subscription has overdue payments. canceled_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription was canceled, or null if not + canceled. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry + set. trial_ends_at: anyOf: - type: number - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. started_at: type: number + description: Timestamp when the subscription started. current_period_start: anyOf: - type: number - type: "null" + description: Start timestamp of the current billing period. current_period_end: anyOf: - type: number - type: "null" + description: End timestamp of the current billing period. quantity: type: number + description: Number of units of this subscription (for per-seat plans). required: - plan_id - auto_enable @@ -1608,6 +1909,8 @@ paths: - current_period_start - current_period_end - quantity + description: Active and scheduled recurring plans that this customer has + attached. purchases: type: array items: @@ -1615,21 +1918,27 @@ paths: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the purchased plan. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. started_at: type: number + description: Timestamp when the purchase was made. quantity: type: number + description: Number of units purchased. required: - plan_id - expires_at - started_at - quantity + description: One-time purchases made by the customer. balances: type: object propertyNames: @@ -1639,6 +1948,7 @@ paths: properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -1688,25 +1998,35 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -1715,20 +2035,28 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -1746,22 +2074,28 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -1776,25 +2110,31 @@ paths: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -1805,6 +2145,8 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -1812,11 +2154,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -1826,6 +2171,30 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + description: Feature balances keyed by feature ID, showing usage limits and + remaining amounts. required: - id - name @@ -1839,9 +2208,58 @@ paths: - subscriptions - purchases - balances + examples: + - &a7 + id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58 + name: Patrick + email: patrick@useautumn.com + createdAt: 1771409161016 + fingerprint: null + stripeId: cus_U0BKxpq1mFhuJO + env: sandbox + metadata: {} + sendEmailReceipts: false + subscriptions: + - planId: pro_plan + autoEnable: true + addOn: false + status: active + pastDue: false + canceledAt: null + expiresAt: null + trialEndsAt: null + startedAt: 1771431921437 + currentPeriodStart: 1771431921437 + currentPeriodEnd: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + featureId: messages + granted: 100 + remaining: 0 + usage: 100 + unlimited: false + overageAllowed: false + maxPurchase: null + nextResetAt: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + planId: pro_plan + includedGrant: 100 + prepaidGrant: 0 + remaining: 0 + usage: 100 + unlimited: false + reset: + interval: month + resetsAt: 1773851121437 + price: null + expiresAt: null + example: *a7 x-speakeasy-name-override: update parameters: - - *a4 + - *a5 /v1/customers.delete: post: operationId: deleteCustomer @@ -1867,10 +2285,10 @@ paths: - customer_id title: DeleteCustomerParams examples: - - &a6 + - &a8 customer_id: cus_123 delete_in_stripe: false - example: *a6 + example: *a8 responses: "200": description: OK @@ -1885,7 +2303,7 @@ paths: - success x-speakeasy-name-override: delete parameters: - - *a4 + - *a5 /v1/plans.list: post: operationId: listPlans @@ -1921,12 +2339,17 @@ paths: - list x-speakeasy-name-override: list parameters: - - *a4 + - *a5 /v1/billing.attach: post: operationId: billingAttach - description: Attaches a plan to a customer. Handles new subscriptions, upgrades - and downgrades. + description: >- + Attaches a plan to a customer. Handles new subscriptions, upgrades and + downgrades. + + + Use this endpoint to subscribe a customer to a plan, upgrade/downgrade + between plans, or add an add-on product. tags: - billing requestBody: @@ -1940,26 +2363,25 @@ paths: type: string description: The ID of the customer to attach the plan to. entity_id: - anyOf: - - type: string - - type: "null" + type: string description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: The ID of the plan. feature_quantities: - anyOf: - - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - minimum: 0 - adjustable: - type: boolean - required: - - feature_id - - type: "null" + type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + minimum: 0 + adjustable: + type: boolean + required: + - feature_id description: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting @@ -1985,6 +2407,8 @@ paths: required: - duration_length - type: "null" + description: Override the plan's default free trial. Pass an object to set a + custom trial, or null to remove the trial entirely. customize: type: object properties: @@ -2115,21 +2539,37 @@ paths: - feature_id description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - plan_id: - type: string invoice_mode: type: object properties: enabled: type: boolean + description: When true, creates an invoice and sends it to the customer instead + of charging their card immediately. Uses Stripe's + send_invoice collection method. enable_plan_immediately: type: boolean default: false + description: If true, enables the plan immediately even though the invoice is + not paid yet. finalize: type: boolean default: true + description: If true, finalizes the invoice so it can be sent to the customer. + If false, keeps it as a draft for manual review. required: - enabled + description: Invoice mode creates a draft or open invoice and sends it to the + customer, instead of charging their card immediately. This + uses Stripe's send_invoice collection method. + billing_behavior: + enum: + - prorate_immediately + - next_cycle_only + description: 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. discounts: type: array items: @@ -2138,35 +2578,44 @@ paths: properties: reward_id: type: string + description: The ID of the reward to apply as a discount. required: - reward_id - type: object properties: promotion_code: type: string + description: The promotion code to apply as a discount. required: - promotion_code - redirect_mode: - enum: - - always - - if_required - - never - default: always + description: A discount to apply. Can be either a reward ID or a promotion code. + description: List of discounts to apply. Each discount can be an Autumn reward + ID, Stripe coupon ID, or Stripe promotion code. success_url: type: string + description: URL to redirect to after successful checkout. new_billing_subscription: type: boolean + description: Only applicable when the customer has an existing Stripe + subscription. If true, creates a new separate subscription + instead of merging into the existing one. plan_schedule: enum: - immediate - end_of_cycle - billing_behavior: - enum: - - prorate_immediately - - next_cycle_only + description: When the plan change should take effect. 'immediate' applies now, + 'end_of_cycle' schedules for the end of the current billing + cycle. By default, upgrades are immediate and downgrades are + scheduled. required: - customer_id - plan_id + title: AttachParams + examples: + - &a9 + customer_id: cus_123 + plan_id: pro_plan + example: *a9 responses: "200": description: OK @@ -2177,8 +2626,10 @@ paths: properties: customer_id: type: string + description: The ID of the customer. entity_id: type: string + description: The ID of the entity, if the plan was attached to an entity. invoice: type: object properties: @@ -2186,26 +2637,36 @@ paths: anyOf: - type: string - type: "null" + description: The status of the invoice (e.g., 'paid', 'open', 'draft'). stripe_id: type: string + description: The Stripe invoice ID. total: type: number + description: The total amount of the invoice in cents. currency: type: string + description: The three-letter ISO currency code (e.g., 'usd'). hosted_invoice_url: anyOf: - type: string - type: "null" + description: URL to the hosted invoice page where the customer can view and pay + the invoice. required: - status - stripe_id - total - currency - hosted_invoice_url + description: Invoice details if an invoice was created. Only present when a + charge was made. payment_url: anyOf: - type: string - type: "null" + description: URL to redirect the customer to complete payment. Null if no + payment action is required. required_action: type: object properties: @@ -2214,21 +2675,36 @@ paths: - 3ds_required - payment_method_required - payment_failed + description: The type of action required to complete the payment. reason: type: string + description: A human-readable explanation of why this action is required. required: - code - reason + description: Details about any action required to complete the payment. Present + when the payment could not be processed automatically. required: - customer_id - payment_url + examples: + - &a10 + customer_id: cus_123 + payment_url: https://checkout.stripe.com/... + example: *a10 x-speakeasy-name-override: attach parameters: - - *a4 + - *a5 /v1/billing.preview_attach: post: - operationId: billingPreviewAttach - description: Preview billing changes before attaching a plan. + operationId: previewAttach + description: >- + Previews the billing changes that would occur when attaching a plan, + without actually making any changes. + + + Use this endpoint to show customers what they will be charged before + confirming a subscription change. tags: - billing requestBody: @@ -2242,26 +2718,25 @@ paths: type: string description: The ID of the customer to attach the plan to. entity_id: - anyOf: - - type: string - - type: "null" + type: string description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: The ID of the plan. feature_quantities: - anyOf: - - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - minimum: 0 - adjustable: - type: boolean - required: - - feature_id - - type: "null" + type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + minimum: 0 + adjustable: + type: boolean + required: + - feature_id description: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting @@ -2287,6 +2762,8 @@ paths: required: - duration_length - type: "null" + description: Override the plan's default free trial. Pass an object to set a + custom trial, or null to remove the trial entirely. customize: type: object properties: @@ -2417,21 +2894,37 @@ paths: - feature_id description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - plan_id: - type: string invoice_mode: type: object properties: enabled: type: boolean + description: When true, creates an invoice and sends it to the customer instead + of charging their card immediately. Uses Stripe's + send_invoice collection method. enable_plan_immediately: type: boolean default: false + description: If true, enables the plan immediately even though the invoice is + not paid yet. finalize: type: boolean default: true + description: If true, finalizes the invoice so it can be sent to the customer. + If false, keeps it as a draft for manual review. required: - enabled + description: Invoice mode creates a draft or open invoice and sends it to the + customer, instead of charging their card immediately. This + uses Stripe's send_invoice collection method. + billing_behavior: + enum: + - prorate_immediately + - next_cycle_only + description: 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. discounts: type: array items: @@ -2440,35 +2933,44 @@ paths: properties: reward_id: type: string + description: The ID of the reward to apply as a discount. required: - reward_id - type: object properties: promotion_code: type: string + description: The promotion code to apply as a discount. required: - promotion_code - redirect_mode: - enum: - - always - - if_required - - never - default: always + description: A discount to apply. Can be either a reward ID or a promotion code. + description: List of discounts to apply. Each discount can be an Autumn reward + ID, Stripe coupon ID, or Stripe promotion code. success_url: type: string + description: URL to redirect to after successful checkout. new_billing_subscription: type: boolean + description: Only applicable when the customer has an existing Stripe + subscription. If true, creates a new separate subscription + instead of merging into the existing one. plan_schedule: enum: - immediate - end_of_cycle - billing_behavior: - enum: - - prorate_immediately - - next_cycle_only + description: When the plan change should take effect. 'immediate' applies now, + 'end_of_cycle' schedules for the end of the current billing + cycle. By default, upgrades are immediate and downgrades are + scheduled. required: - customer_id - plan_id + title: PreviewAttachParams + examples: + - &a11 + customer_id: cus_123 + plan_id: pro_plan + example: *a11 responses: "200": description: OK @@ -2479,6 +2981,7 @@ paths: properties: customer_id: type: string + description: The ID of the customer. line_items: type: array items: @@ -2486,10 +2989,13 @@ paths: properties: title: type: string + description: The title of the line item. description: type: string + description: A detailed description of the line item. amount: type: number + description: The amount in cents for this line item. discounts: type: array items: @@ -2506,571 +3012,61 @@ paths: required: - amountOff default: [] - plan_id: - type: string - total_quantity: - type: number - paid_quantity: - type: number - deferred_for_trial: - type: boolean - effective_period: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - is_base: - type: boolean + description: List of discounts applied to this line item. required: - title - description - amount - - plan_id - - total_quantity - - paid_quantity + description: List of line items for the current billing period. total: type: number + description: The total amount in cents for the current billing period. currency: type: string - period_start: - type: number - period_end: - type: number + description: The three-letter ISO currency code (e.g., 'usd'). next_cycle: type: object properties: starts_at: type: number + description: Unix timestamp (milliseconds) when the next billing cycle starts. total: type: number - line_items: - type: array - items: - type: object - properties: - title: - type: string - description: - type: string - amount: - type: number - discounts: - type: array - items: - type: object - properties: - amountOff: - type: number - percentOff: - type: number - stripeCouponId: - type: string - couponName: - type: string - required: - - amountOff - default: [] - plan_id: - type: string - total_quantity: - type: number - paid_quantity: - type: number - deferred_for_trial: - type: boolean - effective_period: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - is_base: - type: boolean - required: - - title - - description - - amount - - plan_id - - total_quantity - - paid_quantity + description: The total amount in cents for the next cycle. required: - starts_at - total - - line_items - incoming: - type: array - items: - type: object - properties: - plan: - $ref: "#/components/schemas/Plan" - feature_quantities: - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - required: - - feature_id - - quantity - balances: - type: object - propertyNames: - type: string - additionalProperties: - type: object - properties: - feature_id: - type: string - feature: - type: object - properties: - id: - type: string - name: - type: string - type: - enum: - - boolean - - metered - - credit_system - consumable: - type: boolean - event_names: - type: array - items: - type: string - credit_schema: - type: array - items: - type: object - properties: - metered_feature_id: - type: string - credit_cost: - type: number - required: - - metered_feature_id - - credit_cost - display: - type: object - properties: - singular: - anyOf: - - type: string - - type: "null" - plural: - anyOf: - - type: string - - type: "null" - archived: - type: boolean - required: - - id - - name - - type - - consumable - - archived - granted: - type: number - remaining: - type: number - minimum: 0 - usage: - type: number - unlimited: - type: boolean - overage_allowed: - type: boolean - max_purchase: - anyOf: - - type: number - - type: "null" - next_reset_at: - anyOf: - - type: number - - type: "null" - breakdown: - type: array - items: - type: object - properties: - id: - type: string - default: "" - plan_id: - anyOf: - - type: string - - type: "null" - included_grant: - type: number - prepaid_grant: - type: number - remaining: - type: number - usage: - type: number - unlimited: - type: boolean - reset: - anyOf: - - type: object - properties: - interval: - anyOf: - - enum: - - one_off - - minute - - hour - - day - - week - - month - - quarter - - semi_annual - - year - - const: multiple - interval_count: - type: number - resets_at: - anyOf: - - type: number - - type: "null" - required: - - interval - - resets_at - - type: "null" - price: - anyOf: - - type: object - properties: - amount: - type: number - tiers: - type: array - items: - type: object - properties: - to: - anyOf: - - {} - - {} - amount: - type: number - required: - - amount - billing_units: - type: number - billing_method: - enum: - - prepaid - - usage_based - max_purchase: - anyOf: - - type: number - - type: "null" - required: - - billing_units - - billing_method - - max_purchase - - type: "null" - expires_at: - anyOf: - - type: number - - type: "null" - required: - - plan_id - - included_grant - - prepaid_grant - - remaining - - usage - - unlimited - - reset - - price - - expires_at - rollovers: - type: array - items: - type: object - properties: - balance: - type: number - expires_at: - type: number - required: - - balance - - expires_at - required: - - feature_id - - granted - - remaining - - usage - - unlimited - - overage_allowed - - max_purchase - - next_reset_at - period_start: - type: number - period_end: - type: number - required: - - plan - - feature_quantities - - balances - outgoing: - type: array - items: - type: object - properties: - plan: - $ref: "#/components/schemas/Plan" - feature_quantities: - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - required: - - feature_id - - quantity - balances: - type: object - propertyNames: - type: string - additionalProperties: - type: object - properties: - feature_id: - type: string - feature: - type: object - properties: - id: - type: string - name: - type: string - type: - enum: - - boolean - - metered - - credit_system - consumable: - type: boolean - event_names: - type: array - items: - type: string - credit_schema: - type: array - items: - type: object - properties: - metered_feature_id: - type: string - credit_cost: - type: number - required: - - metered_feature_id - - credit_cost - display: - type: object - properties: - singular: - anyOf: - - type: string - - type: "null" - plural: - anyOf: - - type: string - - type: "null" - archived: - type: boolean - required: - - id - - name - - type - - consumable - - archived - granted: - type: number - remaining: - type: number - minimum: 0 - usage: - type: number - unlimited: - type: boolean - overage_allowed: - type: boolean - max_purchase: - anyOf: - - type: number - - type: "null" - next_reset_at: - anyOf: - - type: number - - type: "null" - breakdown: - type: array - items: - type: object - properties: - id: - type: string - default: "" - plan_id: - anyOf: - - type: string - - type: "null" - included_grant: - type: number - prepaid_grant: - type: number - remaining: - type: number - usage: - type: number - unlimited: - type: boolean - reset: - anyOf: - - type: object - properties: - interval: - anyOf: - - enum: - - one_off - - minute - - hour - - day - - week - - month - - quarter - - semi_annual - - year - - const: multiple - interval_count: - type: number - resets_at: - anyOf: - - type: number - - type: "null" - required: - - interval - - resets_at - - type: "null" - price: - anyOf: - - type: object - properties: - amount: - type: number - tiers: - type: array - items: - type: object - properties: - to: - anyOf: - - {} - - {} - amount: - type: number - required: - - amount - billing_units: - type: number - billing_method: - enum: - - prepaid - - usage_based - max_purchase: - anyOf: - - type: number - - type: "null" - required: - - billing_units - - billing_method - - max_purchase - - type: "null" - expires_at: - anyOf: - - type: number - - type: "null" - required: - - plan_id - - included_grant - - prepaid_grant - - remaining - - usage - - unlimited - - reset - - price - - expires_at - rollovers: - type: array - items: - type: object - properties: - balance: - type: number - expires_at: - type: number - required: - - balance - - expires_at - required: - - feature_id - - granted - - remaining - - usage - - unlimited - - overage_allowed - - max_purchase - - next_reset_at - period_start: - type: number - period_end: - type: number - required: - - plan - - feature_quantities - - balances - redirect_type: - anyOf: - - enum: - - stripe_checkout - - autumn_checkout - - type: "null" + description: Preview of the next billing cycle, if applicable. This shows what + the customer will be charged in subsequent cycles. required: - customer_id - line_items - total - currency - - incoming - - outgoing - - redirect_type + examples: + - &a12 + customerId: charles + lineItems: + - title: Pro seed + description: Pro seed - Base Price (from 18 Feb 2026 to 18 Mar 2026) + amount: 20 + discounts: [] + total: 20 + currency: usd + example: *a12 x-speakeasy-name-override: previewAttach parameters: - - *a4 + - *a5 /v1/billing.update: post: operationId: billingUpdate - description: Update an existing subscription. + description: >- + Updates an existing subscription. Use to modify feature quantities, + cancel, or change plan configuration. + + + Use this endpoint to update prepaid quantities, cancel a subscription + (immediately or at end of cycle), or modify subscription settings. tags: - billing requestBody: @@ -3084,26 +3080,25 @@ paths: type: string description: The ID of the customer to attach the plan to. entity_id: - anyOf: - - type: string - - type: "null" + type: string description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: The ID of the plan. feature_quantities: - anyOf: - - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - minimum: 0 - adjustable: - type: boolean - required: - - feature_id - - type: "null" + type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + minimum: 0 + adjustable: + type: boolean + required: + - feature_id description: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting @@ -3129,6 +3124,8 @@ paths: required: - duration_length - type: "null" + description: Override the plan's default free trial. Pass an object to set a + custom trial, or null to remove the trial entirely. customize: type: object properties: @@ -3259,32 +3256,57 @@ paths: - feature_id description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - plan_id: - type: string invoice_mode: type: object properties: enabled: type: boolean + description: When true, creates an invoice and sends it to the customer instead + of charging their card immediately. Uses Stripe's + send_invoice collection method. enable_plan_immediately: type: boolean default: false + description: If true, enables the plan immediately even though the invoice is + not paid yet. finalize: type: boolean default: true + description: If true, finalizes the invoice so it can be sent to the customer. + If false, keeps it as a draft for manual review. required: - enabled + description: Invoice mode creates a draft or open invoice and sends it to the + customer, instead of charging their card immediately. This + uses Stripe's send_invoice collection method. + billing_behavior: + enum: + - prorate_immediately + - next_cycle_only + description: 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. cancel_action: enum: - cancel_immediately - cancel_end_of_cycle - uncancel - billing_behavior: - enum: - - prorate_immediately - - next_cycle_only + description: Action to perform for cancellation. 'cancel_immediately' cancels + now with prorated refund, 'cancel_end_of_cycle' cancels at + period end, 'uncancel' reverses a pending cancellation. required: - customer_id + - plan_id + title: UpdateSubscriptionParams + examples: + - &a13 + customer_id: cus_123 + plan_id: pro_plan + feature_quantities: + - feature_id: seats + quantity: 10 + example: *a13 responses: "200": description: OK @@ -3295,8 +3317,10 @@ paths: properties: customer_id: type: string + description: The ID of the customer. entity_id: type: string + description: The ID of the entity, if the plan was attached to an entity. invoice: type: object properties: @@ -3304,26 +3328,36 @@ paths: anyOf: - type: string - type: "null" + description: The status of the invoice (e.g., 'paid', 'open', 'draft'). stripe_id: type: string + description: The Stripe invoice ID. total: type: number + description: The total amount of the invoice in cents. currency: type: string + description: The three-letter ISO currency code (e.g., 'usd'). hosted_invoice_url: anyOf: - type: string - type: "null" + description: URL to the hosted invoice page where the customer can view and pay + the invoice. required: - status - stripe_id - total - currency - hosted_invoice_url + description: Invoice details if an invoice was created. Only present when a + charge was made. payment_url: anyOf: - type: string - type: "null" + description: URL to redirect the customer to complete payment. Null if no + payment action is required. required_action: type: object properties: @@ -3332,21 +3366,42 @@ paths: - 3ds_required - payment_method_required - payment_failed + description: The type of action required to complete the payment. reason: type: string + description: A human-readable explanation of why this action is required. required: - code - reason + description: Details about any action required to complete the payment. Present + when the payment could not be processed automatically. required: - customer_id - payment_url + examples: + - &a14 + customer_id: cus_123 + invoice: + status: paid + stripe_id: in_1234 + total: 1500 + currency: usd + hosted_invoice_url: https://invoice.stripe.com/... + payment_url: null + example: *a14 x-speakeasy-name-override: update parameters: - - *a4 + - *a5 /v1/billing.preview_update: post: - operationId: billingPreviewUpdate - description: Preview billing changes before updating a subscription. + operationId: previewUpdate + description: >- + Previews the billing changes that would occur when updating a + subscription, without actually making any changes. + + + Use this endpoint to show customers prorated charges or refunds before + confirming subscription modifications. tags: - billing requestBody: @@ -3360,26 +3415,25 @@ paths: type: string description: The ID of the customer to attach the plan to. entity_id: - anyOf: - - type: string - - type: "null" + type: string description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: The ID of the plan. feature_quantities: - anyOf: - - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - minimum: 0 - adjustable: - type: boolean - required: - - feature_id - - type: "null" + type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + minimum: 0 + adjustable: + type: boolean + required: + - feature_id description: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting @@ -3405,6 +3459,8 @@ paths: required: - duration_length - type: "null" + description: Override the plan's default free trial. Pass an object to set a + custom trial, or null to remove the trial entirely. customize: type: object properties: @@ -3535,32 +3591,57 @@ paths: - feature_id description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - plan_id: - type: string invoice_mode: type: object properties: enabled: type: boolean + description: When true, creates an invoice and sends it to the customer instead + of charging their card immediately. Uses Stripe's + send_invoice collection method. enable_plan_immediately: type: boolean default: false + description: If true, enables the plan immediately even though the invoice is + not paid yet. finalize: type: boolean default: true + description: If true, finalizes the invoice so it can be sent to the customer. + If false, keeps it as a draft for manual review. required: - enabled + description: Invoice mode creates a draft or open invoice and sends it to the + customer, instead of charging their card immediately. This + uses Stripe's send_invoice collection method. + billing_behavior: + enum: + - prorate_immediately + - next_cycle_only + description: 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. cancel_action: enum: - cancel_immediately - cancel_end_of_cycle - uncancel - billing_behavior: - enum: - - prorate_immediately - - next_cycle_only + description: Action to perform for cancellation. 'cancel_immediately' cancels + now with prorated refund, 'cancel_end_of_cycle' cancels at + period end, 'uncancel' reverses a pending cancellation. required: - customer_id + - plan_id + title: PreviewUpdateParams + examples: + - &a15 + customer_id: cus_123 + plan_id: pro_plan + feature_quantities: + - feature_id: seats + quantity: 15 + example: *a15 responses: "200": description: OK @@ -3571,6 +3652,7 @@ paths: properties: customer_id: type: string + description: The ID of the customer. line_items: type: array items: @@ -3578,10 +3660,13 @@ paths: properties: title: type: string + description: The title of the line item. description: type: string + description: A detailed description of the line item. amount: type: number + description: The amount in cents for this line item. discounts: type: array items: @@ -3598,118 +3683,56 @@ paths: required: - amountOff default: [] - plan_id: - type: string - total_quantity: - type: number - paid_quantity: - type: number - deferred_for_trial: - type: boolean - effective_period: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - is_base: - type: boolean + description: List of discounts applied to this line item. required: - title - description - amount - - plan_id - - total_quantity - - paid_quantity + description: List of line items for the current billing period. total: type: number + description: The total amount in cents for the current billing period. currency: type: string - period_start: - type: number - period_end: - type: number + description: The three-letter ISO currency code (e.g., 'usd'). next_cycle: type: object properties: starts_at: type: number + description: Unix timestamp (milliseconds) when the next billing cycle starts. total: type: number - line_items: - type: array - items: - type: object - properties: - title: - type: string - description: - type: string - amount: - type: number - discounts: - type: array - items: - type: object - properties: - amountOff: - type: number - percentOff: - type: number - stripeCouponId: - type: string - couponName: - type: string - required: - - amountOff - default: [] - plan_id: - type: string - total_quantity: - type: number - paid_quantity: - type: number - deferred_for_trial: - type: boolean - effective_period: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - is_base: - type: boolean - required: - - title - - description - - amount - - plan_id - - total_quantity - - paid_quantity + description: The total amount in cents for the next cycle. required: - starts_at - total - - line_items + description: Preview of the next billing cycle, if applicable. This shows what + the customer will be charged in subsequent cycles. required: - customer_id - line_items - total - currency + examples: + - &a16 + customerId: charles + lineItems: + - title: Pro seed + description: Pro seed - Base Price (from 18 Feb 2026 to 18 Mar 2026) + amount: 20 + discounts: [] + total: 20 + currency: usd + example: *a16 x-speakeasy-name-override: previewUpdate parameters: - - *a4 - /v1/billing.setup_payment: + - *a5 + /v1/billing.open_customer_portal: post: - operationId: billingSetupPayment - description: Create a setup payment session for a customer. + operationId: openCustomerPortal + description: Create a billing portal session for a customer to manage their + subscription. tags: - billing requestBody: @@ -3721,21 +3744,23 @@ paths: properties: customer_id: type: string - description: The ID of the customer - success_url: + description: The ID of the customer to open the billing portal for. + configuration_id: type: string - description: URL to redirect to after successful payment setup. Must start with - either http:// or https:// - customer_data: - $ref: "#/components/schemas/CustomerData" - checkout_session_params: - type: object - propertyNames: - type: string - additionalProperties: {} - description: Additional parameters for the checkout session + description: Stripe billing portal configuration ID. Create configurations in + your Stripe dashboard. + return_url: + type: string + description: URL to redirect to when back button is clicked in the billing + portal required: - customer_id + title: OpenCustomerPortalParams + examples: + - &a17 + customer_id: cus_123 + return_url: https://useautumn.com + example: *a17 responses: "200": description: OK @@ -3746,19 +3771,24 @@ paths: properties: customer_id: type: string - description: The ID of the customer + description: The ID of the billing portal session url: type: string - description: URL to the payment setup page + description: URL to the billing portal required: - customer_id - url - x-speakeasy-name-override: setupPayment + examples: + - &a18 + customer_id: cus_123 + url: https://billing.stripe.com/session/... + example: *a18 + x-speakeasy-name-override: openCustomerPortal parameters: - - *a4 + - *a5 /v1/balances.create: post: - operationId: balancesCreate + operationId: createBalance description: Create a balance for a customer feature. tags: - balances @@ -3769,21 +3799,24 @@ paths: schema: type: object properties: - feature_id: - type: string - description: The feature ID to create the balance for customer_id: type: string - description: The customer ID to assign the balance to + description: The ID of the customer. + feature_id: + type: string + description: The ID of the feature. entity_id: type: string - description: Entity ID for entity-scoped balances + description: The ID of the entity for entity-scoped balances (e.g., per-seat + limits). included: type: number - description: The initial balance amount to grant + description: The initial balance amount to grant. For metered features, this is + the number of units the customer can use. unlimited: type: boolean - description: Whether the balance is unlimited + description: If true, the balance has unlimited usage. Cannot be combined with + 'included'. reset: type: object properties: @@ -3798,19 +3831,35 @@ paths: - quarter - semi_annual - year + description: The interval at which the balance resets (e.g., 'month', 'day', + 'year'). interval_count: type: number + description: "Number of intervals between resets. Defaults to 1 (e.g., + interval_count: 2 with interval: 'month' resets every 2 + months)." required: - interval - description: Reset configuration for the balance + description: Reset configuration for the balance. If not provided, the balance + is a one-time grant that never resets. expires_at: type: number - description: Unix timestamp (milliseconds) when the balance expires + description: Unix timestamp (milliseconds) when the balance expires. Mutually + exclusive with reset. granted_balance: type: number required: - - feature_id - customer_id + - feature_id + title: CreateBalanceParams + examples: + - &a19 + customer_id: cus_123 + feature_id: api_calls + included: 1000 + reset: + interval: month + example: *a19 responses: "200": description: OK @@ -3825,10 +3874,10 @@ paths: - success x-speakeasy-name-override: create parameters: - - *a4 + - *a5 /v1/balances.update: post: - operationId: balancesUpdate + operationId: updateBalance description: Update a customer balance. tags: - balances @@ -3842,16 +3891,21 @@ paths: customer_id: type: string description: The ID of the customer. - entity_id: - type: string - description: The ID of the entity to update balance for (if using entity - balances). feature_id: type: string - description: The ID of the feature to update balance for. - current_balance: + description: The ID of the feature. + entity_id: + type: string + description: The ID of the entity for entity-scoped balances (e.g., per-seat + limits). + remaining: type: number - description: The new balance value to set. + description: Set the remaining balance to this exact value. Cannot be combined + with add_to_balance. + add_to_balance: + type: number + description: Add this amount to the current balance. Use negative values to + subtract. Cannot be combined with current_balance. interval: enum: - one_off @@ -3863,20 +3917,19 @@ paths: - quarter - semi_annual - year - description: The interval to update balance for. - granted_balance: - type: number - usage: - type: number - customer_entitlement_id: - type: string - next_reset_at: - type: number - add_to_balance: - type: number + description: Target a specific balance by its reset interval. Use when the + customer has multiple balances for the same feature with + different reset intervals. required: - customer_id - feature_id + title: UpdateBalanceParams + examples: + - &a20 + customer_id: cus_123 + feature_id: api_calls + remaining: 5 + example: *a20 responses: "200": description: OK @@ -3891,13 +3944,16 @@ paths: - success x-speakeasy-name-override: update parameters: - - *a4 + - *a5 /v1/balances.check: post: - operationId: balancesCheck - description: Check whether usage is allowed for a customer feature. - tags: - - balances + operationId: check + description: >- + Checks whether a customer currently has enough balance to use a feature. + + + Use this to gate access before a feature action. Enable sendEvent when + you want to check and consume balance atomically in one request. requestBody: required: true content: @@ -3907,37 +3963,47 @@ paths: properties: customer_id: type: string - description: ID which you provided when creating the customer + description: The ID of the customer. feature_id: type: string - description: ID of the feature to check access to. + description: The ID of the feature. entity_id: type: string - description: If using entity balances (eg, seats), the entity ID to check access - for. + description: The ID of the entity for entity-scoped balances (e.g., per-seat + limits). required_balance: type: number - description: If you know the amount of the feature the end user is consuming in - advance. If their balance is below this quantity, allowed - will be false. + description: "Minimum balance required for access. Returns allowed: false if the + customer's balance is below this value. Defaults to 1." properties: type: object propertyNames: type: string additionalProperties: {} + description: Additional properties to attach to the usage event if send_event is + true. send_event: type: boolean - description: If true, a usage event will be recorded together with checking - access. The required_balance field will be used as the usage - value. + description: If true, atomically records a usage event while checking access. + The required_balance value is used as the usage amount. + Combines check + track in one call. with_preview: type: boolean - description: If true, the response will include a preview object, which can be - used to display information such as a paywall or upgrade - confirmation. + description: If true, includes upgrade/upsell information in the response when + access is denied. Useful for displaying paywalls. required: - customer_id - feature_id + title: CheckParams + examples: + - &a21 + customer_id: cus_123 + feature_id: messages + - customer_id: cus_123 + feature_id: messages + required_balance: 3 + send_event: true + example: *a21 responses: "200": description: OK @@ -3948,20 +4014,27 @@ paths: properties: allowed: type: boolean + description: Whether the customer is allowed to use the feature. True if they + have sufficient balance or the feature is + unlimited/boolean. customer_id: type: string + description: The ID of the customer that was checked. entity_id: anyOf: - type: string - type: "null" + description: The ID of the entity, if an entity-scoped check was performed. required_balance: type: number + description: The required balance that was checked against. balance: anyOf: - type: object properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -4011,25 +4084,35 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -4038,20 +4121,28 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -4069,22 +4160,28 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -4099,25 +4196,31 @@ paths: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -4128,6 +4231,8 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -4135,11 +4240,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -4149,7 +4257,31 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null - type: "null" + description: The customer's balance for this feature. Null if the customer has + no balance for this feature. preview: type: object properties: @@ -4157,14 +4289,21 @@ paths: enum: - usage_limit - feature_flag + description: The reason access was denied. 'usage_limit' means the customer + exceeded their balance, 'feature_flag' means the + feature is not included in their plan. title: type: string + description: A title suitable for displaying in a paywall or upgrade modal. message: type: string + description: A message explaining why access was denied. feature_id: type: string + description: The ID of the feature that was checked. feature_name: type: string + description: The display name of the feature. products: type: array items: @@ -4477,6 +4616,8 @@ paths: - items - free_trial - base_variant_id + description: Products that would grant access to this feature. Use to display + upgrade options. required: - scenario - title @@ -4484,19 +4625,53 @@ paths: - feature_id - feature_name - products + description: Upgrade/upsell information when access is denied. Only present if + with_preview was true and allowed is false. required: - allowed - customer_id - balance + examples: + - &a22 + allowed: true + customer_id: cus_123 + entity_id: null + required_balance: 1 + balance: + feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + example: *a22 x-speakeasy-name-override: check parameters: - - *a4 + - *a5 /v1/balances.track: post: - operationId: balancesTrack - description: Track usage for a customer feature. - tags: - - balances + operationId: track + description: >- + Records usage for a customer feature and returns updated balances. + + + Use this after an action happens to decrement usage, or send a negative + value to credit balance back. requestBody: required: true content: @@ -4506,38 +4681,39 @@ paths: properties: customer_id: type: string - minLength: 1 - description: ID which you provided when creating the customer + description: The ID of the customer. feature_id: type: string - description: ID of the feature to track usage for. Required if event_name is not - provided. Use this for direct feature tracking. + description: The ID of the feature to track usage for. Required if event_name is + not provided. + entity_id: + type: string + description: The ID of the entity for entity-scoped balances (e.g., per-seat + limits). event_name: type: string minLength: 1 - description: An [event name](/features/tracking-usage#using-event-names) can be - used in place of feature_id. This can be used if multiple - features are tracked in the same event. + description: Event name to track usage for. Use instead of feature_id when + multiple features should be tracked from a single event. value: type: number - description: The amount of usage to record. Defaults to 1. Can be negative to - increase the balance (e.g., when removing a seat). + description: The amount of usage to record. Defaults to 1. Use negative values + to credit balance (e.g., when removing a seat). properties: type: object propertyNames: type: string additionalProperties: {} description: Additional properties to attach to this usage event. - idempotency_key: - type: string - description: Unique key to prevent duplicate event recording. Use this to safely - retry requests without creating duplicate usage records. - entity_id: - type: string - description: If using [entity balances](/features/feature-entities) (eg, seats), - the entity ID to track usage for. required: - customer_id + title: TrackParams + examples: + - &a23 + customer_id: cus_123 + feature_id: messages + value: 1 + example: *a23 responses: "200": description: OK @@ -4548,21 +4724,24 @@ paths: properties: customer_id: type: string - description: The ID of the customer + description: The ID of the customer whose usage was tracked. entity_id: type: string - description: The ID of the entity (if provided) + description: The ID of the entity, if entity-scoped tracking was performed. event_name: type: string - description: The name of the event + description: The event name that was tracked, if event_name was used instead of + feature_id. value: type: number + description: The amount of usage that was recorded. balance: anyOf: - type: object properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -4612,25 +4791,35 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -4639,20 +4828,28 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -4670,22 +4867,28 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -4700,25 +4903,31 @@ paths: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -4729,6 +4938,8 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -4736,11 +4947,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -4750,7 +4964,31 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null - type: "null" + description: The updated balance for the tracked feature. Null if tracking by + event_name that affects multiple features. balances: type: object propertyNames: @@ -4760,6 +4998,7 @@ paths: properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -4809,25 +5048,35 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -4836,20 +5085,28 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -4867,22 +5124,28 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -4897,25 +5160,31 @@ paths: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -4926,6 +5195,8 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -4933,11 +5204,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -4947,13 +5221,1615 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + description: Map of feature_id to updated balance when tracking by event_name + affects multiple features. required: - customer_id - value - balance + examples: + - &a24 + customer_id: cus_123 + value: 1 + balance: + feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + example: *a24 x-speakeasy-name-override: track parameters: - - *a4 + - *a5 + /v1/events.list: + post: + operationId: listEvents + description: List usage events for your organization. Filter by customer, + feature, or time range. + tags: + - events + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + offset: + type: integer + minimum: 0 + maximum: 9007199254740991 + default: 0 + description: Number of items to skip + limit: + type: integer + minimum: 1 + maximum: 1000 + default: 100 + description: Number of items to return. Default 100, max 1000. + customer_id: + type: string + description: Filter events by customer ID + feature_id: + anyOf: + - type: string + minLength: 1 + - type: array + items: + type: string + minLength: 1 + description: Filter by specific feature ID(s) + custom_range: + type: object + properties: + start: + type: number + description: Filter events after this timestamp (epoch milliseconds) + end: + type: number + description: Filter events before this timestamp (epoch milliseconds) + description: Filter events by time range + title: EventsListParams + examples: + - &a25 + customer_id: cus_123 + limit: 50 + - feature_id: api_calls + custom_range: + start: 1704067200000 + end: 1706745600000 + example: *a25 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + list: + type: array + items: + type: object + properties: + id: + type: string + description: Event ID (KSUID) + timestamp: + type: number + description: Event timestamp (epoch milliseconds) + feature_id: + type: string + description: ID of the feature that the event belongs to + customer_id: + type: string + description: Customer identifier + value: + type: number + description: Event value/count + properties: + type: object + description: Event properties (JSONB) + required: + - id + - timestamp + - feature_id + - customer_id + - value + - properties + description: Array of items for current page + has_more: + type: boolean + description: Whether more results exist after this page + offset: + type: number + description: Current offset position + limit: + type: number + description: Limit passed in the request + total: + type: number + description: Total number of items returned in the current page + required: + - list + - has_more + - offset + - limit + - total + examples: + - &a26 + list: + - id: evt_36xpk2TmuQX5zVPPQ8tCtnR5Weg + timestamp: 1765958215459 + feature_id: credits + customer_id: 0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx + value: 30 + properties: {} + - id: evt_36xmHxxjAkqxufDf9yHAPNfRrLM + timestamp: 1765956512057 + feature_id: credits + customer_id: 0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx + value: 49 + properties: {} + total: 2 + has_more: false + offset: 0 + limit: 100 + example: *a26 + x-speakeasy-name-override: list + parameters: + - *a5 + /v1/events.aggregate: + post: + operationId: aggregateEvents + description: Aggregate usage events by time period. Returns usage totals grouped + by feature and optionally by a custom property. + tags: + - events + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + minLength: 1 + description: Customer ID to aggregate events for + feature_id: + anyOf: + - type: string + minLength: 1 + - type: array + items: + type: string + minLength: 1 + description: Feature ID(s) to aggregate events for + group_by: + type: string + pattern: ^properties\..* + description: Property to group events by. If provided, each key in the response + will be an object with distinct groups as the keys + range: + enum: + - 24h + - 7d + - 30d + - 90d + - last_cycle + - 1bc + - 3bc + description: Time range to aggregate events for. Either range or custom_range + must be provided + bin_size: + enum: + - day + - hour + - month + default: day + description: Size of the time bins to aggregate events for. Defaults to hour if + range is 24h, otherwise day + custom_range: + type: object + properties: + start: + type: number + end: + type: number + required: + - start + - end + description: Custom time range to aggregate events for. If provided, range must + not be provided + required: + - customer_id + - feature_id + title: EventsAggregateParams + examples: + - &a27 + customer_id: cus_123 + feature_id: api_calls + range: 30d + bin_size: day + - customer_id: cus_123 + feature_id: + - api_calls + - messages + range: 7d + group_by: properties.model + example: *a27 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + list: + type: array + items: + type: object + properties: + period: + type: number + description: Unix timestamp (epoch ms) for this time period + values: + type: object + propertyNames: + type: string + additionalProperties: + type: number + description: "Aggregated values per feature: { [featureId]: number }" + grouped_values: + type: object + propertyNames: + type: string + additionalProperties: + type: object + propertyNames: + type: string + additionalProperties: + type: number + description: "Values broken down by group (only present when group_by is used): + { [featureId]: { [groupValue]: number } }" + required: + - period + - values + description: Array of time periods with aggregated values + total: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + count: + type: number + description: Number of events for this feature + sum: + type: number + description: Sum of event values for this feature + required: + - count + - sum + description: Total aggregations per feature. Keys are feature IDs, values + contain count and sum. + required: + - list + - total + examples: + - &a28 + list: + - period: 1762905600000 + values: + messages: 10 + sessions: 3 + - period: 1762992000000 + values: + messages: 3 + sessions: 12 + total: + messages: + count: 2 + sum: 13 + sessions: + count: 2 + sum: 15 + - list: + - period: 1762905600000 + values: + messages: 10 + sessions: 3 + grouped_values: + messages: + api: 5 + web: 5 + sessions: + api: 2 + web: 1 + - period: 1762992000000 + values: + messages: 3 + sessions: 12 + grouped_values: + messages: + api: 1 + web: 2 + sessions: + api: 10 + web: 2 + total: + messages: + count: 2 + sum: 13 + sessions: + count: 2 + sum: 15 + example: *a28 + x-speakeasy-name-override: aggregate + parameters: + - *a5 + /v1/entities.create: + post: + operationId: createEntity + description: >- + 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. + tags: + - entities + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + anyOf: + - type: string + - type: "null" + description: The name of the entity + feature_id: + type: string + description: The ID of the feature this entity is associated with + customer_data: + $ref: "#/components/schemas/CustomerData" + description: Customer attributes used to resolve the customer when customer_id + is not provided. + customer_id: + type: string + description: The ID of the customer to create the entity for. + entity_id: + type: string + description: The ID of the entity. + required: + - feature_id + - customer_id + - entity_id + title: CreateEntityParams + examples: + - &a29 + customer_id: cus_123 + entity_id: seat_42 + feature_id: seats + name: Seat 42 + example: *a29 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + autumn_id: + type: string + id: + anyOf: + - type: string + - type: "null" + description: The unique identifier of the entity + name: + anyOf: + - type: string + - type: "null" + description: The name of the entity + customer_id: + anyOf: + - type: string + - type: "null" + description: The customer ID this entity belongs to + feature_id: + anyOf: + - type: string + - type: "null" + description: The feature ID this entity belongs to + created_at: + type: number + description: Unix timestamp when the entity was created + env: + enum: + - sandbox + - live + description: The environment (sandbox/live) + subscriptions: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. + plan_id: + type: string + description: The unique identifier of the subscribed plan. + auto_enable: + type: boolean + description: Whether the plan was automatically enabled for the customer. + add_on: + type: boolean + description: Whether this is an add-on plan rather than a base subscription. + status: + enum: + - active + - scheduled + description: Current status of the subscription. + past_due: + type: boolean + description: Whether the subscription has overdue payments. + canceled_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the subscription was canceled, or null if not + canceled. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry + set. + trial_ends_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. + started_at: + type: number + description: Timestamp when the subscription started. + current_period_start: + anyOf: + - type: number + - type: "null" + description: Start timestamp of the current billing period. + current_period_end: + anyOf: + - type: number + - type: "null" + description: End timestamp of the current billing period. + quantity: + type: number + description: Number of units of this subscription (for per-seat plans). + required: + - plan_id + - auto_enable + - add_on + - status + - past_due + - canceled_at + - expires_at + - trial_ends_at + - started_at + - current_period_start + - current_period_end + - quantity + purchases: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. + plan_id: + type: string + description: The unique identifier of the purchased plan. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. + started_at: + type: number + description: Timestamp when the purchase was made. + quantity: + type: number + description: Number of units purchased. + required: + - plan_id + - expires_at + - started_at + - quantity + balances: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + feature_id: + type: string + description: The feature ID this balance is for. + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived + description: The full feature object if expanded. + granted: + type: number + description: Total balance granted (included + prepaid). + remaining: + type: number + minimum: 0 + description: Remaining balance available for use. + usage: + type: number + description: Total usage consumed in the current period. + unlimited: + type: boolean + description: Whether this feature has unlimited usage. + overage_allowed: + type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. + next_reset_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the balance will reset, or null for no reset. + breakdown: + type: array + items: + type: object + properties: + id: + type: string + default: "" + description: The unique identifier for this balance breakdown. + plan_id: + anyOf: + - type: string + - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. + included_grant: + type: number + description: Amount granted from the plan's included usage. + prepaid_grant: + type: number + description: Amount granted from prepaid purchases or top-ups. + remaining: + type: number + description: Remaining balance available for use. + usage: + type: number + description: Amount consumed in the current period. + unlimited: + type: boolean + description: Whether this balance has unlimited usage. + reset: + anyOf: + - type: object + properties: + interval: + anyOf: + - enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. + interval_count: + type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). + resets_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the balance will next reset. + required: + - interval + - resets_at + - type: "null" + description: Reset configuration for this balance, or null if no reset. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: The per-unit price amount. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration if applicable. + billing_units: + type: number + description: The number of units per billing increment (eg. $9 / 250 units). + billing_method: + enum: + - prepaid + - usage_based + description: Whether usage is prepaid or billed pay-per-use. + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. + required: + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration if this balance has usage-based pricing. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when this balance expires, or null for no expiration. + required: + - plan_id + - included_grant + - prepaid_grant + - remaining + - usage + - unlimited + - reset + - price + - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. + rollovers: + type: array + items: + type: object + properties: + balance: + type: number + description: Amount of balance rolled over from a previous period. + expires_at: + type: number + description: Timestamp when the rollover balance expires. + required: + - balance + - expires_at + description: Rollover balances carried over from previous periods. + required: + - feature_id + - granted + - remaining + - usage + - unlimited + - overage_allowed + - max_purchase + - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + invoices: + type: array + items: + type: object + properties: + plan_ids: + type: array + items: + type: string + description: Array of plan IDs included in this invoice + stripe_id: + type: string + description: The Stripe invoice ID + status: + type: string + description: The status of the invoice + total: + type: number + description: The total amount of the invoice + currency: + type: string + description: The currency code for the invoice + created_at: + type: number + description: Timestamp when the invoice was created + hosted_invoice_url: + anyOf: + - type: string + - type: "null" + description: URL to the Stripe-hosted invoice page + required: + - plan_ids + - stripe_id + - status + - total + - currency + - created_at + description: Invoices for this entity (only included when expand=invoices) + required: + - id + - name + - created_at + - env + - subscriptions + - purchases + - balances + examples: + - &a30 + id: seat_42 + name: Seat 42 + customer_id: cus_123 + feature_id: seats + created_at: 1771409161016 + env: sandbox + subscriptions: + - plan_id: pro_plan + auto_enable: true + add_on: false + status: active + past_due: false + canceled_at: null + expires_at: null + trial_ends_at: null + started_at: 1771431921437 + current_period_start: 1771431921437 + current_period_end: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + invoices: [] + example: *a30 + x-speakeasy-name-override: create + parameters: + - *a5 + /v1/entities.get: + post: + operationId: getEntity + description: >- + Fetches a single entity by entity ID. + + + Use this to read one entity's current state. Pass customerId when you + want to scope the lookup to a specific customer. + tags: + - entities + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer to create the entity for. + entity_id: + type: string + description: The ID of the entity. + required: + - entity_id + title: GetEntityParams + examples: + - &a31 + entity_id: seat_42 + - customer_id: cus_123 + entity_id: seat_42 + example: *a31 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + autumn_id: + type: string + id: + anyOf: + - type: string + - type: "null" + description: The unique identifier of the entity + name: + anyOf: + - type: string + - type: "null" + description: The name of the entity + customer_id: + anyOf: + - type: string + - type: "null" + description: The customer ID this entity belongs to + feature_id: + anyOf: + - type: string + - type: "null" + description: The feature ID this entity belongs to + created_at: + type: number + description: Unix timestamp when the entity was created + env: + enum: + - sandbox + - live + description: The environment (sandbox/live) + subscriptions: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. + plan_id: + type: string + description: The unique identifier of the subscribed plan. + auto_enable: + type: boolean + description: Whether the plan was automatically enabled for the customer. + add_on: + type: boolean + description: Whether this is an add-on plan rather than a base subscription. + status: + enum: + - active + - scheduled + description: Current status of the subscription. + past_due: + type: boolean + description: Whether the subscription has overdue payments. + canceled_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the subscription was canceled, or null if not + canceled. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry + set. + trial_ends_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. + started_at: + type: number + description: Timestamp when the subscription started. + current_period_start: + anyOf: + - type: number + - type: "null" + description: Start timestamp of the current billing period. + current_period_end: + anyOf: + - type: number + - type: "null" + description: End timestamp of the current billing period. + quantity: + type: number + description: Number of units of this subscription (for per-seat plans). + required: + - plan_id + - auto_enable + - add_on + - status + - past_due + - canceled_at + - expires_at + - trial_ends_at + - started_at + - current_period_start + - current_period_end + - quantity + purchases: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. + plan_id: + type: string + description: The unique identifier of the purchased plan. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. + started_at: + type: number + description: Timestamp when the purchase was made. + quantity: + type: number + description: Number of units purchased. + required: + - plan_id + - expires_at + - started_at + - quantity + balances: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + feature_id: + type: string + description: The feature ID this balance is for. + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived + description: The full feature object if expanded. + granted: + type: number + description: Total balance granted (included + prepaid). + remaining: + type: number + minimum: 0 + description: Remaining balance available for use. + usage: + type: number + description: Total usage consumed in the current period. + unlimited: + type: boolean + description: Whether this feature has unlimited usage. + overage_allowed: + type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. + next_reset_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the balance will reset, or null for no reset. + breakdown: + type: array + items: + type: object + properties: + id: + type: string + default: "" + description: The unique identifier for this balance breakdown. + plan_id: + anyOf: + - type: string + - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. + included_grant: + type: number + description: Amount granted from the plan's included usage. + prepaid_grant: + type: number + description: Amount granted from prepaid purchases or top-ups. + remaining: + type: number + description: Remaining balance available for use. + usage: + type: number + description: Amount consumed in the current period. + unlimited: + type: boolean + description: Whether this balance has unlimited usage. + reset: + anyOf: + - type: object + properties: + interval: + anyOf: + - enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. + interval_count: + type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). + resets_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the balance will next reset. + required: + - interval + - resets_at + - type: "null" + description: Reset configuration for this balance, or null if no reset. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: The per-unit price amount. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration if applicable. + billing_units: + type: number + description: The number of units per billing increment (eg. $9 / 250 units). + billing_method: + enum: + - prepaid + - usage_based + description: Whether usage is prepaid or billed pay-per-use. + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. + required: + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration if this balance has usage-based pricing. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when this balance expires, or null for no expiration. + required: + - plan_id + - included_grant + - prepaid_grant + - remaining + - usage + - unlimited + - reset + - price + - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. + rollovers: + type: array + items: + type: object + properties: + balance: + type: number + description: Amount of balance rolled over from a previous period. + expires_at: + type: number + description: Timestamp when the rollover balance expires. + required: + - balance + - expires_at + description: Rollover balances carried over from previous periods. + required: + - feature_id + - granted + - remaining + - usage + - unlimited + - overage_allowed + - max_purchase + - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + invoices: + type: array + items: + type: object + properties: + plan_ids: + type: array + items: + type: string + description: Array of plan IDs included in this invoice + stripe_id: + type: string + description: The Stripe invoice ID + status: + type: string + description: The status of the invoice + total: + type: number + description: The total amount of the invoice + currency: + type: string + description: The currency code for the invoice + created_at: + type: number + description: Timestamp when the invoice was created + hosted_invoice_url: + anyOf: + - type: string + - type: "null" + description: URL to the Stripe-hosted invoice page + required: + - plan_ids + - stripe_id + - status + - total + - currency + - created_at + description: Invoices for this entity (only included when expand=invoices) + required: + - id + - name + - created_at + - env + - subscriptions + - purchases + - balances + examples: + - &a32 + id: seat_42 + name: Seat 42 + customer_id: cus_123 + feature_id: seats + created_at: 1771409161016 + env: sandbox + subscriptions: + - plan_id: pro_plan + auto_enable: true + add_on: false + status: active + past_due: false + canceled_at: null + expires_at: null + trial_ends_at: null + started_at: 1771431921437 + current_period_start: 1771431921437 + current_period_end: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + invoices: [] + example: *a32 + x-speakeasy-name-override: get + parameters: + - *a5 + /v1/entities.delete: + post: + operationId: deleteEntity + description: >- + Deletes an entity by entity ID. + + + Use this when the underlying resource is removed and you no longer want + entity-scoped balances or subscriptions tracked for it. + tags: + - entities + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer. + entity_id: + type: string + description: The ID of the entity. + required: + - entity_id + title: DeleteEntityParams + examples: + - &a33 + customer_id: cus_123 + entity_id: seat_42 + example: *a33 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + required: + - success + examples: + - &a34 + success: true + example: *a34 + x-speakeasy-name-override: delete + parameters: + - *a5 + /v1/referrals.create_code: + post: + operationId: createReferralCode + description: Create or fetch a referral code for a customer in a referral program. + tags: + - referrals + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The unique identifier of the customer + program_id: + type: string + description: ID of your referral program + required: + - customer_id + - program_id + title: CreateReferralCodeParams + examples: + - &a35 + customer_id: cus_123 + program_id: prog_123 + example: *a35 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + code: + type: string + description: The referral code that can be shared with customers + customer_id: + type: string + description: Your unique identifier for the customer + created_at: + type: number + description: The timestamp of when the referral code was created + required: + - code + - customer_id + - created_at + examples: + - &a36 + code: + customer_id: + created_at: 123 + example: *a36 + x-speakeasy-name-override: createCode + parameters: + - *a5 + /v1/referrals.redeem_code: + post: + operationId: redeemReferralCode + description: Redeem a referral code for a customer. + tags: + - referrals + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + code: + type: string + description: The referral code to redeem + customer_id: + type: string + description: The unique identifier of the customer redeeming the code + required: + - code + - customer_id + title: RedeemReferralCodeParams + examples: + - &a37 + code: REF123 + customer_id: cus_456 + example: *a37 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The ID of the redemption event + customer_id: + type: string + description: Your unique identifier for the customer + reward_id: + type: string + description: The ID of the reward that will be granted + required: + - id + - customer_id + - reward_id + examples: + - &a38 + id: + customer_id: + reward_id: + example: *a38 + x-speakeasy-name-override: redeemCode + parameters: + - *a5 security: - secretKey: [] x-speakeasy-globals: diff --git a/packages/openapi/openapi.yml b/packages/openapi/openapi.yml index c347af5d1..0195586f9 100644 --- a/packages/openapi/openapi.yml +++ b/packages/openapi/openapi.yml @@ -119,43 +119,57 @@ components: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the subscribed plan. auto_enable: type: boolean + description: Whether the plan was automatically enabled for the customer. add_on: type: boolean + description: Whether this is an add-on plan rather than a base subscription. status: enum: - active - scheduled - - expired + description: Current status of the subscription. past_due: type: boolean + description: Whether the subscription has overdue payments. canceled_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription was canceled, or null if not + canceled. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry + set. trial_ends_at: anyOf: - type: number - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. started_at: type: number + description: Timestamp when the subscription started. current_period_start: anyOf: - type: number - type: "null" + description: Start timestamp of the current billing period. current_period_end: anyOf: - type: number - type: "null" + description: End timestamp of the current billing period. quantity: type: number + description: Number of units of this subscription (for per-seat plans). required: - plan_id - auto_enable @@ -169,6 +183,7 @@ components: - current_period_start - current_period_end - quantity + description: Active and scheduled recurring plans that this customer has attached. purchases: type: array items: @@ -176,21 +191,27 @@ components: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the purchased plan. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. started_at: type: number + description: Timestamp when the purchase was made. quantity: type: number + description: Number of units purchased. required: - plan_id - expires_at - started_at - quantity + description: One-time purchases made by the customer. balances: type: object propertyNames: @@ -200,6 +221,7 @@ components: properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -249,25 +271,35 @@ components: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -276,20 +308,28 @@ components: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -307,22 +347,28 @@ components: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -337,25 +383,31 @@ components: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -366,6 +418,8 @@ components: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -373,11 +427,14 @@ components: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -387,6 +444,30 @@ components: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + description: Feature balances keyed by feature ID, showing usage limits and + remaining amounts. invoices: type: array items: @@ -601,30 +682,52 @@ components: - purchases - balances examples: - - id: cus_123 - created_at: 1717000000 - name: John Doe - email: john@example.com - fingerprint: "1234567890" - stripe_id: cus_123 + - id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58 + name: Patrick + email: patrick@useautumn.com + createdAt: 1771409161016 + fingerprint: null + stripeId: cus_U0BKxpq1mFhuJO env: sandbox metadata: {} + sendEmailReceipts: false subscriptions: - - id: sub_123 - created_at: 1717000000 - plan_id: plan_123 + - planId: pro_plan + autoEnable: true + addOn: false status: active + pastDue: false + canceledAt: null + expiresAt: null + trialEndsAt: null + startedAt: 1771431921437 + currentPeriodStart: 1771431921437 + currentPeriodEnd: 1771999921437 quantity: 1 - interval: month - interval_count: 1 purchases: [] balances: - balance_1: - id: balance_1 - amount: 100 - currency: USD - created_at: 1717000000 - updated_at: 1717000000 + messages: + featureId: messages + granted: 100 + remaining: 0 + usage: 100 + unlimited: false + overageAllowed: false + maxPurchase: null + nextResetAt: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + planId: pro_plan + includedGrant: 100 + prepaidGrant: 0 + remaining: 0 + usage: 100 + unlimited: false + reset: + interval: month + resetsAt: 1773851121437 + price: null + expiresAt: null Plan: type: object properties: @@ -1166,43 +1269,57 @@ paths: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the subscribed plan. auto_enable: type: boolean + description: Whether the plan was automatically enabled for the customer. add_on: type: boolean + description: Whether this is an add-on plan rather than a base subscription. status: enum: - active - scheduled - - expired + description: Current status of the subscription. past_due: type: boolean + description: Whether the subscription has overdue payments. canceled_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription was canceled, or null if not + canceled. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry + set. trial_ends_at: anyOf: - type: number - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. started_at: type: number + description: Timestamp when the subscription started. current_period_start: anyOf: - type: number - type: "null" + description: Start timestamp of the current billing period. current_period_end: anyOf: - type: number - type: "null" + description: End timestamp of the current billing period. quantity: type: number + description: Number of units of this subscription (for per-seat plans). required: - plan_id - auto_enable @@ -1216,6 +1333,8 @@ paths: - current_period_start - current_period_end - quantity + description: Active and scheduled recurring plans that this customer has + attached. purchases: type: array items: @@ -1223,21 +1342,27 @@ paths: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the purchased plan. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. started_at: type: number + description: Timestamp when the purchase was made. quantity: type: number + description: Number of units purchased. required: - plan_id - expires_at - started_at - quantity + description: One-time purchases made by the customer. balances: type: object propertyNames: @@ -1247,6 +1372,7 @@ paths: properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -1296,25 +1422,35 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -1323,20 +1459,28 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -1354,22 +1498,29 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different + intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -1383,25 +1534,31 @@ paths: type: number required: - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -1412,6 +1569,8 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -1419,11 +1578,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -1433,6 +1595,30 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + description: Feature balances keyed by feature ID, showing usage limits and + remaining amounts. required: - id - name @@ -1446,6 +1632,53 @@ paths: - subscriptions - purchases - balances + examples: + - id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58 + name: Patrick + email: patrick@useautumn.com + createdAt: 1771409161016 + fingerprint: null + stripeId: cus_U0BKxpq1mFhuJO + env: sandbox + metadata: {} + sendEmailReceipts: false + subscriptions: + - planId: pro_plan + autoEnable: true + addOn: false + status: active + pastDue: false + canceledAt: null + expiresAt: null + trialEndsAt: null + startedAt: 1771431921437 + currentPeriodStart: 1771431921437 + currentPeriodEnd: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + featureId: messages + granted: 100 + remaining: 0 + usage: 100 + unlimited: false + overageAllowed: false + maxPurchase: null + nextResetAt: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + planId: pro_plan + includedGrant: 100 + prepaidGrant: 0 + remaining: 0 + usage: 100 + unlimited: false + reset: + interval: month + resetsAt: 1773851121437 + price: null + expiresAt: null description: Array of items for current page has_more: type: boolean @@ -1465,6 +1698,58 @@ paths: - offset - limit - total + examples: + - list: + - id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58 + name: Patrick + email: patrick@useautumn.com + createdAt: 1771409161016 + fingerprint: null + stripeId: cus_U0BKxpq1mFhuJO + env: sandbox + metadata: {} + sendEmailReceipts: false + subscriptions: + - planId: pro_plan + autoEnable: true + addOn: false + status: active + pastDue: false + canceledAt: null + expiresAt: null + trialEndsAt: null + startedAt: 1771431921437 + currentPeriodStart: 1771431921437 + currentPeriodEnd: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + featureId: messages + granted: 100 + remaining: 0 + usage: 100 + unlimited: false + overageAllowed: false + maxPurchase: null + nextResetAt: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + planId: pro_plan + includedGrant: 100 + prepaidGrant: 0 + remaining: 0 + usage: 100 + unlimited: false + reset: + interval: month + resetsAt: 1773851121437 + price: null + expiresAt: null + has_more: false + offset: 0 + total: 1 + limit: 10 x-speakeasy-name-override: list parameters: - *a1 @@ -1585,43 +1870,57 @@ paths: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the subscribed plan. auto_enable: type: boolean + description: Whether the plan was automatically enabled for the customer. add_on: type: boolean + description: Whether this is an add-on plan rather than a base subscription. status: enum: - active - scheduled - - expired + description: Current status of the subscription. past_due: type: boolean + description: Whether the subscription has overdue payments. canceled_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription was canceled, or null if not + canceled. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry + set. trial_ends_at: anyOf: - type: number - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. started_at: type: number + description: Timestamp when the subscription started. current_period_start: anyOf: - type: number - type: "null" + description: Start timestamp of the current billing period. current_period_end: anyOf: - type: number - type: "null" + description: End timestamp of the current billing period. quantity: type: number + description: Number of units of this subscription (for per-seat plans). required: - plan_id - auto_enable @@ -1635,6 +1934,8 @@ paths: - current_period_start - current_period_end - quantity + description: Active and scheduled recurring plans that this customer has + attached. purchases: type: array items: @@ -1642,21 +1943,27 @@ paths: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the purchased plan. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. started_at: type: number + description: Timestamp when the purchase was made. quantity: type: number + description: Number of units purchased. required: - plan_id - expires_at - started_at - quantity + description: One-time purchases made by the customer. balances: type: object propertyNames: @@ -1666,6 +1973,7 @@ paths: properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -1715,25 +2023,35 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -1742,20 +2060,28 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -1773,22 +2099,28 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -1803,25 +2135,31 @@ paths: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -1832,6 +2170,8 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -1839,11 +2179,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -1853,6 +2196,30 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + description: Feature balances keyed by feature ID, showing usage limits and + remaining amounts. required: - id - name @@ -1866,6 +2233,53 @@ paths: - subscriptions - purchases - balances + examples: + - id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58 + name: Patrick + email: patrick@useautumn.com + createdAt: 1771409161016 + fingerprint: null + stripeId: cus_U0BKxpq1mFhuJO + env: sandbox + metadata: {} + sendEmailReceipts: false + subscriptions: + - planId: pro_plan + autoEnable: true + addOn: false + status: active + pastDue: false + canceledAt: null + expiresAt: null + trialEndsAt: null + startedAt: 1771431921437 + currentPeriodStart: 1771431921437 + currentPeriodEnd: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + featureId: messages + granted: 100 + remaining: 0 + usage: 100 + unlimited: false + overageAllowed: false + maxPurchase: null + nextResetAt: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + planId: pro_plan + includedGrant: 100 + prepaidGrant: 0 + remaining: 0 + usage: 100 + unlimited: false + reset: + interval: month + resetsAt: 1773851121437 + price: null + expiresAt: null x-speakeasy-name-override: update parameters: - *a1 @@ -1955,14 +2369,900 @@ paths: downgrades. + Use this endpoint to subscribe a customer to a plan, upgrade/downgrade + between plans, or add an add-on product. + + @example ```typescript // Attach a plan to a customer - const response = await client.attach({ customerId: "cus_123", planId: - "pro_plan" }); + const response = await client.billing.attach({ customerId: "cus_123", + planId: "pro_plan" }); + + ``` + + + @example + + ```typescript + + // Attach with a free trial + + const response = await client.billing.attach({ customerId: "cus_123", + planId: "pro_plan", freeTrial: + {"durationLength":14,"durationType":"day"} }); + + ``` + + + @example + + ```typescript + + // Attach with custom pricing + + const response = await client.billing.attach({ customerId: "cus_123", + planId: "pro_plan", customize: + {"price":{"amount":4900,"interval":"month"}} }); + + ``` + + + @param customerId - The ID of the customer to attach the plan to. + + @param entityId - The ID of the entity to attach the plan to. (optional) + + @param planId - The ID of the plan. + + @param featureQuantities - If this plan contains prepaid features, use + this field to specify the quantity of each prepaid feature. This + quantity includes the included amount and billing units defined when + setting up the plan. (optional) + + @param version - The version of the plan to attach. (optional) + + @param freeTrial - Override the plan's default free trial. Pass an + object to set a custom trial, or null to remove the trial entirely. + (optional) + + @param customize - Customize the plan to attach. Can either override the + price of the plan, the items in the plan, or both. (optional) + + @param invoiceMode - Invoice mode creates a draft or open invoice and + sends it to the customer, instead of charging their card immediately. + This uses Stripe's send_invoice collection method. (optional) + + @param billingBehavior - 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. (optional) + + @param discounts - List of discounts to apply. Each discount can be an + Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) + + @param successUrl - URL to redirect to after successful checkout. + (optional) + + @param newBillingSubscription - Only applicable when the customer has an + existing Stripe subscription. If true, creates a new separate + subscription instead of merging into the existing one. (optional) + + @param planSchedule - When the plan change should take effect. + 'immediate' applies now, 'end_of_cycle' schedules for the end of the + current billing cycle. By default, upgrades are immediate and downgrades + are scheduled. (optional) + + + @returns A billing response with customer ID, invoice details, and + payment URL (if checkout required). + tags: + - billing + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer to attach the plan to. + entity_id: + type: string + description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: The ID of the plan. + feature_quantities: + type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + minimum: 0 + adjustable: + type: boolean + required: + - feature_id + description: If this plan contains prepaid features, use this field to specify + the quantity of each prepaid feature. This quantity includes + the included amount and billing units defined when setting + up the plan. + version: + type: number + description: The version of the plan to attach. + free_trial: + anyOf: + - type: object + properties: + duration_length: + type: number + duration_type: + enum: + - day + - month + - year + default: month + card_required: + type: boolean + default: true + required: + - duration_length + - type: "null" + description: Override the plan's default free trial. Pass an object to set a + custom trial, or null to remove the trial entirely. + customize: + type: object + properties: + price: + anyOf: + - type: object + properties: + amount: + type: number + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + interval_count: + type: number + required: + - amount + - interval + - type: "null" + items: + type: array + items: + type: object + properties: + feature_id: + type: string + included: + type: number + unlimited: + type: boolean + reset: + type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + interval_count: + type: number + required: + - interval + price: + type: object + properties: + amount: + type: number + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + interval_count: + type: number + default: 1 + billing_units: + type: number + default: 1 + billing_method: + enum: + - prepaid + - usage_based + max_purchase: + type: number + required: + - interval + - billing_method + proration: + type: object + properties: + on_increase: + enum: + - bill_immediately + - prorate_immediately + - prorate_next_cycle + - bill_next_cycle + on_decrease: + enum: + - prorate + - prorate_immediately + - prorate_next_cycle + - none + - no_prorations + required: + - on_increase + - on_decrease + rollover: + type: object + properties: + max: + type: number + expiry_duration_type: + enum: + - month + - forever + expiry_duration_length: + type: number + required: + - expiry_duration_type + required: + - feature_id + description: Customize the plan to attach. Can either override the price of the + plan, the items in the plan, or both. + invoice_mode: + type: object + properties: + enabled: + type: boolean + description: When true, creates an invoice and sends it to the customer instead + of charging their card immediately. Uses Stripe's + send_invoice collection method. + enable_plan_immediately: + type: boolean + default: false + description: If true, enables the plan immediately even though the invoice is + not paid yet. + finalize: + type: boolean + default: true + description: If true, finalizes the invoice so it can be sent to the customer. + If false, keeps it as a draft for manual review. + required: + - enabled + description: Invoice mode creates a draft or open invoice and sends it to the + customer, instead of charging their card immediately. This + uses Stripe's send_invoice collection method. + billing_behavior: + enum: + - prorate_immediately + - next_cycle_only + description: 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. + discounts: + type: array + items: + anyOf: + - type: object + properties: + reward_id: + type: string + description: The ID of the reward to apply as a discount. + required: + - reward_id + - type: object + properties: + promotion_code: + type: string + description: The promotion code to apply as a discount. + required: + - promotion_code + description: A discount to apply. Can be either a reward ID or a promotion code. + description: List of discounts to apply. Each discount can be an Autumn reward + ID, Stripe coupon ID, or Stripe promotion code. + success_url: + type: string + description: URL to redirect to after successful checkout. + new_billing_subscription: + type: boolean + description: Only applicable when the customer has an existing Stripe + subscription. If true, creates a new separate subscription + instead of merging into the existing one. + plan_schedule: + enum: + - immediate + - end_of_cycle + description: When the plan change should take effect. 'immediate' applies now, + 'end_of_cycle' schedules for the end of the current billing + cycle. By default, upgrades are immediate and downgrades are + scheduled. + required: + - customer_id + - plan_id + title: AttachParams + examples: + - customer_id: cus_123 + plan_id: pro_plan + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer. + entity_id: + type: string + description: The ID of the entity, if the plan was attached to an entity. + invoice: + type: object + properties: + status: + anyOf: + - type: string + - type: "null" + description: The status of the invoice (e.g., 'paid', 'open', 'draft'). + stripe_id: + type: string + description: The Stripe invoice ID. + total: + type: number + description: The total amount of the invoice in cents. + currency: + type: string + description: The three-letter ISO currency code (e.g., 'usd'). + hosted_invoice_url: + anyOf: + - type: string + - type: "null" + description: URL to the hosted invoice page where the customer can view and pay + the invoice. + required: + - status + - stripe_id + - total + - currency + - hosted_invoice_url + description: Invoice details if an invoice was created. Only present when a + charge was made. + payment_url: + anyOf: + - type: string + - type: "null" + description: URL to redirect the customer to complete payment. Null if no + payment action is required. + required_action: + type: object + properties: + code: + enum: + - 3ds_required + - payment_method_required + - payment_failed + description: The type of action required to complete the payment. + reason: + type: string + description: A human-readable explanation of why this action is required. + required: + - code + - reason + description: Details about any action required to complete the payment. Present + when the payment could not be processed automatically. + required: + - customer_id + - payment_url + examples: + - customer_id: cus_123 + payment_url: https://checkout.stripe.com/... + x-speakeasy-name-override: attach + parameters: + - *a1 + /v1/billing.preview_attach: + post: + operationId: previewAttach + description: >- + Previews the billing changes that would occur when attaching a plan, + without actually making any changes. + + + Use this endpoint to show customers what they will be charged before + confirming a subscription change. + + + @example + + ```typescript + + // Preview attaching a plan + + const response = await client.billing.previewAttach({ customerId: + "cus_123", planId: "pro_plan" }); + + ``` + + + @param customerId - The ID of the customer to attach the plan to. + + @param entityId - The ID of the entity to attach the plan to. (optional) + + @param planId - The ID of the plan. + + @param featureQuantities - If this plan contains prepaid features, use + this field to specify the quantity of each prepaid feature. This + quantity includes the included amount and billing units defined when + setting up the plan. (optional) + + @param version - The version of the plan to attach. (optional) + + @param freeTrial - Override the plan's default free trial. Pass an + object to set a custom trial, or null to remove the trial entirely. + (optional) + + @param customize - Customize the plan to attach. Can either override the + price of the plan, the items in the plan, or both. (optional) + + @param invoiceMode - Invoice mode creates a draft or open invoice and + sends it to the customer, instead of charging their card immediately. + This uses Stripe's send_invoice collection method. (optional) + + @param billingBehavior - 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. (optional) + + @param discounts - List of discounts to apply. Each discount can be an + Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) + + @param successUrl - URL to redirect to after successful checkout. + (optional) + + @param newBillingSubscription - Only applicable when the customer has an + existing Stripe subscription. If true, creates a new separate + subscription instead of merging into the existing one. (optional) + + @param planSchedule - When the plan change should take effect. + 'immediate' applies now, 'end_of_cycle' schedules for the end of the + current billing cycle. By default, upgrades are immediate and downgrades + are scheduled. (optional) + + + @returns A preview response with line items, totals, and effective dates + for the proposed changes. + tags: + - billing + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer to attach the plan to. + entity_id: + type: string + description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: The ID of the plan. + feature_quantities: + type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + minimum: 0 + adjustable: + type: boolean + required: + - feature_id + description: If this plan contains prepaid features, use this field to specify + the quantity of each prepaid feature. This quantity includes + the included amount and billing units defined when setting + up the plan. + version: + type: number + description: The version of the plan to attach. + free_trial: + anyOf: + - type: object + properties: + duration_length: + type: number + duration_type: + enum: + - day + - month + - year + default: month + card_required: + type: boolean + default: true + required: + - duration_length + - type: "null" + description: Override the plan's default free trial. Pass an object to set a + custom trial, or null to remove the trial entirely. + customize: + type: object + properties: + price: + anyOf: + - type: object + properties: + amount: + type: number + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + interval_count: + type: number + required: + - amount + - interval + - type: "null" + items: + type: array + items: + type: object + properties: + feature_id: + type: string + included: + type: number + unlimited: + type: boolean + reset: + type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + interval_count: + type: number + required: + - interval + price: + type: object + properties: + amount: + type: number + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + interval_count: + type: number + default: 1 + billing_units: + type: number + default: 1 + billing_method: + enum: + - prepaid + - usage_based + max_purchase: + type: number + required: + - interval + - billing_method + proration: + type: object + properties: + on_increase: + enum: + - bill_immediately + - prorate_immediately + - prorate_next_cycle + - bill_next_cycle + on_decrease: + enum: + - prorate + - prorate_immediately + - prorate_next_cycle + - none + - no_prorations + required: + - on_increase + - on_decrease + rollover: + type: object + properties: + max: + type: number + expiry_duration_type: + enum: + - month + - forever + expiry_duration_length: + type: number + required: + - expiry_duration_type + required: + - feature_id + description: Customize the plan to attach. Can either override the price of the + plan, the items in the plan, or both. + invoice_mode: + type: object + properties: + enabled: + type: boolean + description: When true, creates an invoice and sends it to the customer instead + of charging their card immediately. Uses Stripe's + send_invoice collection method. + enable_plan_immediately: + type: boolean + default: false + description: If true, enables the plan immediately even though the invoice is + not paid yet. + finalize: + type: boolean + default: true + description: If true, finalizes the invoice so it can be sent to the customer. + If false, keeps it as a draft for manual review. + required: + - enabled + description: Invoice mode creates a draft or open invoice and sends it to the + customer, instead of charging their card immediately. This + uses Stripe's send_invoice collection method. + billing_behavior: + enum: + - prorate_immediately + - next_cycle_only + description: 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. + discounts: + type: array + items: + anyOf: + - type: object + properties: + reward_id: + type: string + description: The ID of the reward to apply as a discount. + required: + - reward_id + - type: object + properties: + promotion_code: + type: string + description: The promotion code to apply as a discount. + required: + - promotion_code + description: A discount to apply. Can be either a reward ID or a promotion code. + description: List of discounts to apply. Each discount can be an Autumn reward + ID, Stripe coupon ID, or Stripe promotion code. + success_url: + type: string + description: URL to redirect to after successful checkout. + new_billing_subscription: + type: boolean + description: Only applicable when the customer has an existing Stripe + subscription. If true, creates a new separate subscription + instead of merging into the existing one. + plan_schedule: + enum: + - immediate + - end_of_cycle + description: When the plan change should take effect. 'immediate' applies now, + 'end_of_cycle' schedules for the end of the current billing + cycle. By default, upgrades are immediate and downgrades are + scheduled. + required: + - customer_id + - plan_id + title: PreviewAttachParams + examples: + - customer_id: cus_123 + plan_id: pro_plan + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer. + line_items: + type: array + items: + type: object + properties: + title: + type: string + description: The title of the line item. + description: + type: string + description: A detailed description of the line item. + amount: + type: number + description: The amount in cents for this line item. + discounts: + type: array + items: + type: object + properties: + amountOff: + type: number + percentOff: + type: number + stripeCouponId: + type: string + couponName: + type: string + required: + - amountOff + default: [] + description: List of discounts applied to this line item. + required: + - title + - description + - amount + description: List of line items for the current billing period. + total: + type: number + description: The total amount in cents for the current billing period. + currency: + type: string + description: The three-letter ISO currency code (e.g., 'usd'). + next_cycle: + type: object + properties: + starts_at: + type: number + description: Unix timestamp (milliseconds) when the next billing cycle starts. + total: + type: number + description: The total amount in cents for the next cycle. + required: + - starts_at + - total + description: Preview of the next billing cycle, if applicable. This shows what + the customer will be charged in subsequent cycles. + required: + - customer_id + - line_items + - total + - currency + examples: + - customerId: charles + lineItems: + - title: Pro seed + description: Pro seed - Base Price (from 18 Feb 2026 to 18 Mar 2026) + amount: 20 + discounts: [] + total: 20 + currency: usd + x-speakeasy-name-override: previewAttach + parameters: + - *a1 + /v1/billing.update: + post: + operationId: billingUpdate + description: >- + Updates an existing subscription. Use to modify feature quantities, + cancel, or change plan configuration. + + + Use this endpoint to update prepaid quantities, cancel a subscription + (immediately or at end of cycle), or modify subscription settings. + + + @example + + ```typescript + + // Update prepaid feature quantity + + const response = await client.billing.update({ customerId: "cus_123", + planId: "pro_plan", featureQuantities: + [{"featureId":"seats","quantity":10}] }); + + ``` + + + @example + + ```typescript + + // Cancel a subscription at end of billing cycle + + const response = await client.billing.update({ customerId: "cus_123", + planId: "pro_plan", cancelAction: "cancel_end_of_cycle" }); + + ``` + + + @example + + ```typescript + + // Uncancel a subscription at the end of the billing cycle + + const response = await client.billing.update({ customerId: "cus_123", + planId: "pro_plan", cancelAction: "uncancel" }); ``` @@ -1978,8 +3278,30 @@ paths: @param version - The version of the plan to attach. (optional) + @param freeTrial - Override the plan's default free trial. Pass an + object to set a custom trial, or null to remove the trial entirely. + (optional) + @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) + + @param invoiceMode - Invoice mode creates a draft or open invoice and + sends it to the customer, instead of charging their card immediately. + This uses Stripe's send_invoice collection method. (optional) + + @param billingBehavior - 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. (optional) + + @param cancelAction - Action to perform for cancellation. + 'cancel_immediately' cancels now with prorated refund, + 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a + pending cancellation. (optional) + + + @returns A billing response with customer ID, invoice details, and + payment URL (if next action is required). tags: - billing requestBody: @@ -1993,26 +3315,25 @@ paths: type: string description: The ID of the customer to attach the plan to. entity_id: - anyOf: - - type: string - - type: "null" + type: string description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: The ID of the plan. feature_quantities: - anyOf: - - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - minimum: 0 - adjustable: - type: boolean - required: - - feature_id - - type: "null" + type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + minimum: 0 + adjustable: + type: boolean + required: + - feature_id description: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting @@ -2038,6 +3359,8 @@ paths: required: - duration_length - type: "null" + description: Override the plan's default free trial. Pass an object to set a + custom trial, or null to remove the trial entirely. customize: type: object properties: @@ -2168,1176 +3491,55 @@ paths: - feature_id description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - plan_id: - type: string invoice_mode: type: object properties: enabled: type: boolean + description: When true, creates an invoice and sends it to the customer instead + of charging their card immediately. Uses Stripe's + send_invoice collection method. enable_plan_immediately: type: boolean default: false + description: If true, enables the plan immediately even though the invoice is + not paid yet. finalize: type: boolean default: true + description: If true, finalizes the invoice so it can be sent to the customer. + If false, keeps it as a draft for manual review. required: - enabled - discounts: - type: array - items: - anyOf: - - type: object - properties: - reward_id: - type: string - required: - - reward_id - - type: object - properties: - promotion_code: - type: string - required: - - promotion_code - redirect_mode: - enum: - - always - - if_required - - never - default: always - success_url: - type: string - new_billing_subscription: - type: boolean - plan_schedule: - enum: - - immediate - - end_of_cycle + description: Invoice mode creates a draft or open invoice and sends it to the + customer, instead of charging their card immediately. This + uses Stripe's send_invoice collection method. billing_behavior: enum: - prorate_immediately - next_cycle_only - required: - - customer_id - - plan_id - responses: - "200": - description: OK - content: - application/json: - schema: - type: object - properties: - customer_id: - type: string - entity_id: - type: string - invoice: - type: object - properties: - status: - anyOf: - - type: string - - type: "null" - stripe_id: - type: string - total: - type: number - currency: - type: string - hosted_invoice_url: - anyOf: - - type: string - - type: "null" - required: - - status - - stripe_id - - total - - currency - - hosted_invoice_url - payment_url: - anyOf: - - type: string - - type: "null" - required_action: - type: object - properties: - code: - enum: - - 3ds_required - - payment_method_required - - payment_failed - reason: - type: string - required: - - code - - reason - required: - - customer_id - - payment_url - x-speakeasy-name-override: attach - parameters: - - *a1 - /v1/billing.preview_attach: - post: - operationId: billingPreviewAttach - description: Preview billing changes before attaching a plan. - tags: - - billing - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - customer_id: - type: string - description: The ID of the customer to attach the plan to. - entity_id: - anyOf: - - type: string - - type: "null" - description: The ID of the entity to attach the plan to. - feature_quantities: - anyOf: - - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - minimum: 0 - adjustable: - type: boolean - required: - - feature_id - - type: "null" - description: If this plan contains prepaid features, use this field to specify - the quantity of each prepaid feature. This quantity includes - the included amount and billing units defined when setting - up the plan. - version: - type: number - description: The version of the plan to attach. - free_trial: - anyOf: - - type: object - properties: - duration_length: - type: number - duration_type: - enum: - - day - - month - - year - default: month - card_required: - type: boolean - default: true - required: - - duration_length - - type: "null" - customize: - type: object - properties: - price: - anyOf: - - type: object - properties: - amount: - type: number - interval: - enum: - - one_off - - week - - month - - quarter - - semi_annual - - year - interval_count: - type: number - required: - - amount - - interval - - type: "null" - items: - type: array - items: - type: object - properties: - feature_id: - type: string - included: - type: number - unlimited: - type: boolean - reset: - type: object - properties: - interval: - enum: - - one_off - - minute - - hour - - day - - week - - month - - quarter - - semi_annual - - year - interval_count: - type: number - required: - - interval - price: - type: object - properties: - amount: - type: number - tiers: - type: array - items: - type: object - properties: - to: - anyOf: - - type: number - - const: inf - amount: - type: number - required: - - to - - amount - interval: - enum: - - one_off - - week - - month - - quarter - - semi_annual - - year - interval_count: - type: number - default: 1 - billing_units: - type: number - default: 1 - billing_method: - enum: - - prepaid - - usage_based - max_purchase: - type: number - required: - - interval - - billing_method - proration: - type: object - properties: - on_increase: - enum: - - bill_immediately - - prorate_immediately - - prorate_next_cycle - - bill_next_cycle - on_decrease: - enum: - - prorate - - prorate_immediately - - prorate_next_cycle - - none - - no_prorations - required: - - on_increase - - on_decrease - rollover: - type: object - properties: - max: - type: number - expiry_duration_type: - enum: - - month - - forever - expiry_duration_length: - type: number - required: - - expiry_duration_type - required: - - feature_id - description: Customize the plan to attach. Can either override the price of the - plan, the items in the plan, or both. - plan_id: - type: string - invoice_mode: - type: object - properties: - enabled: - type: boolean - enable_plan_immediately: - type: boolean - default: false - finalize: - type: boolean - default: true - required: - - enabled - discounts: - type: array - items: - anyOf: - - type: object - properties: - reward_id: - type: string - required: - - reward_id - - type: object - properties: - promotion_code: - type: string - required: - - promotion_code - redirect_mode: - enum: - - always - - if_required - - never - default: always - success_url: - type: string - new_billing_subscription: - type: boolean - plan_schedule: - enum: - - immediate - - end_of_cycle - billing_behavior: - enum: - - prorate_immediately - - next_cycle_only - required: - - customer_id - - plan_id - responses: - "200": - description: OK - content: - application/json: - schema: - type: object - properties: - customer_id: - type: string - line_items: - type: array - items: - type: object - properties: - title: - type: string - description: - type: string - amount: - type: number - discounts: - type: array - items: - type: object - properties: - amountOff: - type: number - percentOff: - type: number - stripeCouponId: - type: string - couponName: - type: string - required: - - amountOff - default: [] - plan_id: - type: string - total_quantity: - type: number - paid_quantity: - type: number - deferred_for_trial: - type: boolean - effective_period: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - is_base: - type: boolean - required: - - title - - description - - amount - - plan_id - - total_quantity - - paid_quantity - total: - type: number - currency: - type: string - period_start: - type: number - period_end: - type: number - next_cycle: - type: object - properties: - starts_at: - type: number - total: - type: number - line_items: - type: array - items: - type: object - properties: - title: - type: string - description: - type: string - amount: - type: number - discounts: - type: array - items: - type: object - properties: - amountOff: - type: number - percentOff: - type: number - stripeCouponId: - type: string - couponName: - type: string - required: - - amountOff - default: [] - plan_id: - type: string - total_quantity: - type: number - paid_quantity: - type: number - deferred_for_trial: - type: boolean - effective_period: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - is_base: - type: boolean - required: - - title - - description - - amount - - plan_id - - total_quantity - - paid_quantity - required: - - starts_at - - total - - line_items - incoming: - type: array - items: - type: object - properties: - plan: - $ref: "#/components/schemas/Plan" - feature_quantities: - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - required: - - feature_id - - quantity - balances: - type: object - propertyNames: - type: string - additionalProperties: - type: object - properties: - feature_id: - type: string - feature: - type: object - properties: - id: - type: string - name: - type: string - type: - enum: - - boolean - - metered - - credit_system - consumable: - type: boolean - event_names: - type: array - items: - type: string - credit_schema: - type: array - items: - type: object - properties: - metered_feature_id: - type: string - credit_cost: - type: number - required: - - metered_feature_id - - credit_cost - display: - type: object - properties: - singular: - anyOf: - - type: string - - type: "null" - plural: - anyOf: - - type: string - - type: "null" - archived: - type: boolean - required: - - id - - name - - type - - consumable - - archived - granted: - type: number - remaining: - type: number - minimum: 0 - usage: - type: number - unlimited: - type: boolean - overage_allowed: - type: boolean - max_purchase: - anyOf: - - type: number - - type: "null" - next_reset_at: - anyOf: - - type: number - - type: "null" - breakdown: - type: array - items: - type: object - properties: - id: - type: string - default: "" - plan_id: - anyOf: - - type: string - - type: "null" - included_grant: - type: number - prepaid_grant: - type: number - remaining: - type: number - usage: - type: number - unlimited: - type: boolean - reset: - anyOf: - - type: object - properties: - interval: - anyOf: - - enum: - - one_off - - minute - - hour - - day - - week - - month - - quarter - - semi_annual - - year - - const: multiple - interval_count: - type: number - resets_at: - anyOf: - - type: number - - type: "null" - required: - - interval - - resets_at - - type: "null" - price: - anyOf: - - type: object - properties: - amount: - type: number - tiers: - type: array - items: - type: object - properties: - to: - anyOf: - - {} - - {} - amount: - type: number - required: - - amount - billing_units: - type: number - billing_method: - enum: - - prepaid - - usage_based - max_purchase: - anyOf: - - type: number - - type: "null" - required: - - billing_units - - billing_method - - max_purchase - - type: "null" - expires_at: - anyOf: - - type: number - - type: "null" - required: - - plan_id - - included_grant - - prepaid_grant - - remaining - - usage - - unlimited - - reset - - price - - expires_at - rollovers: - type: array - items: - type: object - properties: - balance: - type: number - expires_at: - type: number - required: - - balance - - expires_at - required: - - feature_id - - granted - - remaining - - usage - - unlimited - - overage_allowed - - max_purchase - - next_reset_at - period_start: - type: number - period_end: - type: number - required: - - plan - - feature_quantities - - balances - outgoing: - type: array - items: - type: object - properties: - plan: - $ref: "#/components/schemas/Plan" - feature_quantities: - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - required: - - feature_id - - quantity - balances: - type: object - propertyNames: - type: string - additionalProperties: - type: object - properties: - feature_id: - type: string - feature: - type: object - properties: - id: - type: string - name: - type: string - type: - enum: - - boolean - - metered - - credit_system - consumable: - type: boolean - event_names: - type: array - items: - type: string - credit_schema: - type: array - items: - type: object - properties: - metered_feature_id: - type: string - credit_cost: - type: number - required: - - metered_feature_id - - credit_cost - display: - type: object - properties: - singular: - anyOf: - - type: string - - type: "null" - plural: - anyOf: - - type: string - - type: "null" - archived: - type: boolean - required: - - id - - name - - type - - consumable - - archived - granted: - type: number - remaining: - type: number - minimum: 0 - usage: - type: number - unlimited: - type: boolean - overage_allowed: - type: boolean - max_purchase: - anyOf: - - type: number - - type: "null" - next_reset_at: - anyOf: - - type: number - - type: "null" - breakdown: - type: array - items: - type: object - properties: - id: - type: string - default: "" - plan_id: - anyOf: - - type: string - - type: "null" - included_grant: - type: number - prepaid_grant: - type: number - remaining: - type: number - usage: - type: number - unlimited: - type: boolean - reset: - anyOf: - - type: object - properties: - interval: - anyOf: - - enum: - - one_off - - minute - - hour - - day - - week - - month - - quarter - - semi_annual - - year - - const: multiple - interval_count: - type: number - resets_at: - anyOf: - - type: number - - type: "null" - required: - - interval - - resets_at - - type: "null" - price: - anyOf: - - type: object - properties: - amount: - type: number - tiers: - type: array - items: - type: object - properties: - to: - anyOf: - - {} - - {} - amount: - type: number - required: - - amount - billing_units: - type: number - billing_method: - enum: - - prepaid - - usage_based - max_purchase: - anyOf: - - type: number - - type: "null" - required: - - billing_units - - billing_method - - max_purchase - - type: "null" - expires_at: - anyOf: - - type: number - - type: "null" - required: - - plan_id - - included_grant - - prepaid_grant - - remaining - - usage - - unlimited - - reset - - price - - expires_at - rollovers: - type: array - items: - type: object - properties: - balance: - type: number - expires_at: - type: number - required: - - balance - - expires_at - required: - - feature_id - - granted - - remaining - - usage - - unlimited - - overage_allowed - - max_purchase - - next_reset_at - period_start: - type: number - period_end: - type: number - required: - - plan - - feature_quantities - - balances - redirect_type: - anyOf: - - enum: - - stripe_checkout - - autumn_checkout - - type: "null" - required: - - customer_id - - line_items - - total - - currency - - incoming - - outgoing - - redirect_type - x-speakeasy-name-override: previewAttach - parameters: - - *a1 - /v1/billing.update: - post: - operationId: billingUpdate - description: Update an existing subscription. - tags: - - billing - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - customer_id: - type: string - description: The ID of the customer to attach the plan to. - entity_id: - anyOf: - - type: string - - type: "null" - description: The ID of the entity to attach the plan to. - feature_quantities: - anyOf: - - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - minimum: 0 - adjustable: - type: boolean - required: - - feature_id - - type: "null" - description: If this plan contains prepaid features, use this field to specify - the quantity of each prepaid feature. This quantity includes - the included amount and billing units defined when setting - up the plan. - version: - type: number - description: The version of the plan to attach. - free_trial: - anyOf: - - type: object - properties: - duration_length: - type: number - duration_type: - enum: - - day - - month - - year - default: month - card_required: - type: boolean - default: true - required: - - duration_length - - type: "null" - customize: - type: object - properties: - price: - anyOf: - - type: object - properties: - amount: - type: number - interval: - enum: - - one_off - - week - - month - - quarter - - semi_annual - - year - interval_count: - type: number - required: - - amount - - interval - - type: "null" - items: - type: array - items: - type: object - properties: - feature_id: - type: string - included: - type: number - unlimited: - type: boolean - reset: - type: object - properties: - interval: - enum: - - one_off - - minute - - hour - - day - - week - - month - - quarter - - semi_annual - - year - interval_count: - type: number - required: - - interval - price: - type: object - properties: - amount: - type: number - tiers: - type: array - items: - type: object - properties: - to: - anyOf: - - type: number - - const: inf - amount: - type: number - required: - - to - - amount - interval: - enum: - - one_off - - week - - month - - quarter - - semi_annual - - year - interval_count: - type: number - default: 1 - billing_units: - type: number - default: 1 - billing_method: - enum: - - prepaid - - usage_based - max_purchase: - type: number - required: - - interval - - billing_method - proration: - type: object - properties: - on_increase: - enum: - - bill_immediately - - prorate_immediately - - prorate_next_cycle - - bill_next_cycle - on_decrease: - enum: - - prorate - - prorate_immediately - - prorate_next_cycle - - none - - no_prorations - required: - - on_increase - - on_decrease - rollover: - type: object - properties: - max: - type: number - expiry_duration_type: - enum: - - month - - forever - expiry_duration_length: - type: number - required: - - expiry_duration_type - required: - - feature_id - description: Customize the plan to attach. Can either override the price of the - plan, the items in the plan, or both. - plan_id: - type: string - invoice_mode: - type: object - properties: - enabled: - type: boolean - enable_plan_immediately: - type: boolean - default: false - finalize: - type: boolean - default: true - required: - - enabled + description: 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. cancel_action: enum: - cancel_immediately - cancel_end_of_cycle - uncancel - billing_behavior: - enum: - - prorate_immediately - - next_cycle_only + description: Action to perform for cancellation. 'cancel_immediately' cancels + now with prorated refund, 'cancel_end_of_cycle' cancels at + period end, 'uncancel' reverses a pending cancellation. required: - customer_id + - plan_id + title: UpdateSubscriptionParams + examples: + - customer_id: cus_123 + plan_id: pro_plan + feature_quantities: + - feature_id: seats + quantity: 10 responses: "200": description: OK @@ -3348,8 +3550,10 @@ paths: properties: customer_id: type: string + description: The ID of the customer. entity_id: type: string + description: The ID of the entity, if the plan was attached to an entity. invoice: type: object properties: @@ -3357,26 +3561,36 @@ paths: anyOf: - type: string - type: "null" + description: The status of the invoice (e.g., 'paid', 'open', 'draft'). stripe_id: type: string + description: The Stripe invoice ID. total: type: number + description: The total amount of the invoice in cents. currency: type: string + description: The three-letter ISO currency code (e.g., 'usd'). hosted_invoice_url: anyOf: - type: string - type: "null" + description: URL to the hosted invoice page where the customer can view and pay + the invoice. required: - status - stripe_id - total - currency - hosted_invoice_url + description: Invoice details if an invoice was created. Only present when a + charge was made. payment_url: anyOf: - type: string - type: "null" + description: URL to redirect the customer to complete payment. Null if no + payment action is required. required_action: type: object properties: @@ -3385,21 +3599,90 @@ paths: - 3ds_required - payment_method_required - payment_failed + description: The type of action required to complete the payment. reason: type: string + description: A human-readable explanation of why this action is required. required: - code - reason + description: Details about any action required to complete the payment. Present + when the payment could not be processed automatically. required: - customer_id - payment_url + examples: + - customer_id: cus_123 + invoice: + status: paid + stripe_id: in_1234 + total: 1500 + currency: usd + hosted_invoice_url: https://invoice.stripe.com/... + payment_url: null x-speakeasy-name-override: update parameters: - *a1 /v1/billing.preview_update: post: - operationId: billingPreviewUpdate - description: Preview billing changes before updating a subscription. + operationId: previewUpdate + description: >- + Previews the billing changes that would occur when updating a + subscription, without actually making any changes. + + + Use this endpoint to show customers prorated charges or refunds before + confirming subscription modifications. + + + @example + + ```typescript + + // Preview updating seat quantity + + const response = await client.billing.previewUpdate({ customerId: + "cus_123", planId: "pro_plan", featureQuantities: + [{"featureId":"seats","quantity":15}] }); + + ``` + + + @param customerId - The ID of the customer to attach the plan to. + + @param entityId - The ID of the entity to attach the plan to. (optional) + + @param featureQuantities - If this plan contains prepaid features, use + this field to specify the quantity of each prepaid feature. This + quantity includes the included amount and billing units defined when + setting up the plan. (optional) + + @param version - The version of the plan to attach. (optional) + + @param freeTrial - Override the plan's default free trial. Pass an + object to set a custom trial, or null to remove the trial entirely. + (optional) + + @param customize - Customize the plan to attach. Can either override the + price of the plan, the items in the plan, or both. (optional) + + @param invoiceMode - Invoice mode creates a draft or open invoice and + sends it to the customer, instead of charging their card immediately. + This uses Stripe's send_invoice collection method. (optional) + + @param billingBehavior - 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. (optional) + + @param cancelAction - Action to perform for cancellation. + 'cancel_immediately' cancels now with prorated refund, + 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a + pending cancellation. (optional) + + + @returns A preview response with line items showing prorated charges or + credits for the proposed changes. tags: - billing requestBody: @@ -3413,26 +3696,25 @@ paths: type: string description: The ID of the customer to attach the plan to. entity_id: - anyOf: - - type: string - - type: "null" + type: string description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: The ID of the plan. feature_quantities: - anyOf: - - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - minimum: 0 - adjustable: - type: boolean - required: - - feature_id - - type: "null" + type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + minimum: 0 + adjustable: + type: boolean + required: + - feature_id description: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting @@ -3458,6 +3740,8 @@ paths: required: - duration_length - type: "null" + description: Override the plan's default free trial. Pass an object to set a + custom trial, or null to remove the trial entirely. customize: type: object properties: @@ -3588,32 +3872,55 @@ paths: - feature_id description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - plan_id: - type: string invoice_mode: type: object properties: enabled: type: boolean + description: When true, creates an invoice and sends it to the customer instead + of charging their card immediately. Uses Stripe's + send_invoice collection method. enable_plan_immediately: type: boolean default: false + description: If true, enables the plan immediately even though the invoice is + not paid yet. finalize: type: boolean default: true + description: If true, finalizes the invoice so it can be sent to the customer. + If false, keeps it as a draft for manual review. required: - enabled + description: Invoice mode creates a draft or open invoice and sends it to the + customer, instead of charging their card immediately. This + uses Stripe's send_invoice collection method. + billing_behavior: + enum: + - prorate_immediately + - next_cycle_only + description: 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. cancel_action: enum: - cancel_immediately - cancel_end_of_cycle - uncancel - billing_behavior: - enum: - - prorate_immediately - - next_cycle_only + description: Action to perform for cancellation. 'cancel_immediately' cancels + now with prorated refund, 'cancel_end_of_cycle' cancels at + period end, 'uncancel' reverses a pending cancellation. required: - customer_id + - plan_id + title: PreviewUpdateParams + examples: + - customer_id: cus_123 + plan_id: pro_plan + feature_quantities: + - feature_id: seats + quantity: 15 responses: "200": description: OK @@ -3624,6 +3931,7 @@ paths: properties: customer_id: type: string + description: The ID of the customer. line_items: type: array items: @@ -3631,10 +3939,13 @@ paths: properties: title: type: string + description: The title of the line item. description: type: string + description: A detailed description of the line item. amount: type: number + description: The amount in cents for this line item. discounts: type: array items: @@ -3651,118 +3962,54 @@ paths: required: - amountOff default: [] - plan_id: - type: string - total_quantity: - type: number - paid_quantity: - type: number - deferred_for_trial: - type: boolean - effective_period: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - is_base: - type: boolean + description: List of discounts applied to this line item. required: - title - description - amount - - plan_id - - total_quantity - - paid_quantity + description: List of line items for the current billing period. total: type: number + description: The total amount in cents for the current billing period. currency: type: string - period_start: - type: number - period_end: - type: number + description: The three-letter ISO currency code (e.g., 'usd'). next_cycle: type: object properties: starts_at: type: number + description: Unix timestamp (milliseconds) when the next billing cycle starts. total: type: number - line_items: - type: array - items: - type: object - properties: - title: - type: string - description: - type: string - amount: - type: number - discounts: - type: array - items: - type: object - properties: - amountOff: - type: number - percentOff: - type: number - stripeCouponId: - type: string - couponName: - type: string - required: - - amountOff - default: [] - plan_id: - type: string - total_quantity: - type: number - paid_quantity: - type: number - deferred_for_trial: - type: boolean - effective_period: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - is_base: - type: boolean - required: - - title - - description - - amount - - plan_id - - total_quantity - - paid_quantity + description: The total amount in cents for the next cycle. required: - starts_at - total - - line_items + description: Preview of the next billing cycle, if applicable. This shows what + the customer will be charged in subsequent cycles. required: - customer_id - line_items - total - currency + examples: + - customerId: charles + lineItems: + - title: Pro seed + description: Pro seed - Base Price (from 18 Feb 2026 to 18 Mar 2026) + amount: 20 + discounts: [] + total: 20 + currency: usd x-speakeasy-name-override: previewUpdate parameters: - *a1 - /v1/billing.setup_payment: + /v1/billing.open_customer_portal: post: - operationId: billingSetupPayment - description: Create a setup payment session for a customer. + operationId: openCustomerPortal + description: Create a billing portal session for a customer to manage their + subscription. tags: - billing requestBody: @@ -3774,21 +4021,21 @@ paths: properties: customer_id: type: string - description: The ID of the customer - success_url: + description: The ID of the customer to open the billing portal for. + configuration_id: type: string - description: URL to redirect to after successful payment setup. Must start with - either http:// or https:// - customer_data: - $ref: "#/components/schemas/CustomerData" - checkout_session_params: - type: object - propertyNames: - type: string - additionalProperties: {} - description: Additional parameters for the checkout session + description: Stripe billing portal configuration ID. Create configurations in + your Stripe dashboard. + return_url: + type: string + description: URL to redirect to when back button is clicked in the billing + portal required: - customer_id + title: OpenCustomerPortalParams + examples: + - customer_id: cus_123 + return_url: https://useautumn.com responses: "200": description: OK @@ -3799,19 +4046,22 @@ paths: properties: customer_id: type: string - description: The ID of the customer + description: The ID of the billing portal session url: type: string - description: URL to the payment setup page + description: URL to the billing portal required: - customer_id - url - x-speakeasy-name-override: setupPayment + examples: + - customer_id: cus_123 + url: https://billing.stripe.com/session/... + x-speakeasy-name-override: openCustomerPortal parameters: - *a1 /v1/balances.create: post: - operationId: balancesCreate + operationId: createBalance description: Create a balance for a customer feature. tags: - balances @@ -3822,21 +4072,24 @@ paths: schema: type: object properties: - feature_id: - type: string - description: The feature ID to create the balance for customer_id: type: string - description: The customer ID to assign the balance to + description: The ID of the customer. + feature_id: + type: string + description: The ID of the feature. entity_id: type: string - description: Entity ID for entity-scoped balances + description: The ID of the entity for entity-scoped balances (e.g., per-seat + limits). included: type: number - description: The initial balance amount to grant + description: The initial balance amount to grant. For metered features, this is + the number of units the customer can use. unlimited: type: boolean - description: Whether the balance is unlimited + description: If true, the balance has unlimited usage. Cannot be combined with + 'included'. reset: type: object properties: @@ -3851,19 +4104,33 @@ paths: - quarter - semi_annual - year + description: The interval at which the balance resets (e.g., 'month', 'day', + 'year'). interval_count: type: number + description: "Number of intervals between resets. Defaults to 1 (e.g., + interval_count: 2 with interval: 'month' resets every 2 + months)." required: - interval - description: Reset configuration for the balance + description: Reset configuration for the balance. If not provided, the balance + is a one-time grant that never resets. expires_at: type: number - description: Unix timestamp (milliseconds) when the balance expires + description: Unix timestamp (milliseconds) when the balance expires. Mutually + exclusive with reset. granted_balance: type: number required: - - feature_id - customer_id + - feature_id + title: CreateBalanceParams + examples: + - customer_id: cus_123 + feature_id: api_calls + included: 1000 + reset: + interval: month responses: "200": description: OK @@ -3881,7 +4148,7 @@ paths: - *a1 /v1/balances.update: post: - operationId: balancesUpdate + operationId: updateBalance description: Update a customer balance. tags: - balances @@ -3895,16 +4162,21 @@ paths: customer_id: type: string description: The ID of the customer. - entity_id: - type: string - description: The ID of the entity to update balance for (if using entity - balances). feature_id: type: string - description: The ID of the feature to update balance for. - current_balance: + description: The ID of the feature. + entity_id: + type: string + description: The ID of the entity for entity-scoped balances (e.g., per-seat + limits). + remaining: type: number - description: The new balance value to set. + description: Set the remaining balance to this exact value. Cannot be combined + with add_to_balance. + add_to_balance: + type: number + description: Add this amount to the current balance. Use negative values to + subtract. Cannot be combined with current_balance. interval: enum: - one_off @@ -3916,20 +4188,17 @@ paths: - quarter - semi_annual - year - description: The interval to update balance for. - granted_balance: - type: number - usage: - type: number - customer_entitlement_id: - type: string - next_reset_at: - type: number - add_to_balance: - type: number + description: Target a specific balance by its reset interval. Use when the + customer has multiple balances for the same feature with + different reset intervals. required: - customer_id - feature_id + title: UpdateBalanceParams + examples: + - customer_id: cus_123 + feature_id: api_calls + remaining: 5 responses: "200": description: OK @@ -3947,10 +4216,68 @@ paths: - *a1 /v1/balances.check: post: - operationId: balancesCheck - description: Check whether usage is allowed for a customer feature. - tags: - - balances + operationId: check + description: >- + Checks whether a customer currently has enough balance to use a feature. + + + Use this to gate access before a feature action. Enable sendEvent when + you want to check and consume balance atomically in one request. + + + @example + + ```typescript + + // Check access for a feature + + const response = await client.check({ customerId: "cus_123", featureId: + "messages" }); + + ``` + + + @example + + ```typescript + + // Check and consume 3 units in one call + + const response = await client.check({ + customerId: "cus_123", + featureId: "messages", + requiredBalance: 3, + sendEvent: true, + }); + + ``` + + + @param customerId - The ID of the customer. + + @param featureId - The ID of the feature. + + @param entityId - The ID of the entity for entity-scoped balances (e.g., + per-seat limits). (optional) + + @param requiredBalance - Minimum balance required for access. Returns + allowed: false if the customer's balance is below this value. Defaults + to 1. (optional) + + @param properties - Additional properties to attach to the usage event + if send_event is true. (optional) + + @param sendEvent - If true, atomically records a usage event while + checking access. The required_balance value is used as the usage amount. + Combines check + track in one call. (optional) + + @param withPreview - If true, includes upgrade/upsell information in the + response when access is denied. Useful for displaying paywalls. + (optional) + + + @returns Whether access is allowed, plus the current balance for that + feature. requestBody: required: true content: @@ -3960,37 +4287,45 @@ paths: properties: customer_id: type: string - description: ID which you provided when creating the customer + description: The ID of the customer. feature_id: type: string - description: ID of the feature to check access to. + description: The ID of the feature. entity_id: type: string - description: If using entity balances (eg, seats), the entity ID to check access - for. + description: The ID of the entity for entity-scoped balances (e.g., per-seat + limits). required_balance: type: number - description: If you know the amount of the feature the end user is consuming in - advance. If their balance is below this quantity, allowed - will be false. + description: "Minimum balance required for access. Returns allowed: false if the + customer's balance is below this value. Defaults to 1." properties: type: object propertyNames: type: string additionalProperties: {} + description: Additional properties to attach to the usage event if send_event is + true. send_event: type: boolean - description: If true, a usage event will be recorded together with checking - access. The required_balance field will be used as the usage - value. + description: If true, atomically records a usage event while checking access. + The required_balance value is used as the usage amount. + Combines check + track in one call. with_preview: type: boolean - description: If true, the response will include a preview object, which can be - used to display information such as a paywall or upgrade - confirmation. + description: If true, includes upgrade/upsell information in the response when + access is denied. Useful for displaying paywalls. required: - customer_id - feature_id + title: CheckParams + examples: + - customer_id: cus_123 + feature_id: messages + - customer_id: cus_123 + feature_id: messages + required_balance: 3 + send_event: true responses: "200": description: OK @@ -4001,20 +4336,27 @@ paths: properties: allowed: type: boolean + description: Whether the customer is allowed to use the feature. True if they + have sufficient balance or the feature is + unlimited/boolean. customer_id: type: string + description: The ID of the customer that was checked. entity_id: anyOf: - type: string - type: "null" + description: The ID of the entity, if an entity-scoped check was performed. required_balance: type: number + description: The required balance that was checked against. balance: anyOf: - type: object properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -4064,25 +4406,35 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -4091,20 +4443,28 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -4122,22 +4482,28 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -4152,25 +4518,31 @@ paths: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -4181,6 +4553,8 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -4188,11 +4562,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -4202,7 +4579,31 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null - type: "null" + description: The customer's balance for this feature. Null if the customer has + no balance for this feature. preview: type: object properties: @@ -4210,14 +4611,21 @@ paths: enum: - usage_limit - feature_flag + description: The reason access was denied. 'usage_limit' means the customer + exceeded their balance, 'feature_flag' means the + feature is not included in their plan. title: type: string + description: A title suitable for displaying in a paywall or upgrade modal. message: type: string + description: A message explaining why access was denied. feature_id: type: string + description: The ID of the feature that was checked. feature_name: type: string + description: The display name of the feature. products: type: array items: @@ -4530,6 +4938,8 @@ paths: - items - free_trial - base_variant_id + description: Products that would grant access to this feature. Use to display + upgrade options. required: - scenario - title @@ -4537,19 +4947,99 @@ paths: - feature_id - feature_name - products + description: Upgrade/upsell information when access is denied. Only present if + with_preview was true and allowed is false. required: - allowed - customer_id - balance + examples: + - allowed: true + customer_id: cus_123 + entity_id: null + required_balance: 1 + balance: + feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null x-speakeasy-name-override: check parameters: - *a1 /v1/balances.track: post: - operationId: balancesTrack - description: Track usage for a customer feature. - tags: - - balances + operationId: track + description: >- + Records usage for a customer feature and returns updated balances. + + + Use this after an action happens to decrement usage, or send a negative + value to credit balance back. + + + @example + + ```typescript + + // Track one message event + + const response = await client.track({ customerId: "cus_123", featureId: + "messages", value: 1 }); + + ``` + + + @example + + ```typescript + + // Track an event mapped to multiple features + + const response = await client.track({ customerId: "cus_123", eventName: + "ai_chat_request", value: 1 }); + + ``` + + + @param customerId - The ID of the customer. + + @param featureId - The ID of the feature to track usage for. Required if + event_name is not provided. (optional) + + @param entityId - The ID of the entity for entity-scoped balances (e.g., + per-seat limits). (optional) + + @param eventName - Event name to track usage for. Use instead of + feature_id when multiple features should be tracked from a single event. + (optional) + + @param value - The amount of usage to record. Defaults to 1. Use + negative values to credit balance (e.g., when removing a seat). + (optional) + + @param properties - Additional properties to attach to this usage event. + (optional) + + + @returns The usage value recorded, with either a single updated balance + or a map of updated balances. requestBody: required: true content: @@ -4559,38 +5049,37 @@ paths: properties: customer_id: type: string - minLength: 1 - description: ID which you provided when creating the customer + description: The ID of the customer. feature_id: type: string - description: ID of the feature to track usage for. Required if event_name is not - provided. Use this for direct feature tracking. + description: The ID of the feature to track usage for. Required if event_name is + not provided. + entity_id: + type: string + description: The ID of the entity for entity-scoped balances (e.g., per-seat + limits). event_name: type: string minLength: 1 - description: An [event name](/features/tracking-usage#using-event-names) can be - used in place of feature_id. This can be used if multiple - features are tracked in the same event. + description: Event name to track usage for. Use instead of feature_id when + multiple features should be tracked from a single event. value: type: number - description: The amount of usage to record. Defaults to 1. Can be negative to - increase the balance (e.g., when removing a seat). + description: The amount of usage to record. Defaults to 1. Use negative values + to credit balance (e.g., when removing a seat). properties: type: object propertyNames: type: string additionalProperties: {} description: Additional properties to attach to this usage event. - idempotency_key: - type: string - description: Unique key to prevent duplicate event recording. Use this to safely - retry requests without creating duplicate usage records. - entity_id: - type: string - description: If using [entity balances](/features/feature-entities) (eg, seats), - the entity ID to track usage for. required: - customer_id + title: TrackParams + examples: + - customer_id: cus_123 + feature_id: messages + value: 1 responses: "200": description: OK @@ -4601,21 +5090,24 @@ paths: properties: customer_id: type: string - description: The ID of the customer + description: The ID of the customer whose usage was tracked. entity_id: type: string - description: The ID of the entity (if provided) + description: The ID of the entity, if entity-scoped tracking was performed. event_name: type: string - description: The name of the event + description: The event name that was tracked, if event_name was used instead of + feature_id. value: type: number + description: The amount of usage that was recorded. balance: anyOf: - type: object properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -4665,25 +5157,35 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -4692,20 +5194,28 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -4723,22 +5233,28 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -4753,25 +5269,31 @@ paths: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -4782,6 +5304,8 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -4789,11 +5313,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -4803,7 +5330,31 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null - type: "null" + description: The updated balance for the tracked feature. Null if tracking by + event_name that affects multiple features. balances: type: object propertyNames: @@ -4813,6 +5364,7 @@ paths: properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -4862,25 +5414,35 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -4889,20 +5451,28 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -4920,22 +5490,28 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -4950,25 +5526,31 @@ paths: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -4979,6 +5561,8 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. rollovers: type: array items: @@ -4986,11 +5570,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -5000,13 +5587,1669 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + description: Map of feature_id to updated balance when tracking by event_name + affects multiple features. required: - customer_id - value - balance + examples: + - customer_id: cus_123 + value: 1 + balance: + feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null x-speakeasy-name-override: track parameters: - *a1 + /v1/events.list: + post: + operationId: listEvents + description: List usage events for your organization. Filter by customer, + feature, or time range. + tags: + - events + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + offset: + type: integer + minimum: 0 + maximum: 9007199254740991 + default: 0 + description: Number of items to skip + limit: + type: integer + minimum: 1 + maximum: 1000 + default: 100 + description: Number of items to return. Default 100, max 1000. + customer_id: + type: string + description: Filter events by customer ID + feature_id: + anyOf: + - type: string + minLength: 1 + - type: array + items: + type: string + minLength: 1 + description: Filter by specific feature ID(s) + custom_range: + type: object + properties: + start: + type: number + description: Filter events after this timestamp (epoch milliseconds) + end: + type: number + description: Filter events before this timestamp (epoch milliseconds) + description: Filter events by time range + title: EventsListParams + examples: + - customer_id: cus_123 + limit: 50 + - feature_id: api_calls + custom_range: + start: 1704067200000 + end: 1706745600000 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + list: + type: array + items: + type: object + properties: + id: + type: string + description: Event ID (KSUID) + timestamp: + type: number + description: Event timestamp (epoch milliseconds) + feature_id: + type: string + description: ID of the feature that the event belongs to + customer_id: + type: string + description: Customer identifier + value: + type: number + description: Event value/count + properties: + type: object + description: Event properties (JSONB) + required: + - id + - timestamp + - feature_id + - customer_id + - value + - properties + description: Array of items for current page + has_more: + type: boolean + description: Whether more results exist after this page + offset: + type: number + description: Current offset position + limit: + type: number + description: Limit passed in the request + total: + type: number + description: Total number of items returned in the current page + required: + - list + - has_more + - offset + - limit + - total + examples: + - list: + - id: evt_36xpk2TmuQX5zVPPQ8tCtnR5Weg + timestamp: 1765958215459 + feature_id: credits + customer_id: 0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx + value: 30 + properties: {} + - id: evt_36xmHxxjAkqxufDf9yHAPNfRrLM + timestamp: 1765956512057 + feature_id: credits + customer_id: 0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx + value: 49 + properties: {} + total: 2 + has_more: false + offset: 0 + limit: 100 + x-speakeasy-name-override: list + parameters: + - *a1 + /v1/events.aggregate: + post: + operationId: aggregateEvents + description: Aggregate usage events by time period. Returns usage totals grouped + by feature and optionally by a custom property. + tags: + - events + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + minLength: 1 + description: Customer ID to aggregate events for + feature_id: + anyOf: + - type: string + minLength: 1 + - type: array + items: + type: string + minLength: 1 + description: Feature ID(s) to aggregate events for + group_by: + type: string + pattern: ^properties\..* + description: Property to group events by. If provided, each key in the response + will be an object with distinct groups as the keys + range: + enum: + - 24h + - 7d + - 30d + - 90d + - last_cycle + - 1bc + - 3bc + description: Time range to aggregate events for. Either range or custom_range + must be provided + bin_size: + enum: + - day + - hour + - month + default: day + description: Size of the time bins to aggregate events for. Defaults to hour if + range is 24h, otherwise day + custom_range: + type: object + properties: + start: + type: number + end: + type: number + required: + - start + - end + description: Custom time range to aggregate events for. If provided, range must + not be provided + required: + - customer_id + - feature_id + title: EventsAggregateParams + examples: + - customer_id: cus_123 + feature_id: api_calls + range: 30d + bin_size: day + - customer_id: cus_123 + feature_id: + - api_calls + - messages + range: 7d + group_by: properties.model + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + list: + type: array + items: + type: object + properties: + period: + type: number + description: Unix timestamp (epoch ms) for this time period + values: + type: object + propertyNames: + type: string + additionalProperties: + type: number + description: "Aggregated values per feature: { [featureId]: number }" + grouped_values: + type: object + propertyNames: + type: string + additionalProperties: + type: object + propertyNames: + type: string + additionalProperties: + type: number + description: "Values broken down by group (only present when group_by is used): + { [featureId]: { [groupValue]: number } }" + required: + - period + - values + description: Array of time periods with aggregated values + total: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + count: + type: number + description: Number of events for this feature + sum: + type: number + description: Sum of event values for this feature + required: + - count + - sum + description: Total aggregations per feature. Keys are feature IDs, values + contain count and sum. + required: + - list + - total + examples: + - list: + - period: 1762905600000 + values: + messages: 10 + sessions: 3 + - period: 1762992000000 + values: + messages: 3 + sessions: 12 + total: + messages: + count: 2 + sum: 13 + sessions: + count: 2 + sum: 15 + - list: + - period: 1762905600000 + values: + messages: 10 + sessions: 3 + grouped_values: + messages: + api: 5 + web: 5 + sessions: + api: 2 + web: 1 + - period: 1762992000000 + values: + messages: 3 + sessions: 12 + grouped_values: + messages: + api: 1 + web: 2 + sessions: + api: 10 + web: 2 + total: + messages: + count: 2 + sum: 13 + sessions: + count: 2 + sum: 15 + x-speakeasy-name-override: aggregate + parameters: + - *a1 + /v1/entities.create: + post: + operationId: createEntity + description: >- + 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. + + + @example + + ```typescript + + // Create a seat entity + + const response = await client.entities.create({ + customerId: "cus_123", + entityId: "seat_42", + featureId: "seats", + name: "Seat 42", + }); + + ``` + + + @param name - The name of the entity (optional) + + @param featureId - The ID of the feature this entity is associated with + + @param customerData - Customer attributes used to resolve the customer + when customer_id is not provided. (optional) + + @param customerId - The ID of the customer to create the entity for. + + @param entityId - The ID of the entity. + + + @returns The created entity object including its current subscriptions, + purchases, and balances. + tags: + - entities + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + anyOf: + - type: string + - type: "null" + description: The name of the entity + feature_id: + type: string + description: The ID of the feature this entity is associated with + customer_data: + $ref: "#/components/schemas/CustomerData" + description: Customer attributes used to resolve the customer when customer_id + is not provided. + customer_id: + type: string + description: The ID of the customer to create the entity for. + entity_id: + type: string + description: The ID of the entity. + required: + - feature_id + - customer_id + - entity_id + title: CreateEntityParams + examples: + - customer_id: cus_123 + entity_id: seat_42 + feature_id: seats + name: Seat 42 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + autumn_id: + type: string + id: + anyOf: + - type: string + - type: "null" + description: The unique identifier of the entity + name: + anyOf: + - type: string + - type: "null" + description: The name of the entity + customer_id: + anyOf: + - type: string + - type: "null" + description: The customer ID this entity belongs to + feature_id: + anyOf: + - type: string + - type: "null" + description: The feature ID this entity belongs to + created_at: + type: number + description: Unix timestamp when the entity was created + env: + enum: + - sandbox + - live + description: The environment (sandbox/live) + subscriptions: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. + plan_id: + type: string + description: The unique identifier of the subscribed plan. + auto_enable: + type: boolean + description: Whether the plan was automatically enabled for the customer. + add_on: + type: boolean + description: Whether this is an add-on plan rather than a base subscription. + status: + enum: + - active + - scheduled + description: Current status of the subscription. + past_due: + type: boolean + description: Whether the subscription has overdue payments. + canceled_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the subscription was canceled, or null if not + canceled. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry + set. + trial_ends_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. + started_at: + type: number + description: Timestamp when the subscription started. + current_period_start: + anyOf: + - type: number + - type: "null" + description: Start timestamp of the current billing period. + current_period_end: + anyOf: + - type: number + - type: "null" + description: End timestamp of the current billing period. + quantity: + type: number + description: Number of units of this subscription (for per-seat plans). + required: + - plan_id + - auto_enable + - add_on + - status + - past_due + - canceled_at + - expires_at + - trial_ends_at + - started_at + - current_period_start + - current_period_end + - quantity + purchases: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. + plan_id: + type: string + description: The unique identifier of the purchased plan. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. + started_at: + type: number + description: Timestamp when the purchase was made. + quantity: + type: number + description: Number of units purchased. + required: + - plan_id + - expires_at + - started_at + - quantity + balances: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + feature_id: + type: string + description: The feature ID this balance is for. + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived + description: The full feature object if expanded. + granted: + type: number + description: Total balance granted (included + prepaid). + remaining: + type: number + minimum: 0 + description: Remaining balance available for use. + usage: + type: number + description: Total usage consumed in the current period. + unlimited: + type: boolean + description: Whether this feature has unlimited usage. + overage_allowed: + type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. + next_reset_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the balance will reset, or null for no reset. + breakdown: + type: array + items: + type: object + properties: + id: + type: string + default: "" + description: The unique identifier for this balance breakdown. + plan_id: + anyOf: + - type: string + - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. + included_grant: + type: number + description: Amount granted from the plan's included usage. + prepaid_grant: + type: number + description: Amount granted from prepaid purchases or top-ups. + remaining: + type: number + description: Remaining balance available for use. + usage: + type: number + description: Amount consumed in the current period. + unlimited: + type: boolean + description: Whether this balance has unlimited usage. + reset: + anyOf: + - type: object + properties: + interval: + anyOf: + - enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. + interval_count: + type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). + resets_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the balance will next reset. + required: + - interval + - resets_at + - type: "null" + description: Reset configuration for this balance, or null if no reset. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: The per-unit price amount. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration if applicable. + billing_units: + type: number + description: The number of units per billing increment (eg. $9 / 250 units). + billing_method: + enum: + - prepaid + - usage_based + description: Whether usage is prepaid or billed pay-per-use. + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. + required: + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration if this balance has usage-based pricing. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when this balance expires, or null for no expiration. + required: + - plan_id + - included_grant + - prepaid_grant + - remaining + - usage + - unlimited + - reset + - price + - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. + rollovers: + type: array + items: + type: object + properties: + balance: + type: number + description: Amount of balance rolled over from a previous period. + expires_at: + type: number + description: Timestamp when the rollover balance expires. + required: + - balance + - expires_at + description: Rollover balances carried over from previous periods. + required: + - feature_id + - granted + - remaining + - usage + - unlimited + - overage_allowed + - max_purchase + - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + invoices: + type: array + items: + type: object + properties: + plan_ids: + type: array + items: + type: string + description: Array of plan IDs included in this invoice + stripe_id: + type: string + description: The Stripe invoice ID + status: + type: string + description: The status of the invoice + total: + type: number + description: The total amount of the invoice + currency: + type: string + description: The currency code for the invoice + created_at: + type: number + description: Timestamp when the invoice was created + hosted_invoice_url: + anyOf: + - type: string + - type: "null" + description: URL to the Stripe-hosted invoice page + required: + - plan_ids + - stripe_id + - status + - total + - currency + - created_at + description: Invoices for this entity (only included when expand=invoices) + required: + - id + - name + - created_at + - env + - subscriptions + - purchases + - balances + examples: + - id: seat_42 + name: Seat 42 + customer_id: cus_123 + feature_id: seats + created_at: 1771409161016 + env: sandbox + subscriptions: + - plan_id: pro_plan + auto_enable: true + add_on: false + status: active + past_due: false + canceled_at: null + expires_at: null + trial_ends_at: null + started_at: 1771431921437 + current_period_start: 1771431921437 + current_period_end: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + invoices: [] + x-speakeasy-name-override: create + parameters: + - *a1 + /v1/entities.get: + post: + operationId: getEntity + description: >- + Fetches a single entity by entity ID. + + + Use this to read one entity's current state. Pass customerId when you + want to scope the lookup to a specific customer. + + + @example + + ```typescript + + // Fetch a seat entity + + const response = await client.entities.get({ entityId: "seat_42" }); + + ``` + + + @example + + ```typescript + + // Fetch a seat entity for a specific customer + + const response = await client.entities.get({ customerId: "cus_123", + entityId: "seat_42" }); + + ``` + + + @param customerId - The ID of the customer to create the entity for. + (optional) + + @param entityId - The ID of the entity. + + + @returns The entity object including its current subscriptions, + purchases, and balances. + tags: + - entities + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer to create the entity for. + entity_id: + type: string + description: The ID of the entity. + required: + - entity_id + title: GetEntityParams + examples: + - entity_id: seat_42 + - customer_id: cus_123 + entity_id: seat_42 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + autumn_id: + type: string + id: + anyOf: + - type: string + - type: "null" + description: The unique identifier of the entity + name: + anyOf: + - type: string + - type: "null" + description: The name of the entity + customer_id: + anyOf: + - type: string + - type: "null" + description: The customer ID this entity belongs to + feature_id: + anyOf: + - type: string + - type: "null" + description: The feature ID this entity belongs to + created_at: + type: number + description: Unix timestamp when the entity was created + env: + enum: + - sandbox + - live + description: The environment (sandbox/live) + subscriptions: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. + plan_id: + type: string + description: The unique identifier of the subscribed plan. + auto_enable: + type: boolean + description: Whether the plan was automatically enabled for the customer. + add_on: + type: boolean + description: Whether this is an add-on plan rather than a base subscription. + status: + enum: + - active + - scheduled + description: Current status of the subscription. + past_due: + type: boolean + description: Whether the subscription has overdue payments. + canceled_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the subscription was canceled, or null if not + canceled. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry + set. + trial_ends_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. + started_at: + type: number + description: Timestamp when the subscription started. + current_period_start: + anyOf: + - type: number + - type: "null" + description: Start timestamp of the current billing period. + current_period_end: + anyOf: + - type: number + - type: "null" + description: End timestamp of the current billing period. + quantity: + type: number + description: Number of units of this subscription (for per-seat plans). + required: + - plan_id + - auto_enable + - add_on + - status + - past_due + - canceled_at + - expires_at + - trial_ends_at + - started_at + - current_period_start + - current_period_end + - quantity + purchases: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. + plan_id: + type: string + description: The unique identifier of the purchased plan. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. + started_at: + type: number + description: Timestamp when the purchase was made. + quantity: + type: number + description: Number of units purchased. + required: + - plan_id + - expires_at + - started_at + - quantity + balances: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + feature_id: + type: string + description: The feature ID this balance is for. + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived + description: The full feature object if expanded. + granted: + type: number + description: Total balance granted (included + prepaid). + remaining: + type: number + minimum: 0 + description: Remaining balance available for use. + usage: + type: number + description: Total usage consumed in the current period. + unlimited: + type: boolean + description: Whether this feature has unlimited usage. + overage_allowed: + type: boolean + description: Whether usage beyond the granted balance is allowed (with overage + charges). + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for + unlimited. + next_reset_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the balance will reset, or null for no reset. + breakdown: + type: array + items: + type: object + properties: + id: + type: string + default: "" + description: The unique identifier for this balance breakdown. + plan_id: + anyOf: + - type: string + - type: "null" + description: The plan ID this balance originates from, or null for standalone + balances. + included_grant: + type: number + description: Amount granted from the plan's included usage. + prepaid_grant: + type: number + description: Amount granted from prepaid purchases or top-ups. + remaining: + type: number + description: Remaining balance available for use. + usage: + type: number + description: Amount consumed in the current period. + unlimited: + type: boolean + description: Whether this balance has unlimited usage. + reset: + anyOf: + - type: object + properties: + interval: + anyOf: + - enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if + combined from different intervals. + interval_count: + type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). + resets_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the balance will next reset. + required: + - interval + - resets_at + - type: "null" + description: Reset configuration for this balance, or null if no reset. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: The per-unit price amount. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration if applicable. + billing_units: + type: number + description: The number of units per billing increment (eg. $9 / 250 units). + billing_method: + enum: + - prepaid + - usage_based + description: Whether usage is prepaid or billed pay-per-use. + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. + required: + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration if this balance has usage-based pricing. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when this balance expires, or null for no expiration. + required: + - plan_id + - included_grant + - prepaid_grant + - remaining + - usage + - unlimited + - reset + - price + - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans + or grants. + rollovers: + type: array + items: + type: object + properties: + balance: + type: number + description: Amount of balance rolled over from a previous period. + expires_at: + type: number + description: Timestamp when the rollover balance expires. + required: + - balance + - expires_at + description: Rollover balances carried over from previous periods. + required: + - feature_id + - granted + - remaining + - usage + - unlimited + - overage_allowed + - max_purchase + - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + invoices: + type: array + items: + type: object + properties: + plan_ids: + type: array + items: + type: string + description: Array of plan IDs included in this invoice + stripe_id: + type: string + description: The Stripe invoice ID + status: + type: string + description: The status of the invoice + total: + type: number + description: The total amount of the invoice + currency: + type: string + description: The currency code for the invoice + created_at: + type: number + description: Timestamp when the invoice was created + hosted_invoice_url: + anyOf: + - type: string + - type: "null" + description: URL to the Stripe-hosted invoice page + required: + - plan_ids + - stripe_id + - status + - total + - currency + - created_at + description: Invoices for this entity (only included when expand=invoices) + required: + - id + - name + - created_at + - env + - subscriptions + - purchases + - balances + examples: + - id: seat_42 + name: Seat 42 + customer_id: cus_123 + feature_id: seats + created_at: 1771409161016 + env: sandbox + subscriptions: + - plan_id: pro_plan + auto_enable: true + add_on: false + status: active + past_due: false + canceled_at: null + expires_at: null + trial_ends_at: null + started_at: 1771431921437 + current_period_start: 1771431921437 + current_period_end: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + invoices: [] + x-speakeasy-name-override: get + parameters: + - *a1 + /v1/entities.delete: + post: + operationId: deleteEntity + description: >- + Deletes an entity by entity ID. + + + Use this when the underlying resource is removed and you no longer want + entity-scoped balances or subscriptions tracked for it. + + + @example + + ```typescript + + // Delete a seat entity + + const response = await client.entities.delete({ entityId: "seat_42" }); + + ``` + + + @param customerId - The ID of the customer. (optional) + + @param entityId - The ID of the entity. + + + @returns A success flag indicating the entity was deleted. + tags: + - entities + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer. + entity_id: + type: string + description: The ID of the entity. + required: + - entity_id + title: DeleteEntityParams + examples: + - customer_id: cus_123 + entity_id: seat_42 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + required: + - success + examples: + - success: true + x-speakeasy-name-override: delete + parameters: + - *a1 + /v1/referrals.create_code: + post: + operationId: createReferralCode + description: Create or fetch a referral code for a customer in a referral program. + tags: + - referrals + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The unique identifier of the customer + program_id: + type: string + description: ID of your referral program + required: + - customer_id + - program_id + title: CreateReferralCodeParams + examples: + - customer_id: cus_123 + program_id: prog_123 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + code: + type: string + description: The referral code that can be shared with customers + customer_id: + type: string + description: Your unique identifier for the customer + created_at: + type: number + description: The timestamp of when the referral code was created + required: + - code + - customer_id + - created_at + examples: + - code: + customer_id: + created_at: 123 + x-speakeasy-name-override: createCode + parameters: + - *a1 + /v1/referrals.redeem_code: + post: + operationId: redeemReferralCode + description: Redeem a referral code for a customer. + tags: + - referrals + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + code: + type: string + description: The referral code to redeem + customer_id: + type: string + description: The unique identifier of the customer redeeming the code + required: + - code + - customer_id + title: RedeemReferralCodeParams + examples: + - code: REF123 + customer_id: cus_456 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The ID of the redemption event + customer_id: + type: string + description: Your unique identifier for the customer + reward_id: + type: string + description: The ID of the reward that will be granted + required: + - id + - customer_id + - reward_id + examples: + - id: + customer_id: + reward_id: + x-speakeasy-name-override: redeemCode + parameters: + - *a1 security: - secretKey: [] x-speakeasy-globals: diff --git a/packages/openapi/prevVersions/openapi1.2/entitiesOpenApi.ts b/packages/openapi/prevVersions/openapi1.2/entitiesOpenApi.ts index ab31e9fbe..e0826f935 100644 --- a/packages/openapi/prevVersions/openapi1.2/entitiesOpenApi.ts +++ b/packages/openapi/prevVersions/openapi1.2/entitiesOpenApi.ts @@ -1,9 +1,12 @@ +import { SuccessResponseSchema } from "@api/common"; +import { CreateEntityParamsV0Schema } from "@api/entities/crud/createEntityParams"; +import { + API_ENTITY_V0_EXAMPLE, + ApiEntityV0Schema, + queryStringArray, +} from "@autumn/shared"; import { EntityExpandV0 } from "@models/cusModels/entityModels/entityExpand.js"; import { z } from "zod/v4"; -import { SuccessResponseSchema } from "../../../common/commonResponses.js"; -import { queryStringArray } from "../../../common/queryHelpers.js"; -import { CreateEntityParamsSchema } from "../../../entities/entityOpModels.js"; -import { API_ENTITY_V0_EXAMPLE, ApiEntityV0Schema } from "../../../models.js"; // Note: The meta with id is added in openapi.ts to avoid duplicate registration // This schema is exported through the main index and should not have an id here @@ -24,7 +27,7 @@ export const entitiesOpenApi = { }, requestBody: { content: { - "application/json": { schema: CreateEntityParamsSchema }, + "application/json": { schema: CreateEntityParamsV0Schema }, }, }, responses: { diff --git a/packages/openapi/utils/apiReferenceGenerator/parseOpenApi.ts b/packages/openapi/utils/apiReferenceGenerator/parseOpenApi.ts index 83938dede..f511b1913 100644 --- a/packages/openapi/utils/apiReferenceGenerator/parseOpenApi.ts +++ b/packages/openapi/utils/apiReferenceGenerator/parseOpenApi.ts @@ -61,7 +61,7 @@ export function parseOpenApi({ const operation = operationObj as Record; const operationId = operation.operationId as string | undefined; const tags = operation.tags as string[] | undefined; - const tag = tags?.[0] ?? "misc"; + const tag = tags?.[0] ?? "core"; if (!operationId) continue; @@ -130,9 +130,10 @@ export function parseOpenApi({ } // Extract response example (could be at content level or schema level) + const examples = jsonContent?.examples as unknown[] | undefined; const example = jsonContent?.example ?? - jsonContent?.examples?.[0] ?? + (Array.isArray(examples) ? examples[0] : undefined) ?? resolveSchemaExample({ schema: schema ?? {}, schemas }); if (example) { parsed.responseExamples[statusCode] = example; @@ -245,25 +246,13 @@ function parseSchema({ } // Handle object type - if (schema.type === "object" && schema.properties) { - const properties = schema.properties as Record; - const fields: SchemaField[] = []; - - for (const [propName, propSchema] of Object.entries(properties)) { - const prop = propSchema as Record; - const field = parseField({ - name: propName, - schema: prop, - schemas, - required: requiredFields.includes(propName), - visited: new Set(visited), - }); - if (field) { - fields.push(field); - } - } - - return fields; + if (schema.type === "object") { + return parseObjectFields({ + schema, + schemas, + requiredFields, + visited, + }); } // Handle array type - return the items as a single field @@ -309,6 +298,7 @@ function parseField({ required: boolean; visited: Set; }): SchemaField | null { + let resolvedName = name; let type = resolveType(schema, schemas); let description = schema.description as string | undefined; let children: SchemaField[] | undefined; @@ -392,13 +382,32 @@ function parseField({ } // Handle nested object - if (schema.type === "object" && schema.properties) { - children = parseSchema({ + if (schema.type === "object") { + children = parseObjectFields({ schema, schemas, requiredFields: (schema.required as string[]) ?? [], visited, }); + + // Flatten pure record objects from: + // field -> {key} -> value fields + // into: + // field.{key} -> value fields + const hasInlineProperties = + !!schema.properties && + typeof schema.properties === "object" && + !Array.isArray(schema.properties) && + Object.keys(schema.properties as Record).length > 0; + if ( + !hasInlineProperties && + children.length === 1 && + children[0]?.name === "{key}" + ) { + resolvedName = `${name}.{key}`; + type = children[0].type; + children = children[0].children; + } } // Handle array @@ -433,19 +442,15 @@ function parseField({ } } - // Check if array items have properties (inline object) - if (items.type === "object" && items.properties) { - children = parseSchema({ - schema: items, - schemas, - requiredFields: (items.required as string[]) ?? [], - visited, - }); - } + children = getArrayItemChildren({ + items, + schemas, + visited, + }); } return { - name, + name: resolvedName, type, description, required, @@ -454,6 +459,195 @@ function parseField({ }; } +function parseObjectFields({ + schema, + schemas, + requiredFields, + visited, +}: { + schema: Record; + schemas: Record; + requiredFields: string[]; + visited: Set; +}): SchemaField[] { + const fields: SchemaField[] = []; + const properties = schema.properties as Record | undefined; + + if (properties) { + for (const [propName, propSchema] of Object.entries(properties)) { + const prop = propSchema as Record; + const field = parseField({ + name: propName, + schema: prop, + schemas, + required: requiredFields.includes(propName), + visited: new Set(visited), + }); + if (field) { + fields.push(field); + } + } + } + + const additionalProperties = schema.additionalProperties; + const recordValueSchema = getRecordValueSchema({ + additionalProperties, + }); + if (recordValueSchema) { + const keyField = parseField({ + name: "{key}", + schema: recordValueSchema, + schemas, + required: false, + visited: new Set(visited), + }); + if (keyField) { + fields.push(keyField); + } + } + + return fields; +} + +function getRecordValueSchema({ + additionalProperties, +}: { + additionalProperties: unknown; +}): Record | null { + if ( + !additionalProperties || + typeof additionalProperties !== "object" || + Array.isArray(additionalProperties) + ) { + return null; + } + + const recordValueSchema = additionalProperties as Record; + if (Object.keys(recordValueSchema).length === 0) { + return null; + } + + return recordValueSchema; +} + +function getArrayItemChildren({ + items, + schemas, + visited, +}: { + items: Record; + schemas: Record; + visited: Set; +}): SchemaField[] | undefined { + // Direct object items + if (items.type === "object") { + const objectChildren = parseObjectFields({ + schema: items, + schemas, + requiredFields: (items.required as string[]) ?? [], + visited: new Set(visited), + }); + if (objectChildren.length > 0) { + return objectChildren; + } + } + + // Referenced object items + if (items.$ref) { + const refPath = items.$ref as string; + const refName = refPath.replace("#/components/schemas/", ""); + const refSchema = schemas[refName] as Record | undefined; + if (refSchema?.type === "object") { + const objectChildren = parseObjectFields({ + schema: refSchema, + schemas, + requiredFields: (refSchema.required as string[]) ?? [], + visited: new Set(visited), + }); + if (objectChildren.length > 0) { + return objectChildren; + } + } + } + + // Union object items (e.g. anyOf reward_id | promotion_code) + const variantsRaw = items.anyOf ?? items.oneOf; + if (Array.isArray(variantsRaw) && variantsRaw.length > 0) { + const mergedByName = new Map(); + + for (const variant of variantsRaw) { + if (typeof variant !== "object" || variant === null) { + continue; + } + const variantSchema = variant as Record; + const variantType = resolveType(variantSchema, schemas); + if (variantType !== "object") { + continue; + } + + const variantFields = parseSchema({ + schema: variantSchema, + schemas, + requiredFields: (variantSchema.required as string[]) ?? [], + visited: new Set(visited), + }); + + for (const variantField of variantFields) { + const existing = mergedByName.get(variantField.name); + if (!existing) { + mergedByName.set(variantField.name, { + ...variantField, + required: false, + }); + continue; + } + + const mergedType = mergeFieldTypes({ + left: existing.type, + right: variantField.type, + }); + mergedByName.set(variantField.name, { + ...existing, + type: mergedType, + description: existing.description ?? variantField.description, + children: existing.children ?? variantField.children, + enumValues: existing.enumValues ?? variantField.enumValues, + required: false, + }); + } + } + + const mergedFields = [...mergedByName.values()]; + if (mergedFields.length > 0) { + return mergedFields; + } + } + + return undefined; +} + +function mergeFieldTypes({ + left, + right, +}: { + left: string; + right: string; +}): string { + if (left === right) { + return left; + } + + const typeSet = new Set(); + for (const part of [...left.split("|"), ...right.split("|")]) { + const trimmed = part.trim(); + if (trimmed.length > 0) { + typeSet.add(trimmed); + } + } + + return [...typeSet].join(" | "); +} + /** * Resolve the type string for a schema. */ @@ -482,11 +676,18 @@ function resolveType( string, unknown >[]; - const nonNullVariant = variants.find((v) => v.type !== "null"); - if (nonNullVariant) { - return resolveType(nonNullVariant, schemas); + const nonNullVariants = variants.filter((v) => v.type !== "null"); + + if (nonNullVariants.length === 0) { + return "any"; } - return "any"; + + if (nonNullVariants.length === 1) { + return resolveType(nonNullVariants[0], schemas); + } + + const types = nonNullVariants.map((v) => resolveType(v, schemas)); + return types.join(" | "); } if (schema.type === "array") { diff --git a/packages/openapi/utils/zodSchemaGeneration.ts b/packages/openapi/utils/zodSchemaGeneration.ts index 64755bea3..25565cf74 100644 --- a/packages/openapi/utils/zodSchemaGeneration.ts +++ b/packages/openapi/utils/zodSchemaGeneration.ts @@ -16,7 +16,24 @@ const SCHEMA_SOURCES: SchemaSource[] = [ outputFile: "getOrCreateCustomerSchemas.ts", }, { sdkFile: "billing-attach-op.ts", outputFile: "billingAttachSchemas.ts" }, + { + sdkFile: "open-customer-portal-op.ts", + outputFile: "openCustomerPortalSchemas.ts", + }, { sdkFile: "list-plans-op.ts", outputFile: "listPlansSchemas.ts" }, + { sdkFile: "list-events-op.ts", outputFile: "listEventsSchemas.ts" }, + { + sdkFile: "aggregate-events-op.ts", + outputFile: "aggregateEventsSchemas.ts", + }, + { + sdkFile: "create-referral-code-op.ts", + outputFile: "createReferralCodeSchemas.ts", + }, + { + sdkFile: "redeem-referral-code-op.ts", + outputFile: "redeemReferralCodeSchemas.ts", + }, ]; /** diff --git a/packages/openapi/v2.0/entitiesOpenApi.ts b/packages/openapi/v2.0/entitiesOpenApi.ts index c2551ca6b..301b7f07f 100644 --- a/packages/openapi/v2.0/entitiesOpenApi.ts +++ b/packages/openapi/v2.0/entitiesOpenApi.ts @@ -1,9 +1,8 @@ +import { SuccessResponseSchema } from "@api/common"; +import { CreateEntityParamsV0Schema } from "@api/entities/crud/createEntityParams"; +import { ApiEntitySchema, queryStringArray } from "@autumn/shared"; import { EntityExpand } from "@models/cusModels/entityModels/entityExpand.js"; import { z } from "zod/v4"; -import { SuccessResponseSchema } from "../../common/commonResponses.js"; -import { queryStringArray } from "../../common/queryHelpers.js"; -import { ApiEntitySchema } from "../../entities/apiEntity.js"; -import { CreateEntityParamsSchema } from "../../entities/entityOpModels.js"; // Note: The meta with id is added in openapi.ts to avoid duplicate registration // This schema is exported through the main index and should not have an id here @@ -24,7 +23,7 @@ export const entitiesOpenApi = { }, requestBody: { content: { - "application/json": { schema: CreateEntityParamsSchema }, + "application/json": { schema: CreateEntityParamsV0Schema }, }, }, responses: { diff --git a/packages/openapi/v2.1/contracts/balancesContract.ts b/packages/openapi/v2.1/contracts/balancesContract.ts index f57f14fc1..617b4bff9 100644 --- a/packages/openapi/v2.1/contracts/balancesContract.ts +++ b/packages/openapi/v2.1/contracts/balancesContract.ts @@ -1,19 +1,101 @@ import { SuccessResponseSchema } from "@api/common/commonResponses.js"; import { + API_BALANCE_V1_EXAMPLE, CheckResponseV3Schema, CreateBalanceParamsV0Schema, ExtCheckParamsSchema, TrackParamsSchema, TrackResponseV3Schema, - UpdateBalanceParamsSchema, + UpdateBalanceParamsV0Schema, } from "@autumn/shared"; import { oc } from "@orpc/contract"; +import { + balancesCheckJsDoc, + balancesTrackJsDoc, +} from "../jsDocs/balancesJsDocs"; + +export const balancesCheckContract = oc + .route({ + method: "POST", + path: "/v1/balances.check", + operationId: "check", + description: balancesCheckJsDoc, + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "check", + }), + }) + .input( + ExtCheckParamsSchema.meta({ + title: "CheckParams", + examples: [ + { + customer_id: "cus_123", + feature_id: "messages", + }, + { + customer_id: "cus_123", + feature_id: "messages", + required_balance: 3, + send_event: true, + }, + ], + }), + ) + .output( + CheckResponseV3Schema.meta({ + examples: [ + { + allowed: true, + customer_id: "cus_123", + entity_id: null, + required_balance: 1, + balance: API_BALANCE_V1_EXAMPLE, + }, + ], + }), + ); + +export const balancesTrackContract = oc + .route({ + method: "POST", + path: "/v1/balances.track", + operationId: "track", + description: balancesTrackJsDoc, + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "track", + }), + }) + .input( + TrackParamsSchema.meta({ + title: "TrackParams", + examples: [ + { + customer_id: "cus_123", + feature_id: "messages", + value: 1, + }, + ], + }), + ) + .output( + TrackResponseV3Schema.meta({ + examples: [ + { + customer_id: "cus_123", + value: 1, + balance: API_BALANCE_V1_EXAMPLE, + }, + ], + }), + ); export const balancesCreateContract = oc .route({ method: "POST", path: "/v1/balances.create", - operationId: "balancesCreate", + operationId: "createBalance", tags: ["balances"], description: "Create a balance for a customer feature.", spec: (spec) => ({ @@ -21,14 +103,28 @@ export const balancesCreateContract = oc "x-speakeasy-name-override": "create", }), }) - .input(CreateBalanceParamsV0Schema) + .input( + CreateBalanceParamsV0Schema.meta({ + title: "CreateBalanceParams", + examples: [ + { + customer_id: "cus_123", + feature_id: "api_calls", + included: 1000, + reset: { + interval: "month", + }, + }, + ], + }), + ) .output(SuccessResponseSchema); export const balancesUpdateContract = oc .route({ method: "POST", path: "/v1/balances.update", - operationId: "balancesUpdate", + operationId: "updateBalance", tags: ["balances"], description: "Update a customer balance.", spec: (spec) => ({ @@ -36,35 +132,16 @@ export const balancesUpdateContract = oc "x-speakeasy-name-override": "update", }), }) - .input(UpdateBalanceParamsSchema) + .input( + UpdateBalanceParamsV0Schema.meta({ + title: "UpdateBalanceParams", + examples: [ + { + customer_id: "cus_123", + feature_id: "api_calls", + remaining: 5, + }, + ], + }), + ) .output(SuccessResponseSchema); - -export const balancesCheckContract = oc - .route({ - method: "POST", - path: "/v1/balances.check", - operationId: "balancesCheck", - tags: ["balances"], - description: "Check whether usage is allowed for a customer feature.", - spec: (spec) => ({ - ...spec, - "x-speakeasy-name-override": "check", - }), - }) - .input(ExtCheckParamsSchema) - .output(CheckResponseV3Schema); - -export const balancesTrackContract = oc - .route({ - method: "POST", - path: "/v1/balances.track", - operationId: "balancesTrack", - tags: ["balances"], - description: "Track usage for a customer feature.", - spec: (spec) => ({ - ...spec, - "x-speakeasy-name-override": "track", - }), - }) - .input(TrackParamsSchema) - .output(TrackResponseV3Schema); diff --git a/packages/openapi/v2.1/contracts/billingContract.ts b/packages/openapi/v2.1/contracts/billingContract.ts index 506b1f8be..4063e88d9 100644 --- a/packages/openapi/v2.1/contracts/billingContract.ts +++ b/packages/openapi/v2.1/contracts/billingContract.ts @@ -1,14 +1,20 @@ import { AttachParamsV1Schema, - AttachPreviewResponseSchema, + BILLING_PREVIEW_RESPONSE_EXAMPLE, BillingResponseSchema, - PreviewUpdateSubscriptionResponseSchema, - SetupPaymentParamsSchema, - SetupPaymentResultSchema, - UpdateSubscriptionV1ParamsSchema, + ExtAttachPreviewResponseSchema, + ExtPreviewUpdateSubscriptionResponseSchema, + ExtUpdateSubscriptionV1ParamsSchema, + OpenCustomerPortalParamsV1Schema, + OpenCustomerPortalResponseSchema, } from "@autumn/shared"; import { oc } from "@orpc/contract"; -import { billingAttachJsDoc } from "../jsDocs/billingJsDocs"; +import { + billingAttachJsDoc, + billingPreviewAttachJsDoc, + billingPreviewUpdateJsDoc, + billingUpdateJsDoc, +} from "../jsDocs/billingJsDocs"; export const billingAttachContract = oc .route({ @@ -22,23 +28,27 @@ export const billingAttachContract = oc "x-speakeasy-name-override": "attach", }), }) - .input(AttachParamsV1Schema) - .output(BillingResponseSchema); - -export const billingPreviewAttachContract = oc - .route({ - method: "POST", - path: "/v1/billing.preview_attach", - operationId: "billingPreviewAttach", - tags: ["billing"], - description: "Preview billing changes before attaching a plan.", - spec: (spec) => ({ - ...spec, - "x-speakeasy-name-override": "previewAttach", + .input( + AttachParamsV1Schema.meta({ + title: "AttachParams", + examples: [ + { + customer_id: "cus_123", + plan_id: "pro_plan", + }, + ], }), - }) - .input(AttachParamsV1Schema) - .output(AttachPreviewResponseSchema); + ) + .output( + BillingResponseSchema.meta({ + examples: [ + { + customer_id: "cus_123", + payment_url: "https://checkout.stripe.com/...", + }, + ], + }), + ); export const billingUpdateContract = oc .route({ @@ -46,41 +56,132 @@ export const billingUpdateContract = oc path: "/v1/billing.update", operationId: "billingUpdate", tags: ["billing"], - description: "Update an existing subscription.", + description: billingUpdateJsDoc, spec: (spec) => ({ ...spec, "x-speakeasy-name-override": "update", }), }) - .input(UpdateSubscriptionV1ParamsSchema) - .output(BillingResponseSchema); + .input( + ExtUpdateSubscriptionV1ParamsSchema.meta({ + title: "UpdateSubscriptionParams", + examples: [ + { + customer_id: "cus_123", + plan_id: "pro_plan", + feature_quantities: [{ feature_id: "seats", quantity: 10 }], + }, + ], + }), + ) + .output( + BillingResponseSchema.meta({ + examples: [ + { + customer_id: "cus_123", + invoice: { + status: "paid", + stripe_id: "in_1234", + total: 1500, + currency: "usd", + hosted_invoice_url: "https://invoice.stripe.com/...", + }, + payment_url: null, + }, + ], + }), + ); + +export const billingPreviewAttachContract = oc + .route({ + method: "POST", + path: "/v1/billing.preview_attach", + operationId: "previewAttach", + tags: ["billing"], + description: billingPreviewAttachJsDoc, + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "previewAttach", + }), + }) + .input( + AttachParamsV1Schema.meta({ + title: "PreviewAttachParams", + examples: [ + { + customer_id: "cus_123", + plan_id: "pro_plan", + }, + ], + }), + ) + .output( + ExtAttachPreviewResponseSchema.meta({ + examples: [BILLING_PREVIEW_RESPONSE_EXAMPLE], + }), + ); export const billingPreviewUpdateContract = oc .route({ method: "POST", path: "/v1/billing.preview_update", - operationId: "billingPreviewUpdate", + operationId: "previewUpdate", tags: ["billing"], - description: "Preview billing changes before updating a subscription.", + description: billingPreviewUpdateJsDoc, spec: (spec) => ({ ...spec, "x-speakeasy-name-override": "previewUpdate", }), }) - .input(UpdateSubscriptionV1ParamsSchema) - .output(PreviewUpdateSubscriptionResponseSchema); + .input( + ExtUpdateSubscriptionV1ParamsSchema.meta({ + title: "PreviewUpdateParams", + examples: [ + { + customer_id: "cus_123", + plan_id: "pro_plan", + feature_quantities: [{ feature_id: "seats", quantity: 15 }], + }, + ], + }), + ) + .output( + ExtPreviewUpdateSubscriptionResponseSchema.meta({ + examples: [BILLING_PREVIEW_RESPONSE_EXAMPLE], + }), + ); -export const billingSetupPaymentContract = oc +export const billingOpenCustomerPortalContract = oc .route({ method: "POST", - path: "/v1/billing.setup_payment", - operationId: "billingSetupPayment", + path: "/v1/billing.open_customer_portal", + operationId: "openCustomerPortal", tags: ["billing"], - description: "Create a setup payment session for a customer.", + description: + "Create a billing portal session for a customer to manage their subscription.", spec: (spec) => ({ ...spec, - "x-speakeasy-name-override": "setupPayment", + "x-speakeasy-name-override": "openCustomerPortal", }), }) - .input(SetupPaymentParamsSchema) - .output(SetupPaymentResultSchema); + .input( + OpenCustomerPortalParamsV1Schema.meta({ + title: "OpenCustomerPortalParams", + examples: [ + { + customer_id: "cus_123", + return_url: "https://useautumn.com", + }, + ], + }), + ) + .output( + OpenCustomerPortalResponseSchema.meta({ + examples: [ + { + customer_id: "cus_123", + url: "https://billing.stripe.com/session/...", + }, + ], + }), + ); diff --git a/packages/openapi/v2.1/contracts/customersContract.ts b/packages/openapi/v2.1/contracts/customersContract.ts index ec0596885..af0fd749c 100644 --- a/packages/openapi/v2.1/contracts/customersContract.ts +++ b/packages/openapi/v2.1/contracts/customersContract.ts @@ -1,5 +1,6 @@ import { createPagePaginatedResponseSchema } from "@api/common/pagePaginationSchemas.js"; import { + API_CUSTOMER_V5_EXAMPLE, ApiCustomerV5Schema, BaseApiCustomerV5Schema, } from "@api/customers/apiCustomerV5.js"; @@ -62,7 +63,19 @@ export const listCustomersContract = oc ], }), ) - .output(createPagePaginatedResponseSchema(BaseApiCustomerV5Schema)); + .output( + createPagePaginatedResponseSchema(BaseApiCustomerV5Schema).meta({ + examples: [ + { + list: [API_CUSTOMER_V5_EXAMPLE], + has_more: false, + offset: 0, + total: 1, + limit: 10, + }, + ], + }), + ); export const updateCustomerContract = oc .route({ diff --git a/packages/openapi/v2.1/contracts/entitiesContract.ts b/packages/openapi/v2.1/contracts/entitiesContract.ts new file mode 100644 index 000000000..3b20825d9 --- /dev/null +++ b/packages/openapi/v2.1/contracts/entitiesContract.ts @@ -0,0 +1,136 @@ +import { SuccessResponseSchema } from "@api/common/commonResponses.js"; +import { + API_BALANCE_V1_EXAMPLE, + ApiEntityV2Schema, + CreateEntityParamsV1Schema, + DeleteEntityParamsV0Schema, + GetEntityParamsV0Schema, +} from "@autumn/shared"; +import { oc } from "@orpc/contract"; +import { + createEntityJsDoc, + deleteEntityJsDoc, + getEntityJsDoc, +} from "../jsDocs/entityJsDocs"; + +const API_ENTITY_V2_EXAMPLE = { + id: "seat_42", + name: "Seat 42", + customer_id: "cus_123", + feature_id: "seats", + created_at: 1771409161016, + env: "sandbox", + subscriptions: [ + { + plan_id: "pro_plan", + auto_enable: true, + add_on: false, + status: "active", + past_due: false, + canceled_at: null, + expires_at: null, + trial_ends_at: null, + started_at: 1771431921437, + current_period_start: 1771431921437, + current_period_end: 1771999921437, + quantity: 1, + }, + ], + purchases: [], + balances: { + messages: API_BALANCE_V1_EXAMPLE, + }, + invoices: [], +}; + +export const createEntityContract = oc + .route({ + method: "POST", + path: "/v1/entities.create", + operationId: "createEntity", + tags: ["entities"], + description: createEntityJsDoc, + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "create", + }), + }) + .input( + CreateEntityParamsV1Schema.meta({ + title: "CreateEntityParams", + examples: [ + { + customer_id: "cus_123", + entity_id: "seat_42", + feature_id: "seats", + name: "Seat 42", + }, + ], + }), + ) + .output( + ApiEntityV2Schema.meta({ + examples: [API_ENTITY_V2_EXAMPLE], + }), + ); + +export const getEntityContract = oc + .route({ + method: "POST", + path: "/v1/entities.get", + operationId: "getEntity", + tags: ["entities"], + description: getEntityJsDoc, + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "get", + }), + }) + .input( + GetEntityParamsV0Schema.meta({ + title: "GetEntityParams", + examples: [ + { + entity_id: "seat_42", + }, + { + customer_id: "cus_123", + entity_id: "seat_42", + }, + ], + }), + ) + .output( + ApiEntityV2Schema.meta({ + examples: [API_ENTITY_V2_EXAMPLE], + }), + ); + +export const deleteEntityContract = oc + .route({ + method: "POST", + path: "/v1/entities.delete", + operationId: "deleteEntity", + tags: ["entities"], + description: deleteEntityJsDoc, + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "delete", + }), + }) + .input( + DeleteEntityParamsV0Schema.meta({ + title: "DeleteEntityParams", + examples: [ + { + customer_id: "cus_123", + entity_id: "seat_42", + }, + ], + }), + ) + .output( + SuccessResponseSchema.meta({ + examples: [{ success: true }], + }), + ); diff --git a/packages/openapi/v2.1/contracts/eventsContract.ts b/packages/openapi/v2.1/contracts/eventsContract.ts new file mode 100644 index 000000000..6316bc773 --- /dev/null +++ b/packages/openapi/v2.1/contracts/eventsContract.ts @@ -0,0 +1,90 @@ +import { ExtEventsAggregateParamsSchema } from "@api/events/aggregate/eventsAggregateParams.js"; +import { + EVENTS_AGGREGATE_EXAMPLE_V1_FLAT, + EVENTS_AGGREGATE_EXAMPLE_V1_GROUPED, + EventsAggregateResponseV1Schema, +} from "@api/events/aggregate/eventsAggregateResponseV1.js"; +import { ApiEventsListParamsSchema } from "@api/events/list/eventsListParams.js"; +import { + ApiEventsListResponseSchema, + EVENTS_LIST_EXAMPLE, +} from "@api/events/list/eventsListResponse.js"; +import { oc } from "@orpc/contract"; + +export const eventsListContract = oc + .route({ + method: "POST", + path: "/v1/events.list", + operationId: "listEvents", + tags: ["events"], + description: + "List usage events for your organization. Filter by customer, feature, or time range.", + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "list", + }), + }) + .input( + ApiEventsListParamsSchema.meta({ + title: "EventsListParams", + examples: [ + { + customer_id: "cus_123", + limit: 50, + }, + { + feature_id: "api_calls", + custom_range: { + start: 1704067200000, + end: 1706745600000, + }, + }, + ], + }), + ) + .output( + ApiEventsListResponseSchema.meta({ + examples: [EVENTS_LIST_EXAMPLE], + }), + ); + +export const eventsAggregateContract = oc + .route({ + method: "POST", + path: "/v1/events.aggregate", + operationId: "aggregateEvents", + tags: ["events"], + description: + "Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property.", + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "aggregate", + }), + }) + .input( + ExtEventsAggregateParamsSchema.meta({ + title: "EventsAggregateParams", + examples: [ + { + customer_id: "cus_123", + feature_id: "api_calls", + range: "30d", + bin_size: "day", + }, + { + customer_id: "cus_123", + feature_id: ["api_calls", "messages"], + range: "7d", + group_by: "properties.model", + }, + ], + }), + ) + .output( + EventsAggregateResponseV1Schema.meta({ + examples: [ + EVENTS_AGGREGATE_EXAMPLE_V1_FLAT, + EVENTS_AGGREGATE_EXAMPLE_V1_GROUPED, + ], + }), + ); diff --git a/packages/openapi/v2.1/contracts/index.ts b/packages/openapi/v2.1/contracts/index.ts index f49e6e9b7..8831d535d 100644 --- a/packages/openapi/v2.1/contracts/index.ts +++ b/packages/openapi/v2.1/contracts/index.ts @@ -7,9 +7,9 @@ import { } from "./balancesContract.js"; import { billingAttachContract, + billingOpenCustomerPortalContract, billingPreviewAttachContract, billingPreviewUpdateContract, - billingSetupPaymentContract, billingUpdateContract, } from "./billingContract.js"; import { @@ -18,7 +18,20 @@ import { listCustomersContract, updateCustomerContract, } from "./customersContract.js"; +import { + createEntityContract, + deleteEntityContract, + getEntityContract, +} from "./entitiesContract.js"; +import { + eventsAggregateContract, + eventsListContract, +} from "./eventsContract.js"; import { listPlansContract } from "./plansContract.js"; +import { + referralsCreateCodeContract, + referralsRedeemCodeContract, +} from "./referralsContract.js"; export const v2_1ContractRouter = oc.router({ // Customers @@ -35,11 +48,24 @@ export const v2_1ContractRouter = oc.router({ billingPreviewAttach: billingPreviewAttachContract, billingUpdate: billingUpdateContract, billingPreviewUpdate: billingPreviewUpdateContract, - billingSetupPayment: billingSetupPaymentContract, + billingOpenCustomerPortal: billingOpenCustomerPortalContract, // Balances balancesCreate: balancesCreateContract, balancesUpdate: balancesUpdateContract, balancesCheck: balancesCheckContract, balancesTrack: balancesTrackContract, + + // Events + eventsList: eventsListContract, + eventsAggregate: eventsAggregateContract, + + // Entities + entitiesCreate: createEntityContract, + entitiesGet: getEntityContract, + entitiesDelete: deleteEntityContract, + + // Referrals + referralsCreateCode: referralsCreateCodeContract, + referralsRedeemCode: referralsRedeemCodeContract, }); diff --git a/packages/openapi/v2.1/contracts/referralsContract.ts b/packages/openapi/v2.1/contracts/referralsContract.ts new file mode 100644 index 000000000..072a22a8b --- /dev/null +++ b/packages/openapi/v2.1/contracts/referralsContract.ts @@ -0,0 +1,78 @@ +import { + CreateReferralCodeParamsSchema, + CreateReferralCodeResponseSchema, + RedeemReferralCodeParamsSchema, + RedeemReferralCodeResponseSchema, +} from "@autumn/shared"; +import { oc } from "@orpc/contract"; + +export const referralsCreateCodeContract = oc + .route({ + method: "POST", + path: "/v1/referrals.create_code", + operationId: "createReferralCode", + tags: ["referrals"], + description: + "Create or fetch a referral code for a customer in a referral program.", + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "createCode", + }), + }) + .input( + CreateReferralCodeParamsSchema.meta({ + title: "CreateReferralCodeParams", + examples: [ + { + customer_id: "cus_123", + program_id: "prog_123", + }, + ], + }), + ) + .output( + CreateReferralCodeResponseSchema.meta({ + examples: [ + { + code: "", + customer_id: "", + created_at: 123, + }, + ], + }), + ); + +export const referralsRedeemCodeContract = oc + .route({ + method: "POST", + path: "/v1/referrals.redeem_code", + operationId: "redeemReferralCode", + tags: ["referrals"], + description: "Redeem a referral code for a customer.", + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "redeemCode", + }), + }) + .input( + RedeemReferralCodeParamsSchema.meta({ + title: "RedeemReferralCodeParams", + examples: [ + { + code: "REF123", + customer_id: "cus_456", + }, + ], + }), + ) + .output( + RedeemReferralCodeResponseSchema.meta({ + examples: [ + { + id: "", + customer_id: "", + reward_id: "", + }, + ], + }), + ); diff --git a/packages/openapi/v2.1/jsDocs/balancesJsDocs.ts b/packages/openapi/v2.1/jsDocs/balancesJsDocs.ts new file mode 100644 index 000000000..c43d43bc0 --- /dev/null +++ b/packages/openapi/v2.1/jsDocs/balancesJsDocs.ts @@ -0,0 +1,60 @@ +import { ExtCheckParamsSchema, TrackParamsSchema } from "@autumn/shared"; +import { createJSDocDescription, example } from "../../utils/jsDocs/index.js"; + +export const balancesCheckJsDoc = createJSDocDescription({ + description: + "Checks whether a customer currently has enough balance to use a feature.", + whenToUse: + "Use this to gate access before a feature action. Enable sendEvent when you want to check and consume balance atomically in one request.", + body: ExtCheckParamsSchema, + examples: [ + example({ + description: "Check access for a feature", + values: { + customerId: "cus_123", + featureId: "messages", + }, + }), + example({ + description: "Check and consume 3 units in one call", + values: { + customerId: "cus_123", + featureId: "messages", + requiredBalance: 3, + sendEvent: true, + }, + }), + ], + methodName: "check", + returns: + "Whether access is allowed, plus the current balance for that feature.", +}); + +export const balancesTrackJsDoc = createJSDocDescription({ + description: + "Records usage for a customer feature and returns updated balances.", + whenToUse: + "Use this after an action happens to decrement usage, or send a negative value to credit balance back.", + body: TrackParamsSchema, + examples: [ + example({ + description: "Track one message event", + values: { + customerId: "cus_123", + featureId: "messages", + value: 1, + }, + }), + example({ + description: "Track an event mapped to multiple features", + values: { + customerId: "cus_123", + eventName: "ai_chat_request", + value: 1, + }, + }), + ], + methodName: "track", + returns: + "The usage value recorded, with either a single updated balance or a map of updated balances.", +}); diff --git a/packages/openapi/v2.1/jsDocs/billingJsDocs.ts b/packages/openapi/v2.1/jsDocs/billingJsDocs.ts index 5aa634a8d..481d17ae5 100644 --- a/packages/openapi/v2.1/jsDocs/billingJsDocs.ts +++ b/packages/openapi/v2.1/jsDocs/billingJsDocs.ts @@ -1,9 +1,14 @@ -import { AttachParamsV1Schema } from "@autumn/shared"; +import { + AttachParamsV1Schema, + UpdateSubscriptionV1ParamsSchema, +} from "@autumn/shared"; import { createJSDocDescription, example } from "../../utils/jsDocs/index.js"; export const billingAttachJsDoc = createJSDocDescription({ description: "Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades.", + whenToUse: + "Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product.", body: AttachParamsV1Schema, examples: [ example({ @@ -13,6 +18,110 @@ export const billingAttachJsDoc = createJSDocDescription({ planId: "pro_plan", }, }), + example({ + description: "Attach with a free trial", + values: { + customerId: "cus_123", + planId: "pro_plan", + freeTrial: { + durationLength: 14, + durationType: "day", + }, + }, + }), + example({ + description: "Attach with custom pricing", + values: { + customerId: "cus_123", + planId: "pro_plan", + customize: { + price: { + amount: 4900, + interval: "month", + }, + }, + }, + }), ], - methodName: "attach", + methodName: "billing.attach", + returns: + "A billing response with customer ID, invoice details, and payment URL (if checkout required).", +}); + +export const billingUpdateJsDoc = createJSDocDescription({ + description: + "Updates an existing subscription. Use to modify feature quantities, cancel, or change plan configuration.", + whenToUse: + "Use this endpoint to update prepaid quantities, cancel a subscription (immediately or at end of cycle), or modify subscription settings.", + body: UpdateSubscriptionV1ParamsSchema, + examples: [ + example({ + description: "Update prepaid feature quantity", + values: { + customerId: "cus_123", + planId: "pro_plan", + featureQuantities: [{ featureId: "seats", quantity: 10 }], + }, + }), + example({ + description: "Cancel a subscription at end of billing cycle", + values: { + customerId: "cus_123", + planId: "pro_plan", + cancelAction: "cancel_end_of_cycle", + }, + }), + example({ + description: "Uncancel a subscription at the end of the billing cycle", + values: { + customerId: "cus_123", + planId: "pro_plan", + cancelAction: "uncancel", + }, + }), + ], + methodName: "billing.update", + returns: + "A billing response with customer ID, invoice details, and payment URL (if next action is required).", +}); + +export const billingPreviewAttachJsDoc = createJSDocDescription({ + description: + "Previews the billing changes that would occur when attaching a plan, without actually making any changes.", + whenToUse: + "Use this endpoint to show customers what they will be charged before confirming a subscription change.", + body: AttachParamsV1Schema, + examples: [ + example({ + description: "Preview attaching a plan", + values: { + customerId: "cus_123", + planId: "pro_plan", + }, + }), + ], + methodName: "billing.previewAttach", + returns: + "A preview response with line items, totals, and effective dates for the proposed changes.", +}); + +export const billingPreviewUpdateJsDoc = createJSDocDescription({ + description: + "Previews the billing changes that would occur when updating a subscription, without actually making any changes.", + whenToUse: + "Use this endpoint to show customers prorated charges or refunds before confirming subscription modifications.", + body: UpdateSubscriptionV1ParamsSchema, + examples: [ + example({ + description: "Preview updating seat quantity", + values: { + customerId: "cus_123", + planId: "pro_plan", + featureQuantities: [{ featureId: "seats", quantity: 15 }], + }, + }), + ], + methodName: "billing.previewUpdate", + returns: + "A preview response with line items showing prorated charges or credits for the proposed changes.", }); diff --git a/packages/openapi/v2.1/jsDocs/entityJsDocs.ts b/packages/openapi/v2.1/jsDocs/entityJsDocs.ts new file mode 100644 index 000000000..66f4dd2dc --- /dev/null +++ b/packages/openapi/v2.1/jsDocs/entityJsDocs.ts @@ -0,0 +1,70 @@ +import { + CreateEntityParamsV1Schema, + DeleteEntityParamsV0Schema, + GetEntityParamsV0Schema, +} from "@autumn/shared"; +import { createJSDocDescription, example } from "../../utils/jsDocs/index.js"; + +export const createEntityJsDoc = createJSDocDescription({ + description: + "Creates an entity for a customer and feature, then returns the entity with balances and subscriptions.", + whenToUse: + "Use entities when usage and access must be scoped to sub-resources (for example seats, projects, or workspaces) instead of only the customer.", + body: CreateEntityParamsV1Schema, + examples: [ + example({ + description: "Create a seat entity", + values: { + customerId: "cus_123", + entityId: "seat_42", + featureId: "seats", + name: "Seat 42", + }, + }), + ], + methodName: "entities.create", + returns: + "The created entity object including its current subscriptions, purchases, and balances.", +}); + +export const getEntityJsDoc = createJSDocDescription({ + description: "Fetches an entity by its ID.", + whenToUse: + "Use this to read one entity's current state. Pass customerId when you want to scope the lookup to a specific customer.", + body: GetEntityParamsV0Schema, + examples: [ + example({ + description: "Fetch a seat entity", + values: { + entityId: "seat_42", + }, + }), + example({ + description: "Fetch a seat entity for a specific customer", + values: { + customerId: "cus_123", + entityId: "seat_42", + }, + }), + ], + methodName: "entities.get", + returns: + "The entity object including its current subscriptions, purchases, and balances.", +}); + +export const deleteEntityJsDoc = createJSDocDescription({ + description: "Deletes an entity by entity ID.", + whenToUse: + "Use this when the underlying resource is removed and you no longer want entity-scoped balances or subscriptions tracked for it.", + body: DeleteEntityParamsV0Schema, + examples: [ + example({ + description: "Delete a seat entity", + values: { + entityId: "seat_42", + }, + }), + ], + methodName: "entities.delete", + returns: "A success flag indicating the entity was deleted.", +}); diff --git a/packages/openapi/v2.1/openapi2.1.ts b/packages/openapi/v2.1/openapi2.1.ts index c647c3c08..6937e13d6 100644 --- a/packages/openapi/v2.1/openapi2.1.ts +++ b/packages/openapi/v2.1/openapi2.1.ts @@ -19,7 +19,7 @@ import { SetupPaymentResultSchema, TrackParamsSchema, TrackResponseV3Schema, - UpdateBalanceParamsSchema, + UpdateBalanceParamsV0Schema, UpdateSubscriptionV1ParamsSchema, } from "@autumn/shared"; @@ -52,7 +52,7 @@ async function generateOpenApiDocument(): Promise> { registerInternalSchemas(UpdateSubscriptionV1ParamsSchema); registerInternalSchemas(SetupPaymentParamsSchema); registerInternalSchemas(CreateBalanceParamsV0Schema); - registerInternalSchemas(UpdateBalanceParamsSchema); + registerInternalSchemas(UpdateBalanceParamsV0Schema); registerInternalSchemas(CheckParamsSchema); registerInternalSchemas(TrackParamsSchema); registerInternalSchemas(BillingResponseSchema); diff --git a/packages/sdk/.speakeasy/code-samples.overlay.yaml b/packages/sdk/.speakeasy/code-samples.overlay.yaml index 7ffc8fc8e..bdb23a65a 100644 --- a/packages/sdk/.speakeasy/code-samples.overlay.yaml +++ b/packages/sdk/.speakeasy/code-samples.overlay.yaml @@ -17,9 +17,9 @@ actions: }); async function run() { - const result = await autumn.balances.check({ - customerId: "", - featureId: "", + const result = await autumn.check({ + customerId: "cus_123", + featureId: "messages", }); console.log(result); @@ -41,8 +41,12 @@ actions: async function run() { const result = await autumn.balances.create({ - featureId: "", - customerId: "", + customerId: "cus_123", + featureId: "api_calls", + included: 1000, + reset: { + interval: "month", + }, }); console.log(result); @@ -63,8 +67,10 @@ actions: }); async function run() { - const result = await autumn.balances.track({ - customerId: "", + const result = await autumn.track({ + customerId: "cus_123", + featureId: "messages", + value: 1, }); console.log(result); @@ -86,8 +92,9 @@ actions: async function run() { const result = await autumn.balances.update({ - customerId: "", - featureId: "", + customerId: "cus_123", + featureId: "api_calls", + remaining: 5, }); console.log(result); @@ -109,8 +116,31 @@ actions: async function run() { const result = await autumn.billing.attach({ - customerId: "", - planId: "", + customerId: "cus_123", + planId: "pro_plan", + }); + + console.log(result); + } + + run(); + - target: $["paths"]["/v1/billing.open_customer_portal"]["post"] + update: + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.billing.openCustomerPortal({ + customerId: "cus_123", + returnUrl: "https://useautumn.com", }); console.log(result); @@ -132,8 +162,8 @@ actions: async function run() { const result = await autumn.billing.previewAttach({ - customerId: "", - planId: "", + customerId: "cus_123", + planId: "pro_plan", }); console.log(result); @@ -155,29 +185,14 @@ actions: async function run() { const result = await autumn.billing.previewUpdate({ - customerId: "", - }); - - console.log(result); - } - - run(); - - target: $["paths"]["/v1/billing.setup_payment"]["post"] - update: - x-codeSamples: - - lang: typescript - label: Typescript (SDK) - source: |- - import { Autumn } from "@useautumn/sdk"; - - const autumn = new Autumn({ - xApiVersion: "2.1", - secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", - }); - - async function run() { - const result = await autumn.billing.setupPayment({ - customerId: "", + customerId: "cus_123", + planId: "pro_plan", + featureQuantities: [ + { + featureId: "seats", + quantity: 15, + }, + ], }); console.log(result); @@ -199,7 +214,14 @@ actions: async function run() { const result = await autumn.billing.update({ - customerId: "", + customerId: "cus_123", + planId: "pro_plan", + featureQuantities: [ + { + featureId: "seats", + quantity: 10, + }, + ], }); console.log(result); @@ -295,6 +317,123 @@ actions: console.log(result); } + run(); + - target: $["paths"]["/v1/entities.create"]["post"] + update: + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.entities.create({ + name: "Seat 42", + featureId: "seats", + customerId: "cus_123", + entityId: "seat_42", + }); + + console.log(result); + } + + run(); + - target: $["paths"]["/v1/entities.delete"]["post"] + update: + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.entities.delete({ + customerId: "cus_123", + entityId: "seat_42", + }); + + console.log(result); + } + + run(); + - target: $["paths"]["/v1/entities.get"]["post"] + update: + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.entities.get({ + entityId: "seat_42", + }); + + console.log(result); + } + + run(); + - target: $["paths"]["/v1/events.aggregate"]["post"] + update: + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.events.aggregate({ + customerId: "cus_123", + featureId: "api_calls", + range: "30d", + }); + + console.log(result); + } + + run(); + - target: $["paths"]["/v1/events.list"]["post"] + update: + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.events.list({ + limit: 50, + customerId: "cus_123", + }); + + console.log(result); + } + run(); - target: $["paths"]["/v1/plans.list"]["post"] update: @@ -315,4 +454,50 @@ actions: console.log(result); } + run(); + - target: $["paths"]["/v1/referrals.create_code"]["post"] + update: + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.referrals.createCode({ + customerId: "cus_123", + programId: "prog_123", + }); + + console.log(result); + } + + run(); + - target: $["paths"]["/v1/referrals.redeem_code"]["post"] + update: + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.referrals.redeemCode({ + code: "REF123", + customerId: "cus_456", + }); + + console.log(result); + } + run(); diff --git a/packages/sdk/.speakeasy/gen.lock b/packages/sdk/.speakeasy/gen.lock index ea8fc7f51..7a18c3ec0 100644 --- a/packages/sdk/.speakeasy/gen.lock +++ b/packages/sdk/.speakeasy/gen.lock @@ -1,16 +1,16 @@ lockVersion: 2.0.0 id: 7b300647-cd76-49e9-bf77-7d1bf5446d66 management: - docChecksum: 41614313bae2edc9e0e3bbb7da66a4d6 + docChecksum: 2386fe177eae36ae216eb27ecc4c790a docVersion: 2.1.0 speakeasyVersion: 1.719.0 generationVersion: 2.824.1 - releaseVersion: 0.8.27 - configChecksum: 58626b5f963b3bd6dae32861f7223e4e + releaseVersion: 0.10.4 + configChecksum: 62e57e2e15deb84b81f080779a4f72dc persistentEdits: - generation_id: e65473db-a4c6-4742-b95f-9b8012a90600 - pristine_commit_hash: 9070b0faec440397f5c71122d64b390fcff54c5f - pristine_tree_hash: 2d507ad0bb4c7057b61076d8ab638fad99bd0e61 + generation_id: 6e0372a3-0fd9-4b07-b9b7-032f6b63d6fe + pristine_commit_hash: 660530b4428eb4664b8a718d246f1f18ac98b2fb + pristine_tree_hash: a44c6eefa74448f481b7c5fe9a8fa9959b8ef0b9 features: typescript: additionalDependencies: 0.1.0 @@ -56,304 +56,76 @@ trackedFiles: pristine_git_object: cf98a6bf092538eb10ff0edc915102682ce9a6e6 FUNCTIONS.md: id: 21b9df02aaeb - last_write_checksum: sha1:3102381f2f0239e6cd820f6048dc9df14e57ad2d - pristine_git_object: 997ec44c4ee5408258b58112c217e8366d69c2b3 + last_write_checksum: sha1:59eefaff15c9c280ef26fcc563e8d290320a4003 + pristine_git_object: b3057307d5cce90967702b7636c89322834d1d8f RUNTIMES.md: id: 620c490847b6 last_write_checksum: sha1:e45b854f02c357cbcfdb8c3663000e8339e16505 pristine_git_object: 27731c3b5ace66bedc454ed5acbe15075aacd3dc USAGE.md: id: 3aed33ce6e6f - last_write_checksum: sha1:fee4559ff519f06ab91e5e9656ae606256dc386c - pristine_git_object: b1d99bf9ec8e5f90834cf4649c5498b453dd961b + last_write_checksum: sha1:b85b3354be20e8d14949292b9ef910bdd31a6def + pristine_git_object: 18eb11d41cfedbdf7c5391e0d9b48809fb426077 docs/lib/utils/retryconfig.md: id: 0ce9707cb848 last_write_checksum: sha1:bc4454e196fcd219f5a78da690375a884f5ed07b pristine_git_object: 08f95f4552349360b2c0b01802aa71ec3a55d2c2 - docs/models/balances-check-balance-display.md: - id: e3ef444e5c9b - last_write_checksum: sha1:39e643a0ed86b424bca211449a40466992be04af - pristine_git_object: e4c57044e222a36b52249bfa3a1f816de3945175 - docs/models/balances-check-balance-interval-enum.md: - id: 39a042168c2c - last_write_checksum: sha1:950253f0aad24c1314550569da98cfa589814fd8 - pristine_git_object: 136673145def2da87e59db414be46cb9b13c020b - docs/models/balances-check-balance-rollover.md: - id: 5c18b24a290a - last_write_checksum: sha1:be6ed84c78526a00a12a1c7b693916cb0d917eff - pristine_git_object: 635923f79943aa117c3c60e446f270e47dc199fe - docs/models/balances-check-balance-to.md: - id: 63c149f631df - last_write_checksum: sha1:b89d60c2426e0f6280d26e8cc6b6f6af04156800 - pristine_git_object: 20f24bc0e7c96736c36f5a2b989ec37acbc28930 - docs/models/balances-check-balance-type.md: - id: 365bc42993bb - last_write_checksum: sha1:7cab68250437d61fc34be71107ee5ad1ed4fbe2b - pristine_git_object: 1a9b2c56cbffafe4f9ce50040d67cd01cc9713ad - docs/models/balances-check-balance.md: - id: 2617c1dd40dc - last_write_checksum: sha1:882a4db4be46b51f0e0bbb565b41ee2f650b318c - pristine_git_object: 5db52bece2fb9d7552625a88b9ca0d56605be4dd - docs/models/balances-check-billing-method.md: - id: 583834db21cd - last_write_checksum: sha1:7d77b700b2ae048d475a184872eb5d28a97b6739 - pristine_git_object: d7269db25959238ddb6f8c668389c092078db207 - docs/models/balances-check-breakdown.md: - id: de24bb88bcba - last_write_checksum: sha1:391725266f289e1957c1e64efe73e02ee316caf9 - pristine_git_object: a4f2014656b6e3d5e46c239db56099ad94fd1195 - docs/models/balances-check-credit-schema.md: - id: c589ed3caba6 - last_write_checksum: sha1:2bb946ab9f2ca06de9ec86b6f0339ef4d8175667 - pristine_git_object: 93646a7b1b94496cd13359f1be4d944b84c605eb - docs/models/balances-check-env.md: - id: bc7281d510bf - last_write_checksum: sha1:448bc44e0588e2038aa5543f032fda696896176c - pristine_git_object: 3dede176ccc5388b105769285d6f487c2d0256b8 - docs/models/balances-check-feature.md: - id: c06724d13ea1 - last_write_checksum: sha1:481c0d5ca41a2fce44e536d9b0bd12f3ee78ad95 - pristine_git_object: e09da9500af3bf194cc348db9eb823db60a4eec1 - docs/models/balances-check-free-trial.md: - id: 58cc87fe80df - last_write_checksum: sha1:eebcee964d7e21bbb0cc2953cf35e9e9c35d81bf - pristine_git_object: ff45de9a6235e674abd790481c0fafa1f8e2e345 - docs/models/balances-check-globals.md: - id: 21fbc30ee14d - last_write_checksum: sha1:4abed4d8e7b0daceb3295ad56a6b6524007a71ee - pristine_git_object: f67d2c1b26f46e2ce9f4637ee9d5ced65a668301 - docs/models/balances-check-interval-union.md: - id: f47856907e31 - last_write_checksum: sha1:c9592c8ccb72a03ca7132642edb8aea271ef4fe5 - pristine_git_object: 7cff0134b80c7c14316554b937d5a431f9241702 - docs/models/balances-check-item.md: - id: 4760183f66aa - last_write_checksum: sha1:0a89839681817262c76c91706d34180f2ea1d6df - pristine_git_object: bcb28d0c56822ac1c4896d6f3047875d4ca9f1df - docs/models/balances-check-on-decrease.md: - id: c7a21daab9e7 - last_write_checksum: sha1:b395e937beeaf021392c4450865f46332a401a21 - pristine_git_object: 960d118be7e787ce0ee916e1296112d58b373002 - docs/models/balances-check-on-increase.md: - id: b28105da306c - last_write_checksum: sha1:c188feaefbea9be4222fe586a59ff2d74de5b441 - pristine_git_object: 8f104b202cbf61d6641c6e66ba4aaf849ca24e6d - docs/models/balances-check-price.md: - id: a67634a6965c - last_write_checksum: sha1:a0ac28fcb6dac1db2bbfef3aff4adb11ab83f1f5 - pristine_git_object: 654cee9ccd3ac3ab7e478e50d5bb8e6689078728 - docs/models/balances-check-request.md: - id: 9bc2f38fe309 - last_write_checksum: sha1:0c05c1d4267bf87ccffbd12c2201ba77d3572b2e - pristine_git_object: 3c287ef0a9fb8ba29a9747f85cd7f75fe9deacdb - docs/models/balances-check-reset.md: - id: 0bc9bade2bd6 - last_write_checksum: sha1:e62a7f8a2d10aba44af96cb2013ae8ef04bddbe7 - pristine_git_object: f0bffa7d66f032f26856f1c39d97c8565c2e3b47 - docs/models/balances-check-response.md: - id: bd48955a780a - last_write_checksum: sha1:1f3f7c9ac94fdfc6cd2420fc8aef65797e127abe - pristine_git_object: 13c90b2a54df4c30caf755d899adac4ab7fc2749 - docs/models/balances-check-scenario.md: - id: aefabfed1a3d - last_write_checksum: sha1:0c14ca643df4a726f3aaf30f5c2c1caa3cad2d72 - pristine_git_object: 6a863ffcdaf057b7cc03a54aad7b424fd45f43b4 - docs/models/balances-check-tier.md: - id: fc371fab50e5 - last_write_checksum: sha1:7a788259cf54e59c8c5a98f06c4445b850082cee - pristine_git_object: 5227e29b2b3b9cb79d686bef27c8581046ba8109 - docs/models/balances-create-globals.md: - id: d373066fc383 - last_write_checksum: sha1:2fc458658b9565f3849daf87a29a3cf7c17b45ab - pristine_git_object: 31dd035ed7971ea3822906d0c6a486bb2ef9412e - docs/models/balances-create-interval.md: - id: f091f51d6edc - last_write_checksum: sha1:3ddb603637cb8527105d66993b446ff0828fb1a2 - pristine_git_object: c26212ca8b87b6aeb5e8a6ce6bea214fc6c218c6 - docs/models/balances-create-request.md: - id: eea8e2e81f34 - last_write_checksum: sha1:b428bbf08beebba14b0c6c4fff7045eaed33bdf4 - pristine_git_object: 529df394cb3493777e75f5982164b907eafef0a9 - docs/models/balances-create-reset.md: - id: 88d708517153 - last_write_checksum: sha1:36b048308c1fee7d8169ed1636d689082d5ceffa - pristine_git_object: eea59cb51f5948817cf489a08fefaf3e6b37a253 - docs/models/balances-create-response.md: - id: 3894d655a27c - last_write_checksum: sha1:67c048a0ad4138efc7f741c1d344d9b28dccb0b8 - pristine_git_object: c6f09d0addc548b3fc69f9a4a19d356863666c24 - docs/models/balances-track-balance-billing-method.md: - id: 538c9a188eba - last_write_checksum: sha1:ddeba7a5f8a4c9567b59641779c9dd6440f7d9ea - pristine_git_object: 29cb6a93841aafe72287fee85a49cb3fbcd092e2 - docs/models/balances-track-balance-breakdown.md: - id: bfa6c8f0598f - last_write_checksum: sha1:11cd84de20bebedd8614835f2be1bf41609a2d70 - pristine_git_object: c4ccc9979aa3750535aebbc726d9228f1b8ef2d2 - docs/models/balances-track-balance-credit-schema.md: - id: 5529602a29be - last_write_checksum: sha1:a4da519e6607287c1da2115032df1be457a27eb8 - pristine_git_object: 3e071e31a2ec909065c7fd6331187797f83d21da - docs/models/balances-track-balance-display.md: - id: 1d796cc9c085 - last_write_checksum: sha1:8d266a75d25ae317b04f9952d6c228c50fda76c9 - pristine_git_object: 7ab4ed677e4ac16dbcd14b85b312825025519a04 - docs/models/balances-track-balance-feature.md: - id: 9d8ece2c0c40 - last_write_checksum: sha1:a3fba018b076908e75208902ae83057bfbaf59b0 - pristine_git_object: 23a3d588cb0040afe500f8245b54f6d4d1d12688 - docs/models/balances-track-balance-interval-enum.md: - id: 09d5b4a6f8cb - last_write_checksum: sha1:60103ccf16e1ce23cbcedf42abcdeae9da9a2d10 - pristine_git_object: cddf06ad4c7dbf75c46ee7d54a6cbdaa27bb3148 - docs/models/balances-track-balance-interval-union.md: - id: 923a95f43eb4 - last_write_checksum: sha1:c118534dfe6f90212c7c5165ff09c221d0ace877 - pristine_git_object: 39896172366839afbe03b77eee2da4fec253f65c - docs/models/balances-track-balance-price.md: - id: ddd0f8034ef6 - last_write_checksum: sha1:76f432d2fb2db4a63c4184c740cd964aeca41c2e - pristine_git_object: 55b2e34a5fd883efa5730a26b711a45893a8a5dd - docs/models/balances-track-balance-reset.md: - id: 756b5bebc271 - last_write_checksum: sha1:7ba106f2989597da6cbe64b22dd9b9052367b476 - pristine_git_object: c5fdcca6d8b044815d046ae72640f9f3f2d9188d - docs/models/balances-track-balance-rollover.md: - id: cbc228404b77 - last_write_checksum: sha1:9f22e0a26bc92f6f22b864365a1f5ff30e001382 - pristine_git_object: f90f2fede2ba787ad7388f3578a9ed09a4412698 - docs/models/balances-track-balance-tier.md: - id: b122d032114d - last_write_checksum: sha1:a4f01ab771194c23dee58c5c0813511439ab7c4c - pristine_git_object: 72251f8187283bc6aadddc106b8e6062d5a5c9a6 - docs/models/balances-track-balance-to.md: - id: 2b09528e8f0d - last_write_checksum: sha1:1ab2b839657b0e9631259db84d39a34a957d4b12 - pristine_git_object: ee7789f051108962f76e20dbc4cfd2804ce4d21a - docs/models/balances-track-balance-type.md: - id: b2b2aef595a1 - last_write_checksum: sha1:61f54630781e39412422f14224a0361e702a8d28 - pristine_git_object: 882d9d3dc934b7ed7c4fedc1874a78a72081e2d8 - docs/models/balances-track-balance.md: - id: a63fed0309ba - last_write_checksum: sha1:910bdad0ad4ade89f612abc291732723fe079d50 - pristine_git_object: 932237fa5f2929d6d1dd872afe99c94319204535 - docs/models/balances-track-balances.md: - id: 021ee4a29341 - last_write_checksum: sha1:bab8be67683b4da8c4e68fb98fcc2b45b05b41a8 - pristine_git_object: a19a265977811693320f0e11d414d9202a5da65b - docs/models/balances-track-billing-method.md: - id: a6b8fad7a6ff - last_write_checksum: sha1:7b2aecd489e7876dc1dc4b7b90010b915691b996 - pristine_git_object: 22f323f1f684d0e45189794dcc59954a3be194d0 - docs/models/balances-track-breakdown.md: - id: 9889d0b0d3a3 - last_write_checksum: sha1:6a24d8a6e6432216a3989241265b2bb120f89111 - pristine_git_object: e11ae4e8ad25391630930694d47a2658d17a0f6c - docs/models/balances-track-credit-schema.md: - id: d719ea66b30f - last_write_checksum: sha1:60385b355cf8a70cedb250f948cf3b195715ea27 - pristine_git_object: df1907cc3511577d47d8ef1288a9c161360f815e - docs/models/balances-track-display.md: - id: c36524645849 - last_write_checksum: sha1:d1799187569dc05ec1dcd2f12f08687368510618 - pristine_git_object: c2ffa8215505e4be72e73fd63e3f09f9e5bbe576 - docs/models/balances-track-feature.md: - id: 093957a2e600 - last_write_checksum: sha1:96ffcf0d26f0ba345b186710a7c0b759eab3503c - pristine_git_object: 20852765353dd135640480a548a82653d869a237 - docs/models/balances-track-globals.md: - id: c96065c11a1d - last_write_checksum: sha1:22b782451cb5bf01c74ab2ba07d8bd9ce2e4d946 - pristine_git_object: 976c3ac14e3ec33383ec503b113612977d37abff - docs/models/balances-track-interval-enum.md: - id: 14b33e89a94a - last_write_checksum: sha1:a7bc81f65ea58748cc2aa0e80407fbbb4c2d4262 - pristine_git_object: d3657b2bdaddf63a53ae832076f591161e96fe15 - docs/models/balances-track-interval-union.md: - id: 61b8aabbfe82 - last_write_checksum: sha1:e03c95a80814087cf325e270c4ebde1aa2279aff - pristine_git_object: 54b043bf3cd73b5cd02f049c98b5994143d2b99a - docs/models/balances-track-price.md: - id: 09cd287873ae - last_write_checksum: sha1:66d59fa76e998b9db69c875bf61bcd220537ee89 - pristine_git_object: 19c58b38889285ba3f347a365e1ce54bad9dc24c - docs/models/balances-track-request.md: - id: d188e174bd44 - last_write_checksum: sha1:ad30875769de0dfdc64e697e15f788f3692b0435 - pristine_git_object: 56c3454ebeae61551e67b625980a25cdedf4f559 - docs/models/balances-track-reset.md: - id: d20644671404 - last_write_checksum: sha1:a38d72ba19d7321df98ebb72b792b652a0db11af - pristine_git_object: d6ce345bb4647a172589c205cefe33d1c49d7570 - docs/models/balances-track-response.md: - id: 1505ee74210a - last_write_checksum: sha1:7cabd4dedfdf30d7db034e0a8df088d5e2487af4 - pristine_git_object: ee6fc647bf340a621d98ecd83a923ce5c7bc8004 - docs/models/balances-track-rollover.md: - id: f2a1b55f4f24 - last_write_checksum: sha1:412f352852450e765e62aa33fda87a155804e483 - pristine_git_object: 521af0eb338d677e9f5f3ae5e13c542b32a6e50c - docs/models/balances-track-tier.md: - id: d1e8e6005c8e - last_write_checksum: sha1:eb3316e829f2e9df3a9b503e35237ef67831d119 - pristine_git_object: 47c19a3e9755bec01cdb7964a8f08a3cf679d4fc - docs/models/balances-track-to.md: - id: b6b00665675e - last_write_checksum: sha1:125c0390aed816c47903e8cb4da9cab4b507ccf6 - pristine_git_object: c6d633fa20a494eedd6a1d25f6a72f51be2c43cf - docs/models/balances-track-type.md: - id: e6aa46f3c026 - last_write_checksum: sha1:21e1b3929f6d3b35a866be245d8aee9e123ac19d - pristine_git_object: 03f84e5bcf6b2837a66b6ed8720c7c48b536c9ba - docs/models/balances-update-globals.md: - id: f88afc2cd936 - last_write_checksum: sha1:a54da3cbfc5330d56af742eb3e15db7adcb733c7 - pristine_git_object: 98a6a2c3a193034219fd71ba1ff2855c4c9c2bc2 - docs/models/balances-update-interval.md: - id: 8fac4ab3810c - last_write_checksum: sha1:82376ce62f16ce588ffb9eca0a6506543d27a9e2 - pristine_git_object: ffdf09208eb49a6cc236dda470e3f05e7b0758bd - docs/models/balances-update-request.md: - id: 77126ef19557 - last_write_checksum: sha1:4e6f97a0d9a0af4debc47d799e3647f1f38c7ee8 - pristine_git_object: 1187f049bfdf1f97fccbc13a66664133ead532b7 - docs/models/balances-update-response.md: - id: dea7a6d7386a - last_write_checksum: sha1:c92315479a7c9573d8722da5ad65c8278a887a45 - pristine_git_object: ab7956e12dcd465a3823a93285b175fdc2bbd582 + docs/models/aggregate-events-custom-range.md: + id: 80d18667f314 + last_write_checksum: sha1:29c9839f861369483f282271380f914bb4084649 + pristine_git_object: 626fc2385bebf4c969537e3ad3a904c5945c14a4 + docs/models/aggregate-events-feature-id.md: + id: e838288b220e + last_write_checksum: sha1:bdec4115bd99cea3c20bf97c0894fdc4c23b87cf + pristine_git_object: a3ea76a740ec4de4d096017335e664d11df81c57 + docs/models/aggregate-events-globals.md: + id: d21e79891b07 + last_write_checksum: sha1:38ec03c691db18283e01a1c896f6e27b08642c5f + pristine_git_object: 6ea95a5073b442ca0a89f9e52b7bcabf5cd6c14c + docs/models/aggregate-events-list.md: + id: d27892f6c24a + last_write_checksum: sha1:8c2bff7856c08cc29d5bd6e07e2241f77893a5c5 + pristine_git_object: 4e6f8d7ae24eff7ef26d2404127e4652a8b75836 + docs/models/aggregate-events-response.md: + id: 147b886181ab + last_write_checksum: sha1:745ae2d8cabb73e63fed45a1d83682e602daa81b + pristine_git_object: 39e2e27b82c7b641f0a498550c99017a00321785 + docs/models/attach-params.md: + id: 83d15924bf0f + last_write_checksum: sha1:41ec71bfdee075692e117cc6c7f1ea75a0003612 + pristine_git_object: 5e34cf5d3b17b7c2d087a7d28e56848f9d183324 docs/models/balances.md: id: 2f042cf3d0aa - last_write_checksum: sha1:9a9c2a84d066247446703b35af6efe14f5df1cb3 - pristine_git_object: fd59d3018e8e84c9fcdf744a438072eff75638b6 + last_write_checksum: sha1:14c38d712624a523981c6db4b14499b4f36d4c55 + pristine_git_object: a450c12f9c2d7dcafebd085a62f27f25b1802f64 docs/models/billing-attach-billing-behavior.md: id: 69bb81e8c7dc - last_write_checksum: sha1:09f6094796a2f12ee8a2c68c8017b476fd54c086 - pristine_git_object: 6d65a4c50607dc3efb12afdc7ef35fd71a6e30da + last_write_checksum: sha1:9166f12d3a5f6e639a8d871d1760e76e6e7016ed + pristine_git_object: 8c746b111471fe8bd917852dbea64c219ccf1b32 docs/models/billing-attach-billing-method.md: id: b8065e6e9007 last_write_checksum: sha1:86e46ef6befe65825f85c0c43b2f2dd6b01b0ade pristine_git_object: e1d23e8bd480b7f63eace34dc4e4bf7cea8aafec docs/models/billing-attach-code.md: id: 2fe6307f7f0f - last_write_checksum: sha1:16a4e7ec14eb7eb4b5b19abbe64677549d0213a8 - pristine_git_object: bcc209eac8b4b53dc8977de477b10736462a6750 + last_write_checksum: sha1:72adcc13d2c0f8e0a2c71aa51233ae45adddd295 + pristine_git_object: d4692b8a67cd9100dd6e25e81cd7ba910327a4c9 docs/models/billing-attach-customize.md: id: fdbcde378958 last_write_checksum: sha1:7bfa0fc1444dc4916482edc359762fcb84b0a41a pristine_git_object: f3eda471186b21392e9d1bc031ae3f6307d59233 docs/models/billing-attach-discount-union.md: id: 01f04cffd3dd - last_write_checksum: sha1:99f3732c455c922da151a6e6c7a20f5bcf659d4b - pristine_git_object: 33876bf7e89240f7ea34effdda9c00eaf5ce9166 + last_write_checksum: sha1:6e4621f7b9f7b2611330f82b9ecd8d30b088c14e + pristine_git_object: 01ca4f4bde73f6b452d80ef81e17e6fc976a7a8b docs/models/billing-attach-discount1.md: id: af5d6fe37973 - last_write_checksum: sha1:361203b2dc8f365122f14f6efc68180bc67446e9 - pristine_git_object: 036aadbee3c821bc68ce1ffc6468c2dbbe0d29fb + last_write_checksum: sha1:cf7da385a721f89f1618075f686794279e19218f + pristine_git_object: 62c4ab5978852610df56a84994297b2aa437900a docs/models/billing-attach-discount2.md: id: f3934d8cd724 - last_write_checksum: sha1:7945f5d3f54d6f79bd7ddee8383d9e8ea3c526c7 - pristine_git_object: 9bb46e195ea0586a61a7508a5f4e2e222a2d8be6 + last_write_checksum: sha1:d455db7e21086617d5eb1c69de60cb54c00125c9 + pristine_git_object: b39eb5467b48d4ab4ee88961bacf46c36a5b1f2b docs/models/billing-attach-duration-type.md: id: a223ca393687 last_write_checksum: sha1:33afcef75e572dbb66975dd0868efcc3256c3ad2 @@ -362,10 +134,10 @@ trackedFiles: id: c465a9bb3bd3 last_write_checksum: sha1:60b416eb06e86d946b9b85f9b8738b747a2b5c79 pristine_git_object: e16b20e54ae6214f4d5cfdd24dc27e1a98a792e9 - docs/models/billing-attach-feature-quantities.md: - id: 2b4b198cf60d - last_write_checksum: sha1:044d0aa175d57ae7477609fdf41fa325d2e7269f - pristine_git_object: 58d25518286cab70473fc2e581f1ebcd7d82935e + docs/models/billing-attach-feature-quantity.md: + id: e25424416a8f + last_write_checksum: sha1:14a67df04e74b6d332616014d764b33a69f88236 + pristine_git_object: 1e4cab2648560d39bc880d55d597f8dd50cb4284 docs/models/billing-attach-free-trial.md: id: c39a4c880f22 last_write_checksum: sha1:5f7edb1bd6f73f0867489ca5a3c65ccc07b52984 @@ -376,12 +148,12 @@ trackedFiles: pristine_git_object: e33e3d806a642d9b936d867e0eec217edda9199f docs/models/billing-attach-invoice-mode.md: id: 9cd0f26dd730 - last_write_checksum: sha1:1748f7a34350dea3662e548f8edc6bd4d95c812f - pristine_git_object: 1a41dead8e8bd4a813724e9835328f73657eab37 + last_write_checksum: sha1:4ea16177d21c5944ec180abee1bdb47ccdbc5861 + pristine_git_object: a341890b4e722adbdf3e816a46586d8cf1dbc819 docs/models/billing-attach-invoice.md: id: dc71d6a68aab - last_write_checksum: sha1:c06f7dc2fbb36310c43da2f99ad72082e5e3373f - pristine_git_object: ba086bf65882f2ee1ba2bcd51c4578cfe5d5ee64 + last_write_checksum: sha1:d2cc788309487a9904ea1fd7f571868979c72949 + pristine_git_object: be6a8d739890cf7edccf5d6c29dd28a93688966e docs/models/billing-attach-item-price-interval.md: id: d850bef7cef5 last_write_checksum: sha1:b08ab3ff8aecfb990d53398e36a403b8ff357b93 @@ -404,8 +176,8 @@ trackedFiles: pristine_git_object: b299a19afdb47800bd68273aec509276fea92db4 docs/models/billing-attach-plan-schedule.md: id: 7a4dcb0f0bdd - last_write_checksum: sha1:35172c3d64a402bc29fc4aa94bf309ffc00a1b51 - pristine_git_object: e4df2fb83695600123d160d9935e18aca9225fa6 + last_write_checksum: sha1:fb709e50c297d93f3e8e5a4d591dba75e10a1e57 + pristine_git_object: 680bc5881639a23850a074e5f23662aed1cc91d7 docs/models/billing-attach-price-interval.md: id: 45cebd3dbe41 last_write_checksum: sha1:25d6912322122847f26a7dfd591d1807ddce332d @@ -418,18 +190,10 @@ trackedFiles: id: cedfbc549872 last_write_checksum: sha1:fe283745a679a4b5b353aa2a3eb989c682b5ed7a pristine_git_object: 3715830c1bebb2cb78f511ba04343488c70a091d - docs/models/billing-attach-redirect-mode.md: - id: ea30af24fa29 - last_write_checksum: sha1:42cf1a17b269cf2bc3c3382167934dcf7fe51987 - pristine_git_object: a458416b2fd8ef52ebaf49c4c37d35cdc192e4be - docs/models/billing-attach-request.md: - id: b6f36e00f4c1 - last_write_checksum: sha1:bd2bca7e8167796b1469d9eb956c160106f9dc9d - pristine_git_object: 6115d4c5cb713a6a0a4fc1714bb40eb9e39905f6 docs/models/billing-attach-required-action.md: id: 8ba37f3620e5 - last_write_checksum: sha1:7063b6fd636642582b41505c53e0fd925839f987 - pristine_git_object: c1e2954e729c6b178c26556278295c0fd12e8c70 + last_write_checksum: sha1:67b02b42800df13a6fc74e9c4c16a4377d202185 + pristine_git_object: 5fd1fcd0d815e8fc09a3bfbee27698bab7f498c8 docs/models/billing-attach-reset-interval.md: id: 30540d7bd936 last_write_checksum: sha1:0ef035e8d9c8b08775697e4291d4e683d5eb6212 @@ -440,8 +204,8 @@ trackedFiles: pristine_git_object: 1c1f2244b478e7f1a7c5b0edf1f1f3b1828535d9 docs/models/billing-attach-response.md: id: 616a6ac6b11b - last_write_checksum: sha1:c1efad53f726cf482853ddeb9faacfb910285156 - pristine_git_object: c8c7678f6bfce3682af9aadd22ff7948a2e3050f + last_write_checksum: sha1:1f76d92fb7678a41de1f91a2d7764b148f559f5b + pristine_git_object: f747a42c8125796546ba3fbf103f479d7b6a3d54 docs/models/billing-attach-rollover.md: id: 62a8f718c040 last_write_checksum: sha1:1fe18d84194a880a1ea51ea9dbce5804fc17b2ab @@ -454,306 +218,22 @@ trackedFiles: id: 11f30839adb7 last_write_checksum: sha1:ed5f808165422787d1d0637216480818b1ffcd3c pristine_git_object: 2a7148fde0e0cd4e38a970985affc03a78d27438 - docs/models/billing-preview-attach-billing-behavior.md: - id: a773341207f5 - last_write_checksum: sha1:93f81fe190d8bc53a75f598322c502741c16199f - pristine_git_object: f1a3f9de25cb385993bb07abe9f88950f9c95908 - docs/models/billing-preview-attach-billing-method-request.md: - id: 1495a9fc1816 - last_write_checksum: sha1:85ca489229e4fd71fb11e150d367915c9417e7ac - pristine_git_object: ca72a1af609666308d5289e00c53aee7a46afb82 - docs/models/billing-preview-attach-customize-reset.md: - id: 08b7672cceb1 - last_write_checksum: sha1:012d6ca68c8304d2970da533c2fcdd47c3a474de - pristine_git_object: 417e782695458da4e3d20d842557e3cde0d8165d - docs/models/billing-preview-attach-customize.md: - id: db4350a07b4a - last_write_checksum: sha1:7ca078b89d1ddb807de370c1cb33fa9c7f311827 - pristine_git_object: cbec9da518bc8bce53df143487191d092a8be704 - docs/models/billing-preview-attach-discount-request1.md: - id: b7463c8fcc7e - last_write_checksum: sha1:72de3ad51a1b6baa1e76b49c85d36cbe6be4c56d - pristine_git_object: 6a2be445089511228d0e0fea48462dab402b4894 - docs/models/billing-preview-attach-discount-request2.md: - id: 4f8e1292eca0 - last_write_checksum: sha1:8406c8ad5388fef4944e955058170637c95ec7d0 - pristine_git_object: 94fec8071c75eb829f0c87007cc3d06f7d77c858 - docs/models/billing-preview-attach-discount-response.md: - id: ec844789636c - last_write_checksum: sha1:be755ca8b6e65e3daaea37f6b3996282e691ad20 - pristine_git_object: 61a38dd7bc597066604cc26677173277c04ee376 - docs/models/billing-preview-attach-discount-union.md: - id: 76889a4c3b5a - last_write_checksum: sha1:0e741fb587de3e310461fc5bfac539aefa43fff5 - pristine_git_object: 77b2633931d476d9e411d60a3a5a5c4f21c8ae17 - docs/models/billing-preview-attach-duration-type.md: - id: 699ddcf954af - last_write_checksum: sha1:38d57ee35771f6c419b0ed830b7953442c66249f - pristine_git_object: eab91bd342a65fe75fb62b4cd99ee49d59eb6f6b - docs/models/billing-preview-attach-effective-period.md: - id: 73d5b136763f - last_write_checksum: sha1:fd1bb80aa2eb04df8bcb3fd30d54c3d8bd5997a3 - pristine_git_object: 117a1c0abac4701ef5cb1632109f2da6d352b7bb - docs/models/billing-preview-attach-expiry-duration-type.md: - id: 92f7e725957a - last_write_checksum: sha1:7bd699fd491c25b3e67fbf7f60121396df606cd4 - pristine_git_object: 5c598e5bdcf7c213f2c724b3a6bbd44a2179c50c - docs/models/billing-preview-attach-feature-quantities.md: - id: f96cb38f6665 - last_write_checksum: sha1:604dcd523f3ff3d9064d19e22075b0003d7584ae - pristine_git_object: 241b209997ed3e7ac4d62cf5aa13ef6528f0d453 - docs/models/billing-preview-attach-free-trial.md: - id: 476df352c8a9 - last_write_checksum: sha1:6c56f6897ef11a8e48b58a7fce7e356f4dee1068 - pristine_git_object: 59c9aef5e1f3dea9eeb5921649ed1216f3298b51 - docs/models/billing-preview-attach-globals.md: - id: ba5a39e6c648 - last_write_checksum: sha1:275401b990e1b351ad4b8f740549bf1dde7c9953 - pristine_git_object: 39f8ffc2e65acf9add7aa452b0e13145699d88e3 - docs/models/billing-preview-attach-invoice-mode.md: - id: "579551578440" - last_write_checksum: sha1:3ee9de3e1a1d3f8a33333f4a95f72532de5ff929 - pristine_git_object: 9ed84d9ceedd9d43de863044f7902ed81e199574 - docs/models/billing-preview-attach-item-price-interval.md: - id: 9292f3405760 - last_write_checksum: sha1:7196e1880b16f567598337a0cb543cf4ca2b9985 - pristine_git_object: c5269affbc9c9ed07d3f821502616965793af476 - docs/models/billing-preview-attach-item-price.md: - id: b493d981c4ec - last_write_checksum: sha1:55ffa2831d14c97430de46c60a061df204ab6aeb - pristine_git_object: 27bd7af3a68bb93da3a0d7bfa97174d1885f24b7 - docs/models/billing-preview-attach-item-reset-interval.md: - id: 02a4ded53cc1 - last_write_checksum: sha1:7aa4611a2ad0acb3c7c08d5a531224763415b134 - pristine_git_object: 09ab7360d2f184ecdd7670ef691d34f781834faa - docs/models/billing-preview-attach-item.md: - id: b4cb81f69c8e - last_write_checksum: sha1:5e88ea5b4d132cb65b4d266e7c15458ce96b919f - pristine_git_object: 8bad9add40c4cbf0ce3f01d0d4291c8723d8034b - docs/models/billing-preview-attach-line-item.md: - id: ee96cc430bdf - last_write_checksum: sha1:7b5558d14250b8866c8046b751229956f1b488cc - pristine_git_object: cabb85b7184469d0e4eb7b1c955bba9d99ebbef3 - docs/models/billing-preview-attach-next-cycle-discount.md: - id: 0c48ff87c206 - last_write_checksum: sha1:d0013ae39b392f8e57d1cd3ac3fcfde3f8f2673d - pristine_git_object: 393c8bb4d644617001482eab3fca7c3d2fec3f2c - docs/models/billing-preview-attach-next-cycle-effective-period.md: - id: c08258487407 - last_write_checksum: sha1:7557917f0439cc1cc0466633fb754c71a4266176 - pristine_git_object: f08fff29f4eaff3516916bea3ea7986f1f48c24a - docs/models/billing-preview-attach-next-cycle-line-item.md: - id: 91e717af160b - last_write_checksum: sha1:7a9dd47f011f262a3f77a417f1821b9c4308fec9 - pristine_git_object: d31f66e6273801a88fc176f76be1480255e3b31d - docs/models/billing-preview-attach-next-cycle.md: - id: 74850a3b3f53 - last_write_checksum: sha1:5f0def9a42f509bd6207aa6244b330f33df50af1 - pristine_git_object: d5166513766823e31a5152bd0d3e3d20c2dda77a - docs/models/billing-preview-attach-on-decrease.md: - id: 22ad7854925e - last_write_checksum: sha1:54cc25c8c80ccb32630211a3886e0413a0b5a7cd - pristine_git_object: 2594bdb73dc7fcd0ddaf66f2be65a304d4a4b741 - docs/models/billing-preview-attach-on-increase.md: - id: 140e2f488457 - last_write_checksum: sha1:dcc22ba06ad15a2b26bacd455b7c5f1d29fd64d7 - pristine_git_object: 0cdf2b9518c1bcb1278b0f5696830dacfa0ec212 - docs/models/billing-preview-attach-plan-schedule.md: - id: 9ed7f290711a - last_write_checksum: sha1:2b8694b146c396f83b43430707c9655c5284417d - pristine_git_object: 578e8a7a97489955ac29586f7309416b40ffeaff - docs/models/billing-preview-attach-price-interval.md: - id: ef09566e7016 - last_write_checksum: sha1:54a328c27ffd8f8d7dcac0f1c42dbe5d808b48d8 - pristine_git_object: 69e8688ced9aa9eacfaedaa666d2e647c3684272 - docs/models/billing-preview-attach-price-request.md: - id: 3e714d60d0a7 - last_write_checksum: sha1:4a8da851cb6dbad1b0b201057800bcd2daecb7a5 - pristine_git_object: f746aaf6855616ce84ed7f5ec7f5fe39fedf2ed8 - docs/models/billing-preview-attach-proration.md: - id: a08df0b28937 - last_write_checksum: sha1:7a7dea7e4d8b5211cdba472c23ff117247c80eee - pristine_git_object: fb1232c9c0750ce42f0b97d9d75b6f9d00e0a001 - docs/models/billing-preview-attach-redirect-mode.md: - id: 8eb7d17c6015 - last_write_checksum: sha1:5746297569af0b3f775b627b2addac2f8b06cecb - pristine_git_object: 784a14506156879c0745ac8d9172f468fbeece98 - docs/models/billing-preview-attach-request.md: - id: 3f00ff275eb9 - last_write_checksum: sha1:27d7fa29701311a9f8401f30a53a3ae49119143c - pristine_git_object: dd592a2f9ed74a081031b5d60fac41f8ce874c94 - docs/models/billing-preview-attach-response.md: - id: 28169ccdb7ce - last_write_checksum: sha1:374bba5ebede36501fc1e0659cf098b52068ac0e - pristine_git_object: bea2b64d85a52436189f74b7b55d929069f4d7e3 - docs/models/billing-preview-attach-rollover-request.md: - id: b64b48b2920a - last_write_checksum: sha1:6bf382304fde4646e1233fca8bba98f9e578297a - pristine_git_object: b079a076b2a8bfc0e3a33d45bea4516d6adb08fd - docs/models/billing-preview-attach-tier-request.md: - id: 7b391603abf8 - last_write_checksum: sha1:abf02e95024f330a6ab4251ccc29e64a5e43c1db - pristine_git_object: 6e4f087b8e943bb4a5d7bcaeff21b8d8257b3af6 - docs/models/billing-preview-attach-to.md: - id: 275f530aecda - last_write_checksum: sha1:78628a5192c70b22d923bb023d5cfa5547087ade - pristine_git_object: 7e23e7ea5e3c14c179b731220aced845c3f071af - docs/models/billing-preview-update-billing-behavior.md: - id: a7fb8ea3cf50 - last_write_checksum: sha1:0c9299aa163b6ce342a7e85bf6b9abc30d05eab9 - pristine_git_object: 65abc7d7f9268c60c318610413f8a13082d23d88 - docs/models/billing-preview-update-billing-method.md: - id: 70c3af233f16 - last_write_checksum: sha1:8d4d817d4ecf49cdc30a6210860ffbc5a8c70d51 - pristine_git_object: 17c9f755635ea9c7eb84a1c3bd7539bc3cf590e5 - docs/models/billing-preview-update-cancel-action.md: - id: 84c691cb9224 - last_write_checksum: sha1:2c927b75756dfa054e42bfa357ee74efd22171ed - pristine_git_object: 29380f328502e86965d828a21266e7fcc1f8f71b - docs/models/billing-preview-update-customize.md: - id: 9aea6b63543c - last_write_checksum: sha1:c766c53504776dada8d726769c70fbd5b02a84e7 - pristine_git_object: c452501c4d3f26109ee32f8677b5c29d962486ae - docs/models/billing-preview-update-discount.md: - id: 1c01f60de9f7 - last_write_checksum: sha1:135f79ccda4e8ce197ba4a0db58b4a36b05ac536 - pristine_git_object: 373be10fcfc6f46087d14b21369f0d5e4be76f92 - docs/models/billing-preview-update-duration-type.md: - id: d7630afd0143 - last_write_checksum: sha1:b542e1f047a20848da8a2e5eaf13091c0cda33a5 - pristine_git_object: 6297cd050a25d723ce1578b8b7e00bae2f9ad1c6 - docs/models/billing-preview-update-effective-period.md: - id: 91aa9e5159c6 - last_write_checksum: sha1:a5ed16e66fc490d30e24d195f41f05144e4bace3 - pristine_git_object: b016f91031791cd0cd3ac4ed23916ebd5fd178c9 - docs/models/billing-preview-update-expiry-duration-type.md: - id: 375c3383ad4a - last_write_checksum: sha1:b3be196a6fbddd9c83c3a5ca7d4bcc2b65219fca - pristine_git_object: cb33c604bb6b72cf3f7024098c839c56ed1e53c7 - docs/models/billing-preview-update-feature-quantities.md: - id: b599e75a85cd - last_write_checksum: sha1:8a8f5254a3bf1422d7d34c3f7693bd650fb71684 - pristine_git_object: 111ed8a9c9a4d661df03cbea25ce32c70303b6f2 - docs/models/billing-preview-update-free-trial.md: - id: a7c1c266f2e0 - last_write_checksum: sha1:f65132feeb24383d23e0944c716fcb1470f7c9fe - pristine_git_object: f1927c2b06a78104608f2639cd59b80494f46b5b - docs/models/billing-preview-update-globals.md: - id: a9e11ef600ff - last_write_checksum: sha1:97b53b86e5851b813ce54e752449108afa7d1363 - pristine_git_object: 729798893c6cbeaa8ea67671c9a591fbc20c3b01 - docs/models/billing-preview-update-invoice-mode.md: - id: 3b23bf8970e5 - last_write_checksum: sha1:e9baa60060fb27fe5458a77bf22daa173e7d65cc - pristine_git_object: e11c822a5bb5bec80d5e84a9541cc38041ce33a3 - docs/models/billing-preview-update-item-price-interval.md: - id: fb22f4118c73 - last_write_checksum: sha1:e76e6f8c053d78452ab5b28bd1a53e6e2e04a3a2 - pristine_git_object: 47d9b76350166697d045c8a7cad387549b6d82cd - docs/models/billing-preview-update-item-price.md: - id: 15b031964e72 - last_write_checksum: sha1:96467fbc173e4b61538d9db525b7b94c126ec6f4 - pristine_git_object: 438e102c7921286d58e3b3fd4321d4923d46eabc - docs/models/billing-preview-update-item.md: - id: 582ad8a7016e - last_write_checksum: sha1:d5da9def48f4fe2eec5b83db7f765bcc825adc85 - pristine_git_object: 69874c55c6a4e3e236c35a9084c69c8c911756d6 - docs/models/billing-preview-update-line-item.md: - id: d647f3522082 - last_write_checksum: sha1:f88b8b1f40062efa2071058f361988d40c236e6c - pristine_git_object: 1ed943f4e07f70a2e53533bc18b475bb05f4e91c - docs/models/billing-preview-update-next-cycle-discount.md: - id: 9c3601f4d54f - last_write_checksum: sha1:396dabe7d30e31f233d6c2e197e6ef674e6302fc - pristine_git_object: f93a1245dfff6e0bc27772ddfe162bcefc1f8eb1 - docs/models/billing-preview-update-next-cycle-effective-period.md: - id: aa7e636f5885 - last_write_checksum: sha1:c76b9d2ccfc907c5c392f568a526e5e1c1bc5330 - pristine_git_object: 4a645d24eaca5511ab3d2b4a23b2f5c5bfcbb24f - docs/models/billing-preview-update-next-cycle-line-item.md: - id: 542fb852b4ae - last_write_checksum: sha1:72a6ae263c17a2eaf259ec01c0514fff76e38ebd - pristine_git_object: 76d411dc08437fc30de3858266274b28def2c17d - docs/models/billing-preview-update-next-cycle.md: - id: 6036c027e884 - last_write_checksum: sha1:69ae45131c9d7288c58509330a560a5c8257e972 - pristine_git_object: 3a02cabaf0e2b8340bcc8a52498583df1b8f340c - docs/models/billing-preview-update-on-decrease.md: - id: c1e80b9245b3 - last_write_checksum: sha1:b77aa7b0df8d21104e35cd98e40c520c110a6780 - pristine_git_object: 07c18b3a75751014a89f4f7728ffc698b4566e6b - docs/models/billing-preview-update-on-increase.md: - id: 051a8d780495 - last_write_checksum: sha1:a1ee58a3b97a034109f47eea5bb11285ef007aca - pristine_git_object: b3dcbbcc356456b83778c216c9808a1b7ef5de76 - docs/models/billing-preview-update-price-interval.md: - id: b3f18934e26c - last_write_checksum: sha1:1cd496514d8dc92f6e308ed4bcb44f898a6ea3b9 - pristine_git_object: 05d413712c92ebe38be389534bbfe1d7db7c00d1 - docs/models/billing-preview-update-price.md: - id: a9e474983960 - last_write_checksum: sha1:23e98eaf97cabf7f150e0318d13e4fc2f16e6de0 - pristine_git_object: ebc914f69075f9d8e308dd9fd06745d120464042 - docs/models/billing-preview-update-proration.md: - id: f2c074330022 - last_write_checksum: sha1:3fad86b02837990cd89038885e0001ce079d862d - pristine_git_object: 981563dc95fa105eaf903810acdf57d536287761 - docs/models/billing-preview-update-request.md: - id: 5eb7bb9c4e4b - last_write_checksum: sha1:e041d24f991ccfefdaf51023e140749a3eae7958 - pristine_git_object: 07a22eeaad9210f81758e4dc5e8430a83e08b122 - docs/models/billing-preview-update-reset-interval.md: - id: 453adf1acc00 - last_write_checksum: sha1:acc6ae3f2a0d931d052d13dd6384339270065c94 - pristine_git_object: 800d2758f690d7f18342ef992f8a206227dd4f92 - docs/models/billing-preview-update-reset.md: - id: d038dc41692a - last_write_checksum: sha1:a68deb90a3dae77da1986048751da07c32125636 - pristine_git_object: 1c6ae89cce28249d170b684c6bd2e9e33f892efd - docs/models/billing-preview-update-response.md: - id: fb81ae40e654 - last_write_checksum: sha1:84f2b9d5804e7155fbcaab11df9c796d288f1c71 - pristine_git_object: 53925f7fde6ec1d9d20412aeb65c52bb950aacc9 - docs/models/billing-preview-update-rollover.md: - id: d5c045d6805d - last_write_checksum: sha1:09a485f911c4795cfa7e4764da2a08f7404020aa - pristine_git_object: 66971dca33f0eef2af91bc9a83f3b6cae0cf5455 - docs/models/billing-preview-update-tier.md: - id: 54d9d5146e19 - last_write_checksum: sha1:2c360d6246e06afdb7fc0e7aa0974b97b9095517 - pristine_git_object: 29e61165a42f98350015d9d954ce79b2d31ef6fb - docs/models/billing-preview-update-to.md: - id: f8dba0179331 - last_write_checksum: sha1:a5dc259aa7fc5d51a8e5d908e7e56b242e81bde9 - pristine_git_object: 648197bc99b5ae64e96abf0eb06512c4486472dc - docs/models/billing-setup-payment-globals.md: - id: ee555b0995c7 - last_write_checksum: sha1:bb3fcea57f53e42dad9c264cde760b48bb9759cc - pristine_git_object: 4eea290daa4318d04f84fab17fe706978bdf04c4 - docs/models/billing-setup-payment-request.md: - id: 2a3c6f07200b - last_write_checksum: sha1:7e5bc719adbe1481507e5337ed2703bb5f6c4aa7 - pristine_git_object: 479b704b950218055783dcaacfb144cf66e8d293 - docs/models/billing-setup-payment-response.md: - id: f11d777cdbf7 - last_write_checksum: sha1:3524a73d1c7e53f311edc4d6c0d9bbb5c71d1d09 - pristine_git_object: 3c424b1abe19f5cea5221a53a2ff79c38036d60d docs/models/billing-update-billing-behavior.md: id: e8a9f500c132 - last_write_checksum: sha1:e93c2c4ce88028e327ac89f696cd65ff5b0c104f - pristine_git_object: fac0a1e5ceb8e80d4645c338279b5b64790aa4d7 + last_write_checksum: sha1:72b10eef0e79146a1dfb3515d9f058932a0b7305 + pristine_git_object: 68874c9e1da701993b0d8c86fcddf0814d536872 docs/models/billing-update-billing-method.md: id: 7fa432ebb343 last_write_checksum: sha1:489c66a6dafa3cf82e51239c94e1b75b51ceca72 pristine_git_object: cf04e983d7bf89ea5eb1cf43834caf82734f49d6 docs/models/billing-update-cancel-action.md: id: ab5cbabb3639 - last_write_checksum: sha1:42b1b5504117747a81071145d3eae03227ee26cd - pristine_git_object: 2a51699d3c803cfef151ceed0ccb8b3948623a26 + last_write_checksum: sha1:eb8165b2ea9a086c00f8153a69661852e8743663 + pristine_git_object: 68e5a3a00ee61c31522d695c2cdb26e2917f86be docs/models/billing-update-code.md: id: b84ac28f1591 - last_write_checksum: sha1:e23ee8f0cba08041242063fb8676fe2b8bd11559 - pristine_git_object: 0395a87548b4be60308a174558b5a83316575892 + last_write_checksum: sha1:f884ec08c9f953fc2c2ccb85d0bdc24a71d1568c + pristine_git_object: 167a5a0db0d9f92c36f1f181e642a246753d0210 docs/models/billing-update-customize.md: id: 533e2ca5e4bd last_write_checksum: sha1:2efd7c30b8caf828b782da4cb584982763312914 @@ -766,10 +246,10 @@ trackedFiles: id: 827a3d465f45 last_write_checksum: sha1:54a26a4b6d94edd5abe5bf4e46395d0025ae78f4 pristine_git_object: b1b13de32a3c725cdaa512629214bdf742bd0b5b - docs/models/billing-update-feature-quantities.md: - id: fbc15f5f88dd - last_write_checksum: sha1:58c0bb6a2c75f7a1cee7f8b0137f375aa9c8d88f - pristine_git_object: a442511368a1d2968aca4e3ec6284281891ee474 + docs/models/billing-update-feature-quantity.md: + id: 7a157e142f2d + last_write_checksum: sha1:b4a3f0366b074b9655e53ff369106447a0db9e1d + pristine_git_object: b00a0ce49bbb5a7f69f9f1941943a195a09caaa1 docs/models/billing-update-free-trial.md: id: 1dbc7560f2d4 last_write_checksum: sha1:de03b7b137619dbcd6624b922920f81c88491c6e @@ -780,12 +260,12 @@ trackedFiles: pristine_git_object: a5ca2395c55d099fdc8ca0eb2ca7d93121cc36a3 docs/models/billing-update-invoice-mode.md: id: 33eaf6fc88e5 - last_write_checksum: sha1:0a1a226e00b716e08cde966896c19f69a9ed233b - pristine_git_object: 41a918bde1c4d93d4320d511da5037b9e419a527 + last_write_checksum: sha1:fbb808bc2b039ca460b4f69c9f32ef3967e12d1b + pristine_git_object: 2f182773091916f4903b274a2a4163a5e9e5bfb1 docs/models/billing-update-invoice.md: id: af93d501891d - last_write_checksum: sha1:682f8cbaa0f49befed72b184cde626b6f2bfdc03 - pristine_git_object: 419e5a7ad9fd141eaea03be632ed766117dc188b + last_write_checksum: sha1:3fee4f5648997757b5e17a55fa74baaee170e641 + pristine_git_object: 13271e1570d542c4f7f1e9b3202d81999e16c147 docs/models/billing-update-item-price-interval.md: id: 63d4ab432124 last_write_checksum: sha1:4daa0ff655391276595bae9a512e3d68632fe314 @@ -818,14 +298,10 @@ trackedFiles: id: fcbf404063bc last_write_checksum: sha1:16c2ae0fd826818098a137d0fe8b4a93c7b6598f pristine_git_object: d21ea7ddeec02d3d27542b7fe435fd4d3491f2bc - docs/models/billing-update-request.md: - id: 29e20b402adf - last_write_checksum: sha1:12280466435b737c9b9ef3bdfe45616f62729cf5 - pristine_git_object: ad79f248303e56d87664e7c017394af279afd7a7 docs/models/billing-update-required-action.md: id: bf7357d5d4cb - last_write_checksum: sha1:41c74d57e6714477fb6b7d5f6855beaf1a618ce1 - pristine_git_object: 589db19f4ebb78def2d0126e11b7aaf441726e57 + last_write_checksum: sha1:a32fbd281486508857937d2eab1e6c3ecc6e06d0 + pristine_git_object: 038687e11b22142d0c2e341e60245e8172814595 docs/models/billing-update-reset-interval.md: id: 5e20b42507bc last_write_checksum: sha1:6fa39832434557ceed033ee80a4568f6bbf6a8c7 @@ -836,8 +312,8 @@ trackedFiles: pristine_git_object: 74108db68aa17591614ecd245e5efcb1d5051a34 docs/models/billing-update-response.md: id: 30bde576ea05 - last_write_checksum: sha1:20f01292b9b81aca3ac741f5054209312b4a3ee0 - pristine_git_object: c0b6d687b75ee11631ab02dc6b23ce53f5622bfe + last_write_checksum: sha1:250f8d222eb3ad2c005732882c0a00d7852c31f9 + pristine_git_object: 7b55206b3f362f48b2cfb4e0462c940b2de1afac docs/models/billing-update-rollover.md: id: b8d649352b96 last_write_checksum: sha1:78399e0cc18376b67a0274c430aa53b9ad898710 @@ -850,26 +326,246 @@ trackedFiles: id: 450946242eb6 last_write_checksum: sha1:7fe82feb15e2ce97cc617db910628bbc08599e79 pristine_git_object: 60fcbcb344d4c6c73b744c34eb416803c8090b11 + docs/models/bin-size.md: + id: 8913b50eac9f + last_write_checksum: sha1:358a9a244ac0e71d086aa2d695ca734f58e6a09b + pristine_git_object: dbd7fe4115a6b52486cb1c8157e2572c034ccba2 docs/models/breakdown.md: id: 786823ab8ff0 - last_write_checksum: sha1:6992c68ed199fd46e06c6e7d26d412704f9164f8 - pristine_git_object: f6bdbd480cbf0f5ae1083f2c9cd3a9cd0fb80e9f + last_write_checksum: sha1:989bafd9acd20b604800d13453206c8624ae853f + pristine_git_object: 90b7663ff533bb04d99edc1d0a1e36e761e35f05 + docs/models/check-balance-display.md: + id: b233e804e082 + last_write_checksum: sha1:9092c7c292b603d8172cbbea36540fa1c9eccd05 + pristine_git_object: 2aad6dc55b08ffedf6382f388edf128ac3008312 + docs/models/check-balance-interval-enum.md: + id: 2317071be135 + last_write_checksum: sha1:d70629d03e0f17163ff27a0f6cc823a903d0e4d4 + pristine_git_object: 585c44e739d7ebf182bb6b5b94dee265dda4ab3c + docs/models/check-balance-rollover.md: + id: 91c072a14c5d + last_write_checksum: sha1:3d5ce2cb48e95c285cfbc12686f546e536987ce2 + pristine_git_object: e1a0eafe31d65a079e323357cd37c1900dbce182 + docs/models/check-balance-to.md: + id: 7eb1b54638bf + last_write_checksum: sha1:9c98b4785dd2089eac0160536539bfd91270feff + pristine_git_object: a1d59f978ee42d534526170fde5e4b3d39c49421 + docs/models/check-balance-type.md: + id: da69c49b6600 + last_write_checksum: sha1:7f21eceda5391e309e815bbe8067aef11f8f93f0 + pristine_git_object: 1bb247fcc68b199fbf10361e2e57d11ed283eea4 + docs/models/check-balance.md: + id: 8e818789c8d0 + last_write_checksum: sha1:3e5111e60a541757b03bb51317f5588d7128e772 + pristine_git_object: a50ec6d9a4855c766ee893a1001c9b5a10afe44f + docs/models/check-billing-method.md: + id: d4f5c9817d05 + last_write_checksum: sha1:553ff873a4a0b160b69789ce0db7ba8ebb7ade24 + pristine_git_object: 7b1c6153c3080359b637ced64671055c3ed5ba53 + docs/models/check-breakdown.md: + id: 13a2f5741fa1 + last_write_checksum: sha1:459261a7e45dc8975990c7954cc270ccc02910df + pristine_git_object: da342975b1894c26b72b03677b52f2d7075b13ac + docs/models/check-credit-schema.md: + id: 23d351e08612 + last_write_checksum: sha1:37bcc109cb6a94dd52df2112708c9e4f4b2357a8 + pristine_git_object: c23257a97a3795d6ffe2570e5c95780918858e61 + docs/models/check-env.md: + id: d46376d0c4e0 + last_write_checksum: sha1:fb17dcff1735e72d8f17c8a8ef3ddd6b7970d8bd + pristine_git_object: b232d2049d3acc05d189413f685362c377b0c4a4 + docs/models/check-feature.md: + id: 17698212d17f + last_write_checksum: sha1:65a07ad25b023184e8ad9e89dd215e8618de65f5 + pristine_git_object: 6eb25292ed911d9d1e0621610a9a043057b9ae23 + docs/models/check-free-trial.md: + id: cf185d0b9316 + last_write_checksum: sha1:bc98bdff33e3810402bbd6223688c5aa09844685 + pristine_git_object: 9a2eab113dd5e34faccf718bd046d044ab0e498d + docs/models/check-globals.md: + id: c1c736dc89d3 + last_write_checksum: sha1:ca5e3ab0ab17689f318982a7889bcc89c7c0e1c4 + pristine_git_object: e7a1e28ebd8cb19e0fd665f56754c4252ced391b + docs/models/check-interval-union.md: + id: 039c02b39984 + last_write_checksum: sha1:31c43289dab7276a444309ef23737a9eed17230b + pristine_git_object: a50583f83be7762cb4f9b2ebe3571694d654c1fd + docs/models/check-item.md: + id: 65ebecbc13ac + last_write_checksum: sha1:1dd3278a73afc62d4fe45252e28a5fd247eceb92 + pristine_git_object: 516b1ea77dcf28b867bebb0cb334da1992ec4d3f + docs/models/check-on-decrease.md: + id: 361f05432960 + last_write_checksum: sha1:218fe1ceed4ce70d3ab91ee5f86430670544df50 + pristine_git_object: 7401f77ec62b2981202cbaf4bbf2ffe3379f6bad + docs/models/check-on-increase.md: + id: 9f889141cf7b + last_write_checksum: sha1:eb4f641b50be10d3316210c01a804d260373c3ab + pristine_git_object: 05a41c5e3b43f5b437df88e5c0b36e4a27efe8fd + docs/models/check-params.md: + id: 1f4a01957fbe + last_write_checksum: sha1:32e6916462ffb7d968815f1db610bbafbeef902e + pristine_git_object: 82091b180e85d311110cb6f128c316ccb9fd14c3 + docs/models/check-price.md: + id: 78377e0bcfee + last_write_checksum: sha1:33f5fa535bf809871f28213c810bf9c44db1759d + pristine_git_object: 58e05b53ac4cf582908d5dbc6b06e56efa7236d3 + docs/models/check-properties.md: + id: c5901a400440 + last_write_checksum: sha1:1a462db0ef3bf3ca2f672d32c6f5ec1e9ac55b87 + pristine_git_object: 27676665358eac64c387d26a660aba568c3970d3 + docs/models/check-reset.md: + id: bcb937481963 + last_write_checksum: sha1:45c3a1c3a24980a8dd0caf089f00ca333b09fd88 + pristine_git_object: 4f6898cda3d8010a2cdaf1e95b46ae798b1432e3 + docs/models/check-response.md: + id: d686426b106e + last_write_checksum: sha1:2b066833229ab649f3342c8dab239420a9fc7834 + pristine_git_object: fa322d46b1fbded8c734c53fb66d9ef088e50bef + docs/models/check-scenario.md: + id: 22b128408941 + last_write_checksum: sha1:104762f74c3cf7f795c7bfa056adeecbb4feee2b + pristine_git_object: 3d89a3dd6dc3e7143f44e7ac736018130ae18ca9 + docs/models/check-tier.md: + id: 6f00346eccf5 + last_write_checksum: sha1:7b8bc06086a46912eb81df7142ceea86c6f77c8e + pristine_git_object: 48a363f3e9e8b89c5acc0d34f1c28a190dd922b4 docs/models/config-rollover.md: id: 5ee80b023fde last_write_checksum: sha1:e62db7791a2a08562f37d915c7487fee45a3cadb pristine_git_object: 3ede299ad1f7d6119343996143e3880b8dee538b docs/models/config.md: id: bef254bf823c - last_write_checksum: sha1:b7469e619d64272f372e7450b61f88ebef8c024e - pristine_git_object: a02a537e84866dc989dc55456bf5f24ebb94e204 + last_write_checksum: sha1:bb7871ad8c65695b22f057f7a09c4aa702ede640 + pristine_git_object: 0c95560292c4a6a64789ea9e47d1603ce31fb422 + docs/models/create-balance-globals.md: + id: "892740232808" + last_write_checksum: sha1:e4d0a7c0a7bf0bd4f0dc95db3d8e2184235fb1d6 + pristine_git_object: 6f6ad53ad32c85aebcbdc02ea3b4ec81e82eaa60 + docs/models/create-balance-interval.md: + id: 1c482d19b0eb + last_write_checksum: sha1:c51159302867dfd0791282e6990f3aa53e41540b + pristine_git_object: 16dff46b7c09f4664d761722b9e8ae720fe5e632 + docs/models/create-balance-params.md: + id: d1b424bc090e + last_write_checksum: sha1:2fd31878b9fbbd0f5eced33d51e01602911b4ba7 + pristine_git_object: 1eaaee74a5216e95055907ce9512150785269469 + docs/models/create-balance-reset.md: + id: d0efb1be36d9 + last_write_checksum: sha1:b34a2dae85e1c0ad670d610bb41b02dcb1b529d1 + pristine_git_object: 4c6c1b98a1e091051db0ffdcb9efa575976c5dae + docs/models/create-balance-response.md: + id: e0a096d2f815 + last_write_checksum: sha1:d4a3abb20316dd1a9f6937b15544f90c88edb084 + pristine_git_object: 5a3f8c765ccd682f833dd305a9705770b8cae73c + docs/models/create-entity-balances.md: + id: 5efdec2b89bc + last_write_checksum: sha1:44f4b3b6a3688a5158bca9ec4e698dd6c3df442c + pristine_git_object: 5e2931c149f492f05376aa165d596e7f43449c47 + docs/models/create-entity-billing-method.md: + id: e5008598b612 + last_write_checksum: sha1:e04f3def9f51a843e4a5a9659b3b2a7d50667cfe + pristine_git_object: d0fa7d451561e45016c239f8adfa8e48ff475a51 + docs/models/create-entity-breakdown.md: + id: f78e7d3f900c + last_write_checksum: sha1:acf806a5ca03aee9961120acfe4a7541e40e7b10 + pristine_git_object: dbf164ae14d53f840433b5d5016eda3f2cd81502 + docs/models/create-entity-credit-schema.md: + id: 714d3a17c438 + last_write_checksum: sha1:5388b4e7c174a561c8ec96ebc17f69dc9ea8aaf9 + pristine_git_object: b1f2289d8a85b3c53da994caa496a5a0e0142176 + docs/models/create-entity-display.md: + id: 1383d4af5588 + last_write_checksum: sha1:403432c244de66bc9f59bbd8ef7927e0a6bcc587 + pristine_git_object: 76bb58eb252f9169ce4ebec9d90fda46de2dbee4 + docs/models/create-entity-env.md: + id: bdc2d4cbca15 + last_write_checksum: sha1:7e8a20e31ba746e91bfadc5212e4178f3a3d5564 + pristine_git_object: 923094468b6a6435f41c1f9d831f345ac8a73012 + docs/models/create-entity-feature.md: + id: 53cedd277218 + last_write_checksum: sha1:5523448348912cc64bb70f248804f19bdd720b52 + pristine_git_object: 7fa4e021b8804bbfc999d2b796d767137e06fa1f + docs/models/create-entity-globals.md: + id: 902a5e970af5 + last_write_checksum: sha1:f733da769666730afd447084599622aa3d6e816f + pristine_git_object: 8cef19073e786b968f8c19bb3eab0a292699c58b + docs/models/create-entity-interval-enum.md: + id: 798217a9fbfe + last_write_checksum: sha1:a59d853a6260727c5d6ff315bde97a6eefee85af + pristine_git_object: 2c259aa95379cb1b78e0a6063150ed079b800c60 + docs/models/create-entity-interval-union.md: + id: 17bb5a7c0f2c + last_write_checksum: sha1:3dbcd60659ceb1046288a6a35fe1d397f048a0db + pristine_git_object: 4466891ac632d6aa84fd6172cd464f66f003fc4e + docs/models/create-entity-invoice.md: + id: b02e52191f2a + last_write_checksum: sha1:94f7599ae86979af91e3f8afa73f5e462bbc98c1 + pristine_git_object: 33704bc682a0498a481d2284b0953d18cdce6a4f + docs/models/create-entity-params.md: + id: 18435c8a7fbe + last_write_checksum: sha1:6d3c6a8156317b0b3a47f45985c03ca6f1141fe5 + pristine_git_object: 7cd7963b97738dfc643b511e67aec00b97323fbd + docs/models/create-entity-price.md: + id: ad6d959a3f3c + last_write_checksum: sha1:e4e5dcaac1a8d1121790d00bcc1e4cea47d75607 + pristine_git_object: f309f0c388b85e670b54027d106776e21cbd0d00 + docs/models/create-entity-purchase.md: + id: 0ab83f1b1fde + last_write_checksum: sha1:0c1c8781d2d3e584e3e63c998a50d2de9d81ade0 + pristine_git_object: 2900587b566b4b460283024da4d4d2cdcdb31f5b + docs/models/create-entity-reset.md: + id: 7e01c0bd6c29 + last_write_checksum: sha1:8af369ac517ae7f5659b91b4a88806f85e0e3600 + pristine_git_object: 50dd1a63ca6405a86443214947b9aa90cabf273c + docs/models/create-entity-response.md: + id: b05b19776a8c + last_write_checksum: sha1:a9b1de567e385a8e83498d383f5229b9d98e033b + pristine_git_object: 2c6be3d88e404acf8556f32f94fc4cf0c0bd4fd4 + docs/models/create-entity-rollover.md: + id: 160b69c15d68 + last_write_checksum: sha1:2b90ea7bd61dd0d77e5ca6cf6b31e65042613971 + pristine_git_object: d042fbaa06388dccb954a19b3864792fe69bdd94 + docs/models/create-entity-status.md: + id: 658f1e6dd4d5 + last_write_checksum: sha1:72bf7235eccc3a1a1d871e28628e0a2ae6d689d3 + pristine_git_object: cf476e13ae64e821dc99420ba57aaf3b3a6d3262 + docs/models/create-entity-subscription.md: + id: d07f3f230823 + last_write_checksum: sha1:1fbaccfb0ee86bf1f4db967dd226339a95b57964 + pristine_git_object: 7ff33528c9d68fe729a32c58fcb49851a949b7c5 + docs/models/create-entity-tier.md: + id: ec31825fb620 + last_write_checksum: sha1:9b37ff483944b0e5455905a9063a189baf819d92 + pristine_git_object: 4753fa0cc3f4d3f8aa5a7fea570acf8e27a3da3e + docs/models/create-entity-to.md: + id: 1ff10ed642d3 + last_write_checksum: sha1:62a42ed36841fc334d6f6d8d1940f2d8362e9b22 + pristine_git_object: ee1882db761e24fc00df707e6d0c87aa12ceb68f + docs/models/create-entity-type.md: + id: b7fd22bd7861 + last_write_checksum: sha1:7115e055f68d64e9bc505f1a7630f6865ced19b3 + pristine_git_object: 059a26599ce46e890b612344f585d2695604ced2 + docs/models/create-referral-code-globals.md: + id: 6e32bb0907b2 + last_write_checksum: sha1:35e5d951bf5ff283f2c8325e02b597ec695cd0c4 + pristine_git_object: 35e4440ee86d246d9dffa3cb20c350fd75f64290 + docs/models/create-referral-code-params.md: + id: 7f6d9a2322b6 + last_write_checksum: sha1:0129aab93b4f2f8dd8e6dd3fda1c87b062e835bb + pristine_git_object: d37d3fb103b81dbf060646555e2e116eb3879aae + docs/models/create-referral-code-response.md: + id: 8d8c5e4e1502 + last_write_checksum: sha1:94a43a0d34bb024010eb069d5d2e71b4d5f87d39 + pristine_git_object: 4971dcd50e07c557f14ab1fe6c87ff430903d288 docs/models/customer-balances-type.md: id: 07f78390b2b8 last_write_checksum: sha1:b8f9ee007d08523105f4edb917bad45d71420f0e pristine_git_object: 56317c9af5573ebb281faf683e103d9107cbab7e docs/models/customer-billing-method.md: id: 06ff2abe6f74 - last_write_checksum: sha1:1a9942bc1176ec5185bfe33171162879bf79f405 - pristine_git_object: 12c6c12ff6d8e5fc4dc9a98e0ab1dec6ea7efbb7 + last_write_checksum: sha1:8cbb6c0925f1bcebf2d3a5a7071fbfb9d68b4d3e + pristine_git_object: a5ffcb219b3f54b03f8704a15a1f75f468ccef3a docs/models/customer-credit-schema.md: id: fa77c00fcafd last_write_checksum: sha1:adf6bb711b3cfd99d84da8977c3005cb3baa24e1 @@ -900,28 +596,28 @@ trackedFiles: pristine_git_object: fd2e47dfff6dba01fbad342c2de102c69d44643f docs/models/customer-feature.md: id: d90579a4e5c4 - last_write_checksum: sha1:2571ed92544e364abe99128501011d5745ee3267 - pristine_git_object: a5179d50af3036734719b4158358e7dd6cd730c6 + last_write_checksum: sha1:662f7e0f0792dd6d5c21fc49e23936ee43607cbd + pristine_git_object: d26c97ba4fc31eb3b2027fb8ce1b5adf80aa2b2b docs/models/customer-interval-enum.md: id: b224f2bcbf4b last_write_checksum: sha1:ef6926633f780442c7a7bce1a12c230465f3d6ad pristine_git_object: 7c66977ea25849ef3b234b4944d04e3e9dfd6219 docs/models/customer-interval-union.md: id: 19eb9860227e - last_write_checksum: sha1:8382a134d2408871763ba53f7cd484d6bca64350 - pristine_git_object: 51b233d363c22a95561c44c811ec71721339edac + last_write_checksum: sha1:32ceb892d2647d3d96f3880cd2d37ff8c77382a7 + pristine_git_object: 58599ba43ca146a2c52080b2ae7b686181bf55fb docs/models/customer-price.md: id: 8eec49124dd8 - last_write_checksum: sha1:297d12a534c20d11365f454a0f225f6b63c40f17 - pristine_git_object: 88a0feb0eb977e6bb085f3c0af1327ffef946036 + last_write_checksum: sha1:426a96558f59e3f42db83517f2d56d4733c1edc5 + pristine_git_object: a0620af3a2c06af740495b87c4efbc0f956f193f docs/models/customer-reset.md: id: 27ef7dbfdae8 - last_write_checksum: sha1:326f09990ff11b053ab2f1d74bf401de7d4a1be0 - pristine_git_object: d9fa2417ea1c8f119ebf31421585f27b61ff647d + last_write_checksum: sha1:7ee51193a320a4972f46dc015c954e206edba359 + pristine_git_object: fe6183522b6d2ed91a93cad8a0841cae40dd735c docs/models/customer-rollover.md: id: fe5a77432fc0 - last_write_checksum: sha1:018ac63c30698124f84c74b763e81c17fe946ed5 - pristine_git_object: f450d1ef04ca1eca64590a374333ba5de6210b06 + last_write_checksum: sha1:787fb163afe7c459d4febc73156f06cd6882e359 + pristine_git_object: 356394a6d2983b51c9199cbaa11fa14362700581 docs/models/customer-tier.md: id: ceeee4e97075 last_write_checksum: sha1:84bc0703014f1d9131d6287b261a474166c3c0bf @@ -932,8 +628,8 @@ trackedFiles: pristine_git_object: adb4e6a216daf5fe4f5e1566821240b1406007e1 docs/models/customer.md: id: 42ac97d31359 - last_write_checksum: sha1:9d3f9fa3d14b9a85ee6e8bb245e213768ebc4da2 - pristine_git_object: d7c1b370d1bdab1832f7315616c7b5dae45661e6 + last_write_checksum: sha1:54edaa32997a20b738a75708ee2cf67d4083cf03 + pristine_git_object: f33ec4127124ba66899cd15a3f57c860c950d7a0 docs/models/delete-customer-globals.md: id: e2b2740e2b2d last_write_checksum: sha1:92a62a15010425dfd1b008717705100796c00620 @@ -946,6 +642,18 @@ trackedFiles: id: 7f761e2b18cf last_write_checksum: sha1:b525944202b47c959409d3e0e13edcd0eaa0ecdd pristine_git_object: e019f8f1bbf3f5a24efe970442fc712d61517c3b + docs/models/delete-entity-globals.md: + id: feb619565697 + last_write_checksum: sha1:62684b5d54f6429ec7696dcc213b28bf0c7746bb + pristine_git_object: 7163a2434b46a6d8e9faa6558173e29c00f3b43e + docs/models/delete-entity-params.md: + id: 3cd02c1e0040 + last_write_checksum: sha1:195e7b0bfc8320391ee92d1cff7e86c8b7bec904 + pristine_git_object: ddadf5b19e2277517badaf8210d16e4660883d9b + docs/models/delete-entity-response.md: + id: 6ab9c7801460 + last_write_checksum: sha1:9584a0871969f677a00aec085fe77bc66683a3d5 + pristine_git_object: 6518f0a56332f44caba658751337ad438c625a91 docs/models/discount.md: id: 003b28f6c8a6 last_write_checksum: sha1:514d11ebc37ebdb692a8137be44b60d35549cfb7 @@ -958,6 +666,14 @@ trackedFiles: id: 903c73579a5c last_write_checksum: sha1:3d90d8923798be834d241db6e33846dbbac2cfdf pristine_git_object: 2ea16cf6f98cf4b2085ace4dae3ff34cbbe45f9f + docs/models/events-aggregate-params.md: + id: 081dcd1094d6 + last_write_checksum: sha1:8b233f7cbc8b41551b2a6fee6ea970bb69c38f2a + pristine_git_object: 5a208edf63e7771c6fed16f614fa16d0f3267af5 + docs/models/events-list-params.md: + id: b743a4817767 + last_write_checksum: sha1:ce78329b5fa5e47a5902953216b6342c5828cdb9 + pristine_git_object: 2386a615094cde13c26394cf4ed00fd1c066cdfc docs/models/expiry-duration-type.md: id: 3a927f275515 last_write_checksum: sha1:7059b0a8efd82cdb43c176b868824f5e26d8eb0c @@ -974,6 +690,94 @@ trackedFiles: id: 7d40737b76e3 last_write_checksum: sha1:ab8208a5a5ab8963a8c8fa7f93dfdd9cd068f6c4 pristine_git_object: 4600b15c1d50b17c86bfde5df59541dd36c152e1 + docs/models/get-entity-balances.md: + id: 62fb852c3708 + last_write_checksum: sha1:b6ea62e27792fad4f6b449971831f271c32b0409 + pristine_git_object: 37792392a7aa0e09965be167016d944ec53eed24 + docs/models/get-entity-billing-method.md: + id: 08408396576c + last_write_checksum: sha1:31f18efff2a685cef796e6a3aa4545b74affaa80 + pristine_git_object: 8dc05e30fe0faf970a165d6a1faf8429f550583a + docs/models/get-entity-breakdown.md: + id: 5b82389449be + last_write_checksum: sha1:1c64f77aa03e5be323f99c6520cbb7d7689201e2 + pristine_git_object: 1784f8fd6510148cf58fad857c85c3731afabaac + docs/models/get-entity-credit-schema.md: + id: 6f32eea7abc4 + last_write_checksum: sha1:f97e14d9ca6525feed0cf0b5779ab2c7c4fd0397 + pristine_git_object: 3e7d8d7cd116179ba28514865f874b125ff49355 + docs/models/get-entity-display.md: + id: 505b1368abdf + last_write_checksum: sha1:cab28305f97bea7280dee199fa7522727c1beddc + pristine_git_object: 4b1627c2be57bcc5551a243baa41cdbe5def10c6 + docs/models/get-entity-env.md: + id: a0aec49ca920 + last_write_checksum: sha1:dccda9677d4762959de028b0008965c35968f846 + pristine_git_object: 5490fe5912db6de66a4cfeb05914e41db0cdf110 + docs/models/get-entity-feature.md: + id: 61710e83f226 + last_write_checksum: sha1:cda306d2b94100c6f798771e051fe41827450e01 + pristine_git_object: 58541df1e58337c51b0ca6152cd9eb4a2cd42ef4 + docs/models/get-entity-globals.md: + id: c9509577b5da + last_write_checksum: sha1:0dcd4ee92f21286f58234f5344f5a768a76ba22e + pristine_git_object: a05c79848015cfc966a86adc26edda38beb06849 + docs/models/get-entity-interval-enum.md: + id: 70cd333f0b71 + last_write_checksum: sha1:7632867e83c2bfda6199e4d43e379253a9198bbc + pristine_git_object: c9080f7a6497c2cecbac8e943696a2adc235568c + docs/models/get-entity-interval-union.md: + id: f34f1d190cf2 + last_write_checksum: sha1:78c3ca41fda73f16ea5c03349c2f31631ba06eeb + pristine_git_object: a8dd65e859be45047221d2efebf02cb89ad2bd28 + docs/models/get-entity-invoice.md: + id: 37da93d0f360 + last_write_checksum: sha1:63bb55760e1d91d37780b77957707627f49ba37f + pristine_git_object: dc79e5f9a47c5e2b80a689b321b24b39c18c2b68 + docs/models/get-entity-params.md: + id: b8e4e660b43f + last_write_checksum: sha1:eb63d62c409271526176d7d7f785f865e0b4f8a6 + pristine_git_object: c80f55c5bfdfbff9754e248d771131c7b08322d2 + docs/models/get-entity-price.md: + id: 6c1a4361c621 + last_write_checksum: sha1:6812080bb4ffe9203dc6faafce6469dee46c256e + pristine_git_object: bed688bca59e916e8a6fb18541b6adcfab137ab2 + docs/models/get-entity-purchase.md: + id: b53cb753f928 + last_write_checksum: sha1:39caf81d807d1d830aa04d305f3a7b1242075b68 + pristine_git_object: d5cabde956e74305128951c3c7d72f1a3543d5ff + docs/models/get-entity-reset.md: + id: e4665dfd8168 + last_write_checksum: sha1:20bc9c5b0f44b2f771a0fbcc05983c519d576055 + pristine_git_object: 0e56393cb9a138470082f7f45174b103e12a1c9a + docs/models/get-entity-response.md: + id: 125e7bd4f436 + last_write_checksum: sha1:1249249a145c5214e54dd3e7034fc09b6ddb6a42 + pristine_git_object: 8f7051a27595808efdbbb850b050db519b9debc5 + docs/models/get-entity-rollover.md: + id: 4de03c5af9ff + last_write_checksum: sha1:db7b6400b533a75a7578c29ca939c8f38458c1b5 + pristine_git_object: f3f8aacd6702667198f2ccc955cc1b57f1763dba + docs/models/get-entity-status.md: + id: 06f4024e9973 + last_write_checksum: sha1:1b1e20ff2b6580f8db11b441174e9d9ec923d2f4 + pristine_git_object: 065cb9fd1c823066fcc5e8b1c353eaf607cc82a4 + docs/models/get-entity-subscription.md: + id: 3c768c24c069 + last_write_checksum: sha1:6cadfbd6d5bee718de8c5d26efb255fbab1a6513 + pristine_git_object: 77245e53abbb9dabc33d57b68c73aacb70a74c7d + docs/models/get-entity-tier.md: + id: ad9c57171150 + last_write_checksum: sha1:7d456f88734002fdaf89507107adaec722b4c3fd + pristine_git_object: 1e122164872cd7275eaa7b1b7228e1b91ebf9b52 + docs/models/get-entity-to.md: + id: a612ccbce79c + last_write_checksum: sha1:ae15a050b2d536b336dc3702649b37103505aec0 + pristine_git_object: 7f1b033fed0ab1e3267670a957ff8be67283e142 + docs/models/get-entity-type.md: + id: a4327c9850bb + last_write_checksum: sha1:820ad2709b2a2be65fc0ca72cccd406b8eb62251 + pristine_git_object: 5365c6a7975bd46060ca6674437e289e7a35ed11 docs/models/get-or-create-customer-globals.md: id: 4dd584e66362 last_write_checksum: sha1:2f39158f4225bc4e4fbc5507304a0654c7a2af79 @@ -986,70 +790,6 @@ trackedFiles: id: f27abcdfdd7d last_write_checksum: sha1:ca0a41260fa62322a9525f4267ac0ec6d93ae6d8 pristine_git_object: 5fe6a61067cd319d6cd0d1e1e7f1d165c0d4579d - docs/models/incoming-balances.md: - id: d374de62f567 - last_write_checksum: sha1:0427c9d1c60180243f7b1b21a6a25e4af2d929f1 - pristine_git_object: d7aa18a435815c67678b401063f4ea446448eedc - docs/models/incoming-billing-method.md: - id: 602168a4cedc - last_write_checksum: sha1:a71ce01497dd5ee960fcc3f2a1e6966fe717df61 - pristine_git_object: ad0d10422e0934600ccf04b155b577591de9e2fa - docs/models/incoming-breakdown.md: - id: a52e025e8649 - last_write_checksum: sha1:ab685e06091f5e02efb87bd2dcaa0d29785cbd83 - pristine_git_object: ef753ea993933e410d6576012cfc66524d6babf5 - docs/models/incoming-credit-schema.md: - id: e3f652113358 - last_write_checksum: sha1:12c18c9e498e040d8635b4e4bad010e6ced3a48e - pristine_git_object: 7eba2de8ed8f8dd9089632994d8d4145f06f948f - docs/models/incoming-display.md: - id: 070b82142219 - last_write_checksum: sha1:aa0392eb07600632497383dfcbd5ec29a4211b25 - pristine_git_object: 5fb1963b8bddfb73087e228f8cc886315cf23e9d - docs/models/incoming-feature-quantity.md: - id: c796c4238157 - last_write_checksum: sha1:ee3551e82608463416c6a96f37e527285d12b75a - pristine_git_object: facaea982604f53c11e18034a43c4dde6742bfb5 - docs/models/incoming-feature.md: - id: 4e5f0caa929c - last_write_checksum: sha1:b5d02f7b5b021fa67de4c131aa4a8823a893c316 - pristine_git_object: c3984fc7a1c0bb571f8553d7c962341f45ab62c8 - docs/models/incoming-interval-union.md: - id: e2ff0cec2fcd - last_write_checksum: sha1:63534f4991b41b0c13b2d2796dc3d2a0dc87fc80 - pristine_git_object: 157784f8930799f21738cde473c5dbfd648bfb6c - docs/models/incoming-price.md: - id: 6df15926a43c - last_write_checksum: sha1:12e6878bc8763f32a20809c8c8297541c6db49ff - pristine_git_object: 6e46fe6c6d77e1601b6769ff4d91d9573a085cf8 - docs/models/incoming-reset.md: - id: 140522c2d1e5 - last_write_checksum: sha1:ca1106b335c4543bb56e1ffcf93f50041ec68a46 - pristine_git_object: 78df4f2bb166cde7ae6cbf4a4f1b1820d37ec82f - docs/models/incoming-rollover.md: - id: b7161cb73833 - last_write_checksum: sha1:6a41000fdcc66749319c99c1ccee59a42280721b - pristine_git_object: a7f1b9a30781b8c981972fe418e7891015cac06f - docs/models/incoming-tier.md: - id: 64ad2e302840 - last_write_checksum: sha1:fa37b8dc3abe6faa9d066e5c8588606cef28d6bd - pristine_git_object: 95aee55098ce1ff2ad1c2e578f1eadad2bc8e368 - docs/models/incoming-type.md: - id: b4e51c9462f0 - last_write_checksum: sha1:6d30e5e06c19cfff3ab7e0e7b55f5c79ee50d188 - pristine_git_object: 24ad3e91fca94f76da5397679897bbaf953637a9 - docs/models/incoming.md: - id: 440441d25a42 - last_write_checksum: sha1:5265a1e6b833d8ef04d95642994fdfb2ed0d9d55 - pristine_git_object: 14b39cf62ca462ee56b5a47651a178dd97cb4d8c - docs/models/interval-incoming-enum.md: - id: 4beaa3b22e5b - last_write_checksum: sha1:957607f01827ff06ecda175d8880a6ab252c7ac3 - pristine_git_object: b2686033a1176b4915da778654cb5f9e83470c57 - docs/models/interval-outgoing-enum.md: - id: 3cb6d43a70fa - last_write_checksum: sha1:faf3c98e57e25bb649bcf8ef047619c69aad87a0 - pristine_git_object: 1f89b22cad5d5cae3aab8e2d7ce7b1856cf4b669 docs/models/invoice.md: id: 18e2034f11ad last_write_checksum: sha1:321079a7eab955ee497e7879908a4c2e9ee446b2 @@ -1060,16 +800,16 @@ trackedFiles: pristine_git_object: ed47413dfd80f05f59b2a5f870b612430faea3f6 docs/models/list-customers-balances.md: id: 46cd8155bb0e - last_write_checksum: sha1:1d670bb537ecaffe2f48ced508c1cf672b2ade03 - pristine_git_object: 57123fe519103cc83169e9ddaa0a7fcbaa15d94d + last_write_checksum: sha1:1b4970d002c60209760affe8231d59b75a6d2949 + pristine_git_object: fe5d016e7ac6f8af6b2c1f8ecd7bb9cfec4b911c docs/models/list-customers-billing-method.md: id: 0d3398dec326 - last_write_checksum: sha1:f13e148e053d42bde8430b3fda4803bf7163f77c - pristine_git_object: 3ddd429f50edea95c30f8d0f163aca6e809e74da + last_write_checksum: sha1:fd0c7b0b38706580a164f631d217a63fe9295e8d + pristine_git_object: 7b56a65bc4d871919f706616fa678905d481cb09 docs/models/list-customers-breakdown.md: id: ccf93d67f0e0 - last_write_checksum: sha1:c57363b82b82a2630374718c21832b4cc8f4dedc - pristine_git_object: e24c52777169794b632e0838ea0c4f6c88734fc2 + last_write_checksum: sha1:a5a9cebbeb53cff9bb573e12774b05c43660d484 + pristine_git_object: 4e971a94d84d7bf2cce2b9f1f4019dd725a44222 docs/models/list-customers-credit-schema.md: id: bd8c18aa56d6 last_write_checksum: sha1:7a96afb453ef3df9964ffa03fa62738c2185353d @@ -1084,8 +824,8 @@ trackedFiles: pristine_git_object: ae3dc7884d8884306e3df9310c093ec681637681 docs/models/list-customers-feature.md: id: e66feeb7ba38 - last_write_checksum: sha1:8ea956d31fa73dd4a5c22956c8e1cb1aedeae3c0 - pristine_git_object: 2f16077933c2b628365efc79088d89fd3381fad3 + last_write_checksum: sha1:1cc6fd3886688a95543f76b4a9193dd0766320f2 + pristine_git_object: 2bd98aaab8e35ced9c3e4ed49e74514057c51399 docs/models/list-customers-globals.md: id: b1ab90baa295 last_write_checksum: sha1:b89d70a4cfec57491c4af6b821acc506036a6114 @@ -1096,8 +836,12 @@ trackedFiles: pristine_git_object: 532eb231bc4265e68cd708cf6fa961ca157b2ac1 docs/models/list-customers-interval-union.md: id: df32c8ba2c0f - last_write_checksum: sha1:05df9b4b7c1feb2e1fc476c47be4991fd1c52cb0 - pristine_git_object: 9f90f9e8b1e95bc793ac1665907026096fc41594 + last_write_checksum: sha1:fb1dee1023c18b42cb93612ad3db77c8a4afba68 + pristine_git_object: a7a56c95ad615ec2267f3b391f7d1db7a667f933 + docs/models/list-customers-list.md: + id: d9cf28563990 + last_write_checksum: sha1:3051c4513abc8e4b291bed2ceb0d040564a4d44c + pristine_git_object: ee6aa859605e673bbba73dd3cf5866094cfd2ad2 docs/models/list-customers-params.md: id: 2a01311d59ad last_write_checksum: sha1:099d1b5f75f7c95f6ea79caf42a4a09e3e75f865 @@ -1108,32 +852,32 @@ trackedFiles: pristine_git_object: 4b478123d07c00bf4b2c64a5cdbf9abb6e62d4c6 docs/models/list-customers-price.md: id: 550a843b57e8 - last_write_checksum: sha1:4c73576b961e987151695a50b28d814fe420e829 - pristine_git_object: 9093cb2a1901944d472afa8a8b3b386aaf7030ff + last_write_checksum: sha1:bbaf1462d0ed297b4ccf946b3f8510a0405ae064 + pristine_git_object: 9b10d7f9057bf1e3a1d68951d24d44442a7b03b6 docs/models/list-customers-purchase.md: id: d650442c19db - last_write_checksum: sha1:6ab974c1b43afd4c0aa7ec780e136abb25371f0e - pristine_git_object: 15a224ea137cd118e80acc0a8a64e5c0d7779169 + last_write_checksum: sha1:ade85104c093739ade880fb8c6a12ae160e46e9d + pristine_git_object: fe03aa7b5c0cfbff67fb4d0885225349b46eaced docs/models/list-customers-reset.md: id: 6db31dd08290 - last_write_checksum: sha1:b01b4709a0c8aa2624fcb3a7871acfdfe0578f36 - pristine_git_object: 95dda29ba204003ac1541ad08ba8b084b3000236 + last_write_checksum: sha1:6a15c531945621942c24afae202cb091ed840025 + pristine_git_object: fd9eb265d370916c0894ac5ce62a62e228e17da4 docs/models/list-customers-response.md: id: a8afc03241c9 - last_write_checksum: sha1:f1fe9816d19c3546bc072a51b709b34b78278fb3 - pristine_git_object: 42ef6f2334aa5e4d49b1230dbd137e27d79ded77 + last_write_checksum: sha1:cab1c2886b77b29500d05575fcd986d9ac10ec2b + pristine_git_object: b9c809a5bcdb3d793f4c81baf82db1adde3cf3eb docs/models/list-customers-rollover.md: id: 5cfdb990f867 - last_write_checksum: sha1:93262b341fc92d299fa78f9d83aa5d552be9a706 - pristine_git_object: e297b53d161144af333221f9a0730126bc101403 + last_write_checksum: sha1:c25b11c3593b255a5b55031429ac9ed33659a215 + pristine_git_object: 762f2e2dcfaa7cce43c1bfbd9972a4848debce15 docs/models/list-customers-status.md: id: a101fc59dad3 - last_write_checksum: sha1:4468f2e7993bb0917e444392fb28f421d4d6cd44 - pristine_git_object: 6972de2eca4078bb4625f20946d8163bf915e623 + last_write_checksum: sha1:7b6f527d630b8733488c3527c6097ab8ffdd1c88 + pristine_git_object: cac7cc97ab962419fca75b9d9d2982d25343f5e9 docs/models/list-customers-subscription.md: id: e5c39bdff7de - last_write_checksum: sha1:b3ea35bea7d20edefca920d7cb3f10cccba93dbc - pristine_git_object: 678d509b7e78c0b2400de6c4a6e2b7ff2c5f85f3 + last_write_checksum: sha1:93a506d6f24097f030cc808d37afe6991bcc0200 + pristine_git_object: f81e735e0d0a34a04a86c653ee805899203f5be9 docs/models/list-customers-tier.md: id: 6b79b434f75f last_write_checksum: sha1:d8b70b33bc066203ea74421f493644bb13e5a886 @@ -1142,6 +886,30 @@ trackedFiles: id: 0800cbc8ca9e last_write_checksum: sha1:ce41b4d4a6a56c5f9612079fff6040c13caa239d pristine_git_object: 98cd871a2608aea5ad1c414eb845d27245073dc6 + docs/models/list-events-custom-range.md: + id: 61ea802fb875 + last_write_checksum: sha1:29739e8653c6bc2cb893b8c5fecd7503436f91ad + pristine_git_object: 95468d9cb93f1d6b77e579ac7b5dc3bfe8d0d40f + docs/models/list-events-feature-id.md: + id: 0eee3e349cf2 + last_write_checksum: sha1:0afc3fe8072a7614dc6329e9d0730de90206717c + pristine_git_object: f7d9b81a1cbc884bf61ebed8f759feb3612ae778 + docs/models/list-events-globals.md: + id: 359e8a5d5953 + last_write_checksum: sha1:fd713f7328ef5cc7636081976bee8e8c4a748223 + pristine_git_object: 4a0f0f2d50c2e4f6dc611d56834ec786476cf470 + docs/models/list-events-list.md: + id: 77561e5dc860 + last_write_checksum: sha1:5f8d80bda9c3c6825aa18c7b9ad71e9dd97d0593 + pristine_git_object: ee704864be4786cbac1dcfb6ba107a968d14b1cb + docs/models/list-events-properties.md: + id: 079abf203811 + last_write_checksum: sha1:ace0253396abce328b04f25e76089e33d2b5740a + pristine_git_object: f54bd0dff30f0ab18c51bb21b3cf2c96da44567c + docs/models/list-events-response.md: + id: 1eec34e11f04 + last_write_checksum: sha1:0444da69aef839866f12de44aa63aca40fb19af7 + pristine_git_object: 3957e220e2c44aaa3801a922cedba95b0637edf6 docs/models/list-plans-globals.md: id: 0ac8385a612e last_write_checksum: sha1:e98f76c08fe70bd0b28e9e60669b01a53f5bdb8f @@ -1154,10 +922,6 @@ trackedFiles: id: 9441ad31d57f last_write_checksum: sha1:44fc1035b00d64902c4faba40c680e9ea1537edd pristine_git_object: 69b048bed027e783e547c8f66e32b5d3857d8f09 - docs/models/list.md: - id: 8b31ed970535 - last_write_checksum: sha1:95b239cec1d8ccb8567d63da23de51f72f32d472 - pristine_git_object: 76fdf5d305ba1493108c579791c5836713ee20e8 docs/models/on-decrease.md: id: 101f3c344c1f last_write_checksum: sha1:b8ddb1671b4362bc1aac1936914e10aa554414e5 @@ -1166,62 +930,18 @@ trackedFiles: id: 2094ea0eb56b last_write_checksum: sha1:7659fe425aaa2b88880e746f18b15bdf10b910f3 pristine_git_object: 93010d453c873028de83eddc22d515539582a209 - docs/models/outgoing-balances.md: - id: bf7fc0b18cbd - last_write_checksum: sha1:dd3bba83ba5328e99cb0f175cf7225717e609db7 - pristine_git_object: 33ccd99f1aaf9ab3760306c80154cd042ed18e93 - docs/models/outgoing-billing-method.md: - id: 109e17e2f8f5 - last_write_checksum: sha1:11090fd3c60432cd6a94cb17d62a3581138c2313 - pristine_git_object: 4db5123b9d9f60197fbcfd8bfd5304354037eb0d - docs/models/outgoing-breakdown.md: - id: 0593f700f7df - last_write_checksum: sha1:d8ed909dfa9b88622a4fe23311328b46470bbd19 - pristine_git_object: 979288102952763413ae4c5baa92ac15f082613d - docs/models/outgoing-credit-schema.md: - id: aef5d0af0d19 - last_write_checksum: sha1:93b6d0d8f5426c2efe1a188d806f552975444808 - pristine_git_object: 5999ce837a39a072c40edee08c1bae041ec742f9 - docs/models/outgoing-display.md: - id: 61a576ae4249 - last_write_checksum: sha1:0ff67b03742323624c9cd75228d9217ce977e2bb - pristine_git_object: 907b0f8f66e92f414f03403900022a92106eef66 - docs/models/outgoing-feature-quantity.md: - id: e03476d150b1 - last_write_checksum: sha1:a769d0565567d0e4fa40997dd0acfbb4c81ff2d1 - pristine_git_object: a01d2fa3011a375f94b5f17d18e6606724d065f3 - docs/models/outgoing-feature.md: - id: 1ba8806efb95 - last_write_checksum: sha1:a0b4b8cf3accc006687b667abc608257dcfba57d - pristine_git_object: 104d8d0e2c1b4c5498be48be53ac4598278a9710 - docs/models/outgoing-interval-union.md: - id: 26badcca7e1b - last_write_checksum: sha1:b216a051c5b035f7c22b6cc1e13c376149ee0fa4 - pristine_git_object: 2b4f663b6048430967361d4efe091a746595ecd6 - docs/models/outgoing-price.md: - id: 87037aa7a8a5 - last_write_checksum: sha1:ca290770aeea3fbf3ed39e7792fdad812f8ca8d5 - pristine_git_object: d8c40c9ec77e188ad72e2b3f20d8457fa003ef02 - docs/models/outgoing-reset.md: - id: 90a611000e78 - last_write_checksum: sha1:b043635179cf65cd48f187312cb79d509d6fabba - pristine_git_object: b3940e0f1c05660c7866130904ba24fff6bce0d4 - docs/models/outgoing-rollover.md: - id: 1b778883ec0e - last_write_checksum: sha1:7636fee96f8c1d984af2aeb7abb48ee1c68f269e - pristine_git_object: 63a6eaf4f7f5c6a45d992b9cf073519e9c65dc7d - docs/models/outgoing-tier.md: - id: e6883d375fe4 - last_write_checksum: sha1:8736bed85880cb96a07cbc09547355d5851b18f5 - pristine_git_object: 5b7208924c25c4935e1a77eaa98702482980c10d - docs/models/outgoing-type.md: - id: dd1b0ec7046f - last_write_checksum: sha1:2789c625ec2f17a7524dae47f7819d7b92220e3d - pristine_git_object: d6c26e5ff159fb5aac08f53f8d3bbf81f8ce4ac5 - docs/models/outgoing.md: - id: 5ead4a3a13e9 - last_write_checksum: sha1:ddf1046db0aefda84dcc4a697603075b52409808 - pristine_git_object: 1bc95403e0807bfeeac952251f6edb62953a38ae + docs/models/open-customer-portal-globals.md: + id: e0e501393359 + last_write_checksum: sha1:eb5269be19a6426dfb429110bd750f61a9e2495d + pristine_git_object: 072dc3533a6dc2500ae46223aa9dc45e3f604fa4 + docs/models/open-customer-portal-params.md: + id: ae39be99d2ba + last_write_checksum: sha1:a5beb5bb9a15644762d3f4e682b65db54a1ba143 + pristine_git_object: 11bbdcff15d72d51b81d8c767717344cf9e9f6b1 + docs/models/open-customer-portal-response.md: + id: db6fcd462a9f + last_write_checksum: sha1:3cc1d095c088534baf5c662112b85e1dbd868a0e + pristine_git_object: 160d8340897a8bb4ddc8999bd05e49e2baf3c0ec docs/models/plan-billing-method.md: id: 4789ae90ae01 last_write_checksum: sha1:8b53127c48cd1e81a29d62093ae96a52359b268a @@ -1294,10 +1014,246 @@ trackedFiles: id: 900c4149ef4b last_write_checksum: sha1:08f56cb8cac6d89aba2436975994c1648d8d286d pristine_git_object: c02b9a57fbf832794d06b60296903c7304bddb55 + docs/models/preview-attach-billing-behavior.md: + id: d74cdf2445f9 + last_write_checksum: sha1:dc93f1c2f72a5edc0632962b47e7642c1b206992 + pristine_git_object: 52a5ee918a72ccbb8b0c022d1b7e629526f7ba87 + docs/models/preview-attach-billing-method.md: + id: ed9b4632aabc + last_write_checksum: sha1:3336a7e408425ec5e3111a00a19bd1563e13e7bc + pristine_git_object: 7d5384ae1d24f2ed2f9cfbbd59b53c198bfaa27f + docs/models/preview-attach-customize.md: + id: 56b1da317d34 + last_write_checksum: sha1:327d93e3658bf85c3a0605a25213a68f5773cff1 + pristine_git_object: 31e70e3a3d873c57678074ca57e998dca3d9f185 + docs/models/preview-attach-discount-request1.md: + id: 554f6e16273f + last_write_checksum: sha1:cb1bf4c5a3d5329f63b124f33ba50db5b8f53ffc + pristine_git_object: eafd005aae2e96392bd4d0f53fcdb3ca495b85bf + docs/models/preview-attach-discount-request2.md: + id: db5d080ccc8d + last_write_checksum: sha1:7e31d502043a04ad9794de370336ee61305d003c + pristine_git_object: d21a18ae617d511116d8adf11aaf185dfd71050a + docs/models/preview-attach-discount-response.md: + id: 15f5bdbe5733 + last_write_checksum: sha1:ea3b1a9fd75ada2f2e0060f4abff928bc95745c7 + pristine_git_object: 7657b968b857d4b47c87b585eaa7b69d41954303 + docs/models/preview-attach-discount-union.md: + id: f2e4dbc8ae35 + last_write_checksum: sha1:560d88c9751a3937cfed8e068d9daea34d1b5431 + pristine_git_object: 7d77c8d2cab05bdc384ba2faff5034d32928739c + docs/models/preview-attach-duration-type.md: + id: e74685b36193 + last_write_checksum: sha1:5b256f824629ae65cc8c6e515d63c12a4f5fc6b4 + pristine_git_object: c42259efca376f8f8807fbaba355eba1627ad975 + docs/models/preview-attach-expiry-duration-type.md: + id: e306a966ba64 + last_write_checksum: sha1:becf749264efdbdbd1e725deae55e11534cd2a2a + pristine_git_object: 9cfd61ebc94ce21266b36407d4544992eafafc2c + docs/models/preview-attach-feature-quantity.md: + id: c448b13170d7 + last_write_checksum: sha1:1f37b34f37160e82dadf752cfcc0ebb18c593645 + pristine_git_object: 8037d8cf7d96f480e95f25679d386eee7c18a20a + docs/models/preview-attach-free-trial.md: + id: b82fa3a54db2 + last_write_checksum: sha1:f9108e18b8f4ac3b14cd0e9414879283b65da1c3 + pristine_git_object: b65e3dcb31c32f14baeae021000610dc9e45ff93 + docs/models/preview-attach-globals.md: + id: 6f9378538e25 + last_write_checksum: sha1:468f1060b7560bb8ef29eaa6b142852d9a2906aa + pristine_git_object: cb8d444d5a433ff328230073f2018fb45f881c4f + docs/models/preview-attach-invoice-mode.md: + id: 52be741aaa35 + last_write_checksum: sha1:aa2e16f83e6f12f781c200d6c0e39775d8c8184e + pristine_git_object: 97e52602f6ae11592f38d3949f781e685554d67c + docs/models/preview-attach-item-price-interval.md: + id: 9d980cd59b4e + last_write_checksum: sha1:ea0ee01ba5fd8db2b90a2448db52c805d91bfad3 + pristine_git_object: 26c8b425de1cdf7f141cfc5368aea98e82143351 + docs/models/preview-attach-item-price.md: + id: 7198a3dcdecf + last_write_checksum: sha1:546227317a65ddef8f69ecdc53829da946471fb7 + pristine_git_object: 204288b951204b68d7d3a7e74dd485e87c151c42 + docs/models/preview-attach-item.md: + id: 0cb27cc26622 + last_write_checksum: sha1:248ae819bd4ad71951acbfe5ce2aac929881ea11 + pristine_git_object: 58d3071e96888c644f5228a58d5a8fc35af9abe2 + docs/models/preview-attach-line-item.md: + id: de7befb3b1f6 + last_write_checksum: sha1:45f99e10f5461975bfc3cdadc6f8dcf2599336ad + pristine_git_object: 127b4dbac64018a7b677af94c4782ae80695e77e + docs/models/preview-attach-next-cycle.md: + id: df92599286d6 + last_write_checksum: sha1:359d9f776f7d09f07d477282f484b300a26b4310 + pristine_git_object: 224836d3a6bac1091fcc2c628e4bc43662ce1f2d + docs/models/preview-attach-on-decrease.md: + id: a2d8483a2bcb + last_write_checksum: sha1:cb620b14004c7e90c91cbeee3605b1b9204c39c5 + pristine_git_object: 7990abab7ca12e1295b486962af7af858139889c + docs/models/preview-attach-on-increase.md: + id: e43a332a8b23 + last_write_checksum: sha1:bcfac345638c698108861cf2d2f28754b04572de + pristine_git_object: f12893d76e50a76c0f9d436a5de3a9e5dd4ba2ed + docs/models/preview-attach-params.md: + id: 29fbf5be911d + last_write_checksum: sha1:64aa093712d99c804d86f670cd9c438fa066cde4 + pristine_git_object: 13b4eb9aa2dcfbe7aed80ed9a219d78eaf0e5120 + docs/models/preview-attach-plan-schedule.md: + id: 216721a34465 + last_write_checksum: sha1:c019a49a07da4814558783baf8f61a94a85617a3 + pristine_git_object: f805bd91506382bfd158be4112c48e11f3822add + docs/models/preview-attach-price-interval.md: + id: b7acb2b27e53 + last_write_checksum: sha1:b8402c8374cf2f522ecf8a3c2b96df9f6d06c225 + pristine_git_object: ec12dc9c248020bc203cebd4e67ffde0c688076b + docs/models/preview-attach-price.md: + id: 73d456b81f1d + last_write_checksum: sha1:723b45a259a1157accf3fc65708957df1867d2a6 + pristine_git_object: fd9c1477143f17c836cf46e26cc16ffab2e4cd05 + docs/models/preview-attach-proration.md: + id: 5396ba36c83b + last_write_checksum: sha1:fc91f8f943a6736493e60ea5d0e61a37a17fadec + pristine_git_object: 0a47b28d0f565652a94da0d99503834d60e4a9b0 + docs/models/preview-attach-reset-interval.md: + id: 47af8773c6da + last_write_checksum: sha1:6ba5df48785895d4469f546f95f2b67624959820 + pristine_git_object: 45a0f9186c182e66df0445ca14ad2664fc3178a7 + docs/models/preview-attach-reset.md: + id: 4542e232812f + last_write_checksum: sha1:432ce97de353b797516b220b0bf8a588946e169c + pristine_git_object: 25dcc11c8522d25caa04fcc8678d8cab9429d21d + docs/models/preview-attach-response.md: + id: f53481e3c4e9 + last_write_checksum: sha1:2b8c6281969e84f9dd72128f14947d771010b432 + pristine_git_object: ee09a52b4875b7fa7f782705cafd17b310d9d20c + docs/models/preview-attach-rollover.md: + id: 45bd31144856 + last_write_checksum: sha1:72fd8383f04acc9f683c8f62432b790c6da7de52 + pristine_git_object: 61746c7f9f6b45c0d29f9d092ed63254b5f7ae09 + docs/models/preview-attach-tier.md: + id: b673bbf7eb00 + last_write_checksum: sha1:87d34d121aa0319c6531a83054cd638e74a22f71 + pristine_git_object: d53b282977f7784aa5c38ddf68941399ef84c368 + docs/models/preview-attach-to.md: + id: 030e7d9eb542 + last_write_checksum: sha1:a99b9dda4fb20c320952c188259fd4a6f5f3a3db + pristine_git_object: e7f0025357984088cebe4aa6f9af87ef6848d774 + docs/models/preview-update-billing-behavior.md: + id: 993399767e7c + last_write_checksum: sha1:511fa4f9e620a7e0eb3bba9f4e207ee8fb99f7b1 + pristine_git_object: d576dca35cbb63a9111bbc9f933cccfed4f299e0 + docs/models/preview-update-billing-method.md: + id: 51dabedde884 + last_write_checksum: sha1:2d0a809d249809fd69a88d898a448f11bf68dfd9 + pristine_git_object: 7e312adfb74d1cff7feb8b9cd38f500492625b2f + docs/models/preview-update-cancel-action.md: + id: a8b52c5ce0d3 + last_write_checksum: sha1:75917bffb982a440cc34393c99252d563f7fb10c + pristine_git_object: 0bb67d6c2ccae89db38e76b9f6e7ec2116dc8d6e + docs/models/preview-update-customize.md: + id: 96ff2b01f7eb + last_write_checksum: sha1:2a0db41f6763473d04b2aa9c476f2562e081ed53 + pristine_git_object: 6e85c1dac6e7ff5674a9aac455c2ae8e7f03eaf1 + docs/models/preview-update-discount.md: + id: 4b698ca5724f + last_write_checksum: sha1:bc1e84fcd364d0d344696b34d6fb19e1cbc1054c + pristine_git_object: 1e135288641d484a59be68f6cee54df7b9e4d2e6 + docs/models/preview-update-duration-type.md: + id: 7af46b0f762b + last_write_checksum: sha1:dd203bbfb53ea196dab34a248cca356f549502b5 + pristine_git_object: 8e7a60015cc707a93d88cdeb1f803c02cef32576 + docs/models/preview-update-expiry-duration-type.md: + id: 6ab8a72fab97 + last_write_checksum: sha1:897b1f5bd1a186e89ba9681aa2639ab198bf1f40 + pristine_git_object: 1f2e38a003c637c8b00fb7868fea0cfaf96b80a9 + docs/models/preview-update-feature-quantity.md: + id: 11f11ab645b6 + last_write_checksum: sha1:ad7c9f3f9c1ffb8016d7433afa38853a04c93c7a + pristine_git_object: 214107e1b2a10d78f202a3986f250243f3ef1b3c + docs/models/preview-update-free-trial.md: + id: 8e0901a527d2 + last_write_checksum: sha1:e2126cb35ad2795a13eafde86639d5dad3a32d33 + pristine_git_object: c17094121ec140d1b4043473a0e8755c23fcdea4 + docs/models/preview-update-globals.md: + id: 7007e72c8bad + last_write_checksum: sha1:8b76fc009fcb2884695294ac0dbe6765efaea760 + pristine_git_object: 932c0343b8542ca57a45335b45fd82f447d14106 + docs/models/preview-update-invoice-mode.md: + id: 50a22a368768 + last_write_checksum: sha1:2753fa2eb31780aac9b3daff7744a571c290e59b + pristine_git_object: 2cec59e4e1670db77a61e68ec7b243c8fcf66ae2 + docs/models/preview-update-item-price-interval.md: + id: 3b265ec431b0 + last_write_checksum: sha1:583594e0dfecbb579906ebd140b62d92f23b6403 + pristine_git_object: 331bff6f573798e54fd1acba1e0685005d2b1155 + docs/models/preview-update-item-price.md: + id: 00b74df0e261 + last_write_checksum: sha1:06f773afc3307d77c99e4952449335d5fa939f01 + pristine_git_object: 220c9e3735e8d685beaf980b9913438271e61c64 + docs/models/preview-update-item.md: + id: 6680b6d5d841 + last_write_checksum: sha1:d966c496e69e86ba57f971e6cad4fdab4a66a604 + pristine_git_object: 6f29adac3fa1418417cafae0db6b487b1e5e7327 + docs/models/preview-update-line-item.md: + id: 3b5e9cbaebed + last_write_checksum: sha1:3d40288e0414b99512fad8f44dc03205debe0d60 + pristine_git_object: 50f036c2b4eb55e495422433113ff7312e19fe23 + docs/models/preview-update-next-cycle.md: + id: 6c060a367be6 + last_write_checksum: sha1:f571e63f8756e7fd0f9757c6b5f8d70132dc71bd + pristine_git_object: b1733620aabde628d99febde73c5d8a32f2ee2c5 + docs/models/preview-update-on-decrease.md: + id: e5d78a7b0bd1 + last_write_checksum: sha1:3fd01b49372727991923acb8808ac3ff1607507b + pristine_git_object: 9015efdb69ac5e83713f69f3c0eb32417e5ffd02 + docs/models/preview-update-on-increase.md: + id: 9b0255c20331 + last_write_checksum: sha1:288311401746adaa41b0dfb4f5f17b63eded877e + pristine_git_object: 2d0494cfbbaf6c7412c2082ef8f467b55d5b8d57 + docs/models/preview-update-params.md: + id: 4f27fa514996 + last_write_checksum: sha1:6cfa299847d728e46c8fee92eed09c5a43aeea4f + pristine_git_object: 8f98d98b0c6783b02252457c24704dc9d1b31db3 + docs/models/preview-update-price-interval.md: + id: b53e2aab5336 + last_write_checksum: sha1:ace2f2252fb77f68443eacae090d6e0b6cdc5018 + pristine_git_object: b1a5ecd50b6622c28a9925bdeffc4b64ee497ba9 + docs/models/preview-update-price.md: + id: f1d2ea5fd71c + last_write_checksum: sha1:9c6ac2124188862c054902f0b5bab4d4a0649148 + pristine_git_object: 2b270cb8648863b0222549e5dd839038865227fc + docs/models/preview-update-proration.md: + id: 096020425f5f + last_write_checksum: sha1:809d8b0423478847de40e50635159cfd0525206d + pristine_git_object: a71c9503b0802dcdeb0a7219c22929ac952d8521 + docs/models/preview-update-reset-interval.md: + id: fbd38c74980b + last_write_checksum: sha1:9d37db272f92e28704543375db72d2daab26571e + pristine_git_object: a95452f3272a6c9142c5964237d821b6f17d6ebc + docs/models/preview-update-reset.md: + id: e2d2c2dc2f09 + last_write_checksum: sha1:0af1489cce57d31d9a4bc4ffbbfa3fb3216c2e54 + pristine_git_object: 0c1660a205b76c69293acb1a82f61a0e5e012d2b + docs/models/preview-update-response.md: + id: 8106134ab3a8 + last_write_checksum: sha1:d361a7748d176bab0a46ccd0c123db00089d66bf + pristine_git_object: fd461344e5ec770652f75ecf8bc5751545f769a3 + docs/models/preview-update-rollover.md: + id: fd27620d33af + last_write_checksum: sha1:2db61c95557031769fc1ec808711409ca0a827cc + pristine_git_object: c9e3aa1977dfc45030c0bc82bc476387178a6b97 + docs/models/preview-update-tier.md: + id: 75b24899101d + last_write_checksum: sha1:043d1828e1666d7a17607c2fc9c09801408c978f + pristine_git_object: 6e170c5d8e1723ac8838fef1de72f53dc387a33c + docs/models/preview-update-to.md: + id: 3409c0c34539 + last_write_checksum: sha1:45a0d4e4932f6d10d47d9f6f7a31805cb2056d12 + pristine_git_object: fcda14627b67ed67632122647d46e2017e2d9406 docs/models/preview.md: id: ca71b601ef12 - last_write_checksum: sha1:975307f31997490c67b973d33c24acb3d539404c - pristine_git_object: fc961659da37b1c0d08d317189be4087b0c09d5b + last_write_checksum: sha1:83b97643b438c9f8c649d8d15d7e8a20ef9eec96 + pristine_git_object: d38bd912d9225d833d01e2a9e0221a79ea19f0f6 docs/models/price-display.md: id: e7cc8364bc4b last_write_checksum: sha1:f7d122e7b7776cdcffbc40fd2ced81a215d89c23 @@ -1320,24 +1276,32 @@ trackedFiles: pristine_git_object: 3545a7deb0f2c9974c512988e31f2b5e6e2d038c docs/models/product.md: id: c91436bbe13a - last_write_checksum: sha1:18496fc0a76b124876e7d9315baeba7c3f8381a6 - pristine_git_object: f280693805cde62d01e5f87d1557e384169d3b32 - docs/models/properties.md: - id: 78b1b1d1b631 - last_write_checksum: sha1:5d6627cde2aa86a31974cd3bf255765757c35da2 - pristine_git_object: fda272f14753b6e647c681e24011c9de15a57724 + last_write_checksum: sha1:4f32659bdbdd6cc02f2e3664709c4ff969def976 + pristine_git_object: 6d1ae6a8f5f9b91e51d1b7f36b521c1ba49c2856 docs/models/proration.md: id: ac1d089c0fd1 last_write_checksum: sha1:a0763bf3863245e1ea7004d99849431c154e9ee6 pristine_git_object: 05c6c5284e3e954c03ab875fb305da54e325b60a docs/models/purchase.md: id: f872769b6939 - last_write_checksum: sha1:7b7325af438fe6e59bf3c3f20c154b3ed572ae4c - pristine_git_object: 4454516cad393790d24cf831f6884eedbcebb868 - docs/models/redirect-type.md: - id: 1d9607b50899 - last_write_checksum: sha1:e049cf4ff5bf2821304b23ef1f2e376eba20682d - pristine_git_object: c8ae9b9eb453bf5d7013f983a98f84d95060ba74 + last_write_checksum: sha1:f478ae26fe728efde7d8e38ce46593dab6d5f9d0 + pristine_git_object: bb9d83c959fbb7198e943506a2fae66a0e0f45b8 + docs/models/range.md: + id: 0cae0c76762e + last_write_checksum: sha1:05ccea3be76092b640e73a465cdd61ca0b8f6606 + pristine_git_object: 9ba10cd8669d1f8b448ff7d940c5faea66f1cc66 + docs/models/redeem-referral-code-globals.md: + id: c2de2fdb9460 + last_write_checksum: sha1:beef21f752aec1fcc578f63914a2477783f5a059 + pristine_git_object: 713cbd270d980174d2fb1ea330780fed01c839bf + docs/models/redeem-referral-code-params.md: + id: f056aef0ddf6 + last_write_checksum: sha1:82e7d7a6137079da119e525219d8b0f72258009f + pristine_git_object: 676c658ee24c6aa7d78f116f9188e04cc8c3c3cb + docs/models/redeem-referral-code-response.md: + id: 0c273445ab84 + last_write_checksum: sha1:4fc83a9af2140ddb2188a46a3eef78700819aa55 + pristine_git_object: 3fbb73fe19162aec9d53713c580e10f0e2a574a4 docs/models/referral-customer.md: id: d9629d974163 last_write_checksum: sha1:e4dab25dd04e413f338e813241694e88cb29c09f @@ -1368,16 +1332,16 @@ trackedFiles: pristine_git_object: 314e31deee282b89d14d2a2ef710ee795c9a936c docs/models/status.md: id: 959cd204aadf - last_write_checksum: sha1:e317fd6c26662da3d7a86188280bb120bf1e6f60 - pristine_git_object: 041eaf0d0962f12510d4d8c8031ad3cd9cd7d5b8 + last_write_checksum: sha1:08c58905f6c77c4ff486465c91970c69178eaded + pristine_git_object: 69a5f31b0639d3ffbd64103a34df48bde16da8cd docs/models/subscription-status.md: id: 041b9e856b18 last_write_checksum: sha1:1aabc380fe08ae6fb74c04e205c079831c70f0fb pristine_git_object: ae011837937def92a382e601b7285fae1151f38a docs/models/subscription.md: id: 4a200793e0f4 - last_write_checksum: sha1:97dacf3bcc58a132384b9066f7e5c292c601cdd3 - pristine_git_object: 4d0a253fdaaffd0a33068eae30ace9fc552d04da + last_write_checksum: sha1:105a87deb34a22f3c31984ecb3dccba50bc00029 + pristine_git_object: ed4f767c1e16844e11dfcfadfd672a44d5e7489e docs/models/tiers-to.md: id: 2582c0b2833a last_write_checksum: sha1:af895c17ce80d2c9464763a8ad39cf3a70c3ba94 @@ -1386,22 +1350,166 @@ trackedFiles: id: 06571cdb201f last_write_checksum: sha1:66db9d137065222c5237f33cbda18a341ba97696 pristine_git_object: b16a170c8c8ff2bf634dd3dcf37e861d3290a250 + docs/models/total.md: + id: f4060c3b4657 + last_write_checksum: sha1:db27b4c0beb158424465eff3298baec188ae6bee + pristine_git_object: 07b601a1e1dbf1e05d82533970723f712e30b145 + docs/models/track-balance-billing-method.md: + id: 75e9d99c20fe + last_write_checksum: sha1:219528d8c6413f5c35c8058a98d6d246e8e28e9d + pristine_git_object: c46f7278c01ef21ecc5403a99eb0ff81542ade68 + docs/models/track-balance-breakdown.md: + id: c6a8f349bb1f + last_write_checksum: sha1:e8d50c2ec93bfa9dd621663e0ac9425310f3a133 + pristine_git_object: 23a2f6e3a3876419ab61181746b879b870f1a995 + docs/models/track-balance-credit-schema.md: + id: f2d5dd29cc75 + last_write_checksum: sha1:d9321681fc8442b7a1f9d3c70f8d3143f76159d5 + pristine_git_object: 466a0da0eb11ac38e3c631d57a2b4c515fb1c66b + docs/models/track-balance-display.md: + id: abc921901a97 + last_write_checksum: sha1:74c5cca3b5a0be09f824ee0d380c6c94a7258760 + pristine_git_object: 1308065bd9f4ec69b672625d6726b93ae6988880 + docs/models/track-balance-feature.md: + id: 4618d37518f5 + last_write_checksum: sha1:a86c608489e3a3ed283c15acb16bffa71a40f481 + pristine_git_object: 4c19e6294b61ad5f8fd9e6ea03a6e1ecf503c828 + docs/models/track-balance-interval-enum.md: + id: fd4cd9557866 + last_write_checksum: sha1:8f58fa0a9400724a08c6a19f6d4c80b281b332ec + pristine_git_object: 2edc66f13c5ed6aa9d90a2643d37b094118347c6 + docs/models/track-balance-interval-union.md: + id: 3ec296c12aa8 + last_write_checksum: sha1:65348d2a0559a23e10fdb8adfa076ae4424129e1 + pristine_git_object: 17c27a8b2a8d9fb4f62c0a646405156564c1c10a + docs/models/track-balance-price.md: + id: 7e2c99abc244 + last_write_checksum: sha1:ac9cd1d1e3ce3245c53f224ffaa45dc5f2622694 + pristine_git_object: 9d08305f630be8ff7552e72508e283f4aa55a669 + docs/models/track-balance-reset.md: + id: f601e722a75c + last_write_checksum: sha1:fe003f47acac14a2626c7a63112dfa0b6d06d597 + pristine_git_object: 2ea4e0ab19e787863208d7afb3537068c4f43912 + docs/models/track-balance-rollover.md: + id: 109b168238ef + last_write_checksum: sha1:84a5aeef312acee1f0e8cee4b543e36844ec6f8b + pristine_git_object: 15d9f03c745d77c7a506bf5c08dcec60e7632c8b + docs/models/track-balance-tier.md: + id: 77890da7e86e + last_write_checksum: sha1:506675e8b59e02386937111971e64c3ee8f08a0d + pristine_git_object: b479f4067305bc700a78d47223ef179233c26bf1 + docs/models/track-balance-to.md: + id: 40e55ef34130 + last_write_checksum: sha1:ba741af168697c0b831a94d1ede67e87659bad73 + pristine_git_object: 56194a5a5eb3fd21e2254eef2996d27c19cd9dba + docs/models/track-balance-type.md: + id: 546fe2ea5fa0 + last_write_checksum: sha1:23d5277ccff9d77656c0008a662e1255ec842023 + pristine_git_object: 6a2179a2d957155f728c6ba447d4577b4e228166 + docs/models/track-balance.md: + id: 1503abca910e + last_write_checksum: sha1:6a2f7a55114877c61bb054c562803e07d47ce8e5 + pristine_git_object: f4968f02bd4a85c2404cf806fdb68b52782635aa + docs/models/track-balances-billing-method.md: + id: 9a81f10462e6 + last_write_checksum: sha1:3578fdf2affb42c649d31c40fe7369d2e29314c5 + pristine_git_object: 0432bd3e6b93cb72a50bb22a544131d21a8eed78 + docs/models/track-balances-breakdown.md: + id: 3084e11977a3 + last_write_checksum: sha1:bfa55b774248320354a6050e0fc88f1a9a5d0fb5 + pristine_git_object: ed05dd0f57129c0976860c326aa1af22f5093f25 + docs/models/track-balances-credit-schema.md: + id: c4658e8dc82a + last_write_checksum: sha1:1f607187cad6c671acac9d1d91bc3fe3af377ea1 + pristine_git_object: 208f1746db2f79c15a02e6f57b4b8fc8a90f7d8a + docs/models/track-balances-display.md: + id: 78a906476291 + last_write_checksum: sha1:3a97e8e7e12822356477f4a248b33b5235b10e16 + pristine_git_object: 6bea8f16ef343b5bc8d1ee560fe9ff2720cb151c + docs/models/track-balances-feature.md: + id: 24aa4796e57c + last_write_checksum: sha1:a6f0342c36f49444aeb5e84f782e3487a0b034f3 + pristine_git_object: bef8890df8780a9a229fe421d9cf7e9140526b3c + docs/models/track-balances-interval-union.md: + id: 479e33599fdb + last_write_checksum: sha1:533e519d361e5b0c29a35a1fc98ab4e22e509a6f + pristine_git_object: fc370cad4b1726650545aed01366d2fc593cd1df + docs/models/track-balances-price.md: + id: ad0ee893ef71 + last_write_checksum: sha1:28d6e659798bd690e69f8d54c55fca6b83355caa + pristine_git_object: 98638229eb924c1de9075dc3b8cecb0ea515968a + docs/models/track-balances-reset.md: + id: aa198e758cf6 + last_write_checksum: sha1:14d911b3acd8082acecdf7e1e8ed702b253a98e7 + pristine_git_object: 8afae68c1bf71c15ef429ec6c0dd3db95c366388 + docs/models/track-balances-rollover.md: + id: 184b4f80f12e + last_write_checksum: sha1:37ae7a1184a3efdcefe47dc730263a874fe5945c + pristine_git_object: ec6f47d7c890ce9036665d34a2ba793474aea730 + docs/models/track-balances-tier.md: + id: efe82f22cbce + last_write_checksum: sha1:cfcfd006cd7bbb2c858fe55c85295665634ccaa0 + pristine_git_object: 4699fd1516a0d0dfcf5a6be89609f94b649bdcdb + docs/models/track-balances-to.md: + id: 1a6838504f37 + last_write_checksum: sha1:8b1012801c355fb36d282362875eaf05c19d98f0 + pristine_git_object: 58f9768476f8bf268d3ee1f71d54af1944832d64 + docs/models/track-balances-type.md: + id: 93e563a582eb + last_write_checksum: sha1:16758342ebb9a5124c126c8eda648fa304a6ab26 + pristine_git_object: cdfe15ec56f85ad4ec7bb9158e2fc6097a18215d + docs/models/track-balances.md: + id: 61c4c8f23ca0 + last_write_checksum: sha1:05ac03c0ea838d8ccd893eaad0e089f38e03f1d5 + pristine_git_object: e426f03cecac09ba45b34765f2513894b1f8d070 + docs/models/track-globals.md: + id: ea94605fadf4 + last_write_checksum: sha1:1886ac8d50d0d16265f9edf99c0fe63a9a18bdac + pristine_git_object: 0589b3d84baca72139a2bb03d0fa0b44c822cb88 + docs/models/track-interval-balances-enum.md: + id: ecee12668aa6 + last_write_checksum: sha1:a73b21ea438f4064a93aba47c425b1edc1a38e48 + pristine_git_object: c665cb94927c1f3bafd405a6ede3a3fb3fdd43af + docs/models/track-params.md: + id: 68e025b0826f + last_write_checksum: sha1:3c0b3fc5e89dd061420039efc2cf27a9a36fc7f0 + pristine_git_object: eef55734f329a6b7648ddc9b40bd3c5ad0c648d1 + docs/models/track-response.md: + id: 0d3ebb1bbfdf + last_write_checksum: sha1:b126ac00cbab4d8a5ff4fea3d0c5e7e6f5efa6f7 + pristine_git_object: cfd5df63d9224c4afb5cdc31fdf7c189c71b2754 docs/models/trials-used.md: id: 983b78eb51b7 last_write_checksum: sha1:0fdc1753311eb276ea3d69f275f9bafaf196e538 pristine_git_object: 72df6cb602ecac3658f8cbb19ea2c460995b7a4a + docs/models/update-balance-globals.md: + id: a53fa7049940 + last_write_checksum: sha1:9daf54610174ed6607c383cefdc939977f9f7844 + pristine_git_object: 00afc64c03e50efc72669ef71339f34d840a1d31 + docs/models/update-balance-interval.md: + id: 577fb978555b + last_write_checksum: sha1:9ff1fa5cd1c0825b5ac46beb3f7be9bb463e7a71 + pristine_git_object: 926c9d23317270c16dd2b71f670b3a6a08eb0c5b + docs/models/update-balance-params.md: + id: 0a3afda4e55e + last_write_checksum: sha1:841b0560ec14ad14879b7782a0e07d3594d6a913 + pristine_git_object: 0b869f0d49882d117a1c132f11890f53abb0c64c + docs/models/update-balance-response.md: + id: d4d5020d6417 + last_write_checksum: sha1:d2631ed8951ecffac9131fea4f5dba7cbf04a194 + pristine_git_object: 499e9e62b93f93e4774017a911c621b91407c3bb docs/models/update-customer-balances.md: id: 1bfa8c6cffed - last_write_checksum: sha1:4d0032ada0430399279f5fd8f7c27906c6211626 - pristine_git_object: 011ff0fe532ae95af0738f860353ad9e097e3ce9 + last_write_checksum: sha1:7fb4fe7d4fcc72ef427063fd1b094e1ebd1cc137 + pristine_git_object: 5fab89c303da46c4752ab5c14d9f5c6c8bfe90c6 docs/models/update-customer-billing-method.md: id: 88c216b41cc9 - last_write_checksum: sha1:3bb481957c5c6c49eafbf6f203f509f5b7e2cd58 - pristine_git_object: 8ce9fde5f55f832e49db75595f2d8ce9043491ac + last_write_checksum: sha1:7849ada649d9d055d34c8734aac80df5ca993c92 + pristine_git_object: c5e64c366fdf4586e1277db2c23bc13176d9d975 docs/models/update-customer-breakdown.md: id: f58ab0f6bff1 - last_write_checksum: sha1:15dae25ce69e028151ceb3fea98a1c8b540aed53 - pristine_git_object: a39a9da7e62530194a691bc5587b94df8253d336 + last_write_checksum: sha1:eeb443ec292484b120017584b5d71e0d296456de + pristine_git_object: 5b0f66ceaeccf1311936ffdf4fe88404890977dc docs/models/update-customer-credit-schema.md: id: 3cf3ff338501 last_write_checksum: sha1:ab98468adfe3343dadcaf47c557f168345bfe0d2 @@ -1416,8 +1524,8 @@ trackedFiles: pristine_git_object: 43114cf33fd88602a5997e6575e4a30af88001e8 docs/models/update-customer-feature.md: id: 168e1b65d4aa - last_write_checksum: sha1:cc7c910d313598ad01b4489a3cf2d37ddbea8202 - pristine_git_object: 91b2ad87ba67757f5310b0739ac637255fafc816 + last_write_checksum: sha1:a80d29855b58a686083e03e1736da069fbb6dd7a + pristine_git_object: c95e60c3c4657860686e7a2df298b651eb9e93d8 docs/models/update-customer-globals.md: id: 143999995aa3 last_write_checksum: sha1:68ee60cc1c95d8bae04f3df054e154eba1adad69 @@ -1428,40 +1536,40 @@ trackedFiles: pristine_git_object: 5de2b03937db317630b628227e45e8f0234470c5 docs/models/update-customer-interval-union.md: id: c1080c322f1e - last_write_checksum: sha1:568f89e9dd14bfd44f0ec6ba3f486de1d7b27edd - pristine_git_object: 84e1f9a870da26c402c13bad823e51f8d49c827e + last_write_checksum: sha1:7cd7913ba15fcb6dba913f98ba312be1e3b476e4 + pristine_git_object: 2a1f4b52071c537a5c496235f265a378de67b97d docs/models/update-customer-params.md: id: b0eaa77673a7 last_write_checksum: sha1:1e27c616f406a48b12d45adb7fba648e6cb82ca7 pristine_git_object: 802aecaeb59cf78d2b7fae123eb22e771779650b docs/models/update-customer-price.md: id: dd3d29a936fd - last_write_checksum: sha1:82bea2ad66a537a7e60efa88f693cc55e1816bde - pristine_git_object: 0c19b42f6a2f4cc199161329533d08af813b9a69 + last_write_checksum: sha1:2d9fb98f963acbb73946505654e8abbf28747869 + pristine_git_object: d1e7a2105f5cde872c86cc2b9c6ab9d1815df1d6 docs/models/update-customer-purchase.md: id: b4c8c530ba2c - last_write_checksum: sha1:0e49dfe18dd6fdcfa8bf7bb71fb09c18a4ca8ef5 - pristine_git_object: 1977be2342b8ad291d7fcb9fd63e39102f1b170e + last_write_checksum: sha1:54dd9c3527cc1cc4c6a2018ad2f82c8eb64c7f2a + pristine_git_object: d72d4217209d4bbe577bbc5be5b13f276268b19a docs/models/update-customer-reset.md: id: "728535289868" - last_write_checksum: sha1:dee58d03e84af1db74a0cd958ee44d942bbf1e43 - pristine_git_object: 2409db3ca717177224e94bdcc701a7c3c76782a7 + last_write_checksum: sha1:b0a1e80e6f056ae51dfc11adae37addc4b5563fb + pristine_git_object: 4c9a9168ef7420f7dc60cb6b1233d3881a9747e9 docs/models/update-customer-response.md: id: 605a24a7d121 - last_write_checksum: sha1:ca554e09227c2edbe92a42914c6391511057ad1e - pristine_git_object: 60066e6c25ec487d6b3d9a7aa18ff566818a3a50 + last_write_checksum: sha1:7f544f403f6bb6c3ac326a3c93d4b9f2b4e5b0a5 + pristine_git_object: 1cf734950c48cc12fe0fbe59f6dca6fe02b7032d docs/models/update-customer-rollover.md: id: 3bebebf04665 - last_write_checksum: sha1:924d0bd4ba861322b711cdfe27cd114832951cf6 - pristine_git_object: c48f80df1ab0902c154341ccadee9965aaf443a6 + last_write_checksum: sha1:9ef2b91b916ba7528553e666df62942d856e5259 + pristine_git_object: 8d22e4c64639444a5883ec3ad0cf04a46f8633d2 docs/models/update-customer-status.md: id: 37adfd15b5dc - last_write_checksum: sha1:3ec6b8db6cf520dc9865e71dffb37b26e77588e8 - pristine_git_object: 50b58dd4f2237b2f0894759691961a886c7cf2ef + last_write_checksum: sha1:ccf057de69e42a6f304fae96cce81b4829a5c931 + pristine_git_object: 666616765c3b7e7b81855d3d055c6c497b157973 docs/models/update-customer-subscription.md: id: "412049526229" - last_write_checksum: sha1:da8806e70ff66876187e85502f17369e5aaf0722 - pristine_git_object: db98114fe9d9a546194c2625e632ce8625ac0627 + last_write_checksum: sha1:e73e3976bb8411aa57a518d9ca1015e3e469d966 + pristine_git_object: 87c975e628e30eeafb8e0fc72615459739fe3d37 docs/models/update-customer-tier.md: id: 6416a7c50e28 last_write_checksum: sha1:c86e861e69241388caf84c8e48edd85b12654c0e @@ -1474,26 +1582,46 @@ trackedFiles: id: 875a45ee72f2 last_write_checksum: sha1:dc08a53346fdcf1560ea9519b84e2463d5d60cd5 pristine_git_object: f5d1f7937c5730af0c1a470da9ab49d35dc68ab1 + docs/models/update-subscription-params.md: + id: 2f1abbd42a8a + last_write_checksum: sha1:ebdf31405ff59b8d706482e12ec56fb35df86614 + pristine_git_object: 6417bb668ef023aa2744dd140454572fd5df5708 docs/models/usage-model.md: id: 32a269601e79 last_write_checksum: sha1:c8bfcbed266005cbcc6114bfb969c2d90d028d1c pristine_git_object: 56e566eba7aeffa9422da7c6b4bcb80a123e5f14 + docs/sdks/autumn/README.md: + id: d27c9292a1a3 + last_write_checksum: sha1:e44673c7ffff594ab2dc7c6765f95fb3dd3ee818 + pristine_git_object: 3f79dd34420d7348755a103a8fbb168c472b8a73 docs/sdks/balances/README.md: id: 6ca85866f00d - last_write_checksum: sha1:eece4ef5879f579768573ba82c46936733b88b1f - pristine_git_object: bf8790cb4364546e27a92b5705a0e7f25addeba1 + last_write_checksum: sha1:d699bbfdedd5785246162c3886167ecd3dd3bcca + pristine_git_object: fb242dffad941fbf1279dd86b439d776792395ed docs/sdks/billing/README.md: id: dc915331dd9d - last_write_checksum: sha1:9e5ac33eb2f8161d4a9813184ce0bda310b5184e - pristine_git_object: b4b6ad4f74cdaf1bd54e8ec0afabf089e9c26613 + last_write_checksum: sha1:991fce17f7f65eb7cd06eadd1fdd40b853f14660 + pristine_git_object: 3f8ef93aba67358061c285ccd346e8954536d04d docs/sdks/customers/README.md: id: 9332759cffc2 last_write_checksum: sha1:67ee9f4c5ba6f23fd7e16807f8503ed5a065e1ba pristine_git_object: 72e1e0133dad64984f1ea4de472fd9b57728a036 + docs/sdks/entities/README.md: + id: a140ac5181b9 + last_write_checksum: sha1:d2c40e901bdff031fccfd09c02c2ae321fcc0d47 + pristine_git_object: a53d08371c7b7ce95c81f43f9e9e83630447c8a8 + docs/sdks/events/README.md: + id: cf45a4390b9b + last_write_checksum: sha1:62a90a7ab0988e2ef446432a310af8e068fd9948 + pristine_git_object: 7e53035a1d48d817ca397a5a61632f7dc055e16d docs/sdks/plans/README.md: id: 2d8c741fff57 last_write_checksum: sha1:291981039b36d8a136575a3086801bfbb65bf29e pristine_git_object: 1be0bf7ad53aa2d5d54d5a4b9d98484596e7b971 + docs/sdks/referrals/README.md: + id: 50b71f597f20 + last_write_checksum: sha1:a9ad9263bdca225c9730d00239a045590ba49e56 + pristine_git_object: 9ae45ec380010acb4febdac6ace065f6fe565b9b eslint.config.mjs: id: 461c8d07f6da last_write_checksum: sha1:9398f326377fe47f67af2df6eb6370750c0790b4 @@ -1506,62 +1634,58 @@ trackedFiles: id: 9d0f69d6e677 last_write_checksum: sha1:391a726e729984faf71448391857f90ddf9ae4dd pristine_git_object: 0928c2ed5c0c739a6fb22e31cdaf11d6bdec9dae - examples/customersGetOrCreate.example.ts: - id: cb3cc2b938f4 - last_write_checksum: sha1:c519055c000dbbdca007d9e17d6c33a760c26b8d - pristine_git_object: b6af2731f32a8033a302dfc9681a50d2be6933ef + examples/check.example.ts: + id: af533e83342b + last_write_checksum: sha1:438f516ee9152469d47714ed86beee85feb1fb58 + pristine_git_object: 9153d3e136463154c2c729a9733c5d77e9a1f522 examples/package.json: id: c1d7b0ec8e7e last_write_checksum: sha1:22cf1a48e1d9bc8ffc9e65280aeaa5600b54f659 pristine_git_object: 900d545ed58929951e2208e1bec791cb264429a4 jsr.json: id: 7f6ab7767282 - last_write_checksum: sha1:2f9caf84950826b0f80ea18b58f7a22fb1ff0b31 - pristine_git_object: 1d4fc089e365e8a54c922d38d6937921e6d63ba0 + last_write_checksum: sha1:0025949cfc5ee1c1b49c5ebe7070d9c6553b78ec + pristine_git_object: ead314f8925bc7770ed685ac64dca67d46c6b828 package.json: id: 7030d0b2f71b - last_write_checksum: sha1:871236b8e1d9462e75ac2ba7a9e6654b2bc98a1d - pristine_git_object: a99b0d11bd80af6de52463ca1d05ef57bb5a831f + last_write_checksum: sha1:46cd01e2f1de5bbc03d5997497efd628b5e48b7f + pristine_git_object: ff0cf8f5af7f327746630b43ea85ac5f78d10b06 src/core.ts: id: f431fdbcd144 last_write_checksum: sha1:f8f24a3ca09c1efb285d7a75ad3697d0128f47e2 pristine_git_object: 1f9d5951119ee5295d31c87711f8560f7c2aa9cb - src/funcs/balances-check.ts: - id: 680e14782986 - last_write_checksum: sha1:52e0ac23849756ef801874578d5127a2d5257bb9 - pristine_git_object: bbd9a6fcad2ec5d53c2ad798909356bb84184188 src/funcs/balances-create.ts: id: cb0a1fb144d1 - last_write_checksum: sha1:34c7ddd3e179c0d934724a6947fb18b57b3ea39b - pristine_git_object: 2e31fd672209a5572d924638b9cffe482eab3f3d - src/funcs/balances-track.ts: - id: 91fdae1d675a - last_write_checksum: sha1:7259be15f18d34525765db9e246db0bd6ec938bb - pristine_git_object: efb27297cc04698d0f1199d4fd1b78dbdb11e1ab + last_write_checksum: sha1:452145138bc7f5e9884771aa345c5fa1058b3c8d + pristine_git_object: 38d61f930820392853c2b0686a4b96a87b2fe070 src/funcs/balances-update.ts: id: a4d3bafe74f2 - last_write_checksum: sha1:63acde70d6d8707ead1becd408dbd8924acc71b6 - pristine_git_object: e3f89175fafe3b0a6c5074af1b1d24b8b3ba778b + last_write_checksum: sha1:c179574469056b82c8ab32eb9f8bf64c3c647114 + pristine_git_object: 5cbdc17fad50dd5fe969f2d3b3cb59a166b32049 src/funcs/billing-attach.ts: id: c23b3cd15f32 - last_write_checksum: sha1:b8b163019c58d7e64b39d1ea4524f9ad1ceb706c - pristine_git_object: 2730fb8f3f16c04719808eccd3f7c03aef12e7fb + last_write_checksum: sha1:1bf30d991a44297a4fac8bc61208a0d29412cf7a + pristine_git_object: be3db0e91178d51c774d06f82cb7715406dee226 + src/funcs/billing-open-customer-portal.ts: + id: bb88a88dc0c5 + last_write_checksum: sha1:249539a12246269c58dc8568d65ed3b2cc4bacba + pristine_git_object: fac46490864a5b712d2cc124e69e6cfcaca794f2 src/funcs/billing-preview-attach.ts: id: d262a9163889 - last_write_checksum: sha1:90fb559c4fd90f6339c34c9428da7d69359e78ec - pristine_git_object: 844a7c372364f3680f2801628f7672f35605f266 + last_write_checksum: sha1:234fd4fa1941839381e72eca60f1220f0eed06fc + pristine_git_object: 238dcea67e879734f645371d2e91ce3cd39e8d75 src/funcs/billing-preview-update.ts: id: cd3a375787c5 - last_write_checksum: sha1:4326eed6a3c6c76eafccff09f07879a6da8f25c6 - pristine_git_object: f9180f868089baa7964ce48e8862a36416f477d8 - src/funcs/billing-setup-payment.ts: - id: 4d2d8096862d - last_write_checksum: sha1:e121046919db3db7c446b26a9180af1b32a76f0c - pristine_git_object: 6521e8638485d05fcb3ceeb63fd943e55481fb0c + last_write_checksum: sha1:993c19592ff7a5b9c2b4a60c5c25fea1b502f3e4 + pristine_git_object: 2721f3c74c9bea6500e4edae3d377d0b04e79dce src/funcs/billing-update.ts: id: 5c14ddfe1de0 - last_write_checksum: sha1:e6d9e5e3b7e9834931dd45f89b61a8f256b74a51 - pristine_git_object: b1031d833b6cc2a42d8889ce43205771bb04540b + last_write_checksum: sha1:950bf9530eee3aeaea9c249e533462ef741cdef0 + pristine_git_object: 06ebedff0dfc2612a5b638872d8c727c818872fa + src/funcs/check.ts: + id: e962b1e3321b + last_write_checksum: sha1:eb74bac888b8a8ddce98176f4daccfc3276e6ef3 + pristine_git_object: ba2d6ef7ef27209908dc3a72078789bb2e4e191b src/funcs/customers-delete.ts: id: 92955b4ca056 last_write_checksum: sha1:14160671d93a76cca245a45c25d8465f2e39acd0 @@ -1578,10 +1702,42 @@ trackedFiles: id: 56f7739cc333 last_write_checksum: sha1:a8486cfb7daaa2a6fa86dcdb74cc77f998068fb3 pristine_git_object: d2e5861773eb1ef3cb84012dfa9a99de6d70304f + src/funcs/entities-create.ts: + id: 0b5ed7c43aeb + last_write_checksum: sha1:1d90f434db48cc4e0b2e28a03a7f5863dead2b14 + pristine_git_object: 868cba5cf7231d87cbefad466ab51fa6791b1f85 + src/funcs/entities-delete.ts: + id: d7f045f3e1a6 + last_write_checksum: sha1:517d3fd11defe7b9230c4375a1e5bf517786122d + pristine_git_object: 1e81957414ce9354d39256ba67d8522e2e7399a4 + src/funcs/entities-get.ts: + id: 924f7116550a + last_write_checksum: sha1:ba80f9cd8765d0305cc57851ce03042407215c1d + pristine_git_object: f19d6bb5cc99e696ae187689e91246878cf6a052 + src/funcs/events-aggregate.ts: + id: 125dc2d9a91c + last_write_checksum: sha1:ad210895015433d5dd072d822fff1c7ea6beddd8 + pristine_git_object: 47d6e11d04f1764d0f0d5b9e6373a7a3ca7b28cd + src/funcs/events-list.ts: + id: d1d1ecc122e0 + last_write_checksum: sha1:fe29ddd8c2ed7000d2e016aa5988190636d1c876 + pristine_git_object: b79aaad0ee2cf206a8892b9f352f46e240a61ca6 src/funcs/plans-list.ts: id: ee004b08a26a last_write_checksum: sha1:529fc2b9d479e83724908746421d749dffada2f9 pristine_git_object: 87ff687d83ff92a4cdeea8a5e729c31384657c31 + src/funcs/referrals-create-code.ts: + id: f2088dbf847d + last_write_checksum: sha1:f885e8dbe651c2f8c07a3297f31901277d9a57ed + pristine_git_object: 704d13b41cdc55dc8cfde23807c0337194b93395 + src/funcs/referrals-redeem-code.ts: + id: 0549de1f6073 + last_write_checksum: sha1:ad5cde6d04143bcabba254d17296affc8fe812c8 + pristine_git_object: 5d218a3b4c0d19fbe8ecbb93faef58a04f41282a + src/funcs/track.ts: + id: eb7e0b123329 + last_write_checksum: sha1:cb235c96fcac0bc8cc105f7e0efe38577177ca74 + pristine_git_object: d37789d33ee1991fbd95bafeeab189ee5427c9b9 src/hooks/hooks.ts: id: a2463fc6f69b last_write_checksum: sha1:7dd975bbcc46a32dd394f86a4652b74ecc70d874 @@ -1604,8 +1760,8 @@ trackedFiles: pristine_git_object: 44be0eae8246521b230e8e711a88eff738fc015d src/lib/config.ts: id: 320761608fb3 - last_write_checksum: sha1:600c912298c99f0e576d6ced27c9f13619a6e693 - pristine_git_object: 7cb7a90dbda9a13ec9e20467e06cd2306df7146c + last_write_checksum: sha1:e280d72dab8e159af8bb0310fe6f003f534f56b8 + pristine_git_object: 2ac499055df0daa10e5f802ecab90eb10ec59c0a src/lib/dlv.ts: id: b1988214835a last_write_checksum: sha1:1dd3e3fbb4550c4bf31f5ef997faff355d6f3250 @@ -1662,6 +1818,10 @@ trackedFiles: id: b0057e24ed76 last_write_checksum: sha1:d124050c7e755c0cce233b9e029afb584ff65201 pristine_git_object: f3a8de6c021de59c991707946cd294596cae954d + src/models/aggregate-events-op.ts: + id: 4b7c98b18e2b + last_write_checksum: sha1:f4fac86a8eaa22de6ee94d139021b6160e09c543 + pristine_git_object: 112c7189b409fcf39b701080bd77772cc8b324f8 src/models/autumn-default-error.ts: id: 2528aa7886eb last_write_checksum: sha1:4cce18f91be3262ada7d11dcd6326544e2341b58 @@ -1670,42 +1830,30 @@ trackedFiles: id: 73f08e106349 last_write_checksum: sha1:b7c0cdaffaa829fcf7ed7c080563f06af90a184b pristine_git_object: 7cfcf2c90f1cfaa152ee2f4033187aa20b1c696b - src/models/balances-check-op.ts: - id: b818c72b5764 - last_write_checksum: sha1:ba49fee4c3f2246f0bb7ab82c4c737b64472e3d3 - pristine_git_object: 00b739d168f088a2a6660855f985f6889ea7069f - src/models/balances-create-op.ts: - id: 0ac1d9c85f60 - last_write_checksum: sha1:93f8b8a57403da4a95b83dcb2c7a54029694d2a4 - pristine_git_object: 4691d74f2c76904a0ac5fe8c9db7d95b9fcfb2d1 - src/models/balances-track-op.ts: - id: 827123ccf6a9 - last_write_checksum: sha1:ea05f8b6cca9224837c7cc3e99cb20ca0a77363b - pristine_git_object: c4a0072f6642989ad51949650bccaf1d4869702c - src/models/balances-update-op.ts: - id: 212dd68fb106 - last_write_checksum: sha1:57e79acb25df86996d96340471e5716119f66ba7 - pristine_git_object: 111f5ade15069959b73926dc632a622a5f1f7eaf src/models/billing-attach-op.ts: id: c0a94471ba75 - last_write_checksum: sha1:d32dd4646bdad734acf091264f04eba411e29cc6 - pristine_git_object: a80e00630e5ea26c67ed6b2fc8c852f62b574c67 - src/models/billing-preview-attach-op.ts: - id: ad719a76005b - last_write_checksum: sha1:d8c0b961e6f23fe733cd8483a7467721f24755f4 - pristine_git_object: 8cad4b5fee2c41b1a5c56e5b3ed4061ef82cf8a6 - src/models/billing-preview-update-op.ts: - id: 381d33cff672 - last_write_checksum: sha1:f8a999fa5cae22c7388e9c105d8bfb8daf4bb1de - pristine_git_object: 6caf3a21e1905c23bb01b75f7168bc8885e0e55f - src/models/billing-setup-payment-op.ts: - id: cc957e224289 - last_write_checksum: sha1:be82f17cbf8ea59c8d5fed908d3c91ebb61f45f3 - pristine_git_object: c5ae80c858560b595473286d2a757a5878d56469 + last_write_checksum: sha1:96c25a6a501d9b3935029cecc1e6a8f6472d7a77 + pristine_git_object: 821ac49b55569acce52fa12d43fe8005f4107bd1 src/models/billing-update-op.ts: id: e7371769c7ca - last_write_checksum: sha1:4daf1f198b91c30be0ff075d2d08c70bd900d642 - pristine_git_object: 28e62dae1c16c346623b96cab5b6823162bbbed5 + last_write_checksum: sha1:40b19554a26d1965e72ef2a48bc91d4ec000994c + pristine_git_object: f8402e63dcffc897ad39c101801bd7379ba88ec9 + src/models/check-op.ts: + id: 42085bda016a + last_write_checksum: sha1:4223bcacbe3e3210f757c3dfbbffeaa538493d84 + pristine_git_object: 37ab007d86c57c19439b8323fdaf725f1c135e44 + src/models/create-balance-op.ts: + id: 537b8ff86863 + last_write_checksum: sha1:64b97498d26391e218f83fdfc3e035153ec16afc + pristine_git_object: 640e2c8117001fdb420e129c68654fc3faec749b + src/models/create-entity-op.ts: + id: 9ad8367048a1 + last_write_checksum: sha1:f8e6c4d89138f15791c07a60425e35312fc02d04 + pristine_git_object: b31d8b2ec819baa8ecc6d50461232a4f1f6d727d + src/models/create-referral-code-op.ts: + id: 745cd70e7a69 + last_write_checksum: sha1:01ce64d29c3bd84e0c9bf1e6a979e7e493f10d67 + pristine_git_object: d979198ac227f8e5731e5ca5e2e34b55d88da348 src/models/customer-data.ts: id: 04dac7ee392e last_write_checksum: sha1:418a3dc8273f1a7f0b06e3558d6fb352ca31bfb1 @@ -1716,12 +1864,20 @@ trackedFiles: pristine_git_object: b6a303e11f4d5964b94379a470104d00ff8fb5cc src/models/customer.ts: id: 20be78c552a4 - last_write_checksum: sha1:834fdd87d593fe97b8d00680f1f868571e814aec - pristine_git_object: 85200c4624b20c9991cd822a07f6f4c070e0c752 + last_write_checksum: sha1:bad133a6984cea80fbae1856b1f6ed8465d056d4 + pristine_git_object: 3caab66e21a6893e0da2ff197eb11a505dd97b9f src/models/delete-customer-op.ts: id: 5a0865a96e72 last_write_checksum: sha1:c13b51ffb77a1436b29b76a21686c69813c1e81d pristine_git_object: 3b3187da0e7556b1c0cb43c912be28387438794c + src/models/delete-entity-op.ts: + id: a5fb56f87c80 + last_write_checksum: sha1:2483d448a605d263ddd1baf68a858aaa3a7e917a + pristine_git_object: 09d6e2c7e5175a5634d3fa2fe2bf69ea956e2ff6 + src/models/get-entity-op.ts: + id: 7932a3cea5c1 + last_write_checksum: sha1:8880c46b2eb13fc7c2cc9de60a76b3b14e0f3fb9 + pristine_git_object: 4557f85920cd5cca5138fc076fba3661f2923fbc src/models/get-or-create-customer-op.ts: id: 46f8f65a57f2 last_write_checksum: sha1:26098d6226df14b07bfd4b9c886000a2d3d82bd1 @@ -1732,20 +1888,40 @@ trackedFiles: pristine_git_object: b34f612124c797c2a1106b9735708f679a90b74f src/models/index.ts: id: f93644b0f37e - last_write_checksum: sha1:19b19946d5bfd273bcd63848296f145bd8b9565d - pristine_git_object: 049aff41b9e5a2c33bdc0f7f3241a4e2c0cf14d0 + last_write_checksum: sha1:545e657c2642470acc7edf95909eaef6c390638c + pristine_git_object: 401b7905536520ff174bbb2ab98326bb0bf35f5a src/models/list-customers-op.ts: id: b391692c8429 - last_write_checksum: sha1:5f940428ca63d4e852d4b2b63abba9f258bc4cda - pristine_git_object: dae93235f3abd02ddb5558bbaa90e260d09ba204 + last_write_checksum: sha1:5329f658026ccb8016e70a58f08dc597d19b0351 + pristine_git_object: 789c0d0826fd1df3f13a60b6409cebf139c7e949 + src/models/list-events-op.ts: + id: 82a9f364bb21 + last_write_checksum: sha1:dbbceca3a470d8263f50a3b39d313e19c9a213b5 + pristine_git_object: e0896884a153ad9a340f72825e0efd819c039268 src/models/list-plans-op.ts: id: 513cde894485 last_write_checksum: sha1:df5e3899fe571eedffbebb6dd234e6d5b673b90e pristine_git_object: 47f493799a73d1bf3413a9f38da73cc5076cdc05 + src/models/open-customer-portal-op.ts: + id: a003eb4172a9 + last_write_checksum: sha1:5e672fc975a0336c963181042a770c2a43cbc0e3 + pristine_git_object: 4a9318890026bc6e67a8a5b65dc596ae7f25f855 src/models/plan.ts: id: 9e9698a64fe7 last_write_checksum: sha1:56d2d87477b4a626cc062a85c1c2f35d16cadbbc pristine_git_object: 98bd4bfc4894cce108b7e1290849441288d033b8 + src/models/preview-attach-op.ts: + id: 3efc6e3443a7 + last_write_checksum: sha1:20558306f11aa0fd45373dc3a92e73bdd1124d35 + pristine_git_object: a6e20f4ca5442617dd396c5bd3b1206642337755 + src/models/preview-update-op.ts: + id: fcbbbf3b22ac + last_write_checksum: sha1:1946d63578852a42b4099e9e91752e071b2196e5 + pristine_git_object: af9a1c0d1ee9f35d87b2d189dd277f5859d4b124 + src/models/redeem-referral-code-op.ts: + id: 511bf73dc4c6 + last_write_checksum: sha1:9ab6622018c82175ea98d2b26eadb4abf08f441a + pristine_git_object: ef030006b32f2ffa4a2473e91f72d4a0fe7b8bc0 src/models/response-validation-error.ts: id: 7ace3beff92b last_write_checksum: sha1:2788a46874d1d2b88a1fe8352142516f2e5c9ded @@ -1758,22 +1934,38 @@ trackedFiles: id: d90c6c784ca5 last_write_checksum: sha1:f12af7291ebb0b6712532520d82e8d34fa86885a pristine_git_object: 3774cc1e9bbb80ac592990aa86f8d4a38ee51f29 + src/models/track-op.ts: + id: 5e6a750e8fec + last_write_checksum: sha1:41d4221fab23928dd9e0b0252565d5608cef8a60 + pristine_git_object: 3f311e7efd29cfcf8ad86208dbf5c123c30c800b + src/models/update-balance-op.ts: + id: 69282313a00e + last_write_checksum: sha1:1390d07bc3905bdf61c59745d4f2b7138897c707 + pristine_git_object: 038d8ec3601fcf714640ad04912c83c19e04c0b5 src/models/update-customer-op.ts: id: 5d226d30d8e4 - last_write_checksum: sha1:2691abf4914fdc17ee2bfd41d39931aa968a894e - pristine_git_object: 249d7b1e7c1809d933e9109b5c32b9672996868c + last_write_checksum: sha1:6bbaecbb08b96ef2c22e1049e9d0e26d26e08709 + pristine_git_object: 47dd8fc011ebae8fbc1eecb148f97e52483f6c91 src/sdk/balances.ts: id: 9ad229cb9d64 - last_write_checksum: sha1:d80897969e038afaca2195fc694d98bf4ff5a374 - pristine_git_object: a339128fd41eb46b423d5b7ea44ef9370c61f8c3 + last_write_checksum: sha1:8e311bc69fcc76bfcef79c9621afa090f76c44cf + pristine_git_object: a03539efdd5fe483e1836ed8ece8250b30d7536b src/sdk/billing.ts: id: 10905058c4ad - last_write_checksum: sha1:49cc390bd072973e21df2c234ee113e604426f67 - pristine_git_object: 5e3899481df00efca75de9c2aa555735a9c03a8d + last_write_checksum: sha1:c5f948c90c3424da0da90fbd3827da7802d250f8 + pristine_git_object: f1210dada32c37d87d5991f4f5c61179178febcf src/sdk/customers.ts: id: d33e193e0c00 last_write_checksum: sha1:3e4d794f7a68a5e1962483b578b5643b339581fe pristine_git_object: d1e0a4ac4103ca552dc0229185403106809a01d7 + src/sdk/entities.ts: + id: 71997b5f9b62 + last_write_checksum: sha1:ca1dd19ff7b04b0b42358aba43a0cc2eb50a6495 + pristine_git_object: 334ef70866802a6341fed13aad6bd0c3df3fa06a + src/sdk/events.ts: + id: c7d130088b17 + last_write_checksum: sha1:1dd099274cb75cb4ae46d01fa68ea13b53a79e1a + pristine_git_object: a7453990fa87b1a6b85837c054b65c019cf0bfa2 src/sdk/index.ts: id: a857902a703f last_write_checksum: sha1:ed6d64f2a6135349aa8498b8d8cff9ba85c7fb8f @@ -1782,10 +1974,14 @@ trackedFiles: id: c0cb8188cdc1 last_write_checksum: sha1:03078cefd0187053db898e5619aaf19254c7b40f pristine_git_object: c2146f217348864f34f15fb2a3329677f7ee0ed1 + src/sdk/referrals.ts: + id: bf164167845c + last_write_checksum: sha1:b73c1db6a419f5c7f6643382d5bc399204e95150 + pristine_git_object: 01839523f5433d6365b0f2704b81e5aa72288e66 src/sdk/sdk.ts: id: 784571af2f69 - last_write_checksum: sha1:587718827042099ad17f78172788236c10daf1aa - pristine_git_object: d99bd76cda82ddb7eb3abbe8cc7e3532e73c697e + last_write_checksum: sha1:80ba15c82a308b6cd055367a87ddcb1aaf659552 + pristine_git_object: fcfc869c6d7d0a5a7ea8c960e220896d043045ca src/types/async.ts: id: fac8da972f86 last_write_checksum: sha1:3ff07b3feaf390ec1aeb18ff938e139c6c4a9585 @@ -2115,7 +2311,7 @@ examples: application/json: {"customer_id": "cus_123", "name": "John Doe", "email": "john@example.com"} responses: "200": - application/json: {"id": "cus_123", "name": "John Doe", "email": "john@example.com", "created_at": 1717000000, "fingerprint": "1234567890", "stripe_id": "cus_123", "env": "sandbox", "metadata": {}, "send_email_receipts": true, "subscriptions": [{"plan_id": "plan_123", "auto_enable": false, "add_on": false, "status": "active", "past_due": false, "canceled_at": 9611.97, "expires_at": 7806.81, "trial_ends_at": null, "started_at": 6124.93, "current_period_start": null, "current_period_end": 9733.97, "quantity": 1}], "purchases": [], "balances": {"balance_1": {"feature_id": "", "granted": 8321.34, "remaining": 5.02, "usage": 8589.77, "unlimited": true, "overage_allowed": true, "max_purchase": 5498.35, "next_reset_at": 8214.93}}} + application/json: {"id": "2ee25a41-0d81-4ad2-8451-ec1aadaefe58", "name": "Patrick", "email": "patrick@useautumn.com", "created_at": 1717000000, "fingerprint": null, "stripe_id": "cus_123", "env": "sandbox", "metadata": {}, "send_email_receipts": true, "subscriptions": [{"plan_id": "plan_123", "auto_enable": false, "add_on": false, "status": "active", "past_due": false, "canceled_at": 9611.97, "expires_at": 7806.81, "trial_ends_at": null, "started_at": 6124.93, "current_period_start": null, "current_period_end": 9733.97, "quantity": 1}], "purchases": [], "balances": {"messages": {"feature_id": "", "granted": 100, "remaining": 0, "usage": 100, "unlimited": false, "overage_allowed": false, "max_purchase": 9758.06, "next_reset_at": 9611.97, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "", "included_grant": 7806.81, "prepaid_grant": 455.92, "remaining": 0, "usage": 100, "unlimited": false, "reset": {"interval": "month", "resets_at": 875.56}, "price": null, "expires_at": 9733.97}]}}} listPlans: speakeasy-default-list-plans: parameters: @@ -2130,10 +2326,10 @@ examples: header: x-api-version: "2.1" requestBody: - application/json: {"product_id": "", "redirect_mode": "always"} + application/json: {"customer_id": "cus_123", "plan_id": "pro_plan", "redirect_mode": "always"} responses: "200": - application/json: {"customer_id": "", "payment_url": null} + application/json: {"customer_id": "cus_123", "payment_url": null} getOrCreate: speakeasy-default-get-or-create: parameters: @@ -2161,7 +2357,7 @@ examples: application/json: {"offset": 0, "limit": 10} responses: "200": - application/json: {"list": [], "has_more": true, "offset": 5136.21, "limit": 2534.27, "total": 7618.77} + application/json: {"list": [{"id": "2ee25a41-0d81-4ad2-8451-ec1aadaefe58", "name": "Patrick", "email": "patrick@useautumn.com", "created_at": 2358.1, "fingerprint": null, "stripe_id": null, "env": "sandbox", "metadata": {}, "send_email_receipts": false, "subscriptions": [{"plan_id": "", "auto_enable": true, "add_on": false, "status": "active", "past_due": true, "canceled_at": 1145.98, "expires_at": 4027.68, "trial_ends_at": 910.35, "started_at": 7325.71, "current_period_start": 406.39, "current_period_end": 2629.33, "quantity": 1}], "purchases": [], "balances": {"messages": {"feature_id": "", "granted": 100, "remaining": 0, "usage": 100, "unlimited": false, "overage_allowed": false, "max_purchase": 4531.44, "next_reset_at": 1010.14, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "", "included_grant": 4967.46, "prepaid_grant": 6928.7, "remaining": 0, "usage": 100, "unlimited": false, "reset": {"interval": "month", "resets_at": 7938.58}, "price": null, "expires_at": 7264.51}]}}}], "has_more": false, "offset": 0, "limit": 10, "total": 1} updateCustomer: speakeasy-default-update-customer: parameters: @@ -2171,7 +2367,7 @@ examples: application/json: {"customer_id": "cus_123", "name": "Jane Doe", "email": "jane@example.com"} responses: "200": - application/json: {"id": "cus_123", "name": "John Doe", "email": "john@example.com", "created_at": 1717000000, "fingerprint": "1234567890", "stripe_id": "cus_123", "env": "sandbox", "metadata": {}, "send_email_receipts": true, "subscriptions": [{"plan_id": "plan_123", "auto_enable": true, "add_on": true, "status": "active", "past_due": true, "canceled_at": 8303.59, "expires_at": 2755.88, "trial_ends_at": 1461.02, "started_at": 1649.05, "current_period_start": 8034.1, "current_period_end": 8058.66, "quantity": 1}], "purchases": [], "balances": {"balance_1": {"feature_id": "", "granted": 7559.37, "remaining": 952.25, "usage": 7029.24, "unlimited": true, "overage_allowed": true, "max_purchase": 7619.46, "next_reset_at": 411.76}}} + application/json: {"id": "2ee25a41-0d81-4ad2-8451-ec1aadaefe58", "name": "Patrick", "email": "patrick@useautumn.com", "created_at": 1717000000, "fingerprint": null, "stripe_id": "cus_123", "env": "sandbox", "metadata": {}, "send_email_receipts": true, "subscriptions": [{"plan_id": "plan_123", "auto_enable": true, "add_on": true, "status": "active", "past_due": true, "canceled_at": 8303.59, "expires_at": 2755.88, "trial_ends_at": 1461.02, "started_at": 1649.05, "current_period_start": 8034.1, "current_period_end": 8058.66, "quantity": 1}], "purchases": [], "balances": {"messages": {"feature_id": "", "granted": 100, "remaining": 0, "usage": 100, "unlimited": false, "overage_allowed": true, "max_purchase": 351.74, "next_reset_at": 3436.48, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "", "included_grant": 7153.13, "prepaid_grant": 2755.88, "remaining": 0, "usage": 100, "unlimited": false, "reset": {"interval": "month", "resets_at": 1461.02}, "price": null, "expires_at": 1881.65}]}}} deleteCustomer: speakeasy-default-delete-customer: parameters: @@ -2188,10 +2384,10 @@ examples: header: x-api-version: "2.1" requestBody: - application/json: {"customer_id": "", "plan_id": "", "redirect_mode": "always"} + application/json: {"customer_id": "cus_123", "plan_id": "pro_plan"} responses: "200": - application/json: {"customer_id": "", "payment_url": "https://lean-lobster.name/"} + application/json: {"customer_id": "cus_123", "payment_url": "https://checkout.stripe.com/..."} billingPreviewAttach: speakeasy-default-billing-preview-attach: parameters: @@ -2208,10 +2404,10 @@ examples: header: x-api-version: "2.1" requestBody: - application/json: {"customer_id": ""} + application/json: {"customer_id": "cus_123", "plan_id": "pro_plan", "feature_quantities": [{"feature_id": "seats", "quantity": 10}]} responses: "200": - application/json: {"customer_id": "", "payment_url": "https://salty-birdcage.biz/"} + application/json: {"customer_id": "cus_123", "invoice": {"status": "paid", "stripe_id": "in_1234", "total": 1500, "currency": "usd", "hosted_invoice_url": "https://invoice.stripe.com/..."}, "payment_url": null} billingPreviewUpdate: speakeasy-default-billing-preview-update: parameters: @@ -2238,7 +2434,7 @@ examples: header: x-api-version: "2.1" requestBody: - application/json: {"feature_id": "", "customer_id": ""} + application/json: {"customer_id": "", "feature_id": ""} responses: "200": application/json: {"success": false} @@ -2258,12 +2454,32 @@ examples: header: x-api-version: "2.1" requestBody: - application/json: {"customer_id": "", "feature_id": ""} + application/json: {"customer_id": "cus_123", "feature_id": "messages"} responses: "200": - application/json: {"allowed": true, "customer_id": "", "balance": {"feature_id": "", "granted": 7002.31, "remaining": 9536.21, "usage": 3270.65, "unlimited": false, "overage_allowed": true, "max_purchase": 8252.55, "next_reset_at": 9394.31}} + application/json: {"allowed": true, "customer_id": "cus_123", "entity_id": null, "required_balance": 1, "balance": {"feature_id": "messages", "granted": 100, "remaining": 72, "usage": 28, "unlimited": false, "overage_allowed": false, "max_purchase": null, "next_reset_at": 1773851121437, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "included_grant": 100, "prepaid_grant": 0, "remaining": 72, "usage": 28, "unlimited": false, "reset": {"interval": "month", "resets_at": 1773851121437}, "price": null, "expires_at": null}]}} balancesTrack: speakeasy-default-balances-track: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "feature_id": "messages", "value": 1} + responses: + "200": + application/json: {"customer_id": "cus_123", "value": 1, "balance": {"feature_id": "messages", "granted": 100, "remaining": 72, "usage": 28, "unlimited": false, "overage_allowed": false, "max_purchase": null, "next_reset_at": 1773851121437, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "included_grant": 100, "prepaid_grant": 0, "remaining": 72, "usage": 28, "unlimited": false, "reset": {"interval": "month", "resets_at": 1773851121437}, "price": null, "expires_at": null}]}} + previewAttach: + speakeasy-default-preview-attach: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "plan_id": "pro_plan"} + responses: + "200": + application/json: {"customer_id": "", "line_items": [], "total": 20, "currency": "usd"} + updateSubscription: + speakeasy-default-update-subscription: parameters: header: x-api-version: "2.1" @@ -2271,5 +2487,195 @@ examples: application/json: {"customer_id": ""} responses: "200": - application/json: {"customer_id": "", "value": 3371.48, "balance": {"feature_id": "", "granted": 4457.97, "remaining": 7901.2, "usage": 9728.03, "unlimited": false, "overage_allowed": false, "max_purchase": null, "next_reset_at": 9011.85}} + application/json: {"customer_id": "", "payment_url": "https://yearly-synergy.org"} + previewUpdateSubscription: + speakeasy-default-preview-update-subscription: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": ""} + responses: + "200": + application/json: {"customer_id": "", "line_items": [{"title": "", "description": "after geez graceful small mainstream minister profane", "amount": 727.26, "plan_id": "", "total_quantity": 3904.9, "paid_quantity": 5135.39}], "total": 1103.53, "currency": "Pataca"} + setupPayment: + speakeasy-default-setup-payment: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": ""} + responses: + "200": + application/json: {"customer_id": "", "url": "https://courteous-emergent.name"} + previewBillingUpdate: + speakeasy-default-preview-billing-update: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "plan_id": "pro_plan", "feature_quantities": [{"feature_id": "seats", "quantity": 15}]} + responses: + "200": + application/json: {"customer_id": "", "line_items": [], "total": 20, "currency": "usd"} + previewBillingAttach: + speakeasy-default-preview-billing-attach: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "plan_id": "pro_plan"} + responses: + "200": + application/json: {"customer_id": "", "line_items": [], "total": 20, "currency": "usd"} + openCustomerPortal: + speakeasy-default-open-customer-portal: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "return_url": "https://useautumn.com"} + responses: + "200": + application/json: {"customer_id": "cus_123", "url": "https://billing.stripe.com/session/..."} + previewUpdate: + speakeasy-default-preview-update: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "plan_id": "pro_plan", "feature_quantities": [{"feature_id": "seats", "quantity": 15}]} + responses: + "200": + application/json: {"customer_id": "", "line_items": [], "total": 20, "currency": "usd"} + createBalance: + speakeasy-default-create-balance: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "feature_id": "api_calls", "included": 1000, "reset": {"interval": "month"}} + responses: + "200": + application/json: {"success": true} + updateBalance: + speakeasy-default-update-balance: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "feature_id": "api_calls", "remaining": 5} + responses: + "200": + application/json: {"success": false} + check: + speakeasy-default-check: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "feature_id": "messages"} + responses: + "200": + application/json: {"allowed": true, "customer_id": "cus_123", "entity_id": null, "required_balance": 1, "balance": {"feature_id": "messages", "granted": 100, "remaining": 72, "usage": 28, "unlimited": false, "overage_allowed": false, "max_purchase": null, "next_reset_at": 1773851121437, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "included_grant": 100, "prepaid_grant": 0, "remaining": 72, "usage": 28, "unlimited": false, "reset": {"interval": "month", "resets_at": 1773851121437}, "price": null, "expires_at": null}]}} + track: + speakeasy-default-track: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "feature_id": "messages", "value": 1} + responses: + "200": + application/json: {"customer_id": "cus_123", "value": 1, "balance": {"feature_id": "messages", "granted": 100, "remaining": 72, "usage": 28, "unlimited": false, "overage_allowed": false, "max_purchase": null, "next_reset_at": 1773851121437, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "included_grant": 100, "prepaid_grant": 0, "remaining": 72, "usage": 28, "unlimited": false, "reset": {"interval": "month", "resets_at": 1773851121437}, "price": null, "expires_at": null}]}} + eventsList: + speakeasy-default-events-list: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"offset": 0, "limit": 50, "customer_id": "cus_123"} + responses: + "200": + application/json: {"list": [{"id": "evt_36xpk2TmuQX5zVPPQ8tCtnR5Weg", "timestamp": 1765958215459, "feature_id": "credits", "customer_id": "0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx", "value": 30, "properties": {}}, {"id": "evt_36xmHxxjAkqxufDf9yHAPNfRrLM", "timestamp": 1765956512057, "feature_id": "credits", "customer_id": "0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx", "value": 49, "properties": {}}], "has_more": false, "offset": 0, "limit": 100, "total": 2} + eventsAggregate: + speakeasy-default-events-aggregate: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "feature_id": "api_calls", "range": "30d", "bin_size": "day"} + responses: + "200": + application/json: {"list": [{"period": 1762905600000, "values": {"messages": 10, "sessions": 3}}, {"period": 1762992000000, "values": {"messages": 3, "sessions": 12}}], "total": {"messages": {"count": 2, "sum": 13}, "sessions": {"count": 2, "sum": 15}}} + createReferralCode: + speakeasy-default-create-referral-code: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "program_id": "prog_123"} + responses: + "200": + application/json: {"code": "", "customer_id": "", "created_at": 123} + redeemReferralCode: + speakeasy-default-redeem-referral-code: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"code": "REF123", "customer_id": "cus_456"} + responses: + "200": + application/json: {"id": "", "customer_id": "", "reward_id": ""} + createEntity: + speakeasy-default-create-entity: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"name": "Seat 42", "feature_id": "seats", "customer_id": "cus_123", "entity_id": "seat_42"} + responses: + "200": + application/json: {"id": "seat_42", "name": "Seat 42", "customer_id": "cus_123", "feature_id": "seats", "created_at": 1771409161016, "env": "sandbox", "subscriptions": [{"plan_id": "pro_plan", "auto_enable": true, "add_on": false, "status": "active", "past_due": false, "canceled_at": null, "expires_at": null, "trial_ends_at": null, "started_at": 1771431921437, "current_period_start": 1771431921437, "current_period_end": 1771999921437, "quantity": 1}], "purchases": [], "balances": {"messages": {"feature_id": "messages", "granted": 100, "remaining": 72, "usage": 28, "unlimited": false, "overage_allowed": false, "max_purchase": null, "next_reset_at": 1773851121437, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "included_grant": 100, "prepaid_grant": 0, "remaining": 72, "usage": 28, "unlimited": false, "reset": {"interval": "month", "resets_at": 1773851121437}, "price": null, "expires_at": null}]}}, "invoices": []} + getEntity: + speakeasy-default-get-entity: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"entity_id": "seat_42"} + responses: + "200": + application/json: {"id": "seat_42", "name": "Seat 42", "customer_id": "cus_123", "feature_id": "seats", "created_at": 1771409161016, "env": "sandbox", "subscriptions": [{"plan_id": "pro_plan", "auto_enable": true, "add_on": false, "status": "active", "past_due": false, "canceled_at": null, "expires_at": null, "trial_ends_at": null, "started_at": 1771431921437, "current_period_start": 1771431921437, "current_period_end": 1771999921437, "quantity": 1}], "purchases": [], "balances": {"messages": {"feature_id": "messages", "granted": 100, "remaining": 72, "usage": 28, "unlimited": false, "overage_allowed": false, "max_purchase": null, "next_reset_at": 1773851121437, "breakdown": [{"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV", "plan_id": "pro_plan", "included_grant": 100, "prepaid_grant": 0, "remaining": 72, "usage": 28, "unlimited": false, "reset": {"interval": "month", "resets_at": 1773851121437}, "price": null, "expires_at": null}]}}, "invoices": []} + deleteEntity: + speakeasy-default-delete-entity: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "entity_id": "seat_42"} + responses: + "200": + application/json: {"success": true} + listEvents: + speakeasy-default-list-events: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"offset": 0, "limit": 50, "customer_id": "cus_123"} + responses: + "200": + application/json: {"list": [{"id": "evt_36xpk2TmuQX5zVPPQ8tCtnR5Weg", "timestamp": 1765958215459, "feature_id": "credits", "customer_id": "0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx", "value": 30, "properties": {}}, {"id": "evt_36xmHxxjAkqxufDf9yHAPNfRrLM", "timestamp": 1765956512057, "feature_id": "credits", "customer_id": "0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx", "value": 49, "properties": {}}], "has_more": false, "offset": 0, "limit": 100, "total": 2} + aggregateEvents: + speakeasy-default-aggregate-events: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "feature_id": "api_calls", "range": "30d", "bin_size": "day"} + responses: + "200": + application/json: {"list": [{"period": 1762905600000, "values": {"messages": 10, "sessions": 3}}, {"period": 1762992000000, "values": {"messages": 3, "sessions": 12}}], "total": {"messages": {"count": 2, "sum": 13}, "sessions": {"count": 2, "sum": 15}}} examplesVersion: 1.0.2 diff --git a/packages/sdk/.speakeasy/gen.yaml b/packages/sdk/.speakeasy/gen.yaml index 70673bd9e..5032a08a3 100644 --- a/packages/sdk/.speakeasy/gen.yaml +++ b/packages/sdk/.speakeasy/gen.yaml @@ -33,7 +33,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: false typescript: - version: 0.8.27 + version: 0.10.4 acceptHeaderEnum: false additionalDependencies: dependencies: {} diff --git a/packages/sdk/.speakeasy/out.openapi.yaml b/packages/sdk/.speakeasy/out.openapi.yaml index 7f1bc198e..992c90527 100644 --- a/packages/sdk/.speakeasy/out.openapi.yaml +++ b/packages/sdk/.speakeasy/out.openapi.yaml @@ -117,43 +117,55 @@ components: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the subscribed plan. auto_enable: type: boolean + description: Whether the plan was automatically enabled for the customer. add_on: type: boolean + description: Whether this is an add-on plan rather than a base subscription. status: enum: - active - scheduled - - expired + description: Current status of the subscription. past_due: type: boolean + description: Whether the subscription has overdue payments. canceled_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription was canceled, or null if not canceled. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry set. trial_ends_at: anyOf: - type: number - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. started_at: type: number + description: Timestamp when the subscription started. current_period_start: anyOf: - type: number - type: "null" + description: Start timestamp of the current billing period. current_period_end: anyOf: - type: number - type: "null" + description: End timestamp of the current billing period. quantity: type: number + description: Number of units of this subscription (for per-seat plans). required: - plan_id - auto_enable @@ -167,6 +179,7 @@ components: - current_period_start - current_period_end - quantity + description: Active and scheduled recurring plans that this customer has attached. purchases: type: array items: @@ -174,21 +187,27 @@ components: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the purchased plan. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. started_at: type: number + description: Timestamp when the purchase was made. quantity: type: number + description: Number of units purchased. required: - plan_id - expires_at - started_at - quantity + description: One-time purchases made by the customer. balances: type: object propertyNames: @@ -198,6 +217,7 @@ components: properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -247,25 +267,33 @@ components: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -274,20 +302,27 @@ components: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -305,22 +340,27 @@ components: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -335,25 +375,31 @@ components: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -364,6 +410,7 @@ components: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans or grants. rollovers: type: array items: @@ -371,11 +418,14 @@ components: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -385,6 +435,29 @@ components: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + description: Feature balances keyed by feature ID, showing usage limits and remaining amounts. invoices: type: array items: @@ -598,30 +671,52 @@ components: - purchases - balances examples: - - id: cus_123 - created_at: 1717000000 - name: John Doe - email: john@example.com - fingerprint: "1234567890" - stripe_id: cus_123 + - id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58 + name: Patrick + email: patrick@useautumn.com + createdAt: 1771409161016 + fingerprint: null + stripeId: cus_U0BKxpq1mFhuJO env: sandbox metadata: {} + sendEmailReceipts: false subscriptions: - - id: sub_123 - created_at: 1717000000 - plan_id: plan_123 + - planId: pro_plan + autoEnable: true + addOn: false status: active + pastDue: false + canceledAt: null + expiresAt: null + trialEndsAt: null + startedAt: 1771431921437 + currentPeriodStart: 1771431921437 + currentPeriodEnd: 1771999921437 quantity: 1 - interval: month - interval_count: 1 purchases: [] balances: - balance_1: - id: balance_1 - amount: 100 - currency: USD - created_at: 1717000000 - updated_at: 1717000000 + messages: + featureId: messages + granted: 100 + remaining: 0 + usage: 100 + unlimited: false + overageAllowed: false + maxPurchase: null + nextResetAt: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + planId: pro_plan + includedGrant: 100 + prepaidGrant: 0 + remaining: 0 + usage: 100 + unlimited: false + reset: + interval: month + resetsAt: 1773851121437 + price: null + expiresAt: null Plan: type: object properties: @@ -1151,43 +1246,55 @@ paths: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the subscribed plan. auto_enable: type: boolean + description: Whether the plan was automatically enabled for the customer. add_on: type: boolean + description: Whether this is an add-on plan rather than a base subscription. status: enum: - active - scheduled - - expired + description: Current status of the subscription. past_due: type: boolean + description: Whether the subscription has overdue payments. canceled_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription was canceled, or null if not canceled. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry set. trial_ends_at: anyOf: - type: number - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. started_at: type: number + description: Timestamp when the subscription started. current_period_start: anyOf: - type: number - type: "null" + description: Start timestamp of the current billing period. current_period_end: anyOf: - type: number - type: "null" + description: End timestamp of the current billing period. quantity: type: number + description: Number of units of this subscription (for per-seat plans). required: - plan_id - auto_enable @@ -1201,6 +1308,7 @@ paths: - current_period_start - current_period_end - quantity + description: Active and scheduled recurring plans that this customer has attached. purchases: type: array items: @@ -1208,21 +1316,27 @@ paths: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the purchased plan. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. started_at: type: number + description: Timestamp when the purchase was made. quantity: type: number + description: Number of units purchased. required: - plan_id - expires_at - started_at - quantity + description: One-time purchases made by the customer. balances: type: object propertyNames: @@ -1232,6 +1346,7 @@ paths: properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -1281,25 +1396,33 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -1308,20 +1431,27 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -1339,22 +1469,27 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -1368,25 +1503,31 @@ paths: type: number required: - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -1397,6 +1538,7 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans or grants. rollovers: type: array items: @@ -1404,11 +1546,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -1418,6 +1563,29 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + description: Feature balances keyed by feature ID, showing usage limits and remaining amounts. required: - id - name @@ -1431,6 +1599,53 @@ paths: - subscriptions - purchases - balances + examples: + - id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58 + name: Patrick + email: patrick@useautumn.com + createdAt: 1771409161016 + fingerprint: null + stripeId: cus_U0BKxpq1mFhuJO + env: sandbox + metadata: {} + sendEmailReceipts: false + subscriptions: + - planId: pro_plan + autoEnable: true + addOn: false + status: active + pastDue: false + canceledAt: null + expiresAt: null + trialEndsAt: null + startedAt: 1771431921437 + currentPeriodStart: 1771431921437 + currentPeriodEnd: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + featureId: messages + granted: 100 + remaining: 0 + usage: 100 + unlimited: false + overageAllowed: false + maxPurchase: null + nextResetAt: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + planId: pro_plan + includedGrant: 100 + prepaidGrant: 0 + remaining: 0 + usage: 100 + unlimited: false + reset: + interval: month + resetsAt: 1773851121437 + price: null + expiresAt: null description: Array of items for current page has_more: type: boolean @@ -1450,6 +1665,58 @@ paths: - offset - limit - total + examples: + - list: + - id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58 + name: Patrick + email: patrick@useautumn.com + createdAt: 1771409161016 + fingerprint: null + stripeId: cus_U0BKxpq1mFhuJO + env: sandbox + metadata: {} + sendEmailReceipts: false + subscriptions: + - planId: pro_plan + autoEnable: true + addOn: false + status: active + pastDue: false + canceledAt: null + expiresAt: null + trialEndsAt: null + startedAt: 1771431921437 + currentPeriodStart: 1771431921437 + currentPeriodEnd: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + featureId: messages + granted: 100 + remaining: 0 + usage: 100 + unlimited: false + overageAllowed: false + maxPurchase: null + nextResetAt: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + planId: pro_plan + includedGrant: 100 + prepaidGrant: 0 + remaining: 0 + usage: 100 + unlimited: false + reset: + interval: month + resetsAt: 1773851121437 + price: null + expiresAt: null + has_more: false + offset: 0 + total: 1 + limit: 10 x-speakeasy-name-override: list parameters: - *a1 @@ -1568,43 +1835,55 @@ paths: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the subscribed plan. auto_enable: type: boolean + description: Whether the plan was automatically enabled for the customer. add_on: type: boolean + description: Whether this is an add-on plan rather than a base subscription. status: enum: - active - scheduled - - expired + description: Current status of the subscription. past_due: type: boolean + description: Whether the subscription has overdue payments. canceled_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription was canceled, or null if not canceled. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry set. trial_ends_at: anyOf: - type: number - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. started_at: type: number + description: Timestamp when the subscription started. current_period_start: anyOf: - type: number - type: "null" + description: Start timestamp of the current billing period. current_period_end: anyOf: - type: number - type: "null" + description: End timestamp of the current billing period. quantity: type: number + description: Number of units of this subscription (for per-seat plans). required: - plan_id - auto_enable @@ -1618,6 +1897,7 @@ paths: - current_period_start - current_period_end - quantity + description: Active and scheduled recurring plans that this customer has attached. purchases: type: array items: @@ -1625,21 +1905,27 @@ paths: properties: plan: $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. plan_id: type: string + description: The unique identifier of the purchased plan. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. started_at: type: number + description: Timestamp when the purchase was made. quantity: type: number + description: Number of units purchased. required: - plan_id - expires_at - started_at - quantity + description: One-time purchases made by the customer. balances: type: object propertyNames: @@ -1649,6 +1935,7 @@ paths: properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -1698,25 +1985,33 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -1725,20 +2020,27 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -1756,22 +2058,27 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -1786,25 +2093,31 @@ paths: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -1815,6 +2128,7 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans or grants. rollovers: type: array items: @@ -1822,11 +2136,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -1836,6 +2153,29 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + description: Feature balances keyed by feature ID, showing usage limits and remaining amounts. required: - id - name @@ -1849,6 +2189,53 @@ paths: - subscriptions - purchases - balances + examples: + - id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58 + name: Patrick + email: patrick@useautumn.com + createdAt: 1771409161016 + fingerprint: null + stripeId: cus_U0BKxpq1mFhuJO + env: sandbox + metadata: {} + sendEmailReceipts: false + subscriptions: + - planId: pro_plan + autoEnable: true + addOn: false + status: active + pastDue: false + canceledAt: null + expiresAt: null + trialEndsAt: null + startedAt: 1771431921437 + currentPeriodStart: 1771431921437 + currentPeriodEnd: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + featureId: messages + granted: 100 + remaining: 0 + usage: 100 + unlimited: false + overageAllowed: false + maxPurchase: null + nextResetAt: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + planId: pro_plan + includedGrant: 100 + prepaidGrant: 0 + remaining: 0 + usage: 100 + unlimited: false + reset: + interval: month + resetsAt: 1773851121437 + price: null + expiresAt: null x-speakeasy-name-override: update parameters: - *a1 @@ -1937,13 +2324,802 @@ paths: Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. + Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product. + + @example ```typescript // Attach a plan to a customer - const response = await client.attach({ customerId: "cus_123", planId: "pro_plan" }); + const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan" }); + + ``` + + + @example + + ```typescript + + // Attach with a free trial + + const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan", freeTrial: {"durationLength":14,"durationType":"day"} }); + + ``` + + + @example + + ```typescript + + // Attach with custom pricing + + const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan", customize: {"price":{"amount":4900,"interval":"month"}} }); + + ``` + + + @param customerId - The ID of the customer to attach the plan to. + + @param entityId - The ID of the entity to attach the plan to. (optional) + + @param planId - The ID of the plan. + + @param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) + + @param version - The version of the plan to attach. (optional) + + @param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) + + @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) + + @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) + + @param billingBehavior - 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. (optional) + + @param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) + + @param successUrl - URL to redirect to after successful checkout. (optional) + + @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) + + @param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + + + @returns A billing response with customer ID, invoice details, and payment URL (if checkout required). + tags: + - billing + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer to attach the plan to. + entity_id: + type: string + description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: The ID of the plan. + feature_quantities: + type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + minimum: 0 + adjustable: + type: boolean + required: + - feature_id + description: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. + version: + type: number + description: The version of the plan to attach. + free_trial: + anyOf: + - type: object + properties: + duration_length: + type: number + duration_type: + enum: + - day + - month + - year + default: month + card_required: + type: boolean + default: true + required: + - duration_length + - type: "null" + description: Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. + customize: + type: object + properties: + price: + anyOf: + - type: object + properties: + amount: + type: number + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + interval_count: + type: number + required: + - amount + - interval + - type: "null" + items: + type: array + items: + type: object + properties: + feature_id: + type: string + included: + type: number + unlimited: + type: boolean + reset: + type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + interval_count: + type: number + required: + - interval + price: + type: object + properties: + amount: + type: number + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + interval_count: + type: number + default: 1 + billing_units: + type: number + default: 1 + billing_method: + enum: + - prepaid + - usage_based + max_purchase: + type: number + required: + - interval + - billing_method + proration: + type: object + properties: + on_increase: + enum: + - bill_immediately + - prorate_immediately + - prorate_next_cycle + - bill_next_cycle + on_decrease: + enum: + - prorate + - prorate_immediately + - prorate_next_cycle + - none + - no_prorations + required: + - on_increase + - on_decrease + rollover: + type: object + properties: + max: + type: number + expiry_duration_type: + enum: + - month + - forever + expiry_duration_length: + type: number + required: + - expiry_duration_type + required: + - feature_id + description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. + invoice_mode: + type: object + properties: + enabled: + type: boolean + description: When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. + enable_plan_immediately: + type: boolean + default: false + description: If true, enables the plan immediately even though the invoice is not paid yet. + finalize: + type: boolean + default: true + description: If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. + required: + - enabled + description: Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + billing_behavior: + enum: + - prorate_immediately + - next_cycle_only + description: 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. + discounts: + type: array + items: + anyOf: + - type: object + properties: + reward_id: + type: string + description: The ID of the reward to apply as a discount. + required: + - reward_id + - type: object + properties: + promotion_code: + type: string + description: The promotion code to apply as a discount. + required: + - promotion_code + description: A discount to apply. Can be either a reward ID or a promotion code. + description: List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + success_url: + type: string + description: URL to redirect to after successful checkout. + new_billing_subscription: + type: boolean + description: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + plan_schedule: + enum: + - immediate + - end_of_cycle + description: When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + required: + - customer_id + - plan_id + title: AttachParams + examples: + - customer_id: cus_123 + plan_id: pro_plan + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer. + entity_id: + type: string + description: The ID of the entity, if the plan was attached to an entity. + invoice: + type: object + properties: + status: + anyOf: + - type: string + - type: "null" + description: The status of the invoice (e.g., 'paid', 'open', 'draft'). + stripe_id: + type: string + description: The Stripe invoice ID. + total: + type: number + description: The total amount of the invoice in cents. + currency: + type: string + description: The three-letter ISO currency code (e.g., 'usd'). + hosted_invoice_url: + anyOf: + - type: string + - type: "null" + description: URL to the hosted invoice page where the customer can view and pay the invoice. + required: + - status + - stripe_id + - total + - currency + - hosted_invoice_url + description: Invoice details if an invoice was created. Only present when a charge was made. + payment_url: + anyOf: + - type: string + - type: "null" + description: URL to redirect the customer to complete payment. Null if no payment action is required. + required_action: + type: object + properties: + code: + enum: + - 3ds_required + - payment_method_required + - payment_failed + description: The type of action required to complete the payment. + reason: + type: string + description: A human-readable explanation of why this action is required. + required: + - code + - reason + description: Details about any action required to complete the payment. Present when the payment could not be processed automatically. + required: + - customer_id + - payment_url + examples: + - customer_id: cus_123 + payment_url: https://checkout.stripe.com/... + x-speakeasy-name-override: attach + parameters: + - *a1 + /v1/billing.preview_attach: + post: + operationId: previewAttach + description: >- + Previews the billing changes that would occur when attaching a plan, without actually making any changes. + + + Use this endpoint to show customers what they will be charged before confirming a subscription change. + + + @example + + ```typescript + + // Preview attaching a plan + + const response = await client.billing.previewAttach({ customerId: "cus_123", planId: "pro_plan" }); + + ``` + + + @param customerId - The ID of the customer to attach the plan to. + + @param entityId - The ID of the entity to attach the plan to. (optional) + + @param planId - The ID of the plan. + + @param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) + + @param version - The version of the plan to attach. (optional) + + @param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) + + @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) + + @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) + + @param billingBehavior - 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. (optional) + + @param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) + + @param successUrl - URL to redirect to after successful checkout. (optional) + + @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) + + @param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + + + @returns A preview response with line items, totals, and effective dates for the proposed changes. + tags: + - billing + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer to attach the plan to. + entity_id: + type: string + description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: The ID of the plan. + feature_quantities: + type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + minimum: 0 + adjustable: + type: boolean + required: + - feature_id + description: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. + version: + type: number + description: The version of the plan to attach. + free_trial: + anyOf: + - type: object + properties: + duration_length: + type: number + duration_type: + enum: + - day + - month + - year + default: month + card_required: + type: boolean + default: true + required: + - duration_length + - type: "null" + description: Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. + customize: + type: object + properties: + price: + anyOf: + - type: object + properties: + amount: + type: number + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + interval_count: + type: number + required: + - amount + - interval + - type: "null" + items: + type: array + items: + type: object + properties: + feature_id: + type: string + included: + type: number + unlimited: + type: boolean + reset: + type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + interval_count: + type: number + required: + - interval + price: + type: object + properties: + amount: + type: number + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + interval_count: + type: number + default: 1 + billing_units: + type: number + default: 1 + billing_method: + enum: + - prepaid + - usage_based + max_purchase: + type: number + required: + - interval + - billing_method + proration: + type: object + properties: + on_increase: + enum: + - bill_immediately + - prorate_immediately + - prorate_next_cycle + - bill_next_cycle + on_decrease: + enum: + - prorate + - prorate_immediately + - prorate_next_cycle + - none + - no_prorations + required: + - on_increase + - on_decrease + rollover: + type: object + properties: + max: + type: number + expiry_duration_type: + enum: + - month + - forever + expiry_duration_length: + type: number + required: + - expiry_duration_type + required: + - feature_id + description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. + invoice_mode: + type: object + properties: + enabled: + type: boolean + description: When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. + enable_plan_immediately: + type: boolean + default: false + description: If true, enables the plan immediately even though the invoice is not paid yet. + finalize: + type: boolean + default: true + description: If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. + required: + - enabled + description: Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + billing_behavior: + enum: + - prorate_immediately + - next_cycle_only + description: 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. + discounts: + type: array + items: + anyOf: + - type: object + properties: + reward_id: + type: string + description: The ID of the reward to apply as a discount. + required: + - reward_id + - type: object + properties: + promotion_code: + type: string + description: The promotion code to apply as a discount. + required: + - promotion_code + description: A discount to apply. Can be either a reward ID or a promotion code. + description: List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + success_url: + type: string + description: URL to redirect to after successful checkout. + new_billing_subscription: + type: boolean + description: Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + plan_schedule: + enum: + - immediate + - end_of_cycle + description: When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + required: + - customer_id + - plan_id + title: PreviewAttachParams + examples: + - customer_id: cus_123 + plan_id: pro_plan + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer. + line_items: + type: array + items: + type: object + properties: + title: + type: string + description: The title of the line item. + description: + type: string + description: A detailed description of the line item. + amount: + type: number + description: The amount in cents for this line item. + discounts: + type: array + items: + type: object + properties: + amountOff: + type: number + percentOff: + type: number + stripeCouponId: + type: string + couponName: + type: string + required: + - amountOff + default: [] + description: List of discounts applied to this line item. + required: + - title + - description + - amount + description: List of line items for the current billing period. + total: + type: number + description: The total amount in cents for the current billing period. + currency: + type: string + description: The three-letter ISO currency code (e.g., 'usd'). + next_cycle: + type: object + properties: + starts_at: + type: number + description: Unix timestamp (milliseconds) when the next billing cycle starts. + total: + type: number + description: The total amount in cents for the next cycle. + required: + - starts_at + - total + description: Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. + required: + - customer_id + - line_items + - total + - currency + examples: + - customerId: charles + lineItems: + - title: Pro seed + description: Pro seed - Base Price (from 18 Feb 2026 to 18 Mar 2026) + amount: 20 + discounts: [] + total: 20 + currency: usd + x-speakeasy-name-override: previewAttach + parameters: + - *a1 + /v1/billing.update: + post: + operationId: billingUpdate + description: >- + Updates an existing subscription. Use to modify feature quantities, cancel, or change plan configuration. + + + Use this endpoint to update prepaid quantities, cancel a subscription (immediately or at end of cycle), or modify subscription settings. + + + @example + + ```typescript + + // Update prepaid feature quantity + + const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", featureQuantities: [{"featureId":"seats","quantity":10}] }); + + ``` + + + @example + + ```typescript + + // Cancel a subscription at end of billing cycle + + const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", cancelAction: "cancel_end_of_cycle" }); + + ``` + + + @example + + ```typescript + + // Uncancel a subscription at the end of the billing cycle + + const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", cancelAction: "uncancel" }); ``` @@ -1956,7 +3132,18 @@ paths: @param version - The version of the plan to attach. (optional) + @param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) + @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) + + @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) + + @param billingBehavior - 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. (optional) + + @param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional) + + + @returns A billing response with customer ID, invoice details, and payment URL (if next action is required). tags: - billing requestBody: @@ -1970,26 +3157,25 @@ paths: type: string description: The ID of the customer to attach the plan to. entity_id: - anyOf: - - type: string - - type: "null" + type: string description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: The ID of the plan. feature_quantities: - anyOf: - - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - minimum: 0 - adjustable: - type: boolean - required: - - feature_id - - type: "null" + type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + minimum: 0 + adjustable: + type: boolean + required: + - feature_id description: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. version: type: number @@ -2012,6 +3198,7 @@ paths: required: - duration_length - type: "null" + description: Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. customize: type: object properties: @@ -2141,1168 +3328,44 @@ paths: required: - feature_id description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - plan_id: - type: string invoice_mode: type: object properties: enabled: type: boolean + description: When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. enable_plan_immediately: type: boolean default: false + description: If true, enables the plan immediately even though the invoice is not paid yet. finalize: type: boolean default: true + description: If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. required: - enabled - discounts: - type: array - items: - anyOf: - - type: object - properties: - reward_id: - type: string - required: - - reward_id - - type: object - properties: - promotion_code: - type: string - required: - - promotion_code - redirect_mode: - enum: - - always - - if_required - - never - default: always - success_url: - type: string - new_billing_subscription: - type: boolean - plan_schedule: - enum: - - immediate - - end_of_cycle + description: Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. billing_behavior: enum: - prorate_immediately - next_cycle_only - required: - - customer_id - - plan_id - responses: - "200": - description: OK - content: - application/json: - schema: - type: object - properties: - customer_id: - type: string - entity_id: - type: string - invoice: - type: object - properties: - status: - anyOf: - - type: string - - type: "null" - stripe_id: - type: string - total: - type: number - currency: - type: string - hosted_invoice_url: - anyOf: - - type: string - - type: "null" - required: - - status - - stripe_id - - total - - currency - - hosted_invoice_url - payment_url: - anyOf: - - type: string - - type: "null" - required_action: - type: object - properties: - code: - enum: - - 3ds_required - - payment_method_required - - payment_failed - reason: - type: string - required: - - code - - reason - required: - - customer_id - - payment_url - x-speakeasy-name-override: attach - parameters: - - *a1 - /v1/billing.preview_attach: - post: - operationId: billingPreviewAttach - description: Preview billing changes before attaching a plan. - tags: - - billing - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - customer_id: - type: string - description: The ID of the customer to attach the plan to. - entity_id: - anyOf: - - type: string - - type: "null" - description: The ID of the entity to attach the plan to. - feature_quantities: - anyOf: - - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - minimum: 0 - adjustable: - type: boolean - required: - - feature_id - - type: "null" - description: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. - version: - type: number - description: The version of the plan to attach. - free_trial: - anyOf: - - type: object - properties: - duration_length: - type: number - duration_type: - enum: - - day - - month - - year - default: month - card_required: - type: boolean - default: true - required: - - duration_length - - type: "null" - customize: - type: object - properties: - price: - anyOf: - - type: object - properties: - amount: - type: number - interval: - enum: - - one_off - - week - - month - - quarter - - semi_annual - - year - interval_count: - type: number - required: - - amount - - interval - - type: "null" - items: - type: array - items: - type: object - properties: - feature_id: - type: string - included: - type: number - unlimited: - type: boolean - reset: - type: object - properties: - interval: - enum: - - one_off - - minute - - hour - - day - - week - - month - - quarter - - semi_annual - - year - interval_count: - type: number - required: - - interval - price: - type: object - properties: - amount: - type: number - tiers: - type: array - items: - type: object - properties: - to: - anyOf: - - type: number - - const: inf - amount: - type: number - required: - - to - - amount - interval: - enum: - - one_off - - week - - month - - quarter - - semi_annual - - year - interval_count: - type: number - default: 1 - billing_units: - type: number - default: 1 - billing_method: - enum: - - prepaid - - usage_based - max_purchase: - type: number - required: - - interval - - billing_method - proration: - type: object - properties: - on_increase: - enum: - - bill_immediately - - prorate_immediately - - prorate_next_cycle - - bill_next_cycle - on_decrease: - enum: - - prorate - - prorate_immediately - - prorate_next_cycle - - none - - no_prorations - required: - - on_increase - - on_decrease - rollover: - type: object - properties: - max: - type: number - expiry_duration_type: - enum: - - month - - forever - expiry_duration_length: - type: number - required: - - expiry_duration_type - required: - - feature_id - description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - plan_id: - type: string - invoice_mode: - type: object - properties: - enabled: - type: boolean - enable_plan_immediately: - type: boolean - default: false - finalize: - type: boolean - default: true - required: - - enabled - discounts: - type: array - items: - anyOf: - - type: object - properties: - reward_id: - type: string - required: - - reward_id - - type: object - properties: - promotion_code: - type: string - required: - - promotion_code - redirect_mode: - enum: - - always - - if_required - - never - default: always - success_url: - type: string - new_billing_subscription: - type: boolean - plan_schedule: - enum: - - immediate - - end_of_cycle - billing_behavior: - enum: - - prorate_immediately - - next_cycle_only - required: - - customer_id - - plan_id - responses: - "200": - description: OK - content: - application/json: - schema: - type: object - properties: - customer_id: - type: string - line_items: - type: array - items: - type: object - properties: - title: - type: string - description: - type: string - amount: - type: number - discounts: - type: array - items: - type: object - properties: - amountOff: - type: number - percentOff: - type: number - stripeCouponId: - type: string - couponName: - type: string - required: - - amountOff - default: [] - plan_id: - type: string - total_quantity: - type: number - paid_quantity: - type: number - deferred_for_trial: - type: boolean - effective_period: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - is_base: - type: boolean - required: - - title - - description - - amount - - plan_id - - total_quantity - - paid_quantity - total: - type: number - currency: - type: string - period_start: - type: number - period_end: - type: number - next_cycle: - type: object - properties: - starts_at: - type: number - total: - type: number - line_items: - type: array - items: - type: object - properties: - title: - type: string - description: - type: string - amount: - type: number - discounts: - type: array - items: - type: object - properties: - amountOff: - type: number - percentOff: - type: number - stripeCouponId: - type: string - couponName: - type: string - required: - - amountOff - default: [] - plan_id: - type: string - total_quantity: - type: number - paid_quantity: - type: number - deferred_for_trial: - type: boolean - effective_period: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - is_base: - type: boolean - required: - - title - - description - - amount - - plan_id - - total_quantity - - paid_quantity - required: - - starts_at - - total - - line_items - incoming: - type: array - items: - type: object - properties: - plan: - $ref: "#/components/schemas/Plan" - feature_quantities: - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - required: - - feature_id - - quantity - balances: - type: object - propertyNames: - type: string - additionalProperties: - type: object - properties: - feature_id: - type: string - feature: - type: object - properties: - id: - type: string - name: - type: string - type: - enum: - - boolean - - metered - - credit_system - consumable: - type: boolean - event_names: - type: array - items: - type: string - credit_schema: - type: array - items: - type: object - properties: - metered_feature_id: - type: string - credit_cost: - type: number - required: - - metered_feature_id - - credit_cost - display: - type: object - properties: - singular: - anyOf: - - type: string - - type: "null" - plural: - anyOf: - - type: string - - type: "null" - archived: - type: boolean - required: - - id - - name - - type - - consumable - - archived - granted: - type: number - remaining: - type: number - minimum: 0 - usage: - type: number - unlimited: - type: boolean - overage_allowed: - type: boolean - max_purchase: - anyOf: - - type: number - - type: "null" - next_reset_at: - anyOf: - - type: number - - type: "null" - breakdown: - type: array - items: - type: object - properties: - id: - type: string - default: "" - plan_id: - anyOf: - - type: string - - type: "null" - included_grant: - type: number - prepaid_grant: - type: number - remaining: - type: number - usage: - type: number - unlimited: - type: boolean - reset: - anyOf: - - type: object - properties: - interval: - anyOf: - - enum: - - one_off - - minute - - hour - - day - - week - - month - - quarter - - semi_annual - - year - - const: multiple - interval_count: - type: number - resets_at: - anyOf: - - type: number - - type: "null" - required: - - interval - - resets_at - - type: "null" - price: - anyOf: - - type: object - properties: - amount: - type: number - tiers: - type: array - items: - type: object - properties: - to: - anyOf: - - {} - - {} - amount: - type: number - required: - - amount - billing_units: - type: number - billing_method: - enum: - - prepaid - - usage_based - max_purchase: - anyOf: - - type: number - - type: "null" - required: - - billing_units - - billing_method - - max_purchase - - type: "null" - expires_at: - anyOf: - - type: number - - type: "null" - required: - - plan_id - - included_grant - - prepaid_grant - - remaining - - usage - - unlimited - - reset - - price - - expires_at - rollovers: - type: array - items: - type: object - properties: - balance: - type: number - expires_at: - type: number - required: - - balance - - expires_at - required: - - feature_id - - granted - - remaining - - usage - - unlimited - - overage_allowed - - max_purchase - - next_reset_at - period_start: - type: number - period_end: - type: number - required: - - plan - - feature_quantities - - balances - outgoing: - type: array - items: - type: object - properties: - plan: - $ref: "#/components/schemas/Plan" - feature_quantities: - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - required: - - feature_id - - quantity - balances: - type: object - propertyNames: - type: string - additionalProperties: - type: object - properties: - feature_id: - type: string - feature: - type: object - properties: - id: - type: string - name: - type: string - type: - enum: - - boolean - - metered - - credit_system - consumable: - type: boolean - event_names: - type: array - items: - type: string - credit_schema: - type: array - items: - type: object - properties: - metered_feature_id: - type: string - credit_cost: - type: number - required: - - metered_feature_id - - credit_cost - display: - type: object - properties: - singular: - anyOf: - - type: string - - type: "null" - plural: - anyOf: - - type: string - - type: "null" - archived: - type: boolean - required: - - id - - name - - type - - consumable - - archived - granted: - type: number - remaining: - type: number - minimum: 0 - usage: - type: number - unlimited: - type: boolean - overage_allowed: - type: boolean - max_purchase: - anyOf: - - type: number - - type: "null" - next_reset_at: - anyOf: - - type: number - - type: "null" - breakdown: - type: array - items: - type: object - properties: - id: - type: string - default: "" - plan_id: - anyOf: - - type: string - - type: "null" - included_grant: - type: number - prepaid_grant: - type: number - remaining: - type: number - usage: - type: number - unlimited: - type: boolean - reset: - anyOf: - - type: object - properties: - interval: - anyOf: - - enum: - - one_off - - minute - - hour - - day - - week - - month - - quarter - - semi_annual - - year - - const: multiple - interval_count: - type: number - resets_at: - anyOf: - - type: number - - type: "null" - required: - - interval - - resets_at - - type: "null" - price: - anyOf: - - type: object - properties: - amount: - type: number - tiers: - type: array - items: - type: object - properties: - to: - anyOf: - - {} - - {} - amount: - type: number - required: - - amount - billing_units: - type: number - billing_method: - enum: - - prepaid - - usage_based - max_purchase: - anyOf: - - type: number - - type: "null" - required: - - billing_units - - billing_method - - max_purchase - - type: "null" - expires_at: - anyOf: - - type: number - - type: "null" - required: - - plan_id - - included_grant - - prepaid_grant - - remaining - - usage - - unlimited - - reset - - price - - expires_at - rollovers: - type: array - items: - type: object - properties: - balance: - type: number - expires_at: - type: number - required: - - balance - - expires_at - required: - - feature_id - - granted - - remaining - - usage - - unlimited - - overage_allowed - - max_purchase - - next_reset_at - period_start: - type: number - period_end: - type: number - required: - - plan - - feature_quantities - - balances - redirect_type: - anyOf: - - enum: - - stripe_checkout - - autumn_checkout - - type: "null" - required: - - customer_id - - line_items - - total - - currency - - incoming - - outgoing - - redirect_type - x-speakeasy-name-override: previewAttach - parameters: - - *a1 - /v1/billing.update: - post: - operationId: billingUpdate - description: Update an existing subscription. - tags: - - billing - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - customer_id: - type: string - description: The ID of the customer to attach the plan to. - entity_id: - anyOf: - - type: string - - type: "null" - description: The ID of the entity to attach the plan to. - feature_quantities: - anyOf: - - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - minimum: 0 - adjustable: - type: boolean - required: - - feature_id - - type: "null" - description: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. - version: - type: number - description: The version of the plan to attach. - free_trial: - anyOf: - - type: object - properties: - duration_length: - type: number - duration_type: - enum: - - day - - month - - year - default: month - card_required: - type: boolean - default: true - required: - - duration_length - - type: "null" - customize: - type: object - properties: - price: - anyOf: - - type: object - properties: - amount: - type: number - interval: - enum: - - one_off - - week - - month - - quarter - - semi_annual - - year - interval_count: - type: number - required: - - amount - - interval - - type: "null" - items: - type: array - items: - type: object - properties: - feature_id: - type: string - included: - type: number - unlimited: - type: boolean - reset: - type: object - properties: - interval: - enum: - - one_off - - minute - - hour - - day - - week - - month - - quarter - - semi_annual - - year - interval_count: - type: number - required: - - interval - price: - type: object - properties: - amount: - type: number - tiers: - type: array - items: - type: object - properties: - to: - anyOf: - - type: number - - const: inf - amount: - type: number - required: - - to - - amount - interval: - enum: - - one_off - - week - - month - - quarter - - semi_annual - - year - interval_count: - type: number - default: 1 - billing_units: - type: number - default: 1 - billing_method: - enum: - - prepaid - - usage_based - max_purchase: - type: number - required: - - interval - - billing_method - proration: - type: object - properties: - on_increase: - enum: - - bill_immediately - - prorate_immediately - - prorate_next_cycle - - bill_next_cycle - on_decrease: - enum: - - prorate - - prorate_immediately - - prorate_next_cycle - - none - - no_prorations - required: - - on_increase - - on_decrease - rollover: - type: object - properties: - max: - type: number - expiry_duration_type: - enum: - - month - - forever - expiry_duration_length: - type: number - required: - - expiry_duration_type - required: - - feature_id - description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - plan_id: - type: string - invoice_mode: - type: object - properties: - enabled: - type: boolean - enable_plan_immediately: - type: boolean - default: false - finalize: - type: boolean - default: true - required: - - enabled + description: 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. cancel_action: enum: - cancel_immediately - cancel_end_of_cycle - uncancel - billing_behavior: - enum: - - prorate_immediately - - next_cycle_only + description: Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. required: - customer_id + - plan_id + title: UpdateSubscriptionParams + examples: + - customer_id: cus_123 + plan_id: pro_plan + feature_quantities: + - feature_id: seats + quantity: 10 responses: "200": description: OK @@ -3313,8 +3376,10 @@ paths: properties: customer_id: type: string + description: The ID of the customer. entity_id: type: string + description: The ID of the entity, if the plan was attached to an entity. invoice: type: object properties: @@ -3322,26 +3387,33 @@ paths: anyOf: - type: string - type: "null" + description: The status of the invoice (e.g., 'paid', 'open', 'draft'). stripe_id: type: string + description: The Stripe invoice ID. total: type: number + description: The total amount of the invoice in cents. currency: type: string + description: The three-letter ISO currency code (e.g., 'usd'). hosted_invoice_url: anyOf: - type: string - type: "null" + description: URL to the hosted invoice page where the customer can view and pay the invoice. required: - status - stripe_id - total - currency - hosted_invoice_url + description: Invoice details if an invoice was created. Only present when a charge was made. payment_url: anyOf: - type: string - type: "null" + description: URL to redirect the customer to complete payment. Null if no payment action is required. required_action: type: object properties: @@ -3350,21 +3422,70 @@ paths: - 3ds_required - payment_method_required - payment_failed + description: The type of action required to complete the payment. reason: type: string + description: A human-readable explanation of why this action is required. required: - code - reason + description: Details about any action required to complete the payment. Present when the payment could not be processed automatically. required: - customer_id - payment_url + examples: + - customer_id: cus_123 + invoice: + status: paid + stripe_id: in_1234 + total: 1500 + currency: usd + hosted_invoice_url: https://invoice.stripe.com/... + payment_url: null x-speakeasy-name-override: update parameters: - *a1 /v1/billing.preview_update: post: - operationId: billingPreviewUpdate - description: Preview billing changes before updating a subscription. + operationId: previewUpdate + description: >- + Previews the billing changes that would occur when updating a subscription, without actually making any changes. + + + Use this endpoint to show customers prorated charges or refunds before confirming subscription modifications. + + + @example + + ```typescript + + // Preview updating seat quantity + + const response = await client.billing.previewUpdate({ customerId: "cus_123", planId: "pro_plan", featureQuantities: [{"featureId":"seats","quantity":15}] }); + + ``` + + + @param customerId - The ID of the customer to attach the plan to. + + @param entityId - The ID of the entity to attach the plan to. (optional) + + @param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) + + @param version - The version of the plan to attach. (optional) + + @param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) + + @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) + + @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) + + @param billingBehavior - 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. (optional) + + @param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional) + + + @returns A preview response with line items showing prorated charges or credits for the proposed changes. tags: - billing requestBody: @@ -3378,26 +3499,25 @@ paths: type: string description: The ID of the customer to attach the plan to. entity_id: - anyOf: - - type: string - - type: "null" + type: string description: The ID of the entity to attach the plan to. + plan_id: + type: string + description: The ID of the plan. feature_quantities: - anyOf: - - type: array - items: - type: object - properties: - feature_id: - type: string - quantity: - type: number - minimum: 0 - adjustable: - type: boolean - required: - - feature_id - - type: "null" + type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + minimum: 0 + adjustable: + type: boolean + required: + - feature_id description: If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. version: type: number @@ -3420,6 +3540,7 @@ paths: required: - duration_length - type: "null" + description: Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. customize: type: object properties: @@ -3549,32 +3670,44 @@ paths: required: - feature_id description: Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - plan_id: - type: string invoice_mode: type: object properties: enabled: type: boolean + description: When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. enable_plan_immediately: type: boolean default: false + description: If true, enables the plan immediately even though the invoice is not paid yet. finalize: type: boolean default: true + description: If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. required: - enabled + description: Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + billing_behavior: + enum: + - prorate_immediately + - next_cycle_only + description: 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. cancel_action: enum: - cancel_immediately - cancel_end_of_cycle - uncancel - billing_behavior: - enum: - - prorate_immediately - - next_cycle_only + description: Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. required: - customer_id + - plan_id + title: PreviewUpdateParams + examples: + - customer_id: cus_123 + plan_id: pro_plan + feature_quantities: + - feature_id: seats + quantity: 15 responses: "200": description: OK @@ -3585,6 +3718,7 @@ paths: properties: customer_id: type: string + description: The ID of the customer. line_items: type: array items: @@ -3592,10 +3726,13 @@ paths: properties: title: type: string + description: The title of the line item. description: type: string + description: A detailed description of the line item. amount: type: number + description: The amount in cents for this line item. discounts: type: array items: @@ -3612,118 +3749,52 @@ paths: required: - amountOff default: [] - plan_id: - type: string - total_quantity: - type: number - paid_quantity: - type: number - deferred_for_trial: - type: boolean - effective_period: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - is_base: - type: boolean + description: List of discounts applied to this line item. required: - title - description - amount - - plan_id - - total_quantity - - paid_quantity + description: List of line items for the current billing period. total: type: number + description: The total amount in cents for the current billing period. currency: type: string - period_start: - type: number - period_end: - type: number + description: The three-letter ISO currency code (e.g., 'usd'). next_cycle: type: object properties: starts_at: type: number + description: Unix timestamp (milliseconds) when the next billing cycle starts. total: type: number - line_items: - type: array - items: - type: object - properties: - title: - type: string - description: - type: string - amount: - type: number - discounts: - type: array - items: - type: object - properties: - amountOff: - type: number - percentOff: - type: number - stripeCouponId: - type: string - couponName: - type: string - required: - - amountOff - default: [] - plan_id: - type: string - total_quantity: - type: number - paid_quantity: - type: number - deferred_for_trial: - type: boolean - effective_period: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - is_base: - type: boolean - required: - - title - - description - - amount - - plan_id - - total_quantity - - paid_quantity + description: The total amount in cents for the next cycle. required: - starts_at - total - - line_items + description: Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. required: - customer_id - line_items - total - currency + examples: + - customerId: charles + lineItems: + - title: Pro seed + description: Pro seed - Base Price (from 18 Feb 2026 to 18 Mar 2026) + amount: 20 + discounts: [] + total: 20 + currency: usd x-speakeasy-name-override: previewUpdate parameters: - *a1 - /v1/billing.setup_payment: + /v1/billing.open_customer_portal: post: - operationId: billingSetupPayment - description: Create a setup payment session for a customer. + operationId: openCustomerPortal + description: Create a billing portal session for a customer to manage their subscription. tags: - billing requestBody: @@ -3735,20 +3806,19 @@ paths: properties: customer_id: type: string - description: The ID of the customer - success_url: + description: The ID of the customer to open the billing portal for. + configuration_id: type: string - description: URL to redirect to after successful payment setup. Must start with either http:// or https:// - customer_data: - $ref: "#/components/schemas/CustomerData" - checkout_session_params: - type: object - propertyNames: - type: string - additionalProperties: {} - description: Additional parameters for the checkout session + description: Stripe billing portal configuration ID. Create configurations in your Stripe dashboard. + return_url: + type: string + description: URL to redirect to when back button is clicked in the billing portal required: - customer_id + title: OpenCustomerPortalParams + examples: + - customer_id: cus_123 + return_url: https://useautumn.com responses: "200": description: OK @@ -3759,19 +3829,22 @@ paths: properties: customer_id: type: string - description: The ID of the customer + description: The ID of the billing portal session url: type: string - description: URL to the payment setup page + description: URL to the billing portal required: - customer_id - url - x-speakeasy-name-override: setupPayment + examples: + - customer_id: cus_123 + url: https://billing.stripe.com/session/... + x-speakeasy-name-override: openCustomerPortal parameters: - *a1 /v1/balances.create: post: - operationId: balancesCreate + operationId: createBalance description: Create a balance for a customer feature. tags: - balances @@ -3782,21 +3855,21 @@ paths: schema: type: object properties: - feature_id: - type: string - description: The feature ID to create the balance for customer_id: type: string - description: The customer ID to assign the balance to + description: The ID of the customer. + feature_id: + type: string + description: The ID of the feature. entity_id: type: string - description: Entity ID for entity-scoped balances + description: The ID of the entity for entity-scoped balances (e.g., per-seat limits). included: type: number - description: The initial balance amount to grant + description: The initial balance amount to grant. For metered features, this is the number of units the customer can use. unlimited: type: boolean - description: Whether the balance is unlimited + description: If true, the balance has unlimited usage. Cannot be combined with 'included'. reset: type: object properties: @@ -3811,19 +3884,28 @@ paths: - quarter - semi_annual - year + description: The interval at which the balance resets (e.g., 'month', 'day', 'year'). interval_count: type: number + description: "Number of intervals between resets. Defaults to 1 (e.g., interval_count: 2 with interval: 'month' resets every 2 months)." required: - interval - description: Reset configuration for the balance + description: Reset configuration for the balance. If not provided, the balance is a one-time grant that never resets. expires_at: type: number - description: Unix timestamp (milliseconds) when the balance expires + description: Unix timestamp (milliseconds) when the balance expires. Mutually exclusive with reset. granted_balance: type: number required: - - feature_id - customer_id + - feature_id + title: CreateBalanceParams + examples: + - customer_id: cus_123 + feature_id: api_calls + included: 1000 + reset: + interval: month responses: "200": description: OK @@ -3841,7 +3923,7 @@ paths: - *a1 /v1/balances.update: post: - operationId: balancesUpdate + operationId: updateBalance description: Update a customer balance. tags: - balances @@ -3855,15 +3937,18 @@ paths: customer_id: type: string description: The ID of the customer. - entity_id: - type: string - description: The ID of the entity to update balance for (if using entity balances). feature_id: type: string - description: The ID of the feature to update balance for. - current_balance: + description: The ID of the feature. + entity_id: + type: string + description: The ID of the entity for entity-scoped balances (e.g., per-seat limits). + remaining: type: number - description: The new balance value to set. + description: Set the remaining balance to this exact value. Cannot be combined with add_to_balance. + add_to_balance: + type: number + description: Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance. interval: enum: - one_off @@ -3875,20 +3960,15 @@ paths: - quarter - semi_annual - year - description: The interval to update balance for. - granted_balance: - type: number - usage: - type: number - customer_entitlement_id: - type: string - next_reset_at: - type: number - add_to_balance: - type: number + description: Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals. required: - customer_id - feature_id + title: UpdateBalanceParams + examples: + - customer_id: cus_123 + feature_id: api_calls + remaining: 5 responses: "200": description: OK @@ -3906,10 +3986,58 @@ paths: - *a1 /v1/balances.check: post: - operationId: balancesCheck - description: Check whether usage is allowed for a customer feature. - tags: - - balances + operationId: check + description: >- + Checks whether a customer currently has enough balance to use a feature. + + + Use this to gate access before a feature action. Enable sendEvent when you want to check and consume balance atomically in one request. + + + @example + + ```typescript + + // Check access for a feature + + const response = await client.check({ customerId: "cus_123", featureId: "messages" }); + + ``` + + + @example + + ```typescript + + // Check and consume 3 units in one call + + const response = await client.check({ + + customerId: "cus_123", + featureId: "messages", + requiredBalance: 3, + sendEvent: true, + }); + + ``` + + + @param customerId - The ID of the customer. + + @param featureId - The ID of the feature. + + @param entityId - The ID of the entity for entity-scoped balances (e.g., per-seat limits). (optional) + + @param requiredBalance - Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1. (optional) + + @param properties - Additional properties to attach to the usage event if send_event is true. (optional) + + @param sendEvent - If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. (optional) + + @param withPreview - If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. (optional) + + + @returns Whether access is allowed, plus the current balance for that feature. requestBody: required: true content: @@ -3919,30 +4047,39 @@ paths: properties: customer_id: type: string - description: ID which you provided when creating the customer + description: The ID of the customer. feature_id: type: string - description: ID of the feature to check access to. + description: The ID of the feature. entity_id: type: string - description: If using entity balances (eg, seats), the entity ID to check access for. + description: The ID of the entity for entity-scoped balances (e.g., per-seat limits). required_balance: type: number - description: If you know the amount of the feature the end user is consuming in advance. If their balance is below this quantity, allowed will be false. + description: "Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1." properties: type: object propertyNames: type: string additionalProperties: {} + description: Additional properties to attach to the usage event if send_event is true. send_event: type: boolean - description: If true, a usage event will be recorded together with checking access. The required_balance field will be used as the usage value. + description: If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. with_preview: type: boolean - description: If true, the response will include a preview object, which can be used to display information such as a paywall or upgrade confirmation. + description: If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. required: - customer_id - feature_id + title: CheckParams + examples: + - customer_id: cus_123 + feature_id: messages + - customer_id: cus_123 + feature_id: messages + required_balance: 3 + send_event: true responses: "200": description: OK @@ -3953,20 +4090,25 @@ paths: properties: allowed: type: boolean + description: Whether the customer is allowed to use the feature. True if they have sufficient balance or the feature is unlimited/boolean. customer_id: type: string + description: The ID of the customer that was checked. entity_id: anyOf: - type: string - type: "null" + description: The ID of the entity, if an entity-scoped check was performed. required_balance: type: number + description: The required balance that was checked against. balance: anyOf: - type: object properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -4016,25 +4158,33 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -4043,20 +4193,27 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -4074,22 +4231,27 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -4104,25 +4266,31 @@ paths: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -4133,6 +4301,7 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans or grants. rollovers: type: array items: @@ -4140,11 +4309,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -4154,7 +4326,30 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null - type: "null" + description: The customer's balance for this feature. Null if the customer has no balance for this feature. preview: type: object properties: @@ -4162,14 +4357,19 @@ paths: enum: - usage_limit - feature_flag + description: The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. title: type: string + description: A title suitable for displaying in a paywall or upgrade modal. message: type: string + description: A message explaining why access was denied. feature_id: type: string + description: The ID of the feature that was checked. feature_name: type: string + description: The display name of the feature. products: type: array items: @@ -4461,6 +4661,7 @@ paths: - items - free_trial - base_variant_id + description: Products that would grant access to this feature. Use to display upgrade options. required: - scenario - title @@ -4468,19 +4669,87 @@ paths: - feature_id - feature_name - products + description: Upgrade/upsell information when access is denied. Only present if with_preview was true and allowed is false. required: - allowed - customer_id - balance + examples: + - allowed: true + customer_id: cus_123 + entity_id: null + required_balance: 1 + balance: + feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null x-speakeasy-name-override: check parameters: - *a1 /v1/balances.track: post: - operationId: balancesTrack - description: Track usage for a customer feature. - tags: - - balances + operationId: track + description: >- + Records usage for a customer feature and returns updated balances. + + + Use this after an action happens to decrement usage, or send a negative value to credit balance back. + + + @example + + ```typescript + + // Track one message event + + const response = await client.track({ customerId: "cus_123", featureId: "messages", value: 1 }); + + ``` + + + @example + + ```typescript + + // Track an event mapped to multiple features + + const response = await client.track({ customerId: "cus_123", eventName: "ai_chat_request", value: 1 }); + + ``` + + + @param customerId - The ID of the customer. + + @param featureId - The ID of the feature to track usage for. Required if event_name is not provided. (optional) + + @param entityId - The ID of the entity for entity-scoped balances (e.g., per-seat limits). (optional) + + @param eventName - Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. (optional) + + @param value - The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). (optional) + + @param properties - Additional properties to attach to this usage event. (optional) + + + @returns The usage value recorded, with either a single updated balance or a map of updated balances. requestBody: required: true content: @@ -4490,32 +4759,33 @@ paths: properties: customer_id: type: string - minLength: 1 - description: ID which you provided when creating the customer + description: The ID of the customer. feature_id: type: string - description: ID of the feature to track usage for. Required if event_name is not provided. Use this for direct feature tracking. + description: The ID of the feature to track usage for. Required if event_name is not provided. + entity_id: + type: string + description: The ID of the entity for entity-scoped balances (e.g., per-seat limits). event_name: type: string minLength: 1 - description: An [event name](/features/tracking-usage#using-event-names) can be used in place of feature_id. This can be used if multiple features are tracked in the same event. + description: Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. value: type: number - description: The amount of usage to record. Defaults to 1. Can be negative to increase the balance (e.g., when removing a seat). + description: The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). properties: type: object propertyNames: type: string additionalProperties: {} description: Additional properties to attach to this usage event. - idempotency_key: - type: string - description: Unique key to prevent duplicate event recording. Use this to safely retry requests without creating duplicate usage records. - entity_id: - type: string - description: If using [entity balances](/features/feature-entities) (eg, seats), the entity ID to track usage for. required: - customer_id + title: TrackParams + examples: + - customer_id: cus_123 + feature_id: messages + value: 1 responses: "200": description: OK @@ -4526,21 +4796,23 @@ paths: properties: customer_id: type: string - description: The ID of the customer + description: The ID of the customer whose usage was tracked. entity_id: type: string - description: The ID of the entity (if provided) + description: The ID of the entity, if entity-scoped tracking was performed. event_name: type: string - description: The name of the event + description: The event name that was tracked, if event_name was used instead of feature_id. value: type: number + description: The amount of usage that was recorded. balance: anyOf: - type: object properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -4590,25 +4862,33 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -4617,20 +4897,27 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -4648,22 +4935,27 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -4678,25 +4970,31 @@ paths: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -4707,6 +5005,7 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans or grants. rollovers: type: array items: @@ -4714,11 +5013,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -4728,7 +5030,30 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null - type: "null" + description: The updated balance for the tracked feature. Null if tracking by event_name that affects multiple features. balances: type: object propertyNames: @@ -4738,6 +5063,7 @@ paths: properties: feature_id: type: string + description: The feature ID this balance is for. feature: type: object properties: @@ -4787,25 +5113,33 @@ paths: - type - consumable - archived + description: The full feature object if expanded. granted: type: number + description: Total balance granted (included + prepaid). remaining: type: number minimum: 0 + description: Remaining balance available for use. usage: type: number + description: Total usage consumed in the current period. unlimited: type: boolean + description: Whether this feature has unlimited usage. overage_allowed: type: boolean + description: Whether usage beyond the granted balance is allowed (with overage charges). max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for unlimited. next_reset_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will reset, or null for no reset. breakdown: type: array items: @@ -4814,20 +5148,27 @@ paths: id: type: string default: "" + description: The unique identifier for this balance breakdown. plan_id: anyOf: - type: string - type: "null" + description: The plan ID this balance originates from, or null for standalone balances. included_grant: type: number + description: Amount granted from the plan's included usage. prepaid_grant: type: number + description: Amount granted from prepaid purchases or top-ups. remaining: type: number + description: Remaining balance available for use. usage: type: number + description: Amount consumed in the current period. unlimited: type: boolean + description: Whether this balance has unlimited usage. reset: anyOf: - type: object @@ -4845,22 +5186,27 @@ paths: - semi_annual - year - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. interval_count: type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). resets_at: anyOf: - type: number - type: "null" + description: Timestamp when the balance will next reset. required: - interval - resets_at - type: "null" + description: Reset configuration for this balance, or null if no reset. price: anyOf: - type: object properties: amount: type: number + description: The per-unit price amount. tiers: type: array items: @@ -4875,25 +5221,31 @@ paths: required: - to - amount + description: Tiered pricing configuration if applicable. billing_units: type: number + description: The number of units per billing increment (eg. $9 / 250 units). billing_method: enum: - prepaid - usage_based + description: Whether usage is prepaid or billed pay-per-use. max_purchase: anyOf: - type: number - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. required: - billing_units - billing_method - max_purchase - type: "null" + description: Pricing configuration if this balance has usage-based pricing. expires_at: anyOf: - type: number - type: "null" + description: Timestamp when this balance expires, or null for no expiration. required: - plan_id - included_grant @@ -4904,6 +5256,7 @@ paths: - reset - price - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans or grants. rollovers: type: array items: @@ -4911,11 +5264,14 @@ paths: properties: balance: type: number + description: Amount of balance rolled over from a previous period. expires_at: type: number + description: Timestamp when the rollover balance expires. required: - balance - expires_at + description: Rollover balances carried over from previous periods. required: - feature_id - granted @@ -4925,13 +5281,1637 @@ paths: - overage_allowed - max_purchase - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + description: Map of feature_id to updated balance when tracking by event_name affects multiple features. required: - customer_id - value - balance + examples: + - customer_id: cus_123 + value: 1 + balance: + feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null x-speakeasy-name-override: track parameters: - *a1 + /v1/events.list: + post: + operationId: listEvents + description: List usage events for your organization. Filter by customer, feature, or time range. + tags: + - events + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + offset: + type: integer + minimum: 0 + maximum: 9.007199254740991e+15 + default: 0 + description: Number of items to skip + limit: + type: integer + minimum: 1 + maximum: 1000 + default: 100 + description: Number of items to return. Default 100, max 1000. + customer_id: + type: string + description: Filter events by customer ID + feature_id: + anyOf: + - type: string + minLength: 1 + - type: array + items: + type: string + minLength: 1 + description: Filter by specific feature ID(s) + custom_range: + type: object + properties: + start: + type: number + description: Filter events after this timestamp (epoch milliseconds) + end: + type: number + description: Filter events before this timestamp (epoch milliseconds) + description: Filter events by time range + title: EventsListParams + examples: + - customer_id: cus_123 + limit: 50 + - feature_id: api_calls + custom_range: + start: 1704067200000 + end: 1706745600000 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + list: + type: array + items: + type: object + properties: + id: + type: string + description: Event ID (KSUID) + timestamp: + type: number + description: Event timestamp (epoch milliseconds) + feature_id: + type: string + description: ID of the feature that the event belongs to + customer_id: + type: string + description: Customer identifier + value: + type: number + description: Event value/count + properties: + type: object + description: Event properties (JSONB) + required: + - id + - timestamp + - feature_id + - customer_id + - value + - properties + description: Array of items for current page + has_more: + type: boolean + description: Whether more results exist after this page + offset: + type: number + description: Current offset position + limit: + type: number + description: Limit passed in the request + total: + type: number + description: Total number of items returned in the current page + required: + - list + - has_more + - offset + - limit + - total + examples: + - list: + - id: evt_36xpk2TmuQX5zVPPQ8tCtnR5Weg + timestamp: 1765958215459 + feature_id: credits + customer_id: 0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx + value: 30 + properties: {} + - id: evt_36xmHxxjAkqxufDf9yHAPNfRrLM + timestamp: 1765956512057 + feature_id: credits + customer_id: 0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx + value: 49 + properties: {} + total: 2 + has_more: false + offset: 0 + limit: 100 + x-speakeasy-name-override: list + parameters: + - *a1 + /v1/events.aggregate: + post: + operationId: aggregateEvents + description: Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property. + tags: + - events + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + minLength: 1 + description: Customer ID to aggregate events for + feature_id: + anyOf: + - type: string + minLength: 1 + - type: array + items: + type: string + minLength: 1 + description: Feature ID(s) to aggregate events for + group_by: + type: string + pattern: ^properties\..* + description: Property to group events by. If provided, each key in the response will be an object with distinct groups as the keys + range: + enum: + - 24h + - 7d + - 30d + - 90d + - last_cycle + - 1bc + - 3bc + description: Time range to aggregate events for. Either range or custom_range must be provided + bin_size: + enum: + - day + - hour + - month + default: day + description: Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day + custom_range: + type: object + properties: + start: + type: number + end: + type: number + required: + - start + - end + description: Custom time range to aggregate events for. If provided, range must not be provided + required: + - customer_id + - feature_id + title: EventsAggregateParams + examples: + - customer_id: cus_123 + feature_id: api_calls + range: 30d + bin_size: day + - customer_id: cus_123 + feature_id: + - api_calls + - messages + range: 7d + group_by: properties.model + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + list: + type: array + items: + type: object + properties: + period: + type: number + description: Unix timestamp (epoch ms) for this time period + values: + type: object + propertyNames: + type: string + additionalProperties: + type: number + description: "Aggregated values per feature: { [featureId]: number }" + grouped_values: + type: object + propertyNames: + type: string + additionalProperties: + type: object + propertyNames: + type: string + additionalProperties: + type: number + description: "Values broken down by group (only present when group_by is used): { [featureId]: { [groupValue]: number } }" + required: + - period + - values + description: Array of time periods with aggregated values + total: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + count: + type: number + description: Number of events for this feature + sum: + type: number + description: Sum of event values for this feature + required: + - count + - sum + description: Total aggregations per feature. Keys are feature IDs, values contain count and sum. + required: + - list + - total + examples: + - list: + - period: 1762905600000 + values: + messages: 10 + sessions: 3 + - period: 1762992000000 + values: + messages: 3 + sessions: 12 + total: + messages: + count: 2 + sum: 13 + sessions: + count: 2 + sum: 15 + - list: + - period: 1762905600000 + values: + messages: 10 + sessions: 3 + grouped_values: + messages: + api: 5 + web: 5 + sessions: + api: 2 + web: 1 + - period: 1762992000000 + values: + messages: 3 + sessions: 12 + grouped_values: + messages: + api: 1 + web: 2 + sessions: + api: 10 + web: 2 + total: + messages: + count: 2 + sum: 13 + sessions: + count: 2 + sum: 15 + x-speakeasy-name-override: aggregate + parameters: + - *a1 + /v1/entities.create: + post: + operationId: createEntity + description: >- + 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. + + + @example + + ```typescript + + // Create a seat entity + + const response = await client.entities.create({ + + customerId: "cus_123", + entityId: "seat_42", + featureId: "seats", + name: "Seat 42", + }); + + ``` + + + @param name - The name of the entity (optional) + + @param featureId - The ID of the feature this entity is associated with + + @param customerData - Customer attributes used to resolve the customer when customer_id is not provided. (optional) + + @param customerId - The ID of the customer to create the entity for. + + @param entityId - The ID of the entity. + + + @returns The created entity object including its current subscriptions, purchases, and balances. + tags: + - entities + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + anyOf: + - type: string + - type: "null" + description: The name of the entity + feature_id: + type: string + description: The ID of the feature this entity is associated with + customer_data: + $ref: "#/components/schemas/CustomerData" + description: Customer attributes used to resolve the customer when customer_id is not provided. + customer_id: + type: string + description: The ID of the customer to create the entity for. + entity_id: + type: string + description: The ID of the entity. + required: + - feature_id + - customer_id + - entity_id + title: CreateEntityParams + examples: + - customer_id: cus_123 + entity_id: seat_42 + feature_id: seats + name: Seat 42 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + autumn_id: + type: string + id: + anyOf: + - type: string + - type: "null" + description: The unique identifier of the entity + name: + anyOf: + - type: string + - type: "null" + description: The name of the entity + customer_id: + anyOf: + - type: string + - type: "null" + description: The customer ID this entity belongs to + feature_id: + anyOf: + - type: string + - type: "null" + description: The feature ID this entity belongs to + created_at: + type: number + description: Unix timestamp when the entity was created + env: + enum: + - sandbox + - live + description: The environment (sandbox/live) + subscriptions: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. + plan_id: + type: string + description: The unique identifier of the subscribed plan. + auto_enable: + type: boolean + description: Whether the plan was automatically enabled for the customer. + add_on: + type: boolean + description: Whether this is an add-on plan rather than a base subscription. + status: + enum: + - active + - scheduled + description: Current status of the subscription. + past_due: + type: boolean + description: Whether the subscription has overdue payments. + canceled_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the subscription was canceled, or null if not canceled. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry set. + trial_ends_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. + started_at: + type: number + description: Timestamp when the subscription started. + current_period_start: + anyOf: + - type: number + - type: "null" + description: Start timestamp of the current billing period. + current_period_end: + anyOf: + - type: number + - type: "null" + description: End timestamp of the current billing period. + quantity: + type: number + description: Number of units of this subscription (for per-seat plans). + required: + - plan_id + - auto_enable + - add_on + - status + - past_due + - canceled_at + - expires_at + - trial_ends_at + - started_at + - current_period_start + - current_period_end + - quantity + purchases: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. + plan_id: + type: string + description: The unique identifier of the purchased plan. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. + started_at: + type: number + description: Timestamp when the purchase was made. + quantity: + type: number + description: Number of units purchased. + required: + - plan_id + - expires_at + - started_at + - quantity + balances: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + feature_id: + type: string + description: The feature ID this balance is for. + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived + description: The full feature object if expanded. + granted: + type: number + description: Total balance granted (included + prepaid). + remaining: + type: number + minimum: 0 + description: Remaining balance available for use. + usage: + type: number + description: Total usage consumed in the current period. + unlimited: + type: boolean + description: Whether this feature has unlimited usage. + overage_allowed: + type: boolean + description: Whether usage beyond the granted balance is allowed (with overage charges). + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for unlimited. + next_reset_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the balance will reset, or null for no reset. + breakdown: + type: array + items: + type: object + properties: + id: + type: string + default: "" + description: The unique identifier for this balance breakdown. + plan_id: + anyOf: + - type: string + - type: "null" + description: The plan ID this balance originates from, or null for standalone balances. + included_grant: + type: number + description: Amount granted from the plan's included usage. + prepaid_grant: + type: number + description: Amount granted from prepaid purchases or top-ups. + remaining: + type: number + description: Remaining balance available for use. + usage: + type: number + description: Amount consumed in the current period. + unlimited: + type: boolean + description: Whether this balance has unlimited usage. + reset: + anyOf: + - type: object + properties: + interval: + anyOf: + - enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + interval_count: + type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). + resets_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the balance will next reset. + required: + - interval + - resets_at + - type: "null" + description: Reset configuration for this balance, or null if no reset. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: The per-unit price amount. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration if applicable. + billing_units: + type: number + description: The number of units per billing increment (eg. $9 / 250 units). + billing_method: + enum: + - prepaid + - usage_based + description: Whether usage is prepaid or billed pay-per-use. + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. + required: + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration if this balance has usage-based pricing. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when this balance expires, or null for no expiration. + required: + - plan_id + - included_grant + - prepaid_grant + - remaining + - usage + - unlimited + - reset + - price + - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans or grants. + rollovers: + type: array + items: + type: object + properties: + balance: + type: number + description: Amount of balance rolled over from a previous period. + expires_at: + type: number + description: Timestamp when the rollover balance expires. + required: + - balance + - expires_at + description: Rollover balances carried over from previous periods. + required: + - feature_id + - granted + - remaining + - usage + - unlimited + - overage_allowed + - max_purchase + - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + invoices: + type: array + items: + type: object + properties: + plan_ids: + type: array + items: + type: string + description: Array of plan IDs included in this invoice + stripe_id: + type: string + description: The Stripe invoice ID + status: + type: string + description: The status of the invoice + total: + type: number + description: The total amount of the invoice + currency: + type: string + description: The currency code for the invoice + created_at: + type: number + description: Timestamp when the invoice was created + hosted_invoice_url: + anyOf: + - type: string + - type: "null" + description: URL to the Stripe-hosted invoice page + required: + - plan_ids + - stripe_id + - status + - total + - currency + - created_at + description: Invoices for this entity (only included when expand=invoices) + required: + - id + - name + - created_at + - env + - subscriptions + - purchases + - balances + examples: + - id: seat_42 + name: Seat 42 + customer_id: cus_123 + feature_id: seats + created_at: 1771409161016 + env: sandbox + subscriptions: + - plan_id: pro_plan + auto_enable: true + add_on: false + status: active + past_due: false + canceled_at: null + expires_at: null + trial_ends_at: null + started_at: 1771431921437 + current_period_start: 1771431921437 + current_period_end: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + invoices: [] + x-speakeasy-name-override: create + parameters: + - *a1 + /v1/entities.get: + post: + operationId: getEntity + description: >- + Fetches a single entity by entity ID. + + + Use this to read one entity's current state. Pass customerId when you want to scope the lookup to a specific customer. + + + @example + + ```typescript + + // Fetch a seat entity + + const response = await client.entities.get({ entityId: "seat_42" }); + + ``` + + + @example + + ```typescript + + // Fetch a seat entity for a specific customer + + const response = await client.entities.get({ customerId: "cus_123", entityId: "seat_42" }); + + ``` + + + @param customerId - The ID of the customer to create the entity for. (optional) + + @param entityId - The ID of the entity. + + + @returns The entity object including its current subscriptions, purchases, and balances. + tags: + - entities + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer to create the entity for. + entity_id: + type: string + description: The ID of the entity. + required: + - entity_id + title: GetEntityParams + examples: + - entity_id: seat_42 + - customer_id: cus_123 + entity_id: seat_42 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + autumn_id: + type: string + id: + anyOf: + - type: string + - type: "null" + description: The unique identifier of the entity + name: + anyOf: + - type: string + - type: "null" + description: The name of the entity + customer_id: + anyOf: + - type: string + - type: "null" + description: The customer ID this entity belongs to + feature_id: + anyOf: + - type: string + - type: "null" + description: The feature ID this entity belongs to + created_at: + type: number + description: Unix timestamp when the entity was created + env: + enum: + - sandbox + - live + description: The environment (sandbox/live) + subscriptions: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. + plan_id: + type: string + description: The unique identifier of the subscribed plan. + auto_enable: + type: boolean + description: Whether the plan was automatically enabled for the customer. + add_on: + type: boolean + description: Whether this is an add-on plan rather than a base subscription. + status: + enum: + - active + - scheduled + description: Current status of the subscription. + past_due: + type: boolean + description: Whether the subscription has overdue payments. + canceled_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the subscription was canceled, or null if not canceled. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the subscription will expire, or null if no expiry set. + trial_ends_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the trial period ends, or null if not on trial. + started_at: + type: number + description: Timestamp when the subscription started. + current_period_start: + anyOf: + - type: number + - type: "null" + description: Start timestamp of the current billing period. + current_period_end: + anyOf: + - type: number + - type: "null" + description: End timestamp of the current billing period. + quantity: + type: number + description: Number of units of this subscription (for per-seat plans). + required: + - plan_id + - auto_enable + - add_on + - status + - past_due + - canceled_at + - expires_at + - trial_ends_at + - started_at + - current_period_start + - current_period_end + - quantity + purchases: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + description: The full plan object if expanded. + plan_id: + type: string + description: The unique identifier of the purchased plan. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the purchase expires, or null for lifetime access. + started_at: + type: number + description: Timestamp when the purchase was made. + quantity: + type: number + description: Number of units purchased. + required: + - plan_id + - expires_at + - started_at + - quantity + balances: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + feature_id: + type: string + description: The feature ID this balance is for. + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived + description: The full feature object if expanded. + granted: + type: number + description: Total balance granted (included + prepaid). + remaining: + type: number + minimum: 0 + description: Remaining balance available for use. + usage: + type: number + description: Total usage consumed in the current period. + unlimited: + type: boolean + description: Whether this feature has unlimited usage. + overage_allowed: + type: boolean + description: Whether usage beyond the granted balance is allowed (with overage charges). + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum quantity that can be purchased as a top-up, or null for unlimited. + next_reset_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the balance will reset, or null for no reset. + breakdown: + type: array + items: + type: object + properties: + id: + type: string + default: "" + description: The unique identifier for this balance breakdown. + plan_id: + anyOf: + - type: string + - type: "null" + description: The plan ID this balance originates from, or null for standalone balances. + included_grant: + type: number + description: Amount granted from the plan's included usage. + prepaid_grant: + type: number + description: Amount granted from prepaid purchases or top-ups. + remaining: + type: number + description: Remaining balance available for use. + usage: + type: number + description: Amount consumed in the current period. + unlimited: + type: boolean + description: Whether this balance has unlimited usage. + reset: + anyOf: + - type: object + properties: + interval: + anyOf: + - enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + - const: multiple + description: The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + interval_count: + type: number + description: Number of intervals between resets (eg. 2 for bi-monthly). + resets_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when the balance will next reset. + required: + - interval + - resets_at + - type: "null" + description: Reset configuration for this balance, or null if no reset. + price: + anyOf: + - type: object + properties: + amount: + type: number + description: The per-unit price amount. + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + description: Tiered pricing configuration if applicable. + billing_units: + type: number + description: The number of units per billing increment (eg. $9 / 250 units). + billing_method: + enum: + - prepaid + - usage_based + description: Whether usage is prepaid or billed pay-per-use. + max_purchase: + anyOf: + - type: number + - type: "null" + description: Maximum quantity that can be purchased, or null for unlimited. + required: + - billing_units + - billing_method + - max_purchase + - type: "null" + description: Pricing configuration if this balance has usage-based pricing. + expires_at: + anyOf: + - type: number + - type: "null" + description: Timestamp when this balance expires, or null for no expiration. + required: + - plan_id + - included_grant + - prepaid_grant + - remaining + - usage + - unlimited + - reset + - price + - expires_at + description: Detailed breakdown of balance sources when stacking multiple plans or grants. + rollovers: + type: array + items: + type: object + properties: + balance: + type: number + description: Amount of balance rolled over from a previous period. + expires_at: + type: number + description: Timestamp when the rollover balance expires. + required: + - balance + - expires_at + description: Rollover balances carried over from previous periods. + required: + - feature_id + - granted + - remaining + - usage + - unlimited + - overage_allowed + - max_purchase + - next_reset_at + examples: + - feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + invoices: + type: array + items: + type: object + properties: + plan_ids: + type: array + items: + type: string + description: Array of plan IDs included in this invoice + stripe_id: + type: string + description: The Stripe invoice ID + status: + type: string + description: The status of the invoice + total: + type: number + description: The total amount of the invoice + currency: + type: string + description: The currency code for the invoice + created_at: + type: number + description: Timestamp when the invoice was created + hosted_invoice_url: + anyOf: + - type: string + - type: "null" + description: URL to the Stripe-hosted invoice page + required: + - plan_ids + - stripe_id + - status + - total + - currency + - created_at + description: Invoices for this entity (only included when expand=invoices) + required: + - id + - name + - created_at + - env + - subscriptions + - purchases + - balances + examples: + - id: seat_42 + name: Seat 42 + customer_id: cus_123 + feature_id: seats + created_at: 1771409161016 + env: sandbox + subscriptions: + - plan_id: pro_plan + auto_enable: true + add_on: false + status: active + past_due: false + canceled_at: null + expires_at: null + trial_ends_at: null + started_at: 1771431921437 + current_period_start: 1771431921437 + current_period_end: 1771999921437 + quantity: 1 + purchases: [] + balances: + messages: + feature_id: messages + granted: 100 + remaining: 72 + usage: 28 + unlimited: false + overage_allowed: false + max_purchase: null + next_reset_at: 1773851121437 + breakdown: + - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV + plan_id: pro_plan + included_grant: 100 + prepaid_grant: 0 + remaining: 72 + usage: 28 + unlimited: false + reset: + interval: month + resets_at: 1773851121437 + price: null + expires_at: null + invoices: [] + x-speakeasy-name-override: get + parameters: + - *a1 + /v1/entities.delete: + post: + operationId: deleteEntity + description: >- + Deletes an entity by entity ID. + + + Use this when the underlying resource is removed and you no longer want entity-scoped balances or subscriptions tracked for it. + + + @example + + ```typescript + + // Delete a seat entity + + const response = await client.entities.delete({ entityId: "seat_42" }); + + ``` + + + @param customerId - The ID of the customer. (optional) + + @param entityId - The ID of the entity. + + + @returns A success flag indicating the entity was deleted. + tags: + - entities + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The ID of the customer. + entity_id: + type: string + description: The ID of the entity. + required: + - entity_id + title: DeleteEntityParams + examples: + - customer_id: cus_123 + entity_id: seat_42 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + required: + - success + examples: + - success: true + x-speakeasy-name-override: delete + parameters: + - *a1 + /v1/referrals.create_code: + post: + operationId: createReferralCode + description: Create or fetch a referral code for a customer in a referral program. + tags: + - referrals + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + description: The unique identifier of the customer + program_id: + type: string + description: ID of your referral program + required: + - customer_id + - program_id + title: CreateReferralCodeParams + examples: + - customer_id: cus_123 + program_id: prog_123 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + code: + type: string + description: The referral code that can be shared with customers + customer_id: + type: string + description: Your unique identifier for the customer + created_at: + type: number + description: The timestamp of when the referral code was created + required: + - code + - customer_id + - created_at + examples: + - code: + customer_id: + created_at: 123 + x-speakeasy-name-override: createCode + parameters: + - *a1 + /v1/referrals.redeem_code: + post: + operationId: redeemReferralCode + description: Redeem a referral code for a customer. + tags: + - referrals + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + code: + type: string + description: The referral code to redeem + customer_id: + type: string + description: The unique identifier of the customer redeeming the code + required: + - code + - customer_id + title: RedeemReferralCodeParams + examples: + - code: REF123 + customer_id: cus_456 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The ID of the redemption event + customer_id: + type: string + description: Your unique identifier for the customer + reward_id: + type: string + description: The ID of the reward that will be granted + required: + - id + - customer_id + - reward_id + examples: + - id: + customer_id: + reward_id: + x-speakeasy-name-override: redeemCode + parameters: + - *a1 security: - secretKey: [] x-speakeasy-globals: diff --git a/packages/sdk/.speakeasy/workflow.lock b/packages/sdk/.speakeasy/workflow.lock index 59cbe84b9..dae3adeb4 100644 --- a/packages/sdk/.speakeasy/workflow.lock +++ b/packages/sdk/.speakeasy/workflow.lock @@ -2,15 +2,15 @@ speakeasyVersion: 1.719.0 sources: Autumn API: sourceNamespace: autumn-api - sourceRevisionDigest: sha256:cb77449950de6390b353ba6780b3ec5168a6fb7bdc039120749e8a0dd9e522ca - sourceBlobDigest: sha256:1295e2ee2c5fd69238da680273b71b1f7e6037f848f163ed5a7d42f19e60d95d + sourceRevisionDigest: sha256:907452f52e7316fc31598c430bb2b2d1f511a3e4c1eb21462aa1de10b5d94460 + sourceBlobDigest: sha256:0bf1d6695f34c96339037aa03001ea35b7b7361b45146865c9222d1586109448 tags: - latest - 2.1.0 Autumn API Stripped: sourceNamespace: autumn-api-stripped - sourceRevisionDigest: sha256:40c850f3f37a4ef63ace5e1bdfad2671d0f524de9cb7505fc9bd1cd61d90fbb6 - sourceBlobDigest: sha256:d2a2be089c9d86271ff50f9910f11306fb30e365c419b0c255f9fba2a675cdc7 + sourceRevisionDigest: sha256:a29b17bf6727d2d1521685e1b3043a7da8952b1661af129449379081ee20fdda + sourceBlobDigest: sha256:cc38997f016c321914fd2dba3090fb6b3e2a89d0927d214970f0fb4f64efc230 tags: - latest - 2.1.0 @@ -18,17 +18,17 @@ targets: autumn: source: Autumn API sourceNamespace: autumn-api - sourceRevisionDigest: sha256:cb77449950de6390b353ba6780b3ec5168a6fb7bdc039120749e8a0dd9e522ca - sourceBlobDigest: sha256:1295e2ee2c5fd69238da680273b71b1f7e6037f848f163ed5a7d42f19e60d95d + sourceRevisionDigest: sha256:907452f52e7316fc31598c430bb2b2d1f511a3e4c1eb21462aa1de10b5d94460 + sourceBlobDigest: sha256:0bf1d6695f34c96339037aa03001ea35b7b7361b45146865c9222d1586109448 codeSamplesNamespace: autumn-api-typescript-code-samples - codeSamplesRevisionDigest: sha256:7146b730802f6b22806257917cd80da20b15cf66891d6dbe5d624e7c7ccb4b8d + codeSamplesRevisionDigest: sha256:fab88bba3ef521a0b14213268335ee949761ab98ee60698e9bad7463140563ab autumn-python: source: Autumn API Stripped sourceNamespace: autumn-api-stripped - sourceRevisionDigest: sha256:40c850f3f37a4ef63ace5e1bdfad2671d0f524de9cb7505fc9bd1cd61d90fbb6 - sourceBlobDigest: sha256:d2a2be089c9d86271ff50f9910f11306fb30e365c419b0c255f9fba2a675cdc7 + sourceRevisionDigest: sha256:a29b17bf6727d2d1521685e1b3043a7da8952b1661af129449379081ee20fdda + sourceBlobDigest: sha256:cc38997f016c321914fd2dba3090fb6b3e2a89d0927d214970f0fb4f64efc230 codeSamplesNamespace: autumn-api-python-code-samples - codeSamplesRevisionDigest: sha256:3cd6e4413b7a3d4adb59b7ae7c943dc291d6a2f8cf6416ddb8b286d1a56c9a47 + codeSamplesRevisionDigest: sha256:362b43bd898f745e64830c2c833ab64ae3f92e8ecec59c13152952e239b4f56a workflow: workflowVersion: 1.0.0 speakeasyVersion: pinned diff --git a/packages/sdk/FUNCTIONS.md b/packages/sdk/FUNCTIONS.md index 997ec44c4..b3057307d 100644 --- a/packages/sdk/FUNCTIONS.md +++ b/packages/sdk/FUNCTIONS.md @@ -20,7 +20,7 @@ specific category of applications. ```typescript import { AutumnCore } from "@useautumn/sdk/core.js"; -import { customersGetOrCreate } from "@useautumn/sdk/funcs/customers-get-or-create.js"; +import { check } from "@useautumn/sdk/funcs/check.js"; // Use `AutumnCore` for best tree-shaking performance. // You can create one instance of it to use across an application. @@ -30,16 +30,15 @@ const autumn = new AutumnCore({ }); async function run() { - const res = await customersGetOrCreate(autumn, { + const res = await check(autumn, { customerId: "cus_123", - name: "John Doe", - email: "john@example.com", + featureId: "messages", }); if (res.ok) { const { value: result } = res; console.log(result); } else { - console.log("customersGetOrCreate failed:", res.error); + console.log("check failed:", res.error); } } diff --git a/packages/sdk/README.md b/packages/sdk/README.md index ba4e797ed..635390fde 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -94,10 +94,9 @@ const autumn = new Autumn({ }); async function run() { - const result = await autumn.customers.getOrCreate({ + const result = await autumn.check({ customerId: "cus_123", - name: "John Doe", - email: "john@example.com", + featureId: "messages", }); console.log(result); @@ -129,10 +128,9 @@ const autumn = new Autumn({ }); async function run() { - const result = await autumn.customers.getOrCreate({ + const result = await autumn.check({ customerId: "cus_123", - name: "John Doe", - email: "john@example.com", + featureId: "messages", }); console.log(result); @@ -149,32 +147,188 @@ run();
Available methods +### [Autumn SDK](docs/sdks/autumn/README.md) + +* [check](docs/sdks/autumn/README.md#check) - Checks whether a customer currently has enough balance to use a feature. + +Use this to gate access before a feature action. Enable sendEvent when you want to check and consume balance atomically in one request. + +@example +```typescript +// Check access for a feature +const response = await client.check({ customerId: "cus_123", featureId: "messages" }); +``` + +@example +```typescript +// Check and consume 3 units in one call +const response = await client.check({ + + customerId: "cus_123", + featureId: "messages", + requiredBalance: 3, + sendEvent: true, +}); +``` + +@param customerId - The ID of the customer. +@param featureId - The ID of the feature. +@param entityId - The ID of the entity for entity-scoped balances (e.g., per-seat limits). (optional) +@param requiredBalance - Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1. (optional) +@param properties - Additional properties to attach to the usage event if send_event is true. (optional) +@param sendEvent - If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. (optional) +@param withPreview - If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. (optional) + +@returns Whether access is allowed, plus the current balance for that feature. +* [track](docs/sdks/autumn/README.md#track) - Records usage for a customer feature and returns updated balances. + +Use this after an action happens to decrement usage, or send a negative value to credit balance back. + +@example +```typescript +// Track one message event +const response = await client.track({ customerId: "cus_123", featureId: "messages", value: 1 }); +``` + +@example +```typescript +// Track an event mapped to multiple features +const response = await client.track({ customerId: "cus_123", eventName: "ai_chat_request", value: 1 }); +``` + +@param customerId - The ID of the customer. +@param featureId - The ID of the feature to track usage for. Required if event_name is not provided. (optional) +@param entityId - The ID of the entity for entity-scoped balances (e.g., per-seat limits). (optional) +@param eventName - Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. (optional) +@param value - The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). (optional) +@param properties - Additional properties to attach to this usage event. (optional) + +@returns The usage value recorded, with either a single updated balance or a map of updated balances. + ### [Balances](docs/sdks/balances/README.md) * [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. -* [check](docs/sdks/balances/README.md#check) - Check whether usage is allowed for a customer feature. -* [track](docs/sdks/balances/README.md#track) - Track usage for a customer feature. ### [Billing](docs/sdks/billing/README.md) * [attach](docs/sdks/billing/README.md#attach) - Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. +Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product. + @example ```typescript // Attach a plan to a customer -const response = await client.attach({ customerId: "cus_123", planId: "pro_plan" }); +const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan" }); +``` + +@example +```typescript +// Attach with a free trial +const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan", freeTrial: {"durationLength":14,"durationType":"day"} }); +``` + +@example +```typescript +// Attach with custom pricing +const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan", customize: {"price":{"amount":4900,"interval":"month"}} }); +``` + +@param customerId - The ID of the customer to attach the plan to. +@param entityId - The ID of the entity to attach the plan to. (optional) +@param planId - The ID of the plan. +@param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) +@param version - The version of the plan to attach. (optional) +@param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) +@param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) +@param billingBehavior - 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. (optional) +@param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) +@param successUrl - URL to redirect to after successful checkout. (optional) +@param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) +@param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + +@returns A billing response with customer ID, invoice details, and payment URL (if checkout required). +* [previewAttach](docs/sdks/billing/README.md#previewattach) - Previews the billing changes that would occur when attaching a plan, without actually making any changes. + +Use this endpoint to show customers what they will be charged before confirming a subscription change. + +@example +```typescript +// Preview attaching a plan +const response = await client.billing.previewAttach({ customerId: "cus_123", planId: "pro_plan" }); +``` + +@param customerId - The ID of the customer to attach the plan to. +@param entityId - The ID of the entity to attach the plan to. (optional) +@param planId - The ID of the plan. +@param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) +@param version - The version of the plan to attach. (optional) +@param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) +@param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) +@param billingBehavior - 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. (optional) +@param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) +@param successUrl - URL to redirect to after successful checkout. (optional) +@param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) +@param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + +@returns A preview response with line items, totals, and effective dates for the proposed changes. +* [update](docs/sdks/billing/README.md#update) - Updates an existing subscription. Use to modify feature quantities, cancel, or change plan configuration. + +Use this endpoint to update prepaid quantities, cancel a subscription (immediately or at end of cycle), or modify subscription settings. + +@example +```typescript +// Update prepaid feature quantity +const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", featureQuantities: [{"featureId":"seats","quantity":10}] }); +``` + +@example +```typescript +// Cancel a subscription at end of billing cycle +const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", cancelAction: "cancel_end_of_cycle" }); +``` + +@example +```typescript +// Uncancel a subscription at the end of the billing cycle +const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", cancelAction: "uncancel" }); ``` @param customerId - The ID of the customer to attach the plan to. @param entityId - The ID of the entity to attach the plan to. (optional) @param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) @param version - The version of the plan to attach. (optional) +@param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) -* [previewAttach](docs/sdks/billing/README.md#previewattach) - Preview billing changes before attaching a plan. -* [update](docs/sdks/billing/README.md#update) - Update an existing subscription. -* [previewUpdate](docs/sdks/billing/README.md#previewupdate) - Preview billing changes before updating a subscription. -* [setupPayment](docs/sdks/billing/README.md#setuppayment) - Create a setup payment session for a customer. +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) +@param billingBehavior - 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. (optional) +@param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional) + +@returns A billing response with customer ID, invoice details, and payment URL (if next action is required). +* [previewUpdate](docs/sdks/billing/README.md#previewupdate) - Previews the billing changes that would occur when updating a subscription, without actually making any changes. + +Use this endpoint to show customers prorated charges or refunds before confirming subscription modifications. + +@example +```typescript +// Preview updating seat quantity +const response = await client.billing.previewUpdate({ customerId: "cus_123", planId: "pro_plan", featureQuantities: [{"featureId":"seats","quantity":15}] }); +``` + +@param customerId - The ID of the customer to attach the plan to. +@param entityId - The ID of the entity to attach the plan to. (optional) +@param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) +@param version - The version of the plan to attach. (optional) +@param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) +@param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) +@param billingBehavior - 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. (optional) +@param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional) + +@returns A preview response with line items showing prorated charges or credits for the proposed changes. +* [openCustomerPortal](docs/sdks/billing/README.md#opencustomerportal) - Create a billing portal session for a customer to manage their subscription. ### [Customers](docs/sdks/customers/README.md) @@ -201,10 +355,80 @@ const response = await client.getOrCreate({ customerId: "cus_123", name: "John D * [update](docs/sdks/customers/README.md#update) - Updates an existing customer by ID. * [delete](docs/sdks/customers/README.md#delete) - Deletes a customer by ID. +### [Entities](docs/sdks/entities/README.md) + +* [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. + +@example +```typescript +// Create a seat entity +const response = await client.entities.create({ + + customerId: "cus_123", + entityId: "seat_42", + featureId: "seats", + name: "Seat 42", +}); +``` + +@param name - The name of the entity (optional) +@param featureId - The ID of the feature this entity is associated with +@param customerData - Customer attributes used to resolve the customer when customer_id is not provided. (optional) +@param customerId - The ID of the customer to create the entity for. +@param entityId - The ID of the entity. + +@returns The created entity object including its current subscriptions, purchases, and balances. +* [get](docs/sdks/entities/README.md#get) - Fetches a single entity by entity ID. + +Use this to read one entity's current state. Pass customerId when you want to scope the lookup to a specific customer. + +@example +```typescript +// Fetch a seat entity +const response = await client.entities.get({ entityId: "seat_42" }); +``` + +@example +```typescript +// Fetch a seat entity for a specific customer +const response = await client.entities.get({ customerId: "cus_123", entityId: "seat_42" }); +``` + +@param customerId - The ID of the customer to create the entity for. (optional) +@param entityId - The ID of the entity. + +@returns The entity object including its current subscriptions, purchases, and balances. +* [delete](docs/sdks/entities/README.md#delete) - Deletes an entity by entity ID. + +Use this when the underlying resource is removed and you no longer want entity-scoped balances or subscriptions tracked for it. + +@example +```typescript +// Delete a seat entity +const response = await client.entities.delete({ entityId: "seat_42" }); +``` + +@param customerId - The ID of the customer. (optional) +@param entityId - The ID of the entity. + +@returns A success flag indicating the entity was deleted. + +### [Events](docs/sdks/events/README.md) + +* [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. + ### [Plans](docs/sdks/plans/README.md) * [list](docs/sdks/plans/README.md#list) - List all plans +### [Referrals](docs/sdks/referrals/README.md) + +* [createCode](docs/sdks/referrals/README.md#createcode) - Create or fetch a referral code for a customer in a referral program. +* [redeemCode](docs/sdks/referrals/README.md#redeemcode) - Redeem a referral code for a customer. +
@@ -223,27 +447,156 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md). Available standalone functions -- [`balancesCheck`](docs/sdks/balances/README.md#check) - Check whether usage is allowed for a customer feature. - [`balancesCreate`](docs/sdks/balances/README.md#create) - Create a balance for a customer feature. -- [`balancesTrack`](docs/sdks/balances/README.md#track) - Track usage for a customer feature. - [`balancesUpdate`](docs/sdks/balances/README.md#update) - Update a customer balance. - [`billingAttach`](docs/sdks/billing/README.md#attach) - Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. +Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product. + @example ```typescript // Attach a plan to a customer -const response = await client.attach({ customerId: "cus_123", planId: "pro_plan" }); +const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan" }); +``` + +@example +```typescript +// Attach with a free trial +const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan", freeTrial: {"durationLength":14,"durationType":"day"} }); +``` + +@example +```typescript +// Attach with custom pricing +const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan", customize: {"price":{"amount":4900,"interval":"month"}} }); +``` + +@param customerId - The ID of the customer to attach the plan to. +@param entityId - The ID of the entity to attach the plan to. (optional) +@param planId - The ID of the plan. +@param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) +@param version - The version of the plan to attach. (optional) +@param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) +@param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) +@param billingBehavior - 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. (optional) +@param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) +@param successUrl - URL to redirect to after successful checkout. (optional) +@param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) +@param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + +@returns A billing response with customer ID, invoice details, and payment URL (if checkout required). +- [`billingOpenCustomerPortal`](docs/sdks/billing/README.md#opencustomerportal) - Create a billing portal session for a customer to manage their subscription. +- [`billingPreviewAttach`](docs/sdks/billing/README.md#previewattach) - Previews the billing changes that would occur when attaching a plan, without actually making any changes. + +Use this endpoint to show customers what they will be charged before confirming a subscription change. + +@example +```typescript +// Preview attaching a plan +const response = await client.billing.previewAttach({ customerId: "cus_123", planId: "pro_plan" }); +``` + +@param customerId - The ID of the customer to attach the plan to. +@param entityId - The ID of the entity to attach the plan to. (optional) +@param planId - The ID of the plan. +@param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) +@param version - The version of the plan to attach. (optional) +@param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) +@param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) +@param billingBehavior - 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. (optional) +@param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) +@param successUrl - URL to redirect to after successful checkout. (optional) +@param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) +@param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + +@returns A preview response with line items, totals, and effective dates for the proposed changes. +- [`billingPreviewUpdate`](docs/sdks/billing/README.md#previewupdate) - Previews the billing changes that would occur when updating a subscription, without actually making any changes. + +Use this endpoint to show customers prorated charges or refunds before confirming subscription modifications. + +@example +```typescript +// Preview updating seat quantity +const response = await client.billing.previewUpdate({ customerId: "cus_123", planId: "pro_plan", featureQuantities: [{"featureId":"seats","quantity":15}] }); ``` @param customerId - The ID of the customer to attach the plan to. @param entityId - The ID of the entity to attach the plan to. (optional) @param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) @param version - The version of the plan to attach. (optional) +@param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) -- [`billingPreviewAttach`](docs/sdks/billing/README.md#previewattach) - Preview billing changes before attaching a plan. -- [`billingPreviewUpdate`](docs/sdks/billing/README.md#previewupdate) - Preview billing changes before updating a subscription. -- [`billingSetupPayment`](docs/sdks/billing/README.md#setuppayment) - Create a setup payment session for a customer. -- [`billingUpdate`](docs/sdks/billing/README.md#update) - Update an existing subscription. +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) +@param billingBehavior - 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. (optional) +@param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional) + +@returns A preview response with line items showing prorated charges or credits for the proposed changes. +- [`billingUpdate`](docs/sdks/billing/README.md#update) - Updates an existing subscription. Use to modify feature quantities, cancel, or change plan configuration. + +Use this endpoint to update prepaid quantities, cancel a subscription (immediately or at end of cycle), or modify subscription settings. + +@example +```typescript +// Update prepaid feature quantity +const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", featureQuantities: [{"featureId":"seats","quantity":10}] }); +``` + +@example +```typescript +// Cancel a subscription at end of billing cycle +const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", cancelAction: "cancel_end_of_cycle" }); +``` + +@example +```typescript +// Uncancel a subscription at the end of the billing cycle +const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", cancelAction: "uncancel" }); +``` + +@param customerId - The ID of the customer to attach the plan to. +@param entityId - The ID of the entity to attach the plan to. (optional) +@param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) +@param version - The version of the plan to attach. (optional) +@param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) +@param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) +@param billingBehavior - 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. (optional) +@param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional) + +@returns A billing response with customer ID, invoice details, and payment URL (if next action is required). +- [`check`](docs/sdks/autumn/README.md#check) - Checks whether a customer currently has enough balance to use a feature. + +Use this to gate access before a feature action. Enable sendEvent when you want to check and consume balance atomically in one request. + +@example +```typescript +// Check access for a feature +const response = await client.check({ customerId: "cus_123", featureId: "messages" }); +``` + +@example +```typescript +// Check and consume 3 units in one call +const response = await client.check({ + + customerId: "cus_123", + featureId: "messages", + requiredBalance: 3, + sendEvent: true, +}); +``` + +@param customerId - The ID of the customer. +@param featureId - The ID of the feature. +@param entityId - The ID of the entity for entity-scoped balances (e.g., per-seat limits). (optional) +@param requiredBalance - Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1. (optional) +@param properties - Additional properties to attach to the usage event if send_event is true. (optional) +@param sendEvent - If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. (optional) +@param withPreview - If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. (optional) + +@returns Whether access is allowed, plus the current balance for that feature. - [`customersDelete`](docs/sdks/customers/README.md#delete) - Deletes a customer by ID. - [`customersGetOrCreate`](docs/sdks/customers/README.md#getorcreate) - Creates a customer if they do not exist, or returns the existing customer by your external customer ID. @@ -266,7 +619,92 @@ const response = await client.getOrCreate({ customerId: "cus_123", name: "John D @param expand - Customer expand options (optional) - [`customersList`](docs/sdks/customers/README.md#list) - Lists customers with pagination and optional filters. - [`customersUpdate`](docs/sdks/customers/README.md#update) - Updates an existing customer by ID. +- [`entitiesCreate`](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. + +@example +```typescript +// Create a seat entity +const response = await client.entities.create({ + + customerId: "cus_123", + entityId: "seat_42", + featureId: "seats", + name: "Seat 42", +}); +``` + +@param name - The name of the entity (optional) +@param featureId - The ID of the feature this entity is associated with +@param customerData - Customer attributes used to resolve the customer when customer_id is not provided. (optional) +@param customerId - The ID of the customer to create the entity for. +@param entityId - The ID of the entity. + +@returns The created entity object including its current subscriptions, purchases, and balances. +- [`entitiesDelete`](docs/sdks/entities/README.md#delete) - Deletes an entity by entity ID. + +Use this when the underlying resource is removed and you no longer want entity-scoped balances or subscriptions tracked for it. + +@example +```typescript +// Delete a seat entity +const response = await client.entities.delete({ entityId: "seat_42" }); +``` + +@param customerId - The ID of the customer. (optional) +@param entityId - The ID of the entity. + +@returns A success flag indicating the entity was deleted. +- [`entitiesGet`](docs/sdks/entities/README.md#get) - Fetches a single entity by entity ID. + +Use this to read one entity's current state. Pass customerId when you want to scope the lookup to a specific customer. + +@example +```typescript +// Fetch a seat entity +const response = await client.entities.get({ entityId: "seat_42" }); +``` + +@example +```typescript +// Fetch a seat entity for a specific customer +const response = await client.entities.get({ customerId: "cus_123", entityId: "seat_42" }); +``` + +@param customerId - The ID of the customer to create the entity for. (optional) +@param entityId - The ID of the entity. + +@returns The entity object including its current subscriptions, purchases, and balances. +- [`eventsAggregate`](docs/sdks/events/README.md#aggregate) - Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property. +- [`eventsList`](docs/sdks/events/README.md#list) - List usage events for your organization. Filter by customer, feature, or time range. - [`plansList`](docs/sdks/plans/README.md#list) - List all plans +- [`referralsCreateCode`](docs/sdks/referrals/README.md#createcode) - Create or fetch a referral code for a customer in a referral program. +- [`referralsRedeemCode`](docs/sdks/referrals/README.md#redeemcode) - Redeem a referral code for a customer. +- [`track`](docs/sdks/autumn/README.md#track) - Records usage for a customer feature and returns updated balances. + +Use this after an action happens to decrement usage, or send a negative value to credit balance back. + +@example +```typescript +// Track one message event +const response = await client.track({ customerId: "cus_123", featureId: "messages", value: 1 }); +``` + +@example +```typescript +// Track an event mapped to multiple features +const response = await client.track({ customerId: "cus_123", eventName: "ai_chat_request", value: 1 }); +``` + +@param customerId - The ID of the customer. +@param featureId - The ID of the feature to track usage for. Required if event_name is not provided. (optional) +@param entityId - The ID of the entity for entity-scoped balances (e.g., per-seat limits). (optional) +@param eventName - Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. (optional) +@param value - The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). (optional) +@param properties - Additional properties to attach to this usage event. (optional) + +@returns The usage value recorded, with either a single updated balance or a map of updated balances. @@ -286,10 +724,9 @@ const autumn = new Autumn({ }); async function run() { - const result = await autumn.customers.getOrCreate({ + const result = await autumn.check({ customerId: "cus_123", - name: "John Doe", - email: "john@example.com", + featureId: "messages", }, { retries: { strategy: "backoff", @@ -330,10 +767,9 @@ const autumn = new Autumn({ }); async function run() { - const result = await autumn.customers.getOrCreate({ + const result = await autumn.check({ customerId: "cus_123", - name: "John Doe", - email: "john@example.com", + featureId: "messages", }); console.log(result); @@ -369,10 +805,9 @@ const autumn = new Autumn({ async function run() { try { - const result = await autumn.customers.getOrCreate({ + const result = await autumn.check({ customerId: "cus_123", - name: "John Doe", - email: "john@example.com", + featureId: "messages", }); console.log(result); @@ -428,10 +863,9 @@ const autumn = new Autumn({ }); async function run() { - const result = await autumn.customers.getOrCreate({ + const result = await autumn.check({ customerId: "cus_123", - name: "John Doe", - email: "john@example.com", + featureId: "messages", }); console.log(result); diff --git a/packages/sdk/USAGE.md b/packages/sdk/USAGE.md index b1d99bf9e..18eb11d41 100644 --- a/packages/sdk/USAGE.md +++ b/packages/sdk/USAGE.md @@ -8,10 +8,9 @@ const autumn = new Autumn({ }); async function run() { - const result = await autumn.customers.getOrCreate({ + const result = await autumn.check({ customerId: "cus_123", - name: "John Doe", - email: "john@example.com", + featureId: "messages", }); console.log(result); diff --git a/packages/sdk/docs/models/billing-preview-update-next-cycle-effective-period.md b/packages/sdk/docs/models/aggregate-events-custom-range.md similarity index 61% rename from packages/sdk/docs/models/billing-preview-update-next-cycle-effective-period.md rename to packages/sdk/docs/models/aggregate-events-custom-range.md index 4a645d24e..626fc2385 100644 --- a/packages/sdk/docs/models/billing-preview-update-next-cycle-effective-period.md +++ b/packages/sdk/docs/models/aggregate-events-custom-range.md @@ -1,13 +1,15 @@ -# BillingPreviewUpdateNextCycleEffectivePeriod +# AggregateEventsCustomRange + +Custom time range to aggregate events for. If provided, range must not be provided ## Example Usage ```typescript -import { BillingPreviewUpdateNextCycleEffectivePeriod } from "@useautumn/sdk"; +import { AggregateEventsCustomRange } from "@useautumn/sdk"; -let value: BillingPreviewUpdateNextCycleEffectivePeriod = { - start: 5993.84, - end: 2192.39, +let value: AggregateEventsCustomRange = { + start: 1540.52, + end: 8116.03, }; ``` diff --git a/packages/sdk/docs/models/aggregate-events-feature-id.md b/packages/sdk/docs/models/aggregate-events-feature-id.md new file mode 100644 index 000000000..a3ea76a74 --- /dev/null +++ b/packages/sdk/docs/models/aggregate-events-feature-id.md @@ -0,0 +1,22 @@ +# AggregateEventsFeatureId + +Feature ID(s) to aggregate events for + + +## Supported Types + +### `string` + +```typescript +const value: string = ""; +``` + +### `string[]` + +```typescript +const value: string[] = [ + "", + "", +]; +``` + diff --git a/packages/sdk/docs/models/aggregate-events-globals.md b/packages/sdk/docs/models/aggregate-events-globals.md new file mode 100644 index 000000000..6ea95a507 --- /dev/null +++ b/packages/sdk/docs/models/aggregate-events-globals.md @@ -0,0 +1,15 @@ +# AggregateEventsGlobals + +## Example Usage + +```typescript +import { AggregateEventsGlobals } from "@useautumn/sdk"; + +let value: AggregateEventsGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/aggregate-events-list.md b/packages/sdk/docs/models/aggregate-events-list.md new file mode 100644 index 000000000..4e6f8d7ae --- /dev/null +++ b/packages/sdk/docs/models/aggregate-events-list.md @@ -0,0 +1,22 @@ +# AggregateEventsList + +## Example Usage + +```typescript +import { AggregateEventsList } from "@useautumn/sdk"; + +let value: AggregateEventsList = { + period: 1600.31, + values: { + "key": 8171.94, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | +| `period` | *number* | :heavy_check_mark: | Unix timestamp (epoch ms) for this time period | +| `values` | Record | :heavy_check_mark: | Aggregated values per feature: { [featureId]: number } | +| `groupedValues` | Record> | :heavy_minus_sign: | Values broken down by group (only present when group_by is used): { [featureId]: { [groupValue]: number } } | \ No newline at end of file diff --git a/packages/sdk/docs/models/aggregate-events-response.md b/packages/sdk/docs/models/aggregate-events-response.md new file mode 100644 index 000000000..39e2e27b8 --- /dev/null +++ b/packages/sdk/docs/models/aggregate-events-response.md @@ -0,0 +1,45 @@ +# AggregateEventsResponse + +OK + +## Example Usage + +```typescript +import { AggregateEventsResponse } from "@useautumn/sdk"; + +let value: AggregateEventsResponse = { + list: [ + { + period: 1762905600000, + values: { + "messages": 10, + "sessions": 3, + }, + }, + { + period: 1762992000000, + values: { + "messages": 3, + "sessions": 12, + }, + }, + ], + total: { + "messages": { + count: 2, + sum: 13, + }, + "sessions": { + count: 2, + sum: 15, + }, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | +| `list` | [models.AggregateEventsList](../models/aggregate-events-list.md)[] | :heavy_check_mark: | Array of time periods with aggregated values | +| `total` | Record | :heavy_check_mark: | Total aggregations per feature. Keys are feature IDs, values contain count and sum. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-request.md b/packages/sdk/docs/models/attach-params.md similarity index 55% rename from packages/sdk/docs/models/billing-preview-attach-request.md rename to packages/sdk/docs/models/attach-params.md index dd592a2f9..5e34cf5d3 100644 --- a/packages/sdk/docs/models/billing-preview-attach-request.md +++ b/packages/sdk/docs/models/attach-params.md @@ -1,31 +1,30 @@ -# BillingPreviewAttachRequest +# AttachParams ## Example Usage ```typescript -import { BillingPreviewAttachRequest } from "@useautumn/sdk"; +import { AttachParams } from "@useautumn/sdk"; -let value: BillingPreviewAttachRequest = { - customerId: "", - planId: "", +let value: AttachParams = { + customerId: "cus_123", + planId: "pro_plan", }; ``` ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `customerId` | *string* | :heavy_check_mark: | The ID of the customer to attach the plan to. | -| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | -| `featureQuantities` | [models.BillingPreviewAttachFeatureQuantities](../models/billing-preview-attach-feature-quantities.md)[] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | -| `version` | *number* | :heavy_minus_sign: | The version of the plan to attach. | -| `freeTrial` | [models.BillingPreviewAttachFreeTrial](../models/billing-preview-attach-free-trial.md) | :heavy_minus_sign: | N/A | -| `customize` | [models.BillingPreviewAttachCustomize](../models/billing-preview-attach-customize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `invoiceMode` | [models.BillingPreviewAttachInvoiceMode](../models/billing-preview-attach-invoice-mode.md) | :heavy_minus_sign: | N/A | -| `discounts` | *models.BillingPreviewAttachDiscountUnion*[] | :heavy_minus_sign: | N/A | -| `redirectMode` | [models.BillingPreviewAttachRedirectMode](../models/billing-preview-attach-redirect-mode.md) | :heavy_minus_sign: | N/A | -| `successUrl` | *string* | :heavy_minus_sign: | N/A | -| `newBillingSubscription` | *boolean* | :heavy_minus_sign: | N/A | -| `planSchedule` | [models.BillingPreviewAttachPlanSchedule](../models/billing-preview-attach-plan-schedule.md) | :heavy_minus_sign: | N/A | -| `billingBehavior` | [models.BillingPreviewAttachBillingBehavior](../models/billing-preview-attach-billing-behavior.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer to attach the plan to. | +| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | +| `planId` | *string* | :heavy_check_mark: | The ID of the plan. | +| `featureQuantities` | [models.BillingAttachFeatureQuantity](../models/billing-attach-feature-quantity.md)[] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | +| `version` | *number* | :heavy_minus_sign: | The version of the plan to attach. | +| `freeTrial` | [models.BillingAttachFreeTrial](../models/billing-attach-free-trial.md) | :heavy_minus_sign: | Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. | +| `customize` | [models.BillingAttachCustomize](../models/billing-attach-customize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | +| `invoiceMode` | [models.BillingAttachInvoiceMode](../models/billing-attach-invoice-mode.md) | :heavy_minus_sign: | Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. | +| `billingBehavior` | [models.BillingAttachBillingBehavior](../models/billing-attach-billing-behavior.md) | :heavy_minus_sign: | 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. | +| `discounts` | *models.BillingAttachDiscountUnion*[] | :heavy_minus_sign: | List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. | +| `successUrl` | *string* | :heavy_minus_sign: | URL to redirect to after successful checkout. | +| `newBillingSubscription` | *boolean* | :heavy_minus_sign: | Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. | +| `planSchedule` | [models.BillingAttachPlanSchedule](../models/billing-attach-plan-schedule.md) | :heavy_minus_sign: | When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-balance-display.md b/packages/sdk/docs/models/balances-check-balance-display.md deleted file mode 100644 index e4c57044e..000000000 --- a/packages/sdk/docs/models/balances-check-balance-display.md +++ /dev/null @@ -1,16 +0,0 @@ -# BalancesCheckBalanceDisplay - -## Example Usage - -```typescript -import { BalancesCheckBalanceDisplay } from "@useautumn/sdk"; - -let value: BalancesCheckBalanceDisplay = {}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `singular` | *string* | :heavy_minus_sign: | N/A | -| `plural` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-balance-rollover.md b/packages/sdk/docs/models/balances-check-balance-rollover.md deleted file mode 100644 index 635923f79..000000000 --- a/packages/sdk/docs/models/balances-check-balance-rollover.md +++ /dev/null @@ -1,19 +0,0 @@ -# BalancesCheckBalanceRollover - -## Example Usage - -```typescript -import { BalancesCheckBalanceRollover } from "@useautumn/sdk"; - -let value: BalancesCheckBalanceRollover = { - balance: 7420.71, - expiresAt: 3900.81, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `balance` | *number* | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-balance-type.md b/packages/sdk/docs/models/balances-check-balance-type.md deleted file mode 100644 index 1a9b2c56c..000000000 --- a/packages/sdk/docs/models/balances-check-balance-type.md +++ /dev/null @@ -1,17 +0,0 @@ -# BalancesCheckBalanceType - -## Example Usage - -```typescript -import { BalancesCheckBalanceType } from "@useautumn/sdk"; - -let value: BalancesCheckBalanceType = "credit_system"; -``` - -## Values - -This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. - -```typescript -"boolean" | "metered" | "credit_system" | Unrecognized -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-balance.md b/packages/sdk/docs/models/balances-check-balance.md deleted file mode 100644 index 5db52bece..000000000 --- a/packages/sdk/docs/models/balances-check-balance.md +++ /dev/null @@ -1,34 +0,0 @@ -# BalancesCheckBalance - -## Example Usage - -```typescript -import { BalancesCheckBalance } from "@useautumn/sdk"; - -let value: BalancesCheckBalance = { - featureId: "", - granted: 5805.07, - remaining: 2547.08, - usage: 3557.86, - unlimited: false, - overageAllowed: true, - maxPurchase: 7196.64, - nextResetAt: 709.93, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `feature` | [models.BalancesCheckFeature](../models/balances-check-feature.md) | :heavy_minus_sign: | N/A | -| `granted` | *number* | :heavy_check_mark: | N/A | -| `remaining` | *number* | :heavy_check_mark: | N/A | -| `usage` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `overageAllowed` | *boolean* | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | -| `nextResetAt` | *number* | :heavy_check_mark: | N/A | -| `breakdown` | [models.BalancesCheckBreakdown](../models/balances-check-breakdown.md)[] | :heavy_minus_sign: | N/A | -| `rollovers` | [models.BalancesCheckBalanceRollover](../models/balances-check-balance-rollover.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-breakdown.md b/packages/sdk/docs/models/balances-check-breakdown.md deleted file mode 100644 index a4f201465..000000000 --- a/packages/sdk/docs/models/balances-check-breakdown.md +++ /dev/null @@ -1,41 +0,0 @@ -# BalancesCheckBreakdown - -## Example Usage - -```typescript -import { BalancesCheckBreakdown } from "@useautumn/sdk"; - -let value: BalancesCheckBreakdown = { - planId: "", - includedGrant: 639.18, - prepaidGrant: 9880.63, - remaining: 449.68, - usage: 8613.17, - unlimited: true, - reset: { - interval: "", - resetsAt: 7109.07, - }, - price: { - billingUnits: 2274.85, - billingMethod: "prepaid", - maxPurchase: 4165.66, - }, - expiresAt: 2424.28, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `id` | *string* | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `includedGrant` | *number* | :heavy_check_mark: | N/A | -| `prepaidGrant` | *number* | :heavy_check_mark: | N/A | -| `remaining` | *number* | :heavy_check_mark: | N/A | -| `usage` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `reset` | [models.BalancesCheckReset](../models/balances-check-reset.md) | :heavy_check_mark: | N/A | -| `price` | [models.BalancesCheckPrice](../models/balances-check-price.md) | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-feature.md b/packages/sdk/docs/models/balances-check-feature.md deleted file mode 100644 index e09da9500..000000000 --- a/packages/sdk/docs/models/balances-check-feature.md +++ /dev/null @@ -1,28 +0,0 @@ -# BalancesCheckFeature - -## Example Usage - -```typescript -import { BalancesCheckFeature } from "@useautumn/sdk"; - -let value: BalancesCheckFeature = { - id: "", - name: "", - type: "credit_system", - consumable: true, - archived: false, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | -| `id` | *string* | :heavy_check_mark: | N/A | -| `name` | *string* | :heavy_check_mark: | N/A | -| `type` | [models.BalancesCheckBalanceType](../models/balances-check-balance-type.md) | :heavy_check_mark: | N/A | -| `consumable` | *boolean* | :heavy_check_mark: | N/A | -| `eventNames` | *string*[] | :heavy_minus_sign: | N/A | -| `creditSchema` | [models.BalancesCheckCreditSchema](../models/balances-check-credit-schema.md)[] | :heavy_minus_sign: | N/A | -| `display` | [models.BalancesCheckBalanceDisplay](../models/balances-check-balance-display.md) | :heavy_minus_sign: | N/A | -| `archived` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-interval-union.md b/packages/sdk/docs/models/balances-check-interval-union.md deleted file mode 100644 index 7cff0134b..000000000 --- a/packages/sdk/docs/models/balances-check-interval-union.md +++ /dev/null @@ -1,17 +0,0 @@ -# BalancesCheckIntervalUnion - - -## Supported Types - -### `models.BalancesCheckBalanceIntervalEnum` - -```typescript -const value: models.BalancesCheckBalanceIntervalEnum = "one_off"; -``` - -### `string` - -```typescript -const value: string = ""; -``` - diff --git a/packages/sdk/docs/models/balances-check-request.md b/packages/sdk/docs/models/balances-check-request.md deleted file mode 100644 index 3c287ef0a..000000000 --- a/packages/sdk/docs/models/balances-check-request.md +++ /dev/null @@ -1,24 +0,0 @@ -# BalancesCheckRequest - -## Example Usage - -```typescript -import { BalancesCheckRequest } from "@useautumn/sdk"; - -let value: BalancesCheckRequest = { - customerId: "", - featureId: "", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -| `customerId` | *string* | :heavy_check_mark: | ID which you provided when creating the customer | -| `featureId` | *string* | :heavy_check_mark: | ID of the feature to check access to. | -| `entityId` | *string* | :heavy_minus_sign: | If using entity balances (eg, seats), the entity ID to check access for. | -| `requiredBalance` | *number* | :heavy_minus_sign: | If you know the amount of the feature the end user is consuming in advance. If their balance is below this quantity, allowed will be false. | -| `properties` | Record | :heavy_minus_sign: | N/A | -| `sendEvent` | *boolean* | :heavy_minus_sign: | If true, a usage event will be recorded together with checking access. The required_balance field will be used as the usage value. | -| `withPreview` | *boolean* | :heavy_minus_sign: | If true, the response will include a preview object, which can be used to display information such as a paywall or upgrade confirmation. | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-reset.md b/packages/sdk/docs/models/balances-check-reset.md deleted file mode 100644 index f0bffa7d6..000000000 --- a/packages/sdk/docs/models/balances-check-reset.md +++ /dev/null @@ -1,20 +0,0 @@ -# BalancesCheckReset - -## Example Usage - -```typescript -import { BalancesCheckReset } from "@useautumn/sdk"; - -let value: BalancesCheckReset = { - interval: "year", - resetsAt: 3916.29, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | -| `interval` | *models.BalancesCheckIntervalUnion* | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `resetsAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-response.md b/packages/sdk/docs/models/balances-check-response.md deleted file mode 100644 index 13c90b2a5..000000000 --- a/packages/sdk/docs/models/balances-check-response.md +++ /dev/null @@ -1,35 +0,0 @@ -# BalancesCheckResponse - -OK - -## Example Usage - -```typescript -import { BalancesCheckResponse } from "@useautumn/sdk"; - -let value: BalancesCheckResponse = { - allowed: true, - customerId: "", - balance: { - featureId: "", - granted: 5669.36, - remaining: 9220.56, - usage: 9946.92, - unlimited: true, - overageAllowed: false, - maxPurchase: 4196.97, - nextResetAt: 7938.17, - }, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `allowed` | *boolean* | :heavy_check_mark: | N/A | -| `customerId` | *string* | :heavy_check_mark: | N/A | -| `entityId` | *string* | :heavy_minus_sign: | N/A | -| `requiredBalance` | *number* | :heavy_minus_sign: | N/A | -| `balance` | [models.BalancesCheckBalance](../models/balances-check-balance.md) | :heavy_check_mark: | N/A | -| `preview` | [models.Preview](../models/preview.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-scenario.md b/packages/sdk/docs/models/balances-check-scenario.md deleted file mode 100644 index 6a863ffcd..000000000 --- a/packages/sdk/docs/models/balances-check-scenario.md +++ /dev/null @@ -1,17 +0,0 @@ -# BalancesCheckScenario - -## Example Usage - -```typescript -import { BalancesCheckScenario } from "@useautumn/sdk"; - -let value: BalancesCheckScenario = "usage_limit"; -``` - -## Values - -This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. - -```typescript -"usage_limit" | "feature_flag" | Unrecognized -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-tier.md b/packages/sdk/docs/models/balances-check-tier.md deleted file mode 100644 index 5227e29b2..000000000 --- a/packages/sdk/docs/models/balances-check-tier.md +++ /dev/null @@ -1,19 +0,0 @@ -# BalancesCheckTier - -## Example Usage - -```typescript -import { BalancesCheckTier } from "@useautumn/sdk"; - -let value: BalancesCheckTier = { - to: 1225.39, - amount: 5076.9, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `to` | *models.BalancesCheckBalanceTo* | :heavy_check_mark: | N/A | -| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-create-request.md b/packages/sdk/docs/models/balances-create-request.md deleted file mode 100644 index 529df394c..000000000 --- a/packages/sdk/docs/models/balances-create-request.md +++ /dev/null @@ -1,25 +0,0 @@ -# BalancesCreateRequest - -## Example Usage - -```typescript -import { BalancesCreateRequest } from "@useautumn/sdk"; - -let value: BalancesCreateRequest = { - featureId: "", - customerId: "", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `featureId` | *string* | :heavy_check_mark: | The feature ID to create the balance for | -| `customerId` | *string* | :heavy_check_mark: | The customer ID to assign the balance to | -| `entityId` | *string* | :heavy_minus_sign: | Entity ID for entity-scoped balances | -| `included` | *number* | :heavy_minus_sign: | The initial balance amount to grant | -| `unlimited` | *boolean* | :heavy_minus_sign: | Whether the balance is unlimited | -| `reset` | [models.BalancesCreateReset](../models/balances-create-reset.md) | :heavy_minus_sign: | Reset configuration for the balance | -| `expiresAt` | *number* | :heavy_minus_sign: | Unix timestamp (milliseconds) when the balance expires | -| `grantedBalance` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-balance-credit-schema.md b/packages/sdk/docs/models/balances-track-balance-credit-schema.md deleted file mode 100644 index 3e071e31a..000000000 --- a/packages/sdk/docs/models/balances-track-balance-credit-schema.md +++ /dev/null @@ -1,19 +0,0 @@ -# BalancesTrackBalanceCreditSchema - -## Example Usage - -```typescript -import { BalancesTrackBalanceCreditSchema } from "@useautumn/sdk"; - -let value: BalancesTrackBalanceCreditSchema = { - meteredFeatureId: "", - creditCost: 9143.65, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `meteredFeatureId` | *string* | :heavy_check_mark: | N/A | -| `creditCost` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-balance-feature.md b/packages/sdk/docs/models/balances-track-balance-feature.md deleted file mode 100644 index 23a3d588c..000000000 --- a/packages/sdk/docs/models/balances-track-balance-feature.md +++ /dev/null @@ -1,28 +0,0 @@ -# BalancesTrackBalanceFeature - -## Example Usage - -```typescript -import { BalancesTrackBalanceFeature } from "@useautumn/sdk"; - -let value: BalancesTrackBalanceFeature = { - id: "", - name: "", - type: "boolean", - consumable: true, - archived: true, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `id` | *string* | :heavy_check_mark: | N/A | -| `name` | *string* | :heavy_check_mark: | N/A | -| `type` | [models.BalancesTrackBalanceType](../models/balances-track-balance-type.md) | :heavy_check_mark: | N/A | -| `consumable` | *boolean* | :heavy_check_mark: | N/A | -| `eventNames` | *string*[] | :heavy_minus_sign: | N/A | -| `creditSchema` | [models.BalancesTrackBalanceCreditSchema](../models/balances-track-balance-credit-schema.md)[] | :heavy_minus_sign: | N/A | -| `display` | [models.BalancesTrackBalanceDisplay](../models/balances-track-balance-display.md) | :heavy_minus_sign: | N/A | -| `archived` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-balance-interval-enum.md b/packages/sdk/docs/models/balances-track-balance-interval-enum.md deleted file mode 100644 index cddf06ad4..000000000 --- a/packages/sdk/docs/models/balances-track-balance-interval-enum.md +++ /dev/null @@ -1,17 +0,0 @@ -# BalancesTrackBalanceIntervalEnum - -## Example Usage - -```typescript -import { BalancesTrackBalanceIntervalEnum } from "@useautumn/sdk"; - -let value: BalancesTrackBalanceIntervalEnum = "month"; -``` - -## Values - -This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. - -```typescript -"one_off" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | Unrecognized -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-balance-interval-union.md b/packages/sdk/docs/models/balances-track-balance-interval-union.md deleted file mode 100644 index 398961723..000000000 --- a/packages/sdk/docs/models/balances-track-balance-interval-union.md +++ /dev/null @@ -1,17 +0,0 @@ -# BalancesTrackBalanceIntervalUnion - - -## Supported Types - -### `models.BalancesTrackBalanceIntervalEnum` - -```typescript -const value: models.BalancesTrackBalanceIntervalEnum = "minute"; -``` - -### `string` - -```typescript -const value: string = ""; -``` - diff --git a/packages/sdk/docs/models/balances-track-balance-price.md b/packages/sdk/docs/models/balances-track-balance-price.md deleted file mode 100644 index 55b2e34a5..000000000 --- a/packages/sdk/docs/models/balances-track-balance-price.md +++ /dev/null @@ -1,23 +0,0 @@ -# BalancesTrackBalancePrice - -## Example Usage - -```typescript -import { BalancesTrackBalancePrice } from "@useautumn/sdk"; - -let value: BalancesTrackBalancePrice = { - billingUnits: 404.47, - billingMethod: "usage_based", - maxPurchase: 8873.68, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_minus_sign: | N/A | -| `tiers` | [models.BalancesTrackBalanceTier](../models/balances-track-balance-tier.md)[] | :heavy_minus_sign: | N/A | -| `billingUnits` | *number* | :heavy_check_mark: | N/A | -| `billingMethod` | [models.BalancesTrackBalanceBillingMethod](../models/balances-track-balance-billing-method.md) | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-balance-reset.md b/packages/sdk/docs/models/balances-track-balance-reset.md deleted file mode 100644 index c5fdcca6d..000000000 --- a/packages/sdk/docs/models/balances-track-balance-reset.md +++ /dev/null @@ -1,20 +0,0 @@ -# BalancesTrackBalanceReset - -## Example Usage - -```typescript -import { BalancesTrackBalanceReset } from "@useautumn/sdk"; - -let value: BalancesTrackBalanceReset = { - interval: "minute", - resetsAt: 8210.38, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | -| `interval` | *models.BalancesTrackBalanceIntervalUnion* | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `resetsAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-balance-rollover.md b/packages/sdk/docs/models/balances-track-balance-rollover.md deleted file mode 100644 index f90f2fede..000000000 --- a/packages/sdk/docs/models/balances-track-balance-rollover.md +++ /dev/null @@ -1,19 +0,0 @@ -# BalancesTrackBalanceRollover - -## Example Usage - -```typescript -import { BalancesTrackBalanceRollover } from "@useautumn/sdk"; - -let value: BalancesTrackBalanceRollover = { - balance: 3831.98, - expiresAt: 9536.77, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `balance` | *number* | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-balance-tier.md b/packages/sdk/docs/models/balances-track-balance-tier.md deleted file mode 100644 index 72251f818..000000000 --- a/packages/sdk/docs/models/balances-track-balance-tier.md +++ /dev/null @@ -1,19 +0,0 @@ -# BalancesTrackBalanceTier - -## Example Usage - -```typescript -import { BalancesTrackBalanceTier } from "@useautumn/sdk"; - -let value: BalancesTrackBalanceTier = { - to: "", - amount: 5222.95, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `to` | *models.BalancesTrackBalanceTo* | :heavy_check_mark: | N/A | -| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-balance.md b/packages/sdk/docs/models/balances-track-balance.md deleted file mode 100644 index 932237fa5..000000000 --- a/packages/sdk/docs/models/balances-track-balance.md +++ /dev/null @@ -1,34 +0,0 @@ -# BalancesTrackBalance - -## Example Usage - -```typescript -import { BalancesTrackBalance } from "@useautumn/sdk"; - -let value: BalancesTrackBalance = { - featureId: "", - granted: 6031.57, - remaining: 4645.12, - usage: 8809.38, - unlimited: true, - overageAllowed: false, - maxPurchase: null, - nextResetAt: 3946.98, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `feature` | [models.BalancesTrackBalanceFeature](../models/balances-track-balance-feature.md) | :heavy_minus_sign: | N/A | -| `granted` | *number* | :heavy_check_mark: | N/A | -| `remaining` | *number* | :heavy_check_mark: | N/A | -| `usage` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `overageAllowed` | *boolean* | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | -| `nextResetAt` | *number* | :heavy_check_mark: | N/A | -| `breakdown` | [models.BalancesTrackBalanceBreakdown](../models/balances-track-balance-breakdown.md)[] | :heavy_minus_sign: | N/A | -| `rollovers` | [models.BalancesTrackBalanceRollover](../models/balances-track-balance-rollover.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-balances.md b/packages/sdk/docs/models/balances-track-balances.md deleted file mode 100644 index a19a26597..000000000 --- a/packages/sdk/docs/models/balances-track-balances.md +++ /dev/null @@ -1,34 +0,0 @@ -# BalancesTrackBalances - -## Example Usage - -```typescript -import { BalancesTrackBalances } from "@useautumn/sdk"; - -let value: BalancesTrackBalances = { - featureId: "", - granted: 4279.52, - remaining: 1892.83, - usage: 6157.43, - unlimited: true, - overageAllowed: false, - maxPurchase: 9971.7, - nextResetAt: 2572.61, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `feature` | [models.BalancesTrackFeature](../models/balances-track-feature.md) | :heavy_minus_sign: | N/A | -| `granted` | *number* | :heavy_check_mark: | N/A | -| `remaining` | *number* | :heavy_check_mark: | N/A | -| `usage` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `overageAllowed` | *boolean* | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | -| `nextResetAt` | *number* | :heavy_check_mark: | N/A | -| `breakdown` | [models.BalancesTrackBreakdown](../models/balances-track-breakdown.md)[] | :heavy_minus_sign: | N/A | -| `rollovers` | [models.BalancesTrackRollover](../models/balances-track-rollover.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-breakdown.md b/packages/sdk/docs/models/balances-track-breakdown.md deleted file mode 100644 index e11ae4e8a..000000000 --- a/packages/sdk/docs/models/balances-track-breakdown.md +++ /dev/null @@ -1,41 +0,0 @@ -# BalancesTrackBreakdown - -## Example Usage - -```typescript -import { BalancesTrackBreakdown } from "@useautumn/sdk"; - -let value: BalancesTrackBreakdown = { - planId: null, - includedGrant: 9958.89, - prepaidGrant: 8123.08, - remaining: 5363.08, - usage: 4513.3, - unlimited: false, - reset: { - interval: "", - resetsAt: 6044.5, - }, - price: { - billingUnits: 5510.57, - billingMethod: "usage_based", - maxPurchase: 2833.31, - }, - expiresAt: null, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `id` | *string* | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `includedGrant` | *number* | :heavy_check_mark: | N/A | -| `prepaidGrant` | *number* | :heavy_check_mark: | N/A | -| `remaining` | *number* | :heavy_check_mark: | N/A | -| `usage` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `reset` | [models.BalancesTrackReset](../models/balances-track-reset.md) | :heavy_check_mark: | N/A | -| `price` | [models.BalancesTrackPrice](../models/balances-track-price.md) | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-interval-union.md b/packages/sdk/docs/models/balances-track-interval-union.md deleted file mode 100644 index 54b043bf3..000000000 --- a/packages/sdk/docs/models/balances-track-interval-union.md +++ /dev/null @@ -1,17 +0,0 @@ -# BalancesTrackIntervalUnion - - -## Supported Types - -### `models.BalancesTrackIntervalEnum` - -```typescript -const value: models.BalancesTrackIntervalEnum = "quarter"; -``` - -### `string` - -```typescript -const value: string = ""; -``` - diff --git a/packages/sdk/docs/models/balances-track-request.md b/packages/sdk/docs/models/balances-track-request.md deleted file mode 100644 index 56c3454eb..000000000 --- a/packages/sdk/docs/models/balances-track-request.md +++ /dev/null @@ -1,23 +0,0 @@ -# BalancesTrackRequest - -## Example Usage - -```typescript -import { BalancesTrackRequest } from "@useautumn/sdk"; - -let value: BalancesTrackRequest = { - customerId: "", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `customerId` | *string* | :heavy_check_mark: | ID which you provided when creating the customer | -| `featureId` | *string* | :heavy_minus_sign: | ID of the feature to track usage for. Required if event_name is not provided. Use this for direct feature tracking. | -| `eventName` | *string* | :heavy_minus_sign: | An [event name](/features/tracking-usage#using-event-names) can be used in place of feature_id. This can be used if multiple features are tracked in the same event. | -| `value` | *number* | :heavy_minus_sign: | The amount of usage to record. Defaults to 1. Can be negative to increase the balance (e.g., when removing a seat). | -| `properties` | Record | :heavy_minus_sign: | Additional properties to attach to this usage event. | -| `idempotencyKey` | *string* | :heavy_minus_sign: | Unique key to prevent duplicate event recording. Use this to safely retry requests without creating duplicate usage records. | -| `entityId` | *string* | :heavy_minus_sign: | If using [entity balances](/features/feature-entities) (eg, seats), the entity ID to track usage for. | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-reset.md b/packages/sdk/docs/models/balances-track-reset.md deleted file mode 100644 index d6ce345bb..000000000 --- a/packages/sdk/docs/models/balances-track-reset.md +++ /dev/null @@ -1,20 +0,0 @@ -# BalancesTrackReset - -## Example Usage - -```typescript -import { BalancesTrackReset } from "@useautumn/sdk"; - -let value: BalancesTrackReset = { - interval: "", - resetsAt: 8514.06, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | -| `interval` | *models.BalancesTrackIntervalUnion* | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `resetsAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-response.md b/packages/sdk/docs/models/balances-track-response.md deleted file mode 100644 index ee6fc647b..000000000 --- a/packages/sdk/docs/models/balances-track-response.md +++ /dev/null @@ -1,35 +0,0 @@ -# BalancesTrackResponse - -OK - -## Example Usage - -```typescript -import { BalancesTrackResponse } from "@useautumn/sdk"; - -let value: BalancesTrackResponse = { - customerId: "", - value: 107.2, - balance: { - featureId: "", - granted: 121.68, - remaining: 7842.83, - usage: 1803.23, - unlimited: false, - overageAllowed: true, - maxPurchase: 8102.46, - nextResetAt: 9943.89, - }, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `customerId` | *string* | :heavy_check_mark: | The ID of the customer | -| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity (if provided) | -| `eventName` | *string* | :heavy_minus_sign: | The name of the event | -| `value` | *number* | :heavy_check_mark: | N/A | -| `balance` | [models.BalancesTrackBalance](../models/balances-track-balance.md) | :heavy_check_mark: | N/A | -| `balances` | Record | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-rollover.md b/packages/sdk/docs/models/balances-track-rollover.md deleted file mode 100644 index 521af0eb3..000000000 --- a/packages/sdk/docs/models/balances-track-rollover.md +++ /dev/null @@ -1,19 +0,0 @@ -# BalancesTrackRollover - -## Example Usage - -```typescript -import { BalancesTrackRollover } from "@useautumn/sdk"; - -let value: BalancesTrackRollover = { - balance: 4637.4, - expiresAt: 9268.72, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `balance` | *number* | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-update-interval.md b/packages/sdk/docs/models/balances-update-interval.md deleted file mode 100644 index ffdf09208..000000000 --- a/packages/sdk/docs/models/balances-update-interval.md +++ /dev/null @@ -1,17 +0,0 @@ -# BalancesUpdateInterval - -The interval to update balance for. - -## Example Usage - -```typescript -import { BalancesUpdateInterval } from "@useautumn/sdk"; - -let value: BalancesUpdateInterval = "minute"; -``` - -## Values - -```typescript -"one_off" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-update-request.md b/packages/sdk/docs/models/balances-update-request.md deleted file mode 100644 index 1187f049b..000000000 --- a/packages/sdk/docs/models/balances-update-request.md +++ /dev/null @@ -1,27 +0,0 @@ -# BalancesUpdateRequest - -## Example Usage - -```typescript -import { BalancesUpdateRequest } from "@useautumn/sdk"; - -let value: BalancesUpdateRequest = { - customerId: "", - featureId: "", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `customerId` | *string* | :heavy_check_mark: | The ID of the customer. | -| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity to update balance for (if using entity balances). | -| `featureId` | *string* | :heavy_check_mark: | The ID of the feature to update balance for. | -| `currentBalance` | *number* | :heavy_minus_sign: | The new balance value to set. | -| `interval` | [models.BalancesUpdateInterval](../models/balances-update-interval.md) | :heavy_minus_sign: | The interval to update balance for. | -| `grantedBalance` | *number* | :heavy_minus_sign: | N/A | -| `usage` | *number* | :heavy_minus_sign: | N/A | -| `customerEntitlementId` | *string* | :heavy_minus_sign: | N/A | -| `nextResetAt` | *number* | :heavy_minus_sign: | N/A | -| `addToBalance` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances.md b/packages/sdk/docs/models/balances.md index fd59d3018..a450c12f9 100644 --- a/packages/sdk/docs/models/balances.md +++ b/packages/sdk/docs/models/balances.md @@ -6,29 +6,46 @@ import { Balances } from "@useautumn/sdk"; let value: Balances = { - featureId: "", - granted: 3195.9, - remaining: 3289.89, - usage: 4599.27, + featureId: "messages", + granted: 100, + remaining: 72, + usage: 28, unlimited: false, overageAllowed: false, - maxPurchase: 1182.05, - nextResetAt: 5644.6, + maxPurchase: null, + nextResetAt: 1773851121437, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "pro_plan", + includedGrant: 100, + prepaidGrant: 0, + remaining: 72, + usage: 28, + unlimited: false, + reset: { + interval: "month", + resetsAt: 1773851121437, + }, + price: null, + expiresAt: null, + }, + ], }; ``` ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `feature` | [models.CustomerFeature](../models/customer-feature.md) | :heavy_minus_sign: | N/A | -| `granted` | *number* | :heavy_check_mark: | N/A | -| `remaining` | *number* | :heavy_check_mark: | N/A | -| `usage` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `overageAllowed` | *boolean* | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | -| `nextResetAt` | *number* | :heavy_check_mark: | N/A | -| `breakdown` | [models.Breakdown](../models/breakdown.md)[] | :heavy_minus_sign: | N/A | -| `rollovers` | [models.CustomerRollover](../models/customer-rollover.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | The feature ID this balance is for. | +| `feature` | [models.CustomerFeature](../models/customer-feature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `granted` | *number* | :heavy_check_mark: | Total balance granted (included + prepaid). | +| `remaining` | *number* | :heavy_check_mark: | Remaining balance available for use. | +| `usage` | *number* | :heavy_check_mark: | Total usage consumed in the current period. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether this feature has unlimited usage. | +| `overageAllowed` | *boolean* | :heavy_check_mark: | Whether usage beyond the granted balance is allowed (with overage charges). | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum quantity that can be purchased as a top-up, or null for unlimited. | +| `nextResetAt` | *number* | :heavy_check_mark: | Timestamp when the balance will reset, or null for no reset. | +| `breakdown` | [models.Breakdown](../models/breakdown.md)[] | :heavy_minus_sign: | Detailed breakdown of balance sources when stacking multiple plans or grants. | +| `rollovers` | [models.CustomerRollover](../models/customer-rollover.md)[] | :heavy_minus_sign: | Rollover balances carried over from previous periods. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-attach-billing-behavior.md b/packages/sdk/docs/models/billing-attach-billing-behavior.md index 6d65a4c50..8c746b111 100644 --- a/packages/sdk/docs/models/billing-attach-billing-behavior.md +++ b/packages/sdk/docs/models/billing-attach-billing-behavior.md @@ -1,5 +1,7 @@ # BillingAttachBillingBehavior +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. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-attach-code.md b/packages/sdk/docs/models/billing-attach-code.md index bcc209eac..d4692b8a6 100644 --- a/packages/sdk/docs/models/billing-attach-code.md +++ b/packages/sdk/docs/models/billing-attach-code.md @@ -1,5 +1,7 @@ # BillingAttachCode +The type of action required to complete the payment. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-attach-discount-union.md b/packages/sdk/docs/models/billing-attach-discount-union.md index 33876bf7e..01ca4f4bd 100644 --- a/packages/sdk/docs/models/billing-attach-discount-union.md +++ b/packages/sdk/docs/models/billing-attach-discount-union.md @@ -1,5 +1,7 @@ # BillingAttachDiscountUnion +A discount to apply. Can be either a reward ID or a promotion code. + ## Supported Types diff --git a/packages/sdk/docs/models/billing-attach-discount1.md b/packages/sdk/docs/models/billing-attach-discount1.md index 036aadbee..62c4ab597 100644 --- a/packages/sdk/docs/models/billing-attach-discount1.md +++ b/packages/sdk/docs/models/billing-attach-discount1.md @@ -12,6 +12,6 @@ let value: BillingAttachDiscount1 = { ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `rewardId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| `rewardId` | *string* | :heavy_check_mark: | The ID of the reward to apply as a discount. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-attach-discount2.md b/packages/sdk/docs/models/billing-attach-discount2.md index 9bb46e195..b39eb5467 100644 --- a/packages/sdk/docs/models/billing-attach-discount2.md +++ b/packages/sdk/docs/models/billing-attach-discount2.md @@ -12,6 +12,6 @@ let value: BillingAttachDiscount2 = { ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `promotionCode` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `promotionCode` | *string* | :heavy_check_mark: | The promotion code to apply as a discount. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-attach-feature-quantities.md b/packages/sdk/docs/models/billing-attach-feature-quantity.md similarity index 77% rename from packages/sdk/docs/models/billing-attach-feature-quantities.md rename to packages/sdk/docs/models/billing-attach-feature-quantity.md index 58d255182..1e4cab264 100644 --- a/packages/sdk/docs/models/billing-attach-feature-quantities.md +++ b/packages/sdk/docs/models/billing-attach-feature-quantity.md @@ -1,11 +1,11 @@ -# BillingAttachFeatureQuantities +# BillingAttachFeatureQuantity ## Example Usage ```typescript -import { BillingAttachFeatureQuantities } from "@useautumn/sdk"; +import { BillingAttachFeatureQuantity } from "@useautumn/sdk"; -let value: BillingAttachFeatureQuantities = { +let value: BillingAttachFeatureQuantity = { featureId: "", }; ``` diff --git a/packages/sdk/docs/models/billing-attach-invoice-mode.md b/packages/sdk/docs/models/billing-attach-invoice-mode.md index 1a41dead8..a341890b4 100644 --- a/packages/sdk/docs/models/billing-attach-invoice-mode.md +++ b/packages/sdk/docs/models/billing-attach-invoice-mode.md @@ -1,5 +1,7 @@ # BillingAttachInvoiceMode +Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + ## Example Usage ```typescript @@ -12,8 +14,8 @@ let value: BillingAttachInvoiceMode = { ## Fields -| Field | Type | Required | Description | -| ----------------------- | ----------------------- | ----------------------- | ----------------------- | -| `enabled` | *boolean* | :heavy_check_mark: | N/A | -| `enablePlanImmediately` | *boolean* | :heavy_minus_sign: | N/A | -| `finalize` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `enabled` | *boolean* | :heavy_check_mark: | When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. | +| `enablePlanImmediately` | *boolean* | :heavy_minus_sign: | If true, enables the plan immediately even though the invoice is not paid yet. | +| `finalize` | *boolean* | :heavy_minus_sign: | If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-attach-invoice.md b/packages/sdk/docs/models/billing-attach-invoice.md index ba086bf65..be6a8d739 100644 --- a/packages/sdk/docs/models/billing-attach-invoice.md +++ b/packages/sdk/docs/models/billing-attach-invoice.md @@ -1,5 +1,7 @@ # BillingAttachInvoice +Invoice details if an invoice was created. Only present when a charge was made. + ## Example Usage ```typescript @@ -16,10 +18,10 @@ let value: BillingAttachInvoice = { ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `status` | *string* | :heavy_check_mark: | N/A | -| `stripeId` | *string* | :heavy_check_mark: | N/A | -| `total` | *number* | :heavy_check_mark: | N/A | -| `currency` | *string* | :heavy_check_mark: | N/A | -| `hostedInvoiceUrl` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| `status` | *string* | :heavy_check_mark: | The status of the invoice (e.g., 'paid', 'open', 'draft'). | +| `stripeId` | *string* | :heavy_check_mark: | The Stripe invoice ID. | +| `total` | *number* | :heavy_check_mark: | The total amount of the invoice in cents. | +| `currency` | *string* | :heavy_check_mark: | The three-letter ISO currency code (e.g., 'usd'). | +| `hostedInvoiceUrl` | *string* | :heavy_check_mark: | URL to the hosted invoice page where the customer can view and pay the invoice. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-attach-plan-schedule.md b/packages/sdk/docs/models/billing-attach-plan-schedule.md index e4df2fb83..680bc5881 100644 --- a/packages/sdk/docs/models/billing-attach-plan-schedule.md +++ b/packages/sdk/docs/models/billing-attach-plan-schedule.md @@ -1,5 +1,7 @@ # BillingAttachPlanSchedule +When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-attach-redirect-mode.md b/packages/sdk/docs/models/billing-attach-redirect-mode.md deleted file mode 100644 index a458416b2..000000000 --- a/packages/sdk/docs/models/billing-attach-redirect-mode.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingAttachRedirectMode - -## Example Usage - -```typescript -import { BillingAttachRedirectMode } from "@useautumn/sdk"; - -let value: BillingAttachRedirectMode = "never"; -``` - -## Values - -```typescript -"always" | "if_required" | "never" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-attach-required-action.md b/packages/sdk/docs/models/billing-attach-required-action.md index c1e2954e7..5fd1fcd0d 100644 --- a/packages/sdk/docs/models/billing-attach-required-action.md +++ b/packages/sdk/docs/models/billing-attach-required-action.md @@ -1,5 +1,7 @@ # BillingAttachRequiredAction +Details about any action required to complete the payment. Present when the payment could not be processed automatically. + ## Example Usage ```typescript @@ -15,5 +17,5 @@ let value: BillingAttachRequiredAction = { | Field | Type | Required | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `code` | [models.BillingAttachCode](../models/billing-attach-code.md) | :heavy_check_mark: | N/A | -| `reason` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file +| `code` | [models.BillingAttachCode](../models/billing-attach-code.md) | :heavy_check_mark: | The type of action required to complete the payment. | +| `reason` | *string* | :heavy_check_mark: | A human-readable explanation of why this action is required. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-attach-response.md b/packages/sdk/docs/models/billing-attach-response.md index c8c7678f6..f747a42c8 100644 --- a/packages/sdk/docs/models/billing-attach-response.md +++ b/packages/sdk/docs/models/billing-attach-response.md @@ -8,17 +8,17 @@ OK import { BillingAttachResponse } from "@useautumn/sdk"; let value: BillingAttachResponse = { - customerId: "", - paymentUrl: "https://shy-stock.com/", + customerId: "cus_123", + paymentUrl: "https://checkout.stripe.com/...", }; ``` ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | -| `customerId` | *string* | :heavy_check_mark: | N/A | -| `entityId` | *string* | :heavy_minus_sign: | N/A | -| `invoice` | [models.BillingAttachInvoice](../models/billing-attach-invoice.md) | :heavy_minus_sign: | N/A | -| `paymentUrl` | *string* | :heavy_check_mark: | N/A | -| `requiredAction` | [models.BillingAttachRequiredAction](../models/billing-attach-required-action.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer. | +| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity, if the plan was attached to an entity. | +| `invoice` | [models.BillingAttachInvoice](../models/billing-attach-invoice.md) | :heavy_minus_sign: | Invoice details if an invoice was created. Only present when a charge was made. | +| `paymentUrl` | *string* | :heavy_check_mark: | URL to redirect the customer to complete payment. Null if no payment action is required. | +| `requiredAction` | [models.BillingAttachRequiredAction](../models/billing-attach-required-action.md) | :heavy_minus_sign: | Details about any action required to complete the payment. Present when the payment could not be processed automatically. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-billing-behavior.md b/packages/sdk/docs/models/billing-preview-attach-billing-behavior.md deleted file mode 100644 index f1a3f9de2..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-billing-behavior.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewAttachBillingBehavior - -## Example Usage - -```typescript -import { BillingPreviewAttachBillingBehavior } from "@useautumn/sdk"; - -let value: BillingPreviewAttachBillingBehavior = "next_cycle_only"; -``` - -## Values - -```typescript -"prorate_immediately" | "next_cycle_only" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-billing-method-request.md b/packages/sdk/docs/models/billing-preview-attach-billing-method-request.md deleted file mode 100644 index ca72a1af6..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-billing-method-request.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewAttachBillingMethodRequest - -## Example Usage - -```typescript -import { BillingPreviewAttachBillingMethodRequest } from "@useautumn/sdk"; - -let value: BillingPreviewAttachBillingMethodRequest = "prepaid"; -``` - -## Values - -```typescript -"prepaid" | "usage_based" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-customize-reset.md b/packages/sdk/docs/models/billing-preview-attach-customize-reset.md deleted file mode 100644 index 417e78269..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-customize-reset.md +++ /dev/null @@ -1,18 +0,0 @@ -# BillingPreviewAttachCustomizeReset - -## Example Usage - -```typescript -import { BillingPreviewAttachCustomizeReset } from "@useautumn/sdk"; - -let value: BillingPreviewAttachCustomizeReset = { - interval: "year", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | -| `interval` | [models.BillingPreviewAttachItemResetInterval](../models/billing-preview-attach-item-reset-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-customize.md b/packages/sdk/docs/models/billing-preview-attach-customize.md deleted file mode 100644 index cbec9da51..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-customize.md +++ /dev/null @@ -1,18 +0,0 @@ -# BillingPreviewAttachCustomize - -Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - -## Example Usage - -```typescript -import { BillingPreviewAttachCustomize } from "@useautumn/sdk"; - -let value: BillingPreviewAttachCustomize = {}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `price` | [models.BillingPreviewAttachPriceRequest](../models/billing-preview-attach-price-request.md) | :heavy_minus_sign: | N/A | -| `items` | [models.BillingPreviewAttachItem](../models/billing-preview-attach-item.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-discount-request1.md b/packages/sdk/docs/models/billing-preview-attach-discount-request1.md deleted file mode 100644 index 6a2be4450..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-discount-request1.md +++ /dev/null @@ -1,17 +0,0 @@ -# BillingPreviewAttachDiscountRequest1 - -## Example Usage - -```typescript -import { BillingPreviewAttachDiscountRequest1 } from "@useautumn/sdk"; - -let value: BillingPreviewAttachDiscountRequest1 = { - rewardId: "", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `rewardId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-discount-request2.md b/packages/sdk/docs/models/billing-preview-attach-discount-request2.md deleted file mode 100644 index 94fec8071..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-discount-request2.md +++ /dev/null @@ -1,17 +0,0 @@ -# BillingPreviewAttachDiscountRequest2 - -## Example Usage - -```typescript -import { BillingPreviewAttachDiscountRequest2 } from "@useautumn/sdk"; - -let value: BillingPreviewAttachDiscountRequest2 = { - promotionCode: "", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `promotionCode` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-discount-union.md b/packages/sdk/docs/models/billing-preview-attach-discount-union.md deleted file mode 100644 index 77b263393..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-discount-union.md +++ /dev/null @@ -1,21 +0,0 @@ -# BillingPreviewAttachDiscountUnion - - -## Supported Types - -### `models.BillingPreviewAttachDiscountRequest1` - -```typescript -const value: models.BillingPreviewAttachDiscountRequest1 = { - rewardId: "", -}; -``` - -### `models.BillingPreviewAttachDiscountRequest2` - -```typescript -const value: models.BillingPreviewAttachDiscountRequest2 = { - promotionCode: "", -}; -``` - diff --git a/packages/sdk/docs/models/billing-preview-attach-duration-type.md b/packages/sdk/docs/models/billing-preview-attach-duration-type.md deleted file mode 100644 index eab91bd34..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-duration-type.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewAttachDurationType - -## Example Usage - -```typescript -import { BillingPreviewAttachDurationType } from "@useautumn/sdk"; - -let value: BillingPreviewAttachDurationType = "month"; -``` - -## Values - -```typescript -"day" | "month" | "year" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-effective-period.md b/packages/sdk/docs/models/billing-preview-attach-effective-period.md deleted file mode 100644 index 117a1c0ab..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-effective-period.md +++ /dev/null @@ -1,19 +0,0 @@ -# BillingPreviewAttachEffectivePeriod - -## Example Usage - -```typescript -import { BillingPreviewAttachEffectivePeriod } from "@useautumn/sdk"; - -let value: BillingPreviewAttachEffectivePeriod = { - start: 5919.24, - end: 6879.21, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `start` | *number* | :heavy_check_mark: | N/A | -| `end` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-expiry-duration-type.md b/packages/sdk/docs/models/billing-preview-attach-expiry-duration-type.md deleted file mode 100644 index 5c598e5bd..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-expiry-duration-type.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewAttachExpiryDurationType - -## Example Usage - -```typescript -import { BillingPreviewAttachExpiryDurationType } from "@useautumn/sdk"; - -let value: BillingPreviewAttachExpiryDurationType = "month"; -``` - -## Values - -```typescript -"month" | "forever" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-free-trial.md b/packages/sdk/docs/models/billing-preview-attach-free-trial.md deleted file mode 100644 index 59c9aef5e..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-free-trial.md +++ /dev/null @@ -1,19 +0,0 @@ -# BillingPreviewAttachFreeTrial - -## Example Usage - -```typescript -import { BillingPreviewAttachFreeTrial } from "@useautumn/sdk"; - -let value: BillingPreviewAttachFreeTrial = { - durationLength: 9033.55, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `durationLength` | *number* | :heavy_check_mark: | N/A | -| `durationType` | [models.BillingPreviewAttachDurationType](../models/billing-preview-attach-duration-type.md) | :heavy_minus_sign: | N/A | -| `cardRequired` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-globals.md b/packages/sdk/docs/models/billing-preview-attach-globals.md deleted file mode 100644 index 39f8ffc2e..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-globals.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewAttachGlobals - -## Example Usage - -```typescript -import { BillingPreviewAttachGlobals } from "@useautumn/sdk"; - -let value: BillingPreviewAttachGlobals = {}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-invoice-mode.md b/packages/sdk/docs/models/billing-preview-attach-invoice-mode.md deleted file mode 100644 index 9ed84d9ce..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-invoice-mode.md +++ /dev/null @@ -1,19 +0,0 @@ -# BillingPreviewAttachInvoiceMode - -## Example Usage - -```typescript -import { BillingPreviewAttachInvoiceMode } from "@useautumn/sdk"; - -let value: BillingPreviewAttachInvoiceMode = { - enabled: true, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ----------------------- | ----------------------- | ----------------------- | ----------------------- | -| `enabled` | *boolean* | :heavy_check_mark: | N/A | -| `enablePlanImmediately` | *boolean* | :heavy_minus_sign: | N/A | -| `finalize` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-item-price-interval.md b/packages/sdk/docs/models/billing-preview-attach-item-price-interval.md deleted file mode 100644 index c5269affb..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-item-price-interval.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewAttachItemPriceInterval - -## Example Usage - -```typescript -import { BillingPreviewAttachItemPriceInterval } from "@useautumn/sdk"; - -let value: BillingPreviewAttachItemPriceInterval = "year"; -``` - -## Values - -```typescript -"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-item-price.md b/packages/sdk/docs/models/billing-preview-attach-item-price.md deleted file mode 100644 index 27bd7af3a..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-item-price.md +++ /dev/null @@ -1,24 +0,0 @@ -# BillingPreviewAttachItemPrice - -## Example Usage - -```typescript -import { BillingPreviewAttachItemPrice } from "@useautumn/sdk"; - -let value: BillingPreviewAttachItemPrice = { - interval: "quarter", - billingMethod: "usage_based", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_minus_sign: | N/A | -| `tiers` | [models.BillingPreviewAttachTierRequest](../models/billing-preview-attach-tier-request.md)[] | :heavy_minus_sign: | N/A | -| `interval` | [models.BillingPreviewAttachItemPriceInterval](../models/billing-preview-attach-item-price-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `billingUnits` | *number* | :heavy_minus_sign: | N/A | -| `billingMethod` | [models.BillingPreviewAttachBillingMethodRequest](../models/billing-preview-attach-billing-method-request.md) | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-item-reset-interval.md b/packages/sdk/docs/models/billing-preview-attach-item-reset-interval.md deleted file mode 100644 index 09ab7360d..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-item-reset-interval.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewAttachItemResetInterval - -## Example Usage - -```typescript -import { BillingPreviewAttachItemResetInterval } from "@useautumn/sdk"; - -let value: BillingPreviewAttachItemResetInterval = "quarter"; -``` - -## Values - -```typescript -"one_off" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-item.md b/packages/sdk/docs/models/billing-preview-attach-item.md deleted file mode 100644 index 8bad9add4..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-item.md +++ /dev/null @@ -1,23 +0,0 @@ -# BillingPreviewAttachItem - -## Example Usage - -```typescript -import { BillingPreviewAttachItem } from "@useautumn/sdk"; - -let value: BillingPreviewAttachItem = { - featureId: "", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `included` | *number* | :heavy_minus_sign: | N/A | -| `unlimited` | *boolean* | :heavy_minus_sign: | N/A | -| `reset` | [models.BillingPreviewAttachCustomizeReset](../models/billing-preview-attach-customize-reset.md) | :heavy_minus_sign: | N/A | -| `price` | [models.BillingPreviewAttachItemPrice](../models/billing-preview-attach-item-price.md) | :heavy_minus_sign: | N/A | -| `proration` | [models.BillingPreviewAttachProration](../models/billing-preview-attach-proration.md) | :heavy_minus_sign: | N/A | -| `rollover` | [models.BillingPreviewAttachRolloverRequest](../models/billing-preview-attach-rollover-request.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-line-item.md b/packages/sdk/docs/models/billing-preview-attach-line-item.md deleted file mode 100644 index cabb85b71..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-line-item.md +++ /dev/null @@ -1,32 +0,0 @@ -# BillingPreviewAttachLineItem - -## Example Usage - -```typescript -import { BillingPreviewAttachLineItem } from "@useautumn/sdk"; - -let value: BillingPreviewAttachLineItem = { - title: "", - description: - "anti plagiarise why gah bludgeon from whoever experience celsius", - amount: 9045.15, - planId: "", - totalQuantity: 8695.78, - paidQuantity: 1093.11, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | -| `title` | *string* | :heavy_check_mark: | N/A | -| `description` | *string* | :heavy_check_mark: | N/A | -| `amount` | *number* | :heavy_check_mark: | N/A | -| `discounts` | [models.BillingPreviewAttachDiscountResponse](../models/billing-preview-attach-discount-response.md)[] | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `totalQuantity` | *number* | :heavy_check_mark: | N/A | -| `paidQuantity` | *number* | :heavy_check_mark: | N/A | -| `deferredForTrial` | *boolean* | :heavy_minus_sign: | N/A | -| `effectivePeriod` | [models.BillingPreviewAttachEffectivePeriod](../models/billing-preview-attach-effective-period.md) | :heavy_minus_sign: | N/A | -| `isBase` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-next-cycle-discount.md b/packages/sdk/docs/models/billing-preview-attach-next-cycle-discount.md deleted file mode 100644 index 393c8bb4d..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-next-cycle-discount.md +++ /dev/null @@ -1,20 +0,0 @@ -# BillingPreviewAttachNextCycleDiscount - -## Example Usage - -```typescript -import { BillingPreviewAttachNextCycleDiscount } from "@useautumn/sdk"; - -let value: BillingPreviewAttachNextCycleDiscount = { - amountOff: 3651.45, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `amountOff` | *number* | :heavy_check_mark: | N/A | -| `percentOff` | *number* | :heavy_minus_sign: | N/A | -| `stripeCouponId` | *string* | :heavy_minus_sign: | N/A | -| `couponName` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-next-cycle-effective-period.md b/packages/sdk/docs/models/billing-preview-attach-next-cycle-effective-period.md deleted file mode 100644 index f08fff29f..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-next-cycle-effective-period.md +++ /dev/null @@ -1,19 +0,0 @@ -# BillingPreviewAttachNextCycleEffectivePeriod - -## Example Usage - -```typescript -import { BillingPreviewAttachNextCycleEffectivePeriod } from "@useautumn/sdk"; - -let value: BillingPreviewAttachNextCycleEffectivePeriod = { - start: 9994.41, - end: 2925.89, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `start` | *number* | :heavy_check_mark: | N/A | -| `end` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-next-cycle-line-item.md b/packages/sdk/docs/models/billing-preview-attach-next-cycle-line-item.md deleted file mode 100644 index d31f66e62..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-next-cycle-line-item.md +++ /dev/null @@ -1,31 +0,0 @@ -# BillingPreviewAttachNextCycleLineItem - -## Example Usage - -```typescript -import { BillingPreviewAttachNextCycleLineItem } from "@useautumn/sdk"; - -let value: BillingPreviewAttachNextCycleLineItem = { - title: "", - description: "overdub boohoo along instructor", - amount: 7376.73, - planId: "", - totalQuantity: 9732.07, - paidQuantity: 880.16, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| `title` | *string* | :heavy_check_mark: | N/A | -| `description` | *string* | :heavy_check_mark: | N/A | -| `amount` | *number* | :heavy_check_mark: | N/A | -| `discounts` | [models.BillingPreviewAttachNextCycleDiscount](../models/billing-preview-attach-next-cycle-discount.md)[] | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `totalQuantity` | *number* | :heavy_check_mark: | N/A | -| `paidQuantity` | *number* | :heavy_check_mark: | N/A | -| `deferredForTrial` | *boolean* | :heavy_minus_sign: | N/A | -| `effectivePeriod` | [models.BillingPreviewAttachNextCycleEffectivePeriod](../models/billing-preview-attach-next-cycle-effective-period.md) | :heavy_minus_sign: | N/A | -| `isBase` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-next-cycle.md b/packages/sdk/docs/models/billing-preview-attach-next-cycle.md deleted file mode 100644 index d51665137..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-next-cycle.md +++ /dev/null @@ -1,21 +0,0 @@ -# BillingPreviewAttachNextCycle - -## Example Usage - -```typescript -import { BillingPreviewAttachNextCycle } from "@useautumn/sdk"; - -let value: BillingPreviewAttachNextCycle = { - startsAt: 9741.12, - total: 5338.2, - lineItems: [], -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| `startsAt` | *number* | :heavy_check_mark: | N/A | -| `total` | *number* | :heavy_check_mark: | N/A | -| `lineItems` | [models.BillingPreviewAttachNextCycleLineItem](../models/billing-preview-attach-next-cycle-line-item.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-on-decrease.md b/packages/sdk/docs/models/billing-preview-attach-on-decrease.md deleted file mode 100644 index 2594bdb73..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-on-decrease.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewAttachOnDecrease - -## Example Usage - -```typescript -import { BillingPreviewAttachOnDecrease } from "@useautumn/sdk"; - -let value: BillingPreviewAttachOnDecrease = "no_prorations"; -``` - -## Values - -```typescript -"prorate" | "prorate_immediately" | "prorate_next_cycle" | "none" | "no_prorations" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-on-increase.md b/packages/sdk/docs/models/billing-preview-attach-on-increase.md deleted file mode 100644 index 0cdf2b951..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-on-increase.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewAttachOnIncrease - -## Example Usage - -```typescript -import { BillingPreviewAttachOnIncrease } from "@useautumn/sdk"; - -let value: BillingPreviewAttachOnIncrease = "bill_next_cycle"; -``` - -## Values - -```typescript -"bill_immediately" | "prorate_immediately" | "prorate_next_cycle" | "bill_next_cycle" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-plan-schedule.md b/packages/sdk/docs/models/billing-preview-attach-plan-schedule.md deleted file mode 100644 index 578e8a7a9..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-plan-schedule.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewAttachPlanSchedule - -## Example Usage - -```typescript -import { BillingPreviewAttachPlanSchedule } from "@useautumn/sdk"; - -let value: BillingPreviewAttachPlanSchedule = "immediate"; -``` - -## Values - -```typescript -"immediate" | "end_of_cycle" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-price-interval.md b/packages/sdk/docs/models/billing-preview-attach-price-interval.md deleted file mode 100644 index 69e8688ce..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-price-interval.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewAttachPriceInterval - -## Example Usage - -```typescript -import { BillingPreviewAttachPriceInterval } from "@useautumn/sdk"; - -let value: BillingPreviewAttachPriceInterval = "week"; -``` - -## Values - -```typescript -"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-price-request.md b/packages/sdk/docs/models/billing-preview-attach-price-request.md deleted file mode 100644 index f746aaf68..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-price-request.md +++ /dev/null @@ -1,20 +0,0 @@ -# BillingPreviewAttachPriceRequest - -## Example Usage - -```typescript -import { BillingPreviewAttachPriceRequest } from "@useautumn/sdk"; - -let value: BillingPreviewAttachPriceRequest = { - amount: 1548.13, - interval: "semi_annual", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_check_mark: | N/A | -| `interval` | [models.BillingPreviewAttachPriceInterval](../models/billing-preview-attach-price-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-proration.md b/packages/sdk/docs/models/billing-preview-attach-proration.md deleted file mode 100644 index fb1232c9c..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-proration.md +++ /dev/null @@ -1,19 +0,0 @@ -# BillingPreviewAttachProration - -## Example Usage - -```typescript -import { BillingPreviewAttachProration } from "@useautumn/sdk"; - -let value: BillingPreviewAttachProration = { - onIncrease: "bill_immediately", - onDecrease: "no_prorations", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `onIncrease` | [models.BillingPreviewAttachOnIncrease](../models/billing-preview-attach-on-increase.md) | :heavy_check_mark: | N/A | -| `onDecrease` | [models.BillingPreviewAttachOnDecrease](../models/billing-preview-attach-on-decrease.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-redirect-mode.md b/packages/sdk/docs/models/billing-preview-attach-redirect-mode.md deleted file mode 100644 index 784a14506..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-redirect-mode.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewAttachRedirectMode - -## Example Usage - -```typescript -import { BillingPreviewAttachRedirectMode } from "@useautumn/sdk"; - -let value: BillingPreviewAttachRedirectMode = "if_required"; -``` - -## Values - -```typescript -"always" | "if_required" | "never" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-response.md b/packages/sdk/docs/models/billing-preview-attach-response.md deleted file mode 100644 index bea2b64d8..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-response.md +++ /dev/null @@ -1,98 +0,0 @@ -# BillingPreviewAttachResponse - -OK - -## Example Usage - -```typescript -import { BillingPreviewAttachResponse } from "@useautumn/sdk"; - -let value: BillingPreviewAttachResponse = { - customerId: "", - lineItems: [ - { - title: "", - description: - "what finally apparatus coaxingly atop inside amid heavily CD notwithstanding", - amount: 8002.47, - planId: "", - totalQuantity: 1699.59, - paidQuantity: 5709.75, - }, - ], - total: 3142.76, - currency: "Surinam Dollar", - incoming: [ - { - plan: { - id: "", - name: "", - description: "very neaten definitive psst geez times gah", - group: "", - version: 762.38, - addOn: false, - autoEnable: true, - price: { - amount: 3075.99, - interval: "one_off", - }, - items: [ - { - featureId: "", - included: 7842.81, - unlimited: false, - reset: { - interval: "year", - }, - price: { - interval: "one_off", - billingUnits: 5268.83, - billingMethod: "usage_based", - maxPurchase: 9846.03, - }, - }, - ], - createdAt: 7030.5, - env: "live", - archived: true, - baseVariantId: "", - }, - featureQuantities: [ - { - featureId: "", - quantity: 4242.71, - }, - ], - balances: { - "key": { - featureId: "", - granted: 3858.89, - remaining: 9478.44, - usage: 8.77, - unlimited: false, - overageAllowed: true, - maxPurchase: 7143.31, - nextResetAt: 4884.95, - }, - }, - }, - ], - outgoing: [], - redirectType: "stripe_checkout", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `customerId` | *string* | :heavy_check_mark: | N/A | -| `lineItems` | [models.BillingPreviewAttachLineItem](../models/billing-preview-attach-line-item.md)[] | :heavy_check_mark: | N/A | -| `total` | *number* | :heavy_check_mark: | N/A | -| `currency` | *string* | :heavy_check_mark: | N/A | -| `periodStart` | *number* | :heavy_minus_sign: | N/A | -| `periodEnd` | *number* | :heavy_minus_sign: | N/A | -| `nextCycle` | [models.BillingPreviewAttachNextCycle](../models/billing-preview-attach-next-cycle.md) | :heavy_minus_sign: | N/A | -| `incoming` | [models.Incoming](../models/incoming.md)[] | :heavy_check_mark: | N/A | -| `outgoing` | [models.Outgoing](../models/outgoing.md)[] | :heavy_check_mark: | N/A | -| `redirectType` | [models.RedirectType](../models/redirect-type.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-rollover-request.md b/packages/sdk/docs/models/billing-preview-attach-rollover-request.md deleted file mode 100644 index b079a076b..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-rollover-request.md +++ /dev/null @@ -1,19 +0,0 @@ -# BillingPreviewAttachRolloverRequest - -## Example Usage - -```typescript -import { BillingPreviewAttachRolloverRequest } from "@useautumn/sdk"; - -let value: BillingPreviewAttachRolloverRequest = { - expiryDurationType: "forever", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | -| `max` | *number* | :heavy_minus_sign: | N/A | -| `expiryDurationType` | [models.BillingPreviewAttachExpiryDurationType](../models/billing-preview-attach-expiry-duration-type.md) | :heavy_check_mark: | N/A | -| `expiryDurationLength` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-tier-request.md b/packages/sdk/docs/models/billing-preview-attach-tier-request.md deleted file mode 100644 index 6e4f087b8..000000000 --- a/packages/sdk/docs/models/billing-preview-attach-tier-request.md +++ /dev/null @@ -1,19 +0,0 @@ -# BillingPreviewAttachTierRequest - -## Example Usage - -```typescript -import { BillingPreviewAttachTierRequest } from "@useautumn/sdk"; - -let value: BillingPreviewAttachTierRequest = { - to: "", - amount: 6583.91, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `to` | *models.BillingPreviewAttachTo* | :heavy_check_mark: | N/A | -| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-billing-behavior.md b/packages/sdk/docs/models/billing-preview-update-billing-behavior.md deleted file mode 100644 index 65abc7d7f..000000000 --- a/packages/sdk/docs/models/billing-preview-update-billing-behavior.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewUpdateBillingBehavior - -## Example Usage - -```typescript -import { BillingPreviewUpdateBillingBehavior } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateBillingBehavior = "prorate_immediately"; -``` - -## Values - -```typescript -"prorate_immediately" | "next_cycle_only" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-billing-method.md b/packages/sdk/docs/models/billing-preview-update-billing-method.md deleted file mode 100644 index 17c9f7556..000000000 --- a/packages/sdk/docs/models/billing-preview-update-billing-method.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewUpdateBillingMethod - -## Example Usage - -```typescript -import { BillingPreviewUpdateBillingMethod } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateBillingMethod = "usage_based"; -``` - -## Values - -```typescript -"prepaid" | "usage_based" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-cancel-action.md b/packages/sdk/docs/models/billing-preview-update-cancel-action.md deleted file mode 100644 index 29380f328..000000000 --- a/packages/sdk/docs/models/billing-preview-update-cancel-action.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewUpdateCancelAction - -## Example Usage - -```typescript -import { BillingPreviewUpdateCancelAction } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateCancelAction = "cancel_end_of_cycle"; -``` - -## Values - -```typescript -"cancel_immediately" | "cancel_end_of_cycle" | "uncancel" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-duration-type.md b/packages/sdk/docs/models/billing-preview-update-duration-type.md deleted file mode 100644 index 6297cd050..000000000 --- a/packages/sdk/docs/models/billing-preview-update-duration-type.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewUpdateDurationType - -## Example Usage - -```typescript -import { BillingPreviewUpdateDurationType } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateDurationType = "month"; -``` - -## Values - -```typescript -"day" | "month" | "year" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-effective-period.md b/packages/sdk/docs/models/billing-preview-update-effective-period.md deleted file mode 100644 index b016f9103..000000000 --- a/packages/sdk/docs/models/billing-preview-update-effective-period.md +++ /dev/null @@ -1,19 +0,0 @@ -# BillingPreviewUpdateEffectivePeriod - -## Example Usage - -```typescript -import { BillingPreviewUpdateEffectivePeriod } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateEffectivePeriod = { - start: 8292.7, - end: 7772.42, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `start` | *number* | :heavy_check_mark: | N/A | -| `end` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-expiry-duration-type.md b/packages/sdk/docs/models/billing-preview-update-expiry-duration-type.md deleted file mode 100644 index cb33c604b..000000000 --- a/packages/sdk/docs/models/billing-preview-update-expiry-duration-type.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewUpdateExpiryDurationType - -## Example Usage - -```typescript -import { BillingPreviewUpdateExpiryDurationType } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateExpiryDurationType = "forever"; -``` - -## Values - -```typescript -"month" | "forever" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-free-trial.md b/packages/sdk/docs/models/billing-preview-update-free-trial.md deleted file mode 100644 index f1927c2b0..000000000 --- a/packages/sdk/docs/models/billing-preview-update-free-trial.md +++ /dev/null @@ -1,19 +0,0 @@ -# BillingPreviewUpdateFreeTrial - -## Example Usage - -```typescript -import { BillingPreviewUpdateFreeTrial } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateFreeTrial = { - durationLength: 2197.72, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `durationLength` | *number* | :heavy_check_mark: | N/A | -| `durationType` | [models.BillingPreviewUpdateDurationType](../models/billing-preview-update-duration-type.md) | :heavy_minus_sign: | N/A | -| `cardRequired` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-globals.md b/packages/sdk/docs/models/billing-preview-update-globals.md deleted file mode 100644 index 729798893..000000000 --- a/packages/sdk/docs/models/billing-preview-update-globals.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewUpdateGlobals - -## Example Usage - -```typescript -import { BillingPreviewUpdateGlobals } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateGlobals = {}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-invoice-mode.md b/packages/sdk/docs/models/billing-preview-update-invoice-mode.md deleted file mode 100644 index e11c822a5..000000000 --- a/packages/sdk/docs/models/billing-preview-update-invoice-mode.md +++ /dev/null @@ -1,19 +0,0 @@ -# BillingPreviewUpdateInvoiceMode - -## Example Usage - -```typescript -import { BillingPreviewUpdateInvoiceMode } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateInvoiceMode = { - enabled: true, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ----------------------- | ----------------------- | ----------------------- | ----------------------- | -| `enabled` | *boolean* | :heavy_check_mark: | N/A | -| `enablePlanImmediately` | *boolean* | :heavy_minus_sign: | N/A | -| `finalize` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-item-price-interval.md b/packages/sdk/docs/models/billing-preview-update-item-price-interval.md deleted file mode 100644 index 47d9b7635..000000000 --- a/packages/sdk/docs/models/billing-preview-update-item-price-interval.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewUpdateItemPriceInterval - -## Example Usage - -```typescript -import { BillingPreviewUpdateItemPriceInterval } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateItemPriceInterval = "semi_annual"; -``` - -## Values - -```typescript -"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-item-price.md b/packages/sdk/docs/models/billing-preview-update-item-price.md deleted file mode 100644 index 438e102c7..000000000 --- a/packages/sdk/docs/models/billing-preview-update-item-price.md +++ /dev/null @@ -1,24 +0,0 @@ -# BillingPreviewUpdateItemPrice - -## Example Usage - -```typescript -import { BillingPreviewUpdateItemPrice } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateItemPrice = { - interval: "week", - billingMethod: "prepaid", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_minus_sign: | N/A | -| `tiers` | [models.BillingPreviewUpdateTier](../models/billing-preview-update-tier.md)[] | :heavy_minus_sign: | N/A | -| `interval` | [models.BillingPreviewUpdateItemPriceInterval](../models/billing-preview-update-item-price-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `billingUnits` | *number* | :heavy_minus_sign: | N/A | -| `billingMethod` | [models.BillingPreviewUpdateBillingMethod](../models/billing-preview-update-billing-method.md) | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-item.md b/packages/sdk/docs/models/billing-preview-update-item.md deleted file mode 100644 index 69874c55c..000000000 --- a/packages/sdk/docs/models/billing-preview-update-item.md +++ /dev/null @@ -1,23 +0,0 @@ -# BillingPreviewUpdateItem - -## Example Usage - -```typescript -import { BillingPreviewUpdateItem } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateItem = { - featureId: "", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `included` | *number* | :heavy_minus_sign: | N/A | -| `unlimited` | *boolean* | :heavy_minus_sign: | N/A | -| `reset` | [models.BillingPreviewUpdateReset](../models/billing-preview-update-reset.md) | :heavy_minus_sign: | N/A | -| `price` | [models.BillingPreviewUpdateItemPrice](../models/billing-preview-update-item-price.md) | :heavy_minus_sign: | N/A | -| `proration` | [models.BillingPreviewUpdateProration](../models/billing-preview-update-proration.md) | :heavy_minus_sign: | N/A | -| `rollover` | [models.BillingPreviewUpdateRollover](../models/billing-preview-update-rollover.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-line-item.md b/packages/sdk/docs/models/billing-preview-update-line-item.md deleted file mode 100644 index 1ed943f4e..000000000 --- a/packages/sdk/docs/models/billing-preview-update-line-item.md +++ /dev/null @@ -1,32 +0,0 @@ -# BillingPreviewUpdateLineItem - -## Example Usage - -```typescript -import { BillingPreviewUpdateLineItem } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateLineItem = { - title: "", - description: - "nun uh-huh clonk towards forenenst major yum justly young brand", - amount: 4163.79, - planId: "", - totalQuantity: 7156.63, - paidQuantity: 2381.01, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `title` | *string* | :heavy_check_mark: | N/A | -| `description` | *string* | :heavy_check_mark: | N/A | -| `amount` | *number* | :heavy_check_mark: | N/A | -| `discounts` | [models.BillingPreviewUpdateDiscount](../models/billing-preview-update-discount.md)[] | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `totalQuantity` | *number* | :heavy_check_mark: | N/A | -| `paidQuantity` | *number* | :heavy_check_mark: | N/A | -| `deferredForTrial` | *boolean* | :heavy_minus_sign: | N/A | -| `effectivePeriod` | [models.BillingPreviewUpdateEffectivePeriod](../models/billing-preview-update-effective-period.md) | :heavy_minus_sign: | N/A | -| `isBase` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-next-cycle-discount.md b/packages/sdk/docs/models/billing-preview-update-next-cycle-discount.md deleted file mode 100644 index f93a1245d..000000000 --- a/packages/sdk/docs/models/billing-preview-update-next-cycle-discount.md +++ /dev/null @@ -1,20 +0,0 @@ -# BillingPreviewUpdateNextCycleDiscount - -## Example Usage - -```typescript -import { BillingPreviewUpdateNextCycleDiscount } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateNextCycleDiscount = { - amountOff: 6564.14, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `amountOff` | *number* | :heavy_check_mark: | N/A | -| `percentOff` | *number* | :heavy_minus_sign: | N/A | -| `stripeCouponId` | *string* | :heavy_minus_sign: | N/A | -| `couponName` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-next-cycle-line-item.md b/packages/sdk/docs/models/billing-preview-update-next-cycle-line-item.md deleted file mode 100644 index 76d411dc0..000000000 --- a/packages/sdk/docs/models/billing-preview-update-next-cycle-line-item.md +++ /dev/null @@ -1,31 +0,0 @@ -# BillingPreviewUpdateNextCycleLineItem - -## Example Usage - -```typescript -import { BillingPreviewUpdateNextCycleLineItem } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateNextCycleLineItem = { - title: "", - description: "as wetly punctual nor upon likewise unless that motionless", - amount: 4446.55, - planId: "", - totalQuantity: 4950.32, - paidQuantity: 9579.37, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| `title` | *string* | :heavy_check_mark: | N/A | -| `description` | *string* | :heavy_check_mark: | N/A | -| `amount` | *number* | :heavy_check_mark: | N/A | -| `discounts` | [models.BillingPreviewUpdateNextCycleDiscount](../models/billing-preview-update-next-cycle-discount.md)[] | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `totalQuantity` | *number* | :heavy_check_mark: | N/A | -| `paidQuantity` | *number* | :heavy_check_mark: | N/A | -| `deferredForTrial` | *boolean* | :heavy_minus_sign: | N/A | -| `effectivePeriod` | [models.BillingPreviewUpdateNextCycleEffectivePeriod](../models/billing-preview-update-next-cycle-effective-period.md) | :heavy_minus_sign: | N/A | -| `isBase` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-next-cycle.md b/packages/sdk/docs/models/billing-preview-update-next-cycle.md deleted file mode 100644 index 3a02cabaf..000000000 --- a/packages/sdk/docs/models/billing-preview-update-next-cycle.md +++ /dev/null @@ -1,30 +0,0 @@ -# BillingPreviewUpdateNextCycle - -## Example Usage - -```typescript -import { BillingPreviewUpdateNextCycle } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateNextCycle = { - startsAt: 5213.81, - total: 8156.95, - lineItems: [ - { - title: "", - description: "given gratefully whoever", - amount: 5703.35, - planId: "", - totalQuantity: 3085.48, - paidQuantity: 8080.87, - }, - ], -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| `startsAt` | *number* | :heavy_check_mark: | N/A | -| `total` | *number* | :heavy_check_mark: | N/A | -| `lineItems` | [models.BillingPreviewUpdateNextCycleLineItem](../models/billing-preview-update-next-cycle-line-item.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-on-decrease.md b/packages/sdk/docs/models/billing-preview-update-on-decrease.md deleted file mode 100644 index 07c18b3a7..000000000 --- a/packages/sdk/docs/models/billing-preview-update-on-decrease.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewUpdateOnDecrease - -## Example Usage - -```typescript -import { BillingPreviewUpdateOnDecrease } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateOnDecrease = "prorate_immediately"; -``` - -## Values - -```typescript -"prorate" | "prorate_immediately" | "prorate_next_cycle" | "none" | "no_prorations" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-on-increase.md b/packages/sdk/docs/models/billing-preview-update-on-increase.md deleted file mode 100644 index b3dcbbcc3..000000000 --- a/packages/sdk/docs/models/billing-preview-update-on-increase.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewUpdateOnIncrease - -## Example Usage - -```typescript -import { BillingPreviewUpdateOnIncrease } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateOnIncrease = "prorate_next_cycle"; -``` - -## Values - -```typescript -"bill_immediately" | "prorate_immediately" | "prorate_next_cycle" | "bill_next_cycle" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-price-interval.md b/packages/sdk/docs/models/billing-preview-update-price-interval.md deleted file mode 100644 index 05d413712..000000000 --- a/packages/sdk/docs/models/billing-preview-update-price-interval.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingPreviewUpdatePriceInterval - -## Example Usage - -```typescript -import { BillingPreviewUpdatePriceInterval } from "@useautumn/sdk"; - -let value: BillingPreviewUpdatePriceInterval = "semi_annual"; -``` - -## Values - -```typescript -"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-price.md b/packages/sdk/docs/models/billing-preview-update-price.md deleted file mode 100644 index ebc914f69..000000000 --- a/packages/sdk/docs/models/billing-preview-update-price.md +++ /dev/null @@ -1,20 +0,0 @@ -# BillingPreviewUpdatePrice - -## Example Usage - -```typescript -import { BillingPreviewUpdatePrice } from "@useautumn/sdk"; - -let value: BillingPreviewUpdatePrice = { - amount: 8566.24, - interval: "one_off", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_check_mark: | N/A | -| `interval` | [models.BillingPreviewUpdatePriceInterval](../models/billing-preview-update-price-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-proration.md b/packages/sdk/docs/models/billing-preview-update-proration.md deleted file mode 100644 index 981563dc9..000000000 --- a/packages/sdk/docs/models/billing-preview-update-proration.md +++ /dev/null @@ -1,19 +0,0 @@ -# BillingPreviewUpdateProration - -## Example Usage - -```typescript -import { BillingPreviewUpdateProration } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateProration = { - onIncrease: "bill_next_cycle", - onDecrease: "no_prorations", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `onIncrease` | [models.BillingPreviewUpdateOnIncrease](../models/billing-preview-update-on-increase.md) | :heavy_check_mark: | N/A | -| `onDecrease` | [models.BillingPreviewUpdateOnDecrease](../models/billing-preview-update-on-decrease.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-reset.md b/packages/sdk/docs/models/billing-preview-update-reset.md deleted file mode 100644 index 1c6ae89cc..000000000 --- a/packages/sdk/docs/models/billing-preview-update-reset.md +++ /dev/null @@ -1,18 +0,0 @@ -# BillingPreviewUpdateReset - -## Example Usage - -```typescript -import { BillingPreviewUpdateReset } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateReset = { - interval: "day", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `interval` | [models.BillingPreviewUpdateResetInterval](../models/billing-preview-update-reset-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-response.md b/packages/sdk/docs/models/billing-preview-update-response.md deleted file mode 100644 index 53925f7fd..000000000 --- a/packages/sdk/docs/models/billing-preview-update-response.md +++ /dev/null @@ -1,28 +0,0 @@ -# BillingPreviewUpdateResponse - -OK - -## Example Usage - -```typescript -import { BillingPreviewUpdateResponse } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateResponse = { - customerId: "", - lineItems: [], - total: 1183.22, - currency: "Pa'anga", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `customerId` | *string* | :heavy_check_mark: | N/A | -| `lineItems` | [models.BillingPreviewUpdateLineItem](../models/billing-preview-update-line-item.md)[] | :heavy_check_mark: | N/A | -| `total` | *number* | :heavy_check_mark: | N/A | -| `currency` | *string* | :heavy_check_mark: | N/A | -| `periodStart` | *number* | :heavy_minus_sign: | N/A | -| `periodEnd` | *number* | :heavy_minus_sign: | N/A | -| `nextCycle` | [models.BillingPreviewUpdateNextCycle](../models/billing-preview-update-next-cycle.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-rollover.md b/packages/sdk/docs/models/billing-preview-update-rollover.md deleted file mode 100644 index 66971dca3..000000000 --- a/packages/sdk/docs/models/billing-preview-update-rollover.md +++ /dev/null @@ -1,19 +0,0 @@ -# BillingPreviewUpdateRollover - -## Example Usage - -```typescript -import { BillingPreviewUpdateRollover } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateRollover = { - expiryDurationType: "month", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | -| `max` | *number* | :heavy_minus_sign: | N/A | -| `expiryDurationType` | [models.BillingPreviewUpdateExpiryDurationType](../models/billing-preview-update-expiry-duration-type.md) | :heavy_check_mark: | N/A | -| `expiryDurationLength` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-tier.md b/packages/sdk/docs/models/billing-preview-update-tier.md deleted file mode 100644 index 29e61165a..000000000 --- a/packages/sdk/docs/models/billing-preview-update-tier.md +++ /dev/null @@ -1,19 +0,0 @@ -# BillingPreviewUpdateTier - -## Example Usage - -```typescript -import { BillingPreviewUpdateTier } from "@useautumn/sdk"; - -let value: BillingPreviewUpdateTier = { - to: 6823.5, - amount: 5086.61, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `to` | *models.BillingPreviewUpdateTo* | :heavy_check_mark: | N/A | -| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-to.md b/packages/sdk/docs/models/billing-preview-update-to.md deleted file mode 100644 index 648197bc9..000000000 --- a/packages/sdk/docs/models/billing-preview-update-to.md +++ /dev/null @@ -1,17 +0,0 @@ -# BillingPreviewUpdateTo - - -## Supported Types - -### `number` - -```typescript -const value: number = 1284.03; -``` - -### `string` - -```typescript -const value: string = ""; -``` - diff --git a/packages/sdk/docs/models/billing-setup-payment-globals.md b/packages/sdk/docs/models/billing-setup-payment-globals.md deleted file mode 100644 index 4eea290da..000000000 --- a/packages/sdk/docs/models/billing-setup-payment-globals.md +++ /dev/null @@ -1,15 +0,0 @@ -# BillingSetupPaymentGlobals - -## Example Usage - -```typescript -import { BillingSetupPaymentGlobals } from "@useautumn/sdk"; - -let value: BillingSetupPaymentGlobals = {}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-setup-payment-request.md b/packages/sdk/docs/models/billing-setup-payment-request.md deleted file mode 100644 index 479b704b9..000000000 --- a/packages/sdk/docs/models/billing-setup-payment-request.md +++ /dev/null @@ -1,20 +0,0 @@ -# BillingSetupPaymentRequest - -## Example Usage - -```typescript -import { BillingSetupPaymentRequest } from "@useautumn/sdk"; - -let value: BillingSetupPaymentRequest = { - customerId: "", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -| `customerId` | *string* | :heavy_check_mark: | The ID of the customer | -| `successUrl` | *string* | :heavy_minus_sign: | URL to redirect to after successful payment setup. Must start with either http:// or https:// | -| `customerData` | [models.CustomerData](../models/customer-data.md) | :heavy_minus_sign: | Customer details to set when creating a customer | -| `checkoutSessionParams` | Record | :heavy_minus_sign: | Additional parameters for the checkout session | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-setup-payment-response.md b/packages/sdk/docs/models/billing-setup-payment-response.md deleted file mode 100644 index 3c424b1ab..000000000 --- a/packages/sdk/docs/models/billing-setup-payment-response.md +++ /dev/null @@ -1,21 +0,0 @@ -# BillingSetupPaymentResponse - -OK - -## Example Usage - -```typescript -import { BillingSetupPaymentResponse } from "@useautumn/sdk"; - -let value: BillingSetupPaymentResponse = { - customerId: "", - url: "https://teeming-backbone.name", -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ----------------------------- | ----------------------------- | ----------------------------- | ----------------------------- | -| `customerId` | *string* | :heavy_check_mark: | The ID of the customer | -| `url` | *string* | :heavy_check_mark: | URL to the payment setup page | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-update-billing-behavior.md b/packages/sdk/docs/models/billing-update-billing-behavior.md index fac0a1e5c..68874c9e1 100644 --- a/packages/sdk/docs/models/billing-update-billing-behavior.md +++ b/packages/sdk/docs/models/billing-update-billing-behavior.md @@ -1,5 +1,7 @@ # BillingUpdateBillingBehavior +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. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-update-cancel-action.md b/packages/sdk/docs/models/billing-update-cancel-action.md index 2a51699d3..68e5a3a00 100644 --- a/packages/sdk/docs/models/billing-update-cancel-action.md +++ b/packages/sdk/docs/models/billing-update-cancel-action.md @@ -1,5 +1,7 @@ # BillingUpdateCancelAction +Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-update-code.md b/packages/sdk/docs/models/billing-update-code.md index 0395a8754..167a5a0db 100644 --- a/packages/sdk/docs/models/billing-update-code.md +++ b/packages/sdk/docs/models/billing-update-code.md @@ -1,5 +1,7 @@ # BillingUpdateCode +The type of action required to complete the payment. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/billing-update-feature-quantities.md b/packages/sdk/docs/models/billing-update-feature-quantity.md similarity index 77% rename from packages/sdk/docs/models/billing-update-feature-quantities.md rename to packages/sdk/docs/models/billing-update-feature-quantity.md index a44251136..b00a0ce49 100644 --- a/packages/sdk/docs/models/billing-update-feature-quantities.md +++ b/packages/sdk/docs/models/billing-update-feature-quantity.md @@ -1,11 +1,11 @@ -# BillingUpdateFeatureQuantities +# BillingUpdateFeatureQuantity ## Example Usage ```typescript -import { BillingUpdateFeatureQuantities } from "@useautumn/sdk"; +import { BillingUpdateFeatureQuantity } from "@useautumn/sdk"; -let value: BillingUpdateFeatureQuantities = { +let value: BillingUpdateFeatureQuantity = { featureId: "", }; ``` diff --git a/packages/sdk/docs/models/billing-update-invoice-mode.md b/packages/sdk/docs/models/billing-update-invoice-mode.md index 41a918bde..2f1827730 100644 --- a/packages/sdk/docs/models/billing-update-invoice-mode.md +++ b/packages/sdk/docs/models/billing-update-invoice-mode.md @@ -1,5 +1,7 @@ # BillingUpdateInvoiceMode +Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + ## Example Usage ```typescript @@ -12,8 +14,8 @@ let value: BillingUpdateInvoiceMode = { ## Fields -| Field | Type | Required | Description | -| ----------------------- | ----------------------- | ----------------------- | ----------------------- | -| `enabled` | *boolean* | :heavy_check_mark: | N/A | -| `enablePlanImmediately` | *boolean* | :heavy_minus_sign: | N/A | -| `finalize` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `enabled` | *boolean* | :heavy_check_mark: | When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. | +| `enablePlanImmediately` | *boolean* | :heavy_minus_sign: | If true, enables the plan immediately even though the invoice is not paid yet. | +| `finalize` | *boolean* | :heavy_minus_sign: | If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-update-invoice.md b/packages/sdk/docs/models/billing-update-invoice.md index 419e5a7ad..13271e157 100644 --- a/packages/sdk/docs/models/billing-update-invoice.md +++ b/packages/sdk/docs/models/billing-update-invoice.md @@ -1,5 +1,7 @@ # BillingUpdateInvoice +Invoice details if an invoice was created. Only present when a charge was made. + ## Example Usage ```typescript @@ -16,10 +18,10 @@ let value: BillingUpdateInvoice = { ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `status` | *string* | :heavy_check_mark: | N/A | -| `stripeId` | *string* | :heavy_check_mark: | N/A | -| `total` | *number* | :heavy_check_mark: | N/A | -| `currency` | *string* | :heavy_check_mark: | N/A | -| `hostedInvoiceUrl` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| `status` | *string* | :heavy_check_mark: | The status of the invoice (e.g., 'paid', 'open', 'draft'). | +| `stripeId` | *string* | :heavy_check_mark: | The Stripe invoice ID. | +| `total` | *number* | :heavy_check_mark: | The total amount of the invoice in cents. | +| `currency` | *string* | :heavy_check_mark: | The three-letter ISO currency code (e.g., 'usd'). | +| `hostedInvoiceUrl` | *string* | :heavy_check_mark: | URL to the hosted invoice page where the customer can view and pay the invoice. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-update-required-action.md b/packages/sdk/docs/models/billing-update-required-action.md index 589db19f4..038687e11 100644 --- a/packages/sdk/docs/models/billing-update-required-action.md +++ b/packages/sdk/docs/models/billing-update-required-action.md @@ -1,5 +1,7 @@ # BillingUpdateRequiredAction +Details about any action required to complete the payment. Present when the payment could not be processed automatically. + ## Example Usage ```typescript @@ -15,5 +17,5 @@ let value: BillingUpdateRequiredAction = { | Field | Type | Required | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `code` | [models.BillingUpdateCode](../models/billing-update-code.md) | :heavy_check_mark: | N/A | -| `reason` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file +| `code` | [models.BillingUpdateCode](../models/billing-update-code.md) | :heavy_check_mark: | The type of action required to complete the payment. | +| `reason` | *string* | :heavy_check_mark: | A human-readable explanation of why this action is required. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-update-response.md b/packages/sdk/docs/models/billing-update-response.md index c0b6d687b..7b55206b3 100644 --- a/packages/sdk/docs/models/billing-update-response.md +++ b/packages/sdk/docs/models/billing-update-response.md @@ -8,17 +8,24 @@ OK import { BillingUpdateResponse } from "@useautumn/sdk"; let value: BillingUpdateResponse = { - customerId: "", - paymentUrl: "https://cavernous-folklore.net/", + customerId: "cus_123", + invoice: { + status: "paid", + stripeId: "in_1234", + total: 1500, + currency: "usd", + hostedInvoiceUrl: "https://invoice.stripe.com/...", + }, + paymentUrl: null, }; ``` ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | -| `customerId` | *string* | :heavy_check_mark: | N/A | -| `entityId` | *string* | :heavy_minus_sign: | N/A | -| `invoice` | [models.BillingUpdateInvoice](../models/billing-update-invoice.md) | :heavy_minus_sign: | N/A | -| `paymentUrl` | *string* | :heavy_check_mark: | N/A | -| `requiredAction` | [models.BillingUpdateRequiredAction](../models/billing-update-required-action.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer. | +| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity, if the plan was attached to an entity. | +| `invoice` | [models.BillingUpdateInvoice](../models/billing-update-invoice.md) | :heavy_minus_sign: | Invoice details if an invoice was created. Only present when a charge was made. | +| `paymentUrl` | *string* | :heavy_check_mark: | URL to redirect the customer to complete payment. Null if no payment action is required. | +| `requiredAction` | [models.BillingUpdateRequiredAction](../models/billing-update-required-action.md) | :heavy_minus_sign: | Details about any action required to complete the payment. Present when the payment could not be processed automatically. | \ No newline at end of file diff --git a/packages/sdk/docs/models/bin-size.md b/packages/sdk/docs/models/bin-size.md new file mode 100644 index 000000000..dbd7fe411 --- /dev/null +++ b/packages/sdk/docs/models/bin-size.md @@ -0,0 +1,17 @@ +# BinSize + +Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day + +## Example Usage + +```typescript +import { BinSize } from "@useautumn/sdk"; + +let value: BinSize = "day"; +``` + +## Values + +```typescript +"day" | "hour" | "month" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/breakdown.md b/packages/sdk/docs/models/breakdown.md index f6bdbd480..90b7663ff 100644 --- a/packages/sdk/docs/models/breakdown.md +++ b/packages/sdk/docs/models/breakdown.md @@ -27,15 +27,15 @@ let value: Breakdown = { ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | -| `id` | *string* | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `includedGrant` | *number* | :heavy_check_mark: | N/A | -| `prepaidGrant` | *number* | :heavy_check_mark: | N/A | -| `remaining` | *number* | :heavy_check_mark: | N/A | -| `usage` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `reset` | [models.CustomerReset](../models/customer-reset.md) | :heavy_check_mark: | N/A | -| `price` | [models.CustomerPrice](../models/customer-price.md) | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | The unique identifier for this balance breakdown. | +| `planId` | *string* | :heavy_check_mark: | The plan ID this balance originates from, or null for standalone balances. | +| `includedGrant` | *number* | :heavy_check_mark: | Amount granted from the plan's included usage. | +| `prepaidGrant` | *number* | :heavy_check_mark: | Amount granted from prepaid purchases or top-ups. | +| `remaining` | *number* | :heavy_check_mark: | Remaining balance available for use. | +| `usage` | *number* | :heavy_check_mark: | Amount consumed in the current period. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether this balance has unlimited usage. | +| `reset` | [models.CustomerReset](../models/customer-reset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. | +| `price` | [models.CustomerPrice](../models/customer-price.md) | :heavy_check_mark: | Pricing configuration if this balance has usage-based pricing. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when this balance expires, or null for no expiration. | \ No newline at end of file diff --git a/packages/sdk/docs/models/incoming-display.md b/packages/sdk/docs/models/check-balance-display.md similarity index 77% rename from packages/sdk/docs/models/incoming-display.md rename to packages/sdk/docs/models/check-balance-display.md index 5fb1963b8..2aad6dc55 100644 --- a/packages/sdk/docs/models/incoming-display.md +++ b/packages/sdk/docs/models/check-balance-display.md @@ -1,11 +1,11 @@ -# IncomingDisplay +# CheckBalanceDisplay ## Example Usage ```typescript -import { IncomingDisplay } from "@useautumn/sdk"; +import { CheckBalanceDisplay } from "@useautumn/sdk"; -let value: IncomingDisplay = {}; +let value: CheckBalanceDisplay = {}; ``` ## Fields diff --git a/packages/sdk/docs/models/balances-track-interval-enum.md b/packages/sdk/docs/models/check-balance-interval-enum.md similarity index 68% rename from packages/sdk/docs/models/balances-track-interval-enum.md rename to packages/sdk/docs/models/check-balance-interval-enum.md index d3657b2bd..585c44e73 100644 --- a/packages/sdk/docs/models/balances-track-interval-enum.md +++ b/packages/sdk/docs/models/check-balance-interval-enum.md @@ -1,11 +1,11 @@ -# BalancesTrackIntervalEnum +# CheckBalanceIntervalEnum ## Example Usage ```typescript -import { BalancesTrackIntervalEnum } from "@useautumn/sdk"; +import { CheckBalanceIntervalEnum } from "@useautumn/sdk"; -let value: BalancesTrackIntervalEnum = "hour"; +let value: CheckBalanceIntervalEnum = "week"; ``` ## Values diff --git a/packages/sdk/docs/models/check-balance-rollover.md b/packages/sdk/docs/models/check-balance-rollover.md new file mode 100644 index 000000000..e1a0eafe3 --- /dev/null +++ b/packages/sdk/docs/models/check-balance-rollover.md @@ -0,0 +1,19 @@ +# CheckBalanceRollover + +## Example Usage + +```typescript +import { CheckBalanceRollover } from "@useautumn/sdk"; + +let value: CheckBalanceRollover = { + balance: 9280.93, + expiresAt: 5290.45, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `balance` | *number* | :heavy_check_mark: | Amount of balance rolled over from a previous period. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the rollover balance expires. | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-to.md b/packages/sdk/docs/models/check-balance-to.md similarity index 89% rename from packages/sdk/docs/models/balances-track-to.md rename to packages/sdk/docs/models/check-balance-to.md index c6d633fa2..a1d59f978 100644 --- a/packages/sdk/docs/models/balances-track-to.md +++ b/packages/sdk/docs/models/check-balance-to.md @@ -1,4 +1,4 @@ -# BalancesTrackTo +# CheckBalanceTo ## Supported Types diff --git a/packages/sdk/docs/models/outgoing-type.md b/packages/sdk/docs/models/check-balance-type.md similarity index 67% rename from packages/sdk/docs/models/outgoing-type.md rename to packages/sdk/docs/models/check-balance-type.md index d6c26e5ff..1bb247fcc 100644 --- a/packages/sdk/docs/models/outgoing-type.md +++ b/packages/sdk/docs/models/check-balance-type.md @@ -1,11 +1,11 @@ -# OutgoingType +# CheckBalanceType ## Example Usage ```typescript -import { OutgoingType } from "@useautumn/sdk"; +import { CheckBalanceType } from "@useautumn/sdk"; -let value: OutgoingType = "credit_system"; +let value: CheckBalanceType = "boolean"; ``` ## Values diff --git a/packages/sdk/docs/models/check-balance.md b/packages/sdk/docs/models/check-balance.md new file mode 100644 index 000000000..a50ec6d9a --- /dev/null +++ b/packages/sdk/docs/models/check-balance.md @@ -0,0 +1,51 @@ +# CheckBalance + +## Example Usage + +```typescript +import { CheckBalance } from "@useautumn/sdk"; + +let value: CheckBalance = { + featureId: "messages", + granted: 100, + remaining: 72, + usage: 28, + unlimited: false, + overageAllowed: false, + maxPurchase: null, + nextResetAt: 1773851121437, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "pro_plan", + includedGrant: 100, + prepaidGrant: 0, + remaining: 72, + usage: 28, + unlimited: false, + reset: { + interval: "month", + resetsAt: 1773851121437, + }, + price: null, + expiresAt: null, + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | The feature ID this balance is for. | +| `feature` | [models.CheckFeature](../models/check-feature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `granted` | *number* | :heavy_check_mark: | Total balance granted (included + prepaid). | +| `remaining` | *number* | :heavy_check_mark: | Remaining balance available for use. | +| `usage` | *number* | :heavy_check_mark: | Total usage consumed in the current period. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether this feature has unlimited usage. | +| `overageAllowed` | *boolean* | :heavy_check_mark: | Whether usage beyond the granted balance is allowed (with overage charges). | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum quantity that can be purchased as a top-up, or null for unlimited. | +| `nextResetAt` | *number* | :heavy_check_mark: | Timestamp when the balance will reset, or null for no reset. | +| `breakdown` | [models.CheckBreakdown](../models/check-breakdown.md)[] | :heavy_minus_sign: | Detailed breakdown of balance sources when stacking multiple plans or grants. | +| `rollovers` | [models.CheckBalanceRollover](../models/check-balance-rollover.md)[] | :heavy_minus_sign: | Rollover balances carried over from previous periods. | \ No newline at end of file diff --git a/packages/sdk/docs/models/incoming-billing-method.md b/packages/sdk/docs/models/check-billing-method.md similarity index 56% rename from packages/sdk/docs/models/incoming-billing-method.md rename to packages/sdk/docs/models/check-billing-method.md index ad0d10422..7b1c6153c 100644 --- a/packages/sdk/docs/models/incoming-billing-method.md +++ b/packages/sdk/docs/models/check-billing-method.md @@ -1,11 +1,13 @@ -# IncomingBillingMethod +# CheckBillingMethod + +Whether usage is prepaid or billed pay-per-use. ## Example Usage ```typescript -import { IncomingBillingMethod } from "@useautumn/sdk"; +import { CheckBillingMethod } from "@useautumn/sdk"; -let value: IncomingBillingMethod = "usage_based"; +let value: CheckBillingMethod = "usage_based"; ``` ## Values diff --git a/packages/sdk/docs/models/check-breakdown.md b/packages/sdk/docs/models/check-breakdown.md new file mode 100644 index 000000000..da342975b --- /dev/null +++ b/packages/sdk/docs/models/check-breakdown.md @@ -0,0 +1,41 @@ +# CheckBreakdown + +## Example Usage + +```typescript +import { CheckBreakdown } from "@useautumn/sdk"; + +let value: CheckBreakdown = { + planId: null, + includedGrant: 5398.34, + prepaidGrant: 3882.27, + remaining: 6713.51, + usage: 4631.11, + unlimited: false, + reset: { + interval: "week", + resetsAt: 294.12, + }, + price: { + billingUnits: 9415.84, + billingMethod: "usage_based", + maxPurchase: 2801.79, + }, + expiresAt: 2220.75, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | The unique identifier for this balance breakdown. | +| `planId` | *string* | :heavy_check_mark: | The plan ID this balance originates from, or null for standalone balances. | +| `includedGrant` | *number* | :heavy_check_mark: | Amount granted from the plan's included usage. | +| `prepaidGrant` | *number* | :heavy_check_mark: | Amount granted from prepaid purchases or top-ups. | +| `remaining` | *number* | :heavy_check_mark: | Remaining balance available for use. | +| `usage` | *number* | :heavy_check_mark: | Amount consumed in the current period. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether this balance has unlimited usage. | +| `reset` | [models.CheckReset](../models/check-reset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. | +| `price` | [models.CheckPrice](../models/check-price.md) | :heavy_check_mark: | Pricing configuration if this balance has usage-based pricing. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when this balance expires, or null for no expiration. | \ No newline at end of file diff --git a/packages/sdk/docs/models/incoming-credit-schema.md b/packages/sdk/docs/models/check-credit-schema.md similarity index 75% rename from packages/sdk/docs/models/incoming-credit-schema.md rename to packages/sdk/docs/models/check-credit-schema.md index 7eba2de8e..c23257a97 100644 --- a/packages/sdk/docs/models/incoming-credit-schema.md +++ b/packages/sdk/docs/models/check-credit-schema.md @@ -1,13 +1,13 @@ -# IncomingCreditSchema +# CheckCreditSchema ## Example Usage ```typescript -import { IncomingCreditSchema } from "@useautumn/sdk"; +import { CheckCreditSchema } from "@useautumn/sdk"; -let value: IncomingCreditSchema = { +let value: CheckCreditSchema = { meteredFeatureId: "", - creditCost: 375.23, + creditCost: 6772.45, }; ``` diff --git a/packages/sdk/docs/models/balances-check-env.md b/packages/sdk/docs/models/check-env.md similarity index 68% rename from packages/sdk/docs/models/balances-check-env.md rename to packages/sdk/docs/models/check-env.md index 3dede176c..b232d2049 100644 --- a/packages/sdk/docs/models/balances-check-env.md +++ b/packages/sdk/docs/models/check-env.md @@ -1,13 +1,13 @@ -# BalancesCheckEnv +# CheckEnv The environment of the product ## Example Usage ```typescript -import { BalancesCheckEnv } from "@useautumn/sdk"; +import { CheckEnv } from "@useautumn/sdk"; -let value: BalancesCheckEnv = "sandbox"; +let value: CheckEnv = "live"; ``` ## Values diff --git a/packages/sdk/docs/models/check-feature.md b/packages/sdk/docs/models/check-feature.md new file mode 100644 index 000000000..6eb25292e --- /dev/null +++ b/packages/sdk/docs/models/check-feature.md @@ -0,0 +1,30 @@ +# CheckFeature + +The full feature object if expanded. + +## Example Usage + +```typescript +import { CheckFeature } from "@useautumn/sdk"; + +let value: CheckFeature = { + id: "", + name: "", + type: "metered", + consumable: false, + archived: true, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | N/A | +| `name` | *string* | :heavy_check_mark: | N/A | +| `type` | [models.CheckBalanceType](../models/check-balance-type.md) | :heavy_check_mark: | N/A | +| `consumable` | *boolean* | :heavy_check_mark: | N/A | +| `eventNames` | *string*[] | :heavy_minus_sign: | N/A | +| `creditSchema` | [models.CheckCreditSchema](../models/check-credit-schema.md)[] | :heavy_minus_sign: | N/A | +| `display` | [models.CheckBalanceDisplay](../models/check-balance-display.md) | :heavy_minus_sign: | N/A | +| `archived` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-free-trial.md b/packages/sdk/docs/models/check-free-trial.md similarity index 96% rename from packages/sdk/docs/models/balances-check-free-trial.md rename to packages/sdk/docs/models/check-free-trial.md index ff45de9a6..9a2eab113 100644 --- a/packages/sdk/docs/models/balances-check-free-trial.md +++ b/packages/sdk/docs/models/check-free-trial.md @@ -1,15 +1,15 @@ -# BalancesCheckFreeTrial +# CheckFreeTrial ## Example Usage ```typescript -import { BalancesCheckFreeTrial } from "@useautumn/sdk"; +import { CheckFreeTrial } from "@useautumn/sdk"; -let value: BalancesCheckFreeTrial = { - duration: "day", - length: 8856.14, +let value: CheckFreeTrial = { + duration: "year", + length: 5382.25, uniqueFingerprint: false, - cardRequired: true, + cardRequired: false, }; ``` diff --git a/packages/sdk/docs/models/balances-check-globals.md b/packages/sdk/docs/models/check-globals.md similarity index 72% rename from packages/sdk/docs/models/balances-check-globals.md rename to packages/sdk/docs/models/check-globals.md index f67d2c1b2..e7a1e28eb 100644 --- a/packages/sdk/docs/models/balances-check-globals.md +++ b/packages/sdk/docs/models/check-globals.md @@ -1,11 +1,11 @@ -# BalancesCheckGlobals +# CheckGlobals ## Example Usage ```typescript -import { BalancesCheckGlobals } from "@useautumn/sdk"; +import { CheckGlobals } from "@useautumn/sdk"; -let value: BalancesCheckGlobals = {}; +let value: CheckGlobals = {}; ``` ## Fields diff --git a/packages/sdk/docs/models/check-interval-union.md b/packages/sdk/docs/models/check-interval-union.md new file mode 100644 index 000000000..a50583f83 --- /dev/null +++ b/packages/sdk/docs/models/check-interval-union.md @@ -0,0 +1,19 @@ +# CheckIntervalUnion + +The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + +## Supported Types + +### `models.CheckBalanceIntervalEnum` + +```typescript +const value: models.CheckBalanceIntervalEnum = "one_off"; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/balances-check-item.md b/packages/sdk/docs/models/check-item.md similarity index 99% rename from packages/sdk/docs/models/balances-check-item.md rename to packages/sdk/docs/models/check-item.md index bcb28d0c5..516b1ea77 100644 --- a/packages/sdk/docs/models/balances-check-item.md +++ b/packages/sdk/docs/models/check-item.md @@ -1,13 +1,13 @@ -# BalancesCheckItem +# CheckItem Product item defining features and pricing within a product ## Example Usage ```typescript -import { BalancesCheckItem } from "@useautumn/sdk"; +import { CheckItem } from "@useautumn/sdk"; -let value: BalancesCheckItem = {}; +let value: CheckItem = {}; ``` ## Fields diff --git a/packages/sdk/docs/models/balances-check-on-decrease.md b/packages/sdk/docs/models/check-on-decrease.md similarity index 66% rename from packages/sdk/docs/models/balances-check-on-decrease.md rename to packages/sdk/docs/models/check-on-decrease.md index 960d118be..7401f77ec 100644 --- a/packages/sdk/docs/models/balances-check-on-decrease.md +++ b/packages/sdk/docs/models/check-on-decrease.md @@ -1,11 +1,11 @@ -# BalancesCheckOnDecrease +# CheckOnDecrease ## Example Usage ```typescript -import { BalancesCheckOnDecrease } from "@useautumn/sdk"; +import { CheckOnDecrease } from "@useautumn/sdk"; -let value: BalancesCheckOnDecrease = "prorate_next_cycle"; +let value: CheckOnDecrease = "prorate_immediately"; ``` ## Values diff --git a/packages/sdk/docs/models/balances-check-on-increase.md b/packages/sdk/docs/models/check-on-increase.md similarity index 66% rename from packages/sdk/docs/models/balances-check-on-increase.md rename to packages/sdk/docs/models/check-on-increase.md index 8f104b202..05a41c5e3 100644 --- a/packages/sdk/docs/models/balances-check-on-increase.md +++ b/packages/sdk/docs/models/check-on-increase.md @@ -1,11 +1,11 @@ -# BalancesCheckOnIncrease +# CheckOnIncrease ## Example Usage ```typescript -import { BalancesCheckOnIncrease } from "@useautumn/sdk"; +import { CheckOnIncrease } from "@useautumn/sdk"; -let value: BalancesCheckOnIncrease = "bill_immediately"; +let value: CheckOnIncrease = "prorate_immediately"; ``` ## Values diff --git a/packages/sdk/docs/models/check-params.md b/packages/sdk/docs/models/check-params.md new file mode 100644 index 000000000..82091b180 --- /dev/null +++ b/packages/sdk/docs/models/check-params.md @@ -0,0 +1,24 @@ +# CheckParams + +## Example Usage + +```typescript +import { CheckParams } from "@useautumn/sdk"; + +let value: CheckParams = { + customerId: "cus_123", + featureId: "messages", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer. | +| `featureId` | *string* | :heavy_check_mark: | The ID of the feature. | +| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity for entity-scoped balances (e.g., per-seat limits). | +| `requiredBalance` | *number* | :heavy_minus_sign: | Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1. | +| `properties` | Record | :heavy_minus_sign: | Additional properties to attach to the usage event if send_event is true. | +| `sendEvent` | *boolean* | :heavy_minus_sign: | If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. | +| `withPreview` | *boolean* | :heavy_minus_sign: | If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. | \ No newline at end of file diff --git a/packages/sdk/docs/models/check-price.md b/packages/sdk/docs/models/check-price.md new file mode 100644 index 000000000..58e05b53a --- /dev/null +++ b/packages/sdk/docs/models/check-price.md @@ -0,0 +1,23 @@ +# CheckPrice + +## Example Usage + +```typescript +import { CheckPrice } from "@useautumn/sdk"; + +let value: CheckPrice = { + billingUnits: 4264.55, + billingMethod: "prepaid", + maxPurchase: 3762.8, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `amount` | *number* | :heavy_minus_sign: | The per-unit price amount. | +| `tiers` | [models.CheckTier](../models/check-tier.md)[] | :heavy_minus_sign: | Tiered pricing configuration if applicable. | +| `billingUnits` | *number* | :heavy_check_mark: | The number of units per billing increment (eg. $9 / 250 units). | +| `billingMethod` | [models.CheckBillingMethod](../models/check-billing-method.md) | :heavy_check_mark: | Whether usage is prepaid or billed pay-per-use. | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum quantity that can be purchased, or null for unlimited. | \ No newline at end of file diff --git a/packages/sdk/docs/models/properties.md b/packages/sdk/docs/models/check-properties.md similarity index 96% rename from packages/sdk/docs/models/properties.md rename to packages/sdk/docs/models/check-properties.md index fda272f14..276766653 100644 --- a/packages/sdk/docs/models/properties.md +++ b/packages/sdk/docs/models/check-properties.md @@ -1,13 +1,13 @@ -# Properties +# CheckProperties ## Example Usage ```typescript -import { Properties } from "@useautumn/sdk"; +import { CheckProperties } from "@useautumn/sdk"; -let value: Properties = { +let value: CheckProperties = { isFree: true, - isOneOff: false, + isOneOff: true, }; ``` diff --git a/packages/sdk/docs/models/check-reset.md b/packages/sdk/docs/models/check-reset.md new file mode 100644 index 000000000..4f6898cda --- /dev/null +++ b/packages/sdk/docs/models/check-reset.md @@ -0,0 +1,20 @@ +# CheckReset + +## Example Usage + +```typescript +import { CheckReset } from "@useautumn/sdk"; + +let value: CheckReset = { + interval: "one_off", + resetsAt: 5013.88, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `interval` | *models.CheckIntervalUnion* | :heavy_check_mark: | The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets (eg. 2 for bi-monthly). | +| `resetsAt` | *number* | :heavy_check_mark: | Timestamp when the balance will next reset. | \ No newline at end of file diff --git a/packages/sdk/docs/models/check-response.md b/packages/sdk/docs/models/check-response.md new file mode 100644 index 000000000..fa322d46b --- /dev/null +++ b/packages/sdk/docs/models/check-response.md @@ -0,0 +1,54 @@ +# CheckResponse + +OK + +## Example Usage + +```typescript +import { CheckResponse } from "@useautumn/sdk"; + +let value: CheckResponse = { + allowed: true, + customerId: "cus_123", + entityId: null, + requiredBalance: 1, + balance: { + featureId: "messages", + granted: 100, + remaining: 72, + usage: 28, + unlimited: false, + overageAllowed: false, + maxPurchase: null, + nextResetAt: 1773851121437, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "pro_plan", + includedGrant: 100, + prepaidGrant: 0, + remaining: 72, + usage: 28, + unlimited: false, + reset: { + interval: "month", + resetsAt: 1773851121437, + }, + price: null, + expiresAt: null, + }, + ], + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allowed` | *boolean* | :heavy_check_mark: | Whether the customer is allowed to use the feature. True if they have sufficient balance or the feature is unlimited/boolean. | | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer that was checked. | | +| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity, if an entity-scoped check was performed. | | +| `requiredBalance` | *number* | :heavy_minus_sign: | The required balance that was checked against. | | +| `balance` | [models.CheckBalance](../models/check-balance.md) | :heavy_check_mark: | The customer's balance for this feature. Null if the customer has no balance for this feature. | {
"feature_id": "messages",
"granted": 100,
"remaining": 72,
"usage": 28,
"unlimited": false,
"overage_allowed": false,
"max_purchase": null,
"next_reset_at": 1773851121437,
"breakdown": [
{
"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV",
"plan_id": "pro_plan",
"included_grant": 100,
"prepaid_grant": 0,
"remaining": 72,
"usage": 28,
"unlimited": false,
"reset": {
"interval": "month",
"resets_at": 1773851121437
},
"price": null,
"expires_at": null
}
]
} | +| `preview` | [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. | | \ No newline at end of file diff --git a/packages/sdk/docs/models/check-scenario.md b/packages/sdk/docs/models/check-scenario.md new file mode 100644 index 000000000..3d89a3dd6 --- /dev/null +++ b/packages/sdk/docs/models/check-scenario.md @@ -0,0 +1,19 @@ +# CheckScenario + +The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. + +## Example Usage + +```typescript +import { CheckScenario } from "@useautumn/sdk"; + +let value: CheckScenario = "usage_limit"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"usage_limit" | "feature_flag" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/check-tier.md b/packages/sdk/docs/models/check-tier.md new file mode 100644 index 000000000..48a363f3e --- /dev/null +++ b/packages/sdk/docs/models/check-tier.md @@ -0,0 +1,19 @@ +# CheckTier + +## Example Usage + +```typescript +import { CheckTier } from "@useautumn/sdk"; + +let value: CheckTier = { + to: 9017.61, + amount: 1492.2, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `to` | *models.CheckBalanceTo* | :heavy_check_mark: | N/A | +| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/config.md b/packages/sdk/docs/models/config.md index a02a537e8..0c9556029 100644 --- a/packages/sdk/docs/models/config.md +++ b/packages/sdk/docs/models/config.md @@ -10,8 +10,8 @@ let value: Config = {}; ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `rollover` | [models.ConfigRollover](../models/config-rollover.md) | :heavy_minus_sign: | N/A | -| `onIncrease` | [models.BalancesCheckOnIncrease](../models/balances-check-on-increase.md) | :heavy_minus_sign: | N/A | -| `onDecrease` | [models.BalancesCheckOnDecrease](../models/balances-check-on-decrease.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `rollover` | [models.ConfigRollover](../models/config-rollover.md) | :heavy_minus_sign: | N/A | +| `onIncrease` | [models.CheckOnIncrease](../models/check-on-increase.md) | :heavy_minus_sign: | N/A | +| `onDecrease` | [models.CheckOnDecrease](../models/check-on-decrease.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-globals.md b/packages/sdk/docs/models/create-balance-globals.md similarity index 72% rename from packages/sdk/docs/models/balances-track-globals.md rename to packages/sdk/docs/models/create-balance-globals.md index 976c3ac14..6f6ad53ad 100644 --- a/packages/sdk/docs/models/balances-track-globals.md +++ b/packages/sdk/docs/models/create-balance-globals.md @@ -1,11 +1,11 @@ -# BalancesTrackGlobals +# CreateBalanceGlobals ## Example Usage ```typescript -import { BalancesTrackGlobals } from "@useautumn/sdk"; +import { CreateBalanceGlobals } from "@useautumn/sdk"; -let value: BalancesTrackGlobals = {}; +let value: CreateBalanceGlobals = {}; ``` ## Fields diff --git a/packages/sdk/docs/models/create-balance-interval.md b/packages/sdk/docs/models/create-balance-interval.md new file mode 100644 index 000000000..16dff46b7 --- /dev/null +++ b/packages/sdk/docs/models/create-balance-interval.md @@ -0,0 +1,17 @@ +# CreateBalanceInterval + +The interval at which the balance resets (e.g., 'month', 'day', 'year'). + +## Example Usage + +```typescript +import { CreateBalanceInterval } from "@useautumn/sdk"; + +let value: CreateBalanceInterval = "semi_annual"; +``` + +## Values + +```typescript +"one_off" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-balance-params.md b/packages/sdk/docs/models/create-balance-params.md new file mode 100644 index 000000000..1eaaee74a --- /dev/null +++ b/packages/sdk/docs/models/create-balance-params.md @@ -0,0 +1,29 @@ +# CreateBalanceParams + +## Example Usage + +```typescript +import { CreateBalanceParams } from "@useautumn/sdk"; + +let value: CreateBalanceParams = { + customerId: "cus_123", + featureId: "api_calls", + included: 1000, + reset: { + interval: "month", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer. | +| `featureId` | *string* | :heavy_check_mark: | The ID of the feature. | +| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity for entity-scoped balances (e.g., per-seat limits). | +| `included` | *number* | :heavy_minus_sign: | The initial balance amount to grant. For metered features, this is the number of units the customer can use. | +| `unlimited` | *boolean* | :heavy_minus_sign: | If true, the balance has unlimited usage. Cannot be combined with 'included'. | +| `reset` | [models.CreateBalanceReset](../models/create-balance-reset.md) | :heavy_minus_sign: | Reset configuration for the balance. If not provided, the balance is a one-time grant that never resets. | +| `expiresAt` | *number* | :heavy_minus_sign: | Unix timestamp (milliseconds) when the balance expires. Mutually exclusive with reset. | +| `grantedBalance` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-balance-reset.md b/packages/sdk/docs/models/create-balance-reset.md new file mode 100644 index 000000000..4c6c1b98a --- /dev/null +++ b/packages/sdk/docs/models/create-balance-reset.md @@ -0,0 +1,20 @@ +# CreateBalanceReset + +Reset configuration for the balance. If not provided, the balance is a one-time grant that never resets. + +## Example Usage + +```typescript +import { CreateBalanceReset } from "@useautumn/sdk"; + +let value: CreateBalanceReset = { + interval: "year", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `interval` | [models.CreateBalanceInterval](../models/create-balance-interval.md) | :heavy_check_mark: | The interval at which the balance resets (e.g., 'month', 'day', 'year'). | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets. Defaults to 1 (e.g., interval_count: 2 with interval: 'month' resets every 2 months). | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-create-response.md b/packages/sdk/docs/models/create-balance-response.md similarity index 73% rename from packages/sdk/docs/models/balances-create-response.md rename to packages/sdk/docs/models/create-balance-response.md index c6f09d0ad..5a3f8c765 100644 --- a/packages/sdk/docs/models/balances-create-response.md +++ b/packages/sdk/docs/models/create-balance-response.md @@ -1,13 +1,13 @@ -# BalancesCreateResponse +# CreateBalanceResponse OK ## Example Usage ```typescript -import { BalancesCreateResponse } from "@useautumn/sdk"; +import { CreateBalanceResponse } from "@useautumn/sdk"; -let value: BalancesCreateResponse = { +let value: CreateBalanceResponse = { success: true, }; ``` diff --git a/packages/sdk/docs/models/create-entity-balances.md b/packages/sdk/docs/models/create-entity-balances.md new file mode 100644 index 000000000..5e2931c14 --- /dev/null +++ b/packages/sdk/docs/models/create-entity-balances.md @@ -0,0 +1,51 @@ +# CreateEntityBalances + +## Example Usage + +```typescript +import { CreateEntityBalances } from "@useautumn/sdk"; + +let value: CreateEntityBalances = { + featureId: "messages", + granted: 100, + remaining: 72, + usage: 28, + unlimited: false, + overageAllowed: false, + maxPurchase: null, + nextResetAt: 1773851121437, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "pro_plan", + includedGrant: 100, + prepaidGrant: 0, + remaining: 72, + usage: 28, + unlimited: false, + reset: { + interval: "month", + resetsAt: 1773851121437, + }, + price: null, + expiresAt: null, + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | The feature ID this balance is for. | +| `feature` | [models.CreateEntityFeature](../models/create-entity-feature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `granted` | *number* | :heavy_check_mark: | Total balance granted (included + prepaid). | +| `remaining` | *number* | :heavy_check_mark: | Remaining balance available for use. | +| `usage` | *number* | :heavy_check_mark: | Total usage consumed in the current period. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether this feature has unlimited usage. | +| `overageAllowed` | *boolean* | :heavy_check_mark: | Whether usage beyond the granted balance is allowed (with overage charges). | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum quantity that can be purchased as a top-up, or null for unlimited. | +| `nextResetAt` | *number* | :heavy_check_mark: | Timestamp when the balance will reset, or null for no reset. | +| `breakdown` | [models.CreateEntityBreakdown](../models/create-entity-breakdown.md)[] | :heavy_minus_sign: | Detailed breakdown of balance sources when stacking multiple plans or grants. | +| `rollovers` | [models.CreateEntityRollover](../models/create-entity-rollover.md)[] | :heavy_minus_sign: | Rollover balances carried over from previous periods. | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-billing-method.md b/packages/sdk/docs/models/create-entity-billing-method.md similarity index 53% rename from packages/sdk/docs/models/balances-check-billing-method.md rename to packages/sdk/docs/models/create-entity-billing-method.md index d7269db25..d0fa7d451 100644 --- a/packages/sdk/docs/models/balances-check-billing-method.md +++ b/packages/sdk/docs/models/create-entity-billing-method.md @@ -1,11 +1,13 @@ -# BalancesCheckBillingMethod +# CreateEntityBillingMethod + +Whether usage is prepaid or billed pay-per-use. ## Example Usage ```typescript -import { BalancesCheckBillingMethod } from "@useautumn/sdk"; +import { CreateEntityBillingMethod } from "@useautumn/sdk"; -let value: BalancesCheckBillingMethod = "prepaid"; +let value: CreateEntityBillingMethod = "usage_based"; ``` ## Values diff --git a/packages/sdk/docs/models/create-entity-breakdown.md b/packages/sdk/docs/models/create-entity-breakdown.md new file mode 100644 index 000000000..dbf164ae1 --- /dev/null +++ b/packages/sdk/docs/models/create-entity-breakdown.md @@ -0,0 +1,41 @@ +# CreateEntityBreakdown + +## Example Usage + +```typescript +import { CreateEntityBreakdown } from "@useautumn/sdk"; + +let value: CreateEntityBreakdown = { + planId: "", + includedGrant: 4526.54, + prepaidGrant: 4519.44, + remaining: 6479.7, + usage: 9789.79, + unlimited: false, + reset: { + interval: "", + resetsAt: 2923.33, + }, + price: { + billingUnits: 4543.63, + billingMethod: "usage_based", + maxPurchase: 2063.43, + }, + expiresAt: 9755.62, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | The unique identifier for this balance breakdown. | +| `planId` | *string* | :heavy_check_mark: | The plan ID this balance originates from, or null for standalone balances. | +| `includedGrant` | *number* | :heavy_check_mark: | Amount granted from the plan's included usage. | +| `prepaidGrant` | *number* | :heavy_check_mark: | Amount granted from prepaid purchases or top-ups. | +| `remaining` | *number* | :heavy_check_mark: | Remaining balance available for use. | +| `usage` | *number* | :heavy_check_mark: | Amount consumed in the current period. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether this balance has unlimited usage. | +| `reset` | [models.CreateEntityReset](../models/create-entity-reset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. | +| `price` | [models.CreateEntityPrice](../models/create-entity-price.md) | :heavy_check_mark: | Pricing configuration if this balance has usage-based pricing. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when this balance expires, or null for no expiration. | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-credit-schema.md b/packages/sdk/docs/models/create-entity-credit-schema.md similarity index 73% rename from packages/sdk/docs/models/balances-track-credit-schema.md rename to packages/sdk/docs/models/create-entity-credit-schema.md index df1907cc3..b1f2289d8 100644 --- a/packages/sdk/docs/models/balances-track-credit-schema.md +++ b/packages/sdk/docs/models/create-entity-credit-schema.md @@ -1,13 +1,13 @@ -# BalancesTrackCreditSchema +# CreateEntityCreditSchema ## Example Usage ```typescript -import { BalancesTrackCreditSchema } from "@useautumn/sdk"; +import { CreateEntityCreditSchema } from "@useautumn/sdk"; -let value: BalancesTrackCreditSchema = { +let value: CreateEntityCreditSchema = { meteredFeatureId: "", - creditCost: 4484.92, + creditCost: 2316.33, }; ``` diff --git a/packages/sdk/docs/models/balances-track-display.md b/packages/sdk/docs/models/create-entity-display.md similarity index 77% rename from packages/sdk/docs/models/balances-track-display.md rename to packages/sdk/docs/models/create-entity-display.md index c2ffa8215..76bb58eb2 100644 --- a/packages/sdk/docs/models/balances-track-display.md +++ b/packages/sdk/docs/models/create-entity-display.md @@ -1,11 +1,11 @@ -# BalancesTrackDisplay +# CreateEntityDisplay ## Example Usage ```typescript -import { BalancesTrackDisplay } from "@useautumn/sdk"; +import { CreateEntityDisplay } from "@useautumn/sdk"; -let value: BalancesTrackDisplay = {}; +let value: CreateEntityDisplay = {}; ``` ## Fields diff --git a/packages/sdk/docs/models/create-entity-env.md b/packages/sdk/docs/models/create-entity-env.md new file mode 100644 index 000000000..923094468 --- /dev/null +++ b/packages/sdk/docs/models/create-entity-env.md @@ -0,0 +1,19 @@ +# CreateEntityEnv + +The environment (sandbox/live) + +## Example Usage + +```typescript +import { CreateEntityEnv } from "@useautumn/sdk"; + +let value: CreateEntityEnv = "sandbox"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"sandbox" | "live" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-balance-breakdown.md b/packages/sdk/docs/models/create-entity-feature.md similarity index 52% rename from packages/sdk/docs/models/balances-track-balance-breakdown.md rename to packages/sdk/docs/models/create-entity-feature.md index c4ccc9979..7fa4e021b 100644 --- a/packages/sdk/docs/models/balances-track-balance-breakdown.md +++ b/packages/sdk/docs/models/create-entity-feature.md @@ -1,27 +1,18 @@ -# BalancesTrackBalanceBreakdown +# CreateEntityFeature + +The full feature object if expanded. ## Example Usage ```typescript -import { BalancesTrackBalanceBreakdown } from "@useautumn/sdk"; +import { CreateEntityFeature } from "@useautumn/sdk"; -let value: BalancesTrackBalanceBreakdown = { - planId: "", - includedGrant: 1267.23, - prepaidGrant: 7892.69, - remaining: 8736.65, - usage: 6694.14, - unlimited: false, - reset: { - interval: "one_off", - resetsAt: 1535.27, - }, - price: { - billingUnits: 6850.46, - billingMethod: "usage_based", - maxPurchase: 6457.4, - }, - expiresAt: null, +let value: CreateEntityFeature = { + id: "", + name: "", + type: "boolean", + consumable: false, + archived: false, }; ``` @@ -29,13 +20,11 @@ let value: BalancesTrackBalanceBreakdown = { | Field | Type | Required | Description | | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `id` | *string* | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `includedGrant` | *number* | :heavy_check_mark: | N/A | -| `prepaidGrant` | *number* | :heavy_check_mark: | N/A | -| `remaining` | *number* | :heavy_check_mark: | N/A | -| `usage` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `reset` | [models.BalancesTrackBalanceReset](../models/balances-track-balance-reset.md) | :heavy_check_mark: | N/A | -| `price` | [models.BalancesTrackBalancePrice](../models/balances-track-balance-price.md) | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| `id` | *string* | :heavy_check_mark: | N/A | +| `name` | *string* | :heavy_check_mark: | N/A | +| `type` | [models.CreateEntityType](../models/create-entity-type.md) | :heavy_check_mark: | N/A | +| `consumable` | *boolean* | :heavy_check_mark: | N/A | +| `eventNames` | *string*[] | :heavy_minus_sign: | N/A | +| `creditSchema` | [models.CreateEntityCreditSchema](../models/create-entity-credit-schema.md)[] | :heavy_minus_sign: | N/A | +| `display` | [models.CreateEntityDisplay](../models/create-entity-display.md) | :heavy_minus_sign: | N/A | +| `archived` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-update-globals.md b/packages/sdk/docs/models/create-entity-globals.md similarity index 72% rename from packages/sdk/docs/models/balances-update-globals.md rename to packages/sdk/docs/models/create-entity-globals.md index 98a6a2c3a..8cef19073 100644 --- a/packages/sdk/docs/models/balances-update-globals.md +++ b/packages/sdk/docs/models/create-entity-globals.md @@ -1,11 +1,11 @@ -# BalancesUpdateGlobals +# CreateEntityGlobals ## Example Usage ```typescript -import { BalancesUpdateGlobals } from "@useautumn/sdk"; +import { CreateEntityGlobals } from "@useautumn/sdk"; -let value: BalancesUpdateGlobals = {}; +let value: CreateEntityGlobals = {}; ``` ## Fields diff --git a/packages/sdk/docs/models/interval-incoming-enum.md b/packages/sdk/docs/models/create-entity-interval-enum.md similarity index 68% rename from packages/sdk/docs/models/interval-incoming-enum.md rename to packages/sdk/docs/models/create-entity-interval-enum.md index b2686033a..2c259aa95 100644 --- a/packages/sdk/docs/models/interval-incoming-enum.md +++ b/packages/sdk/docs/models/create-entity-interval-enum.md @@ -1,11 +1,11 @@ -# IntervalIncomingEnum +# CreateEntityIntervalEnum ## Example Usage ```typescript -import { IntervalIncomingEnum } from "@useautumn/sdk"; +import { CreateEntityIntervalEnum } from "@useautumn/sdk"; -let value: IntervalIncomingEnum = "quarter"; +let value: CreateEntityIntervalEnum = "day"; ``` ## Values diff --git a/packages/sdk/docs/models/create-entity-interval-union.md b/packages/sdk/docs/models/create-entity-interval-union.md new file mode 100644 index 000000000..4466891ac --- /dev/null +++ b/packages/sdk/docs/models/create-entity-interval-union.md @@ -0,0 +1,19 @@ +# CreateEntityIntervalUnion + +The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + +## Supported Types + +### `models.CreateEntityIntervalEnum` + +```typescript +const value: models.CreateEntityIntervalEnum = "month"; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/create-entity-invoice.md b/packages/sdk/docs/models/create-entity-invoice.md new file mode 100644 index 000000000..33704bc68 --- /dev/null +++ b/packages/sdk/docs/models/create-entity-invoice.md @@ -0,0 +1,30 @@ +# CreateEntityInvoice + +## Example Usage + +```typescript +import { CreateEntityInvoice } from "@useautumn/sdk"; + +let value: CreateEntityInvoice = { + planIds: [ + "", + ], + stripeId: "", + status: "", + total: 5342.82, + currency: "Azerbaijanian Manat", + createdAt: 2464.41, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `planIds` | *string*[] | :heavy_check_mark: | Array of plan IDs included in this invoice | +| `stripeId` | *string* | :heavy_check_mark: | The Stripe invoice ID | +| `status` | *string* | :heavy_check_mark: | The status of the invoice | +| `total` | *number* | :heavy_check_mark: | The total amount of the invoice | +| `currency` | *string* | :heavy_check_mark: | The currency code for the invoice | +| `createdAt` | *number* | :heavy_check_mark: | Timestamp when the invoice was created | +| `hostedInvoiceUrl` | *string* | :heavy_minus_sign: | URL to the Stripe-hosted invoice page | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-entity-params.md b/packages/sdk/docs/models/create-entity-params.md new file mode 100644 index 000000000..7cd7963b9 --- /dev/null +++ b/packages/sdk/docs/models/create-entity-params.md @@ -0,0 +1,24 @@ +# CreateEntityParams + +## Example Usage + +```typescript +import { CreateEntityParams } from "@useautumn/sdk"; + +let value: CreateEntityParams = { + name: "Seat 42", + featureId: "seats", + customerId: "cus_123", + entityId: "seat_42", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | +| `name` | *string* | :heavy_minus_sign: | The name of the entity | +| `featureId` | *string* | :heavy_check_mark: | The ID of the feature this entity is associated with | +| `customerData` | [models.CustomerData](../models/customer-data.md) | :heavy_minus_sign: | Customer details to set when creating a customer | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer to create the entity for. | +| `entityId` | *string* | :heavy_check_mark: | The ID of the entity. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-entity-price.md b/packages/sdk/docs/models/create-entity-price.md new file mode 100644 index 000000000..f309f0c38 --- /dev/null +++ b/packages/sdk/docs/models/create-entity-price.md @@ -0,0 +1,23 @@ +# CreateEntityPrice + +## Example Usage + +```typescript +import { CreateEntityPrice } from "@useautumn/sdk"; + +let value: CreateEntityPrice = { + billingUnits: 6571.54, + billingMethod: "usage_based", + maxPurchase: 7712.88, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `amount` | *number* | :heavy_minus_sign: | The per-unit price amount. | +| `tiers` | [models.CreateEntityTier](../models/create-entity-tier.md)[] | :heavy_minus_sign: | Tiered pricing configuration if applicable. | +| `billingUnits` | *number* | :heavy_check_mark: | The number of units per billing increment (eg. $9 / 250 units). | +| `billingMethod` | [models.CreateEntityBillingMethod](../models/create-entity-billing-method.md) | :heavy_check_mark: | Whether usage is prepaid or billed pay-per-use. | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum quantity that can be purchased, or null for unlimited. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-entity-purchase.md b/packages/sdk/docs/models/create-entity-purchase.md new file mode 100644 index 000000000..2900587b5 --- /dev/null +++ b/packages/sdk/docs/models/create-entity-purchase.md @@ -0,0 +1,24 @@ +# CreateEntityPurchase + +## Example Usage + +```typescript +import { CreateEntityPurchase } from "@useautumn/sdk"; + +let value: CreateEntityPurchase = { + planId: "", + expiresAt: 4006.24, + startedAt: 8884.43, + quantity: 6176.82, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | +| `planId` | *string* | :heavy_check_mark: | The unique identifier of the purchased plan. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the purchase expires, or null for lifetime access. | +| `startedAt` | *number* | :heavy_check_mark: | Timestamp when the purchase was made. | +| `quantity` | *number* | :heavy_check_mark: | Number of units purchased. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-entity-reset.md b/packages/sdk/docs/models/create-entity-reset.md new file mode 100644 index 000000000..50dd1a63c --- /dev/null +++ b/packages/sdk/docs/models/create-entity-reset.md @@ -0,0 +1,20 @@ +# CreateEntityReset + +## Example Usage + +```typescript +import { CreateEntityReset } from "@useautumn/sdk"; + +let value: CreateEntityReset = { + interval: "week", + resetsAt: 5060.33, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `interval` | *models.CreateEntityIntervalUnion* | :heavy_check_mark: | The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets (eg. 2 for bi-monthly). | +| `resetsAt` | *number* | :heavy_check_mark: | Timestamp when the balance will next reset. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-entity-response.md b/packages/sdk/docs/models/create-entity-response.md new file mode 100644 index 000000000..2c6be3d88 --- /dev/null +++ b/packages/sdk/docs/models/create-entity-response.md @@ -0,0 +1,81 @@ +# CreateEntityResponse + +OK + +## Example Usage + +```typescript +import { CreateEntityResponse } from "@useautumn/sdk"; + +let value: CreateEntityResponse = { + id: "seat_42", + name: "Seat 42", + customerId: "cus_123", + featureId: "seats", + createdAt: 1771409161016, + env: "sandbox", + subscriptions: [ + { + planId: "pro_plan", + autoEnable: true, + addOn: false, + status: "active", + pastDue: false, + canceledAt: null, + expiresAt: null, + trialEndsAt: null, + startedAt: 1771431921437, + currentPeriodStart: 1771431921437, + currentPeriodEnd: 1771999921437, + quantity: 1, + }, + ], + purchases: [], + balances: { + "messages": { + featureId: "messages", + granted: 100, + remaining: 72, + usage: 28, + unlimited: false, + overageAllowed: false, + maxPurchase: null, + nextResetAt: 1773851121437, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "pro_plan", + includedGrant: 100, + prepaidGrant: 0, + remaining: 72, + usage: 28, + unlimited: false, + reset: { + interval: "month", + resetsAt: 1773851121437, + }, + price: null, + expiresAt: null, + }, + ], + }, + }, + invoices: [], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `autumnId` | *string* | :heavy_minus_sign: | N/A | +| `id` | *string* | :heavy_check_mark: | The unique identifier of the entity | +| `name` | *string* | :heavy_check_mark: | The name of the entity | +| `customerId` | *string* | :heavy_minus_sign: | The customer ID this entity belongs to | +| `featureId` | *string* | :heavy_minus_sign: | The feature ID this entity belongs to | +| `createdAt` | *number* | :heavy_check_mark: | Unix timestamp when the entity was created | +| `env` | [models.CreateEntityEnv](../models/create-entity-env.md) | :heavy_check_mark: | The environment (sandbox/live) | +| `subscriptions` | [models.CreateEntitySubscription](../models/create-entity-subscription.md)[] | :heavy_check_mark: | N/A | +| `purchases` | [models.CreateEntityPurchase](../models/create-entity-purchase.md)[] | :heavy_check_mark: | N/A | +| `balances` | Record | :heavy_check_mark: | N/A | +| `invoices` | [models.CreateEntityInvoice](../models/create-entity-invoice.md)[] | :heavy_minus_sign: | Invoices for this entity (only included when expand=invoices) | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-entity-rollover.md b/packages/sdk/docs/models/create-entity-rollover.md new file mode 100644 index 000000000..d042fbaa0 --- /dev/null +++ b/packages/sdk/docs/models/create-entity-rollover.md @@ -0,0 +1,19 @@ +# CreateEntityRollover + +## Example Usage + +```typescript +import { CreateEntityRollover } from "@useautumn/sdk"; + +let value: CreateEntityRollover = { + balance: 3028.79, + expiresAt: 9861.8, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `balance` | *number* | :heavy_check_mark: | Amount of balance rolled over from a previous period. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the rollover balance expires. | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-entity-status.md b/packages/sdk/docs/models/create-entity-status.md new file mode 100644 index 000000000..cf476e13a --- /dev/null +++ b/packages/sdk/docs/models/create-entity-status.md @@ -0,0 +1,19 @@ +# CreateEntityStatus + +Current status of the subscription. + +## Example Usage + +```typescript +import { CreateEntityStatus } from "@useautumn/sdk"; + +let value: CreateEntityStatus = "active"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"active" | "scheduled" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/create-entity-subscription.md b/packages/sdk/docs/models/create-entity-subscription.md new file mode 100644 index 000000000..7ff33528c --- /dev/null +++ b/packages/sdk/docs/models/create-entity-subscription.md @@ -0,0 +1,40 @@ +# CreateEntitySubscription + +## Example Usage + +```typescript +import { CreateEntitySubscription } from "@useautumn/sdk"; + +let value: CreateEntitySubscription = { + planId: "", + autoEnable: false, + addOn: false, + status: "active", + pastDue: false, + canceledAt: 5661.83, + expiresAt: null, + trialEndsAt: 9861.97, + startedAt: 3108.66, + currentPeriodStart: 1951.21, + currentPeriodEnd: 6302.47, + quantity: 3052.58, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | +| `planId` | *string* | :heavy_check_mark: | The unique identifier of the subscribed plan. | +| `autoEnable` | *boolean* | :heavy_check_mark: | Whether the plan was automatically enabled for the customer. | +| `addOn` | *boolean* | :heavy_check_mark: | Whether this is an add-on plan rather than a base subscription. | +| `status` | [models.CreateEntityStatus](../models/create-entity-status.md) | :heavy_check_mark: | Current status of the subscription. | +| `pastDue` | *boolean* | :heavy_check_mark: | Whether the subscription has overdue payments. | +| `canceledAt` | *number* | :heavy_check_mark: | Timestamp when the subscription was canceled, or null if not canceled. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the subscription will expire, or null if no expiry set. | +| `trialEndsAt` | *number* | :heavy_check_mark: | Timestamp when the trial period ends, or null if not on trial. | +| `startedAt` | *number* | :heavy_check_mark: | Timestamp when the subscription started. | +| `currentPeriodStart` | *number* | :heavy_check_mark: | Start timestamp of the current billing period. | +| `currentPeriodEnd` | *number* | :heavy_check_mark: | End timestamp of the current billing period. | +| `quantity` | *number* | :heavy_check_mark: | Number of units of this subscription (for per-seat plans). | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-entity-tier.md b/packages/sdk/docs/models/create-entity-tier.md new file mode 100644 index 000000000..4753fa0cc --- /dev/null +++ b/packages/sdk/docs/models/create-entity-tier.md @@ -0,0 +1,19 @@ +# CreateEntityTier + +## Example Usage + +```typescript +import { CreateEntityTier } from "@useautumn/sdk"; + +let value: CreateEntityTier = { + to: 8908.67, + amount: 9091.52, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `to` | *models.CreateEntityTo* | :heavy_check_mark: | N/A | +| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-balance-to.md b/packages/sdk/docs/models/create-entity-to.md similarity index 85% rename from packages/sdk/docs/models/balances-check-balance-to.md rename to packages/sdk/docs/models/create-entity-to.md index 20f24bc0e..ee1882db7 100644 --- a/packages/sdk/docs/models/balances-check-balance-to.md +++ b/packages/sdk/docs/models/create-entity-to.md @@ -1,4 +1,4 @@ -# BalancesCheckBalanceTo +# CreateEntityTo ## Supported Types diff --git a/packages/sdk/docs/models/balances-track-type.md b/packages/sdk/docs/models/create-entity-type.md similarity index 67% rename from packages/sdk/docs/models/balances-track-type.md rename to packages/sdk/docs/models/create-entity-type.md index 03f84e5bc..059a26599 100644 --- a/packages/sdk/docs/models/balances-track-type.md +++ b/packages/sdk/docs/models/create-entity-type.md @@ -1,11 +1,11 @@ -# BalancesTrackType +# CreateEntityType ## Example Usage ```typescript -import { BalancesTrackType } from "@useautumn/sdk"; +import { CreateEntityType } from "@useautumn/sdk"; -let value: BalancesTrackType = "boolean"; +let value: CreateEntityType = "boolean"; ``` ## Values diff --git a/packages/sdk/docs/models/create-referral-code-globals.md b/packages/sdk/docs/models/create-referral-code-globals.md new file mode 100644 index 000000000..35e4440ee --- /dev/null +++ b/packages/sdk/docs/models/create-referral-code-globals.md @@ -0,0 +1,15 @@ +# CreateReferralCodeGlobals + +## Example Usage + +```typescript +import { CreateReferralCodeGlobals } from "@useautumn/sdk"; + +let value: CreateReferralCodeGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-referral-code-params.md b/packages/sdk/docs/models/create-referral-code-params.md new file mode 100644 index 000000000..d37d3fb10 --- /dev/null +++ b/packages/sdk/docs/models/create-referral-code-params.md @@ -0,0 +1,19 @@ +# CreateReferralCodeParams + +## Example Usage + +```typescript +import { CreateReferralCodeParams } from "@useautumn/sdk"; + +let value: CreateReferralCodeParams = { + customerId: "cus_123", + programId: "prog_123", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------- | ------------------------------------- | ------------------------------------- | ------------------------------------- | +| `customerId` | *string* | :heavy_check_mark: | The unique identifier of the customer | +| `programId` | *string* | :heavy_check_mark: | ID of your referral program | \ No newline at end of file diff --git a/packages/sdk/docs/models/create-referral-code-response.md b/packages/sdk/docs/models/create-referral-code-response.md new file mode 100644 index 000000000..4971dcd50 --- /dev/null +++ b/packages/sdk/docs/models/create-referral-code-response.md @@ -0,0 +1,23 @@ +# CreateReferralCodeResponse + +OK + +## Example Usage + +```typescript +import { CreateReferralCodeResponse } from "@useautumn/sdk"; + +let value: CreateReferralCodeResponse = { + code: "", + customerId: "", + createdAt: 123, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | +| `code` | *string* | :heavy_check_mark: | The referral code that can be shared with customers | +| `customerId` | *string* | :heavy_check_mark: | Your unique identifier for the customer | +| `createdAt` | *number* | :heavy_check_mark: | The timestamp of when the referral code was created | \ No newline at end of file diff --git a/packages/sdk/docs/models/customer-billing-method.md b/packages/sdk/docs/models/customer-billing-method.md index 12c6c12ff..a5ffcb219 100644 --- a/packages/sdk/docs/models/customer-billing-method.md +++ b/packages/sdk/docs/models/customer-billing-method.md @@ -1,5 +1,7 @@ # CustomerBillingMethod +Whether usage is prepaid or billed pay-per-use. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/customer-feature.md b/packages/sdk/docs/models/customer-feature.md index a5179d50a..d26c97ba4 100644 --- a/packages/sdk/docs/models/customer-feature.md +++ b/packages/sdk/docs/models/customer-feature.md @@ -1,5 +1,7 @@ # CustomerFeature +The full feature object if expanded. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/customer-interval-union.md b/packages/sdk/docs/models/customer-interval-union.md index 51b233d36..58599ba43 100644 --- a/packages/sdk/docs/models/customer-interval-union.md +++ b/packages/sdk/docs/models/customer-interval-union.md @@ -1,5 +1,7 @@ # CustomerIntervalUnion +The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + ## Supported Types diff --git a/packages/sdk/docs/models/customer-price.md b/packages/sdk/docs/models/customer-price.md index 88a0feb0e..a0620af3a 100644 --- a/packages/sdk/docs/models/customer-price.md +++ b/packages/sdk/docs/models/customer-price.md @@ -16,8 +16,8 @@ let value: CustomerPrice = { | Field | Type | Required | Description | | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `amount` | *number* | :heavy_minus_sign: | N/A | -| `tiers` | [models.CustomerTier](../models/customer-tier.md)[] | :heavy_minus_sign: | N/A | -| `billingUnits` | *number* | :heavy_check_mark: | N/A | -| `billingMethod` | [models.CustomerBillingMethod](../models/customer-billing-method.md) | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| `amount` | *number* | :heavy_minus_sign: | The per-unit price amount. | +| `tiers` | [models.CustomerTier](../models/customer-tier.md)[] | :heavy_minus_sign: | Tiered pricing configuration if applicable. | +| `billingUnits` | *number* | :heavy_check_mark: | The number of units per billing increment (eg. $9 / 250 units). | +| `billingMethod` | [models.CustomerBillingMethod](../models/customer-billing-method.md) | :heavy_check_mark: | Whether usage is prepaid or billed pay-per-use. | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum quantity that can be purchased, or null for unlimited. | \ No newline at end of file diff --git a/packages/sdk/docs/models/customer-reset.md b/packages/sdk/docs/models/customer-reset.md index d9fa2417e..fe6183522 100644 --- a/packages/sdk/docs/models/customer-reset.md +++ b/packages/sdk/docs/models/customer-reset.md @@ -13,8 +13,8 @@ let value: CustomerReset = { ## Fields -| Field | Type | Required | Description | -| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | -| `interval` | *models.CustomerIntervalUnion* | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `resetsAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `interval` | *models.CustomerIntervalUnion* | :heavy_check_mark: | The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets (eg. 2 for bi-monthly). | +| `resetsAt` | *number* | :heavy_check_mark: | Timestamp when the balance will next reset. | \ No newline at end of file diff --git a/packages/sdk/docs/models/customer-rollover.md b/packages/sdk/docs/models/customer-rollover.md index f450d1ef0..356394a6d 100644 --- a/packages/sdk/docs/models/customer-rollover.md +++ b/packages/sdk/docs/models/customer-rollover.md @@ -13,7 +13,7 @@ let value: CustomerRollover = { ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `balance` | *number* | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `balance` | *number* | :heavy_check_mark: | Amount of balance rolled over from a previous period. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the rollover balance expires. | \ No newline at end of file diff --git a/packages/sdk/docs/models/customer.md b/packages/sdk/docs/models/customer.md index d7c1b370d..f33ec4127 100644 --- a/packages/sdk/docs/models/customer.md +++ b/packages/sdk/docs/models/customer.md @@ -6,42 +6,59 @@ import { Customer } from "@useautumn/sdk"; let value: Customer = { - id: "cus_123", - name: "John Doe", - email: "john@example.com", - createdAt: 1717000000, - fingerprint: "1234567890", - stripeId: "cus_123", + id: "2ee25a41-0d81-4ad2-8451-ec1aadaefe58", + name: "Patrick", + email: "patrick@useautumn.com", + createdAt: 8386.3, + fingerprint: null, + stripeId: null, env: "sandbox", metadata: {}, sendEmailReceipts: false, subscriptions: [ { - planId: "plan_123", - autoEnable: true, + planId: "", + autoEnable: false, addOn: false, status: "active", pastDue: false, - canceledAt: 9016.07, - expiresAt: 7919.45, - trialEndsAt: 9802.8, - startedAt: 9956.34, - currentPeriodStart: 4924.95, - currentPeriodEnd: 7855.7, + canceledAt: 7919.45, + expiresAt: 9802.8, + trialEndsAt: 3055.97, + startedAt: 4924.95, + currentPeriodStart: 7855.7, + currentPeriodEnd: 7441.15, quantity: 1, }, ], purchases: [], balances: { - "balance_1": { + "messages": { featureId: "", - granted: 7438.76, - remaining: 7441.15, - usage: 5903.02, - unlimited: true, + granted: 100, + remaining: 0, + usage: 100, + unlimited: false, overageAllowed: false, - maxPurchase: 934.85, - nextResetAt: 1710.61, + maxPurchase: 8444.68, + nextResetAt: 934.85, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "", + includedGrant: 1710.61, + prepaidGrant: 3221.05, + remaining: 0, + usage: 100, + unlimited: false, + reset: { + interval: "month", + resetsAt: 72.25, + }, + price: null, + expiresAt: 8651.43, + }, + ], }, }, }; @@ -60,9 +77,9 @@ let value: Customer = { | `env` | [models.CustomerEnv](../models/customer-env.md) | :heavy_check_mark: | The environment this customer was created in. | | `metadata` | Record | :heavy_check_mark: | The metadata for the customer. | | `sendEmailReceipts` | *boolean* | :heavy_check_mark: | Whether to send email receipts to the customer. | -| `subscriptions` | [models.Subscription](../models/subscription.md)[] | :heavy_check_mark: | N/A | -| `purchases` | [models.Purchase](../models/purchase.md)[] | :heavy_check_mark: | N/A | -| `balances` | Record | :heavy_check_mark: | N/A | +| `subscriptions` | [models.Subscription](../models/subscription.md)[] | :heavy_check_mark: | Active and scheduled recurring plans that this customer has attached. | +| `purchases` | [models.Purchase](../models/purchase.md)[] | :heavy_check_mark: | One-time purchases made by the customer. | +| `balances` | Record | :heavy_check_mark: | Feature balances keyed by feature ID, showing usage limits and remaining amounts. | | `invoices` | [models.Invoice](../models/invoice.md)[] | :heavy_minus_sign: | N/A | | `entities` | [models.Entity](../models/entity.md)[] | :heavy_minus_sign: | N/A | | `trialsUsed` | [models.TrialsUsed](../models/trials-used.md)[] | :heavy_minus_sign: | N/A | diff --git a/packages/sdk/docs/models/balances-create-globals.md b/packages/sdk/docs/models/delete-entity-globals.md similarity index 72% rename from packages/sdk/docs/models/balances-create-globals.md rename to packages/sdk/docs/models/delete-entity-globals.md index 31dd035ed..7163a2434 100644 --- a/packages/sdk/docs/models/balances-create-globals.md +++ b/packages/sdk/docs/models/delete-entity-globals.md @@ -1,11 +1,11 @@ -# BalancesCreateGlobals +# DeleteEntityGlobals ## Example Usage ```typescript -import { BalancesCreateGlobals } from "@useautumn/sdk"; +import { DeleteEntityGlobals } from "@useautumn/sdk"; -let value: BalancesCreateGlobals = {}; +let value: DeleteEntityGlobals = {}; ``` ## Fields diff --git a/packages/sdk/docs/models/delete-entity-params.md b/packages/sdk/docs/models/delete-entity-params.md new file mode 100644 index 000000000..ddadf5b19 --- /dev/null +++ b/packages/sdk/docs/models/delete-entity-params.md @@ -0,0 +1,19 @@ +# DeleteEntityParams + +## Example Usage + +```typescript +import { DeleteEntityParams } from "@useautumn/sdk"; + +let value: DeleteEntityParams = { + customerId: "cus_123", + entityId: "seat_42", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `customerId` | *string* | :heavy_minus_sign: | The ID of the customer. | +| `entityId` | *string* | :heavy_check_mark: | The ID of the entity. | \ No newline at end of file diff --git a/packages/sdk/docs/models/delete-entity-response.md b/packages/sdk/docs/models/delete-entity-response.md new file mode 100644 index 000000000..6518f0a56 --- /dev/null +++ b/packages/sdk/docs/models/delete-entity-response.md @@ -0,0 +1,19 @@ +# DeleteEntityResponse + +OK + +## Example Usage + +```typescript +import { DeleteEntityResponse } from "@useautumn/sdk"; + +let value: DeleteEntityResponse = { + success: true, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `success` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/events-aggregate-params.md b/packages/sdk/docs/models/events-aggregate-params.md new file mode 100644 index 000000000..5a208edf6 --- /dev/null +++ b/packages/sdk/docs/models/events-aggregate-params.md @@ -0,0 +1,24 @@ +# EventsAggregateParams + +## Example Usage + +```typescript +import { EventsAggregateParams } from "@useautumn/sdk"; + +let value: EventsAggregateParams = { + customerId: "cus_123", + featureId: "api_calls", + range: "30d", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| `customerId` | *string* | :heavy_check_mark: | Customer ID to aggregate events for | +| `featureId` | *models.AggregateEventsFeatureId* | :heavy_check_mark: | Feature ID(s) to aggregate events for | +| `groupBy` | *string* | :heavy_minus_sign: | Property to group events by. If provided, each key in the response will be an object with distinct groups as the keys | +| `range` | [models.Range](../models/range.md) | :heavy_minus_sign: | Time range to aggregate events for. Either range or custom_range must be provided | +| `binSize` | [models.BinSize](../models/bin-size.md) | :heavy_minus_sign: | Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day | +| `customRange` | [models.AggregateEventsCustomRange](../models/aggregate-events-custom-range.md) | :heavy_minus_sign: | Custom time range to aggregate events for. If provided, range must not be provided | \ No newline at end of file diff --git a/packages/sdk/docs/models/events-list-params.md b/packages/sdk/docs/models/events-list-params.md new file mode 100644 index 000000000..2386a6150 --- /dev/null +++ b/packages/sdk/docs/models/events-list-params.md @@ -0,0 +1,22 @@ +# EventsListParams + +## Example Usage + +```typescript +import { EventsListParams } from "@useautumn/sdk"; + +let value: EventsListParams = { + limit: 50, + customerId: "cus_123", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `offset` | *number* | :heavy_minus_sign: | Number of items to skip | +| `limit` | *number* | :heavy_minus_sign: | Number of items to return. Default 100, max 1000. | +| `customerId` | *string* | :heavy_minus_sign: | Filter events by customer ID | +| `featureId` | *models.ListEventsFeatureId* | :heavy_minus_sign: | Filter by specific feature ID(s) | +| `customRange` | [models.ListEventsCustomRange](../models/list-events-custom-range.md) | :heavy_minus_sign: | Filter events by time range | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-entity-balances.md b/packages/sdk/docs/models/get-entity-balances.md new file mode 100644 index 000000000..37792392a --- /dev/null +++ b/packages/sdk/docs/models/get-entity-balances.md @@ -0,0 +1,51 @@ +# GetEntityBalances + +## Example Usage + +```typescript +import { GetEntityBalances } from "@useautumn/sdk"; + +let value: GetEntityBalances = { + featureId: "messages", + granted: 100, + remaining: 72, + usage: 28, + unlimited: false, + overageAllowed: false, + maxPurchase: null, + nextResetAt: 1773851121437, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "pro_plan", + includedGrant: 100, + prepaidGrant: 0, + remaining: 72, + usage: 28, + unlimited: false, + reset: { + interval: "month", + resetsAt: 1773851121437, + }, + price: null, + expiresAt: null, + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | The feature ID this balance is for. | +| `feature` | [models.GetEntityFeature](../models/get-entity-feature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `granted` | *number* | :heavy_check_mark: | Total balance granted (included + prepaid). | +| `remaining` | *number* | :heavy_check_mark: | Remaining balance available for use. | +| `usage` | *number* | :heavy_check_mark: | Total usage consumed in the current period. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether this feature has unlimited usage. | +| `overageAllowed` | *boolean* | :heavy_check_mark: | Whether usage beyond the granted balance is allowed (with overage charges). | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum quantity that can be purchased as a top-up, or null for unlimited. | +| `nextResetAt` | *number* | :heavy_check_mark: | Timestamp when the balance will reset, or null for no reset. | +| `breakdown` | [models.GetEntityBreakdown](../models/get-entity-breakdown.md)[] | :heavy_minus_sign: | Detailed breakdown of balance sources when stacking multiple plans or grants. | +| `rollovers` | [models.GetEntityRollover](../models/get-entity-rollover.md)[] | :heavy_minus_sign: | Rollover balances carried over from previous periods. | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-balance-billing-method.md b/packages/sdk/docs/models/get-entity-billing-method.md similarity index 55% rename from packages/sdk/docs/models/balances-track-balance-billing-method.md rename to packages/sdk/docs/models/get-entity-billing-method.md index 29cb6a938..8dc05e30f 100644 --- a/packages/sdk/docs/models/balances-track-balance-billing-method.md +++ b/packages/sdk/docs/models/get-entity-billing-method.md @@ -1,11 +1,13 @@ -# BalancesTrackBalanceBillingMethod +# GetEntityBillingMethod + +Whether usage is prepaid or billed pay-per-use. ## Example Usage ```typescript -import { BalancesTrackBalanceBillingMethod } from "@useautumn/sdk"; +import { GetEntityBillingMethod } from "@useautumn/sdk"; -let value: BalancesTrackBalanceBillingMethod = "usage_based"; +let value: GetEntityBillingMethod = "prepaid"; ``` ## Values diff --git a/packages/sdk/docs/models/get-entity-breakdown.md b/packages/sdk/docs/models/get-entity-breakdown.md new file mode 100644 index 000000000..1784f8fd6 --- /dev/null +++ b/packages/sdk/docs/models/get-entity-breakdown.md @@ -0,0 +1,41 @@ +# GetEntityBreakdown + +## Example Usage + +```typescript +import { GetEntityBreakdown } from "@useautumn/sdk"; + +let value: GetEntityBreakdown = { + planId: "", + includedGrant: 3968.62, + prepaidGrant: 3696.36, + remaining: 8414.69, + usage: 708.25, + unlimited: false, + reset: { + interval: "", + resetsAt: 9173.38, + }, + price: { + billingUnits: 7902.18, + billingMethod: "prepaid", + maxPurchase: 9150.43, + }, + expiresAt: 227.64, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | The unique identifier for this balance breakdown. | +| `planId` | *string* | :heavy_check_mark: | The plan ID this balance originates from, or null for standalone balances. | +| `includedGrant` | *number* | :heavy_check_mark: | Amount granted from the plan's included usage. | +| `prepaidGrant` | *number* | :heavy_check_mark: | Amount granted from prepaid purchases or top-ups. | +| `remaining` | *number* | :heavy_check_mark: | Remaining balance available for use. | +| `usage` | *number* | :heavy_check_mark: | Amount consumed in the current period. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether this balance has unlimited usage. | +| `reset` | [models.GetEntityReset](../models/get-entity-reset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. | +| `price` | [models.GetEntityPrice](../models/get-entity-price.md) | :heavy_check_mark: | Pricing configuration if this balance has usage-based pricing. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when this balance expires, or null for no expiration. | \ No newline at end of file diff --git a/packages/sdk/docs/models/outgoing-credit-schema.md b/packages/sdk/docs/models/get-entity-credit-schema.md similarity index 75% rename from packages/sdk/docs/models/outgoing-credit-schema.md rename to packages/sdk/docs/models/get-entity-credit-schema.md index 5999ce837..3e7d8d7cd 100644 --- a/packages/sdk/docs/models/outgoing-credit-schema.md +++ b/packages/sdk/docs/models/get-entity-credit-schema.md @@ -1,13 +1,13 @@ -# OutgoingCreditSchema +# GetEntityCreditSchema ## Example Usage ```typescript -import { OutgoingCreditSchema } from "@useautumn/sdk"; +import { GetEntityCreditSchema } from "@useautumn/sdk"; -let value: OutgoingCreditSchema = { +let value: GetEntityCreditSchema = { meteredFeatureId: "", - creditCost: 4711.27, + creditCost: 4881.48, }; ``` diff --git a/packages/sdk/docs/models/outgoing-display.md b/packages/sdk/docs/models/get-entity-display.md similarity index 79% rename from packages/sdk/docs/models/outgoing-display.md rename to packages/sdk/docs/models/get-entity-display.md index 907b0f8f6..4b1627c2b 100644 --- a/packages/sdk/docs/models/outgoing-display.md +++ b/packages/sdk/docs/models/get-entity-display.md @@ -1,11 +1,11 @@ -# OutgoingDisplay +# GetEntityDisplay ## Example Usage ```typescript -import { OutgoingDisplay } from "@useautumn/sdk"; +import { GetEntityDisplay } from "@useautumn/sdk"; -let value: OutgoingDisplay = {}; +let value: GetEntityDisplay = {}; ``` ## Fields diff --git a/packages/sdk/docs/models/redirect-type.md b/packages/sdk/docs/models/get-entity-env.md similarity index 50% rename from packages/sdk/docs/models/redirect-type.md rename to packages/sdk/docs/models/get-entity-env.md index c8ae9b9eb..5490fe591 100644 --- a/packages/sdk/docs/models/redirect-type.md +++ b/packages/sdk/docs/models/get-entity-env.md @@ -1,11 +1,13 @@ -# RedirectType +# GetEntityEnv + +The environment (sandbox/live) ## Example Usage ```typescript -import { RedirectType } from "@useautumn/sdk"; +import { GetEntityEnv } from "@useautumn/sdk"; -let value: RedirectType = "autumn_checkout"; +let value: GetEntityEnv = "live"; ``` ## Values @@ -13,5 +15,5 @@ let value: RedirectType = "autumn_checkout"; This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. ```typescript -"stripe_checkout" | "autumn_checkout" | Unrecognized +"sandbox" | "live" | Unrecognized ``` \ No newline at end of file diff --git a/packages/sdk/docs/models/get-entity-feature.md b/packages/sdk/docs/models/get-entity-feature.md new file mode 100644 index 000000000..58541df1e --- /dev/null +++ b/packages/sdk/docs/models/get-entity-feature.md @@ -0,0 +1,30 @@ +# GetEntityFeature + +The full feature object if expanded. + +## Example Usage + +```typescript +import { GetEntityFeature } from "@useautumn/sdk"; + +let value: GetEntityFeature = { + id: "", + name: "", + type: "metered", + consumable: false, + archived: false, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | N/A | +| `name` | *string* | :heavy_check_mark: | N/A | +| `type` | [models.GetEntityType](../models/get-entity-type.md) | :heavy_check_mark: | N/A | +| `consumable` | *boolean* | :heavy_check_mark: | N/A | +| `eventNames` | *string*[] | :heavy_minus_sign: | N/A | +| `creditSchema` | [models.GetEntityCreditSchema](../models/get-entity-credit-schema.md)[] | :heavy_minus_sign: | N/A | +| `display` | [models.GetEntityDisplay](../models/get-entity-display.md) | :heavy_minus_sign: | N/A | +| `archived` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-entity-globals.md b/packages/sdk/docs/models/get-entity-globals.md new file mode 100644 index 000000000..a05c79848 --- /dev/null +++ b/packages/sdk/docs/models/get-entity-globals.md @@ -0,0 +1,15 @@ +# GetEntityGlobals + +## Example Usage + +```typescript +import { GetEntityGlobals } from "@useautumn/sdk"; + +let value: GetEntityGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/interval-outgoing-enum.md b/packages/sdk/docs/models/get-entity-interval-enum.md similarity index 69% rename from packages/sdk/docs/models/interval-outgoing-enum.md rename to packages/sdk/docs/models/get-entity-interval-enum.md index 1f89b22ca..c9080f7a6 100644 --- a/packages/sdk/docs/models/interval-outgoing-enum.md +++ b/packages/sdk/docs/models/get-entity-interval-enum.md @@ -1,11 +1,11 @@ -# IntervalOutgoingEnum +# GetEntityIntervalEnum ## Example Usage ```typescript -import { IntervalOutgoingEnum } from "@useautumn/sdk"; +import { GetEntityIntervalEnum } from "@useautumn/sdk"; -let value: IntervalOutgoingEnum = "quarter"; +let value: GetEntityIntervalEnum = "minute"; ``` ## Values diff --git a/packages/sdk/docs/models/get-entity-interval-union.md b/packages/sdk/docs/models/get-entity-interval-union.md new file mode 100644 index 000000000..a8dd65e85 --- /dev/null +++ b/packages/sdk/docs/models/get-entity-interval-union.md @@ -0,0 +1,19 @@ +# GetEntityIntervalUnion + +The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + +## Supported Types + +### `models.GetEntityIntervalEnum` + +```typescript +const value: models.GetEntityIntervalEnum = "year"; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/get-entity-invoice.md b/packages/sdk/docs/models/get-entity-invoice.md new file mode 100644 index 000000000..dc79e5f9a --- /dev/null +++ b/packages/sdk/docs/models/get-entity-invoice.md @@ -0,0 +1,28 @@ +# GetEntityInvoice + +## Example Usage + +```typescript +import { GetEntityInvoice } from "@useautumn/sdk"; + +let value: GetEntityInvoice = { + planIds: [], + stripeId: "", + status: "", + total: 9799.6, + currency: "Barbados Dollar", + createdAt: 6472.17, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `planIds` | *string*[] | :heavy_check_mark: | Array of plan IDs included in this invoice | +| `stripeId` | *string* | :heavy_check_mark: | The Stripe invoice ID | +| `status` | *string* | :heavy_check_mark: | The status of the invoice | +| `total` | *number* | :heavy_check_mark: | The total amount of the invoice | +| `currency` | *string* | :heavy_check_mark: | The currency code for the invoice | +| `createdAt` | *number* | :heavy_check_mark: | Timestamp when the invoice was created | +| `hostedInvoiceUrl` | *string* | :heavy_minus_sign: | URL to the Stripe-hosted invoice page | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-entity-params.md b/packages/sdk/docs/models/get-entity-params.md new file mode 100644 index 000000000..c80f55c5b --- /dev/null +++ b/packages/sdk/docs/models/get-entity-params.md @@ -0,0 +1,18 @@ +# GetEntityParams + +## Example Usage + +```typescript +import { GetEntityParams } from "@useautumn/sdk"; + +let value: GetEntityParams = { + entityId: "seat_42", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | +| `customerId` | *string* | :heavy_minus_sign: | The ID of the customer to create the entity for. | +| `entityId` | *string* | :heavy_check_mark: | The ID of the entity. | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-entity-price.md b/packages/sdk/docs/models/get-entity-price.md new file mode 100644 index 000000000..bed688bca --- /dev/null +++ b/packages/sdk/docs/models/get-entity-price.md @@ -0,0 +1,23 @@ +# GetEntityPrice + +## Example Usage + +```typescript +import { GetEntityPrice } from "@useautumn/sdk"; + +let value: GetEntityPrice = { + billingUnits: 7241.11, + billingMethod: "usage_based", + maxPurchase: 6870.54, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `amount` | *number* | :heavy_minus_sign: | The per-unit price amount. | +| `tiers` | [models.GetEntityTier](../models/get-entity-tier.md)[] | :heavy_minus_sign: | Tiered pricing configuration if applicable. | +| `billingUnits` | *number* | :heavy_check_mark: | The number of units per billing increment (eg. $9 / 250 units). | +| `billingMethod` | [models.GetEntityBillingMethod](../models/get-entity-billing-method.md) | :heavy_check_mark: | Whether usage is prepaid or billed pay-per-use. | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum quantity that can be purchased, or null for unlimited. | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-entity-purchase.md b/packages/sdk/docs/models/get-entity-purchase.md new file mode 100644 index 000000000..d5cabde95 --- /dev/null +++ b/packages/sdk/docs/models/get-entity-purchase.md @@ -0,0 +1,24 @@ +# GetEntityPurchase + +## Example Usage + +```typescript +import { GetEntityPurchase } from "@useautumn/sdk"; + +let value: GetEntityPurchase = { + planId: "", + expiresAt: 7077.77, + startedAt: 2644.6, + quantity: 4562.19, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | +| `planId` | *string* | :heavy_check_mark: | The unique identifier of the purchased plan. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the purchase expires, or null for lifetime access. | +| `startedAt` | *number* | :heavy_check_mark: | Timestamp when the purchase was made. | +| `quantity` | *number* | :heavy_check_mark: | Number of units purchased. | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-entity-reset.md b/packages/sdk/docs/models/get-entity-reset.md new file mode 100644 index 000000000..0e56393cb --- /dev/null +++ b/packages/sdk/docs/models/get-entity-reset.md @@ -0,0 +1,20 @@ +# GetEntityReset + +## Example Usage + +```typescript +import { GetEntityReset } from "@useautumn/sdk"; + +let value: GetEntityReset = { + interval: "", + resetsAt: null, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `interval` | *models.GetEntityIntervalUnion* | :heavy_check_mark: | The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets (eg. 2 for bi-monthly). | +| `resetsAt` | *number* | :heavy_check_mark: | Timestamp when the balance will next reset. | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-entity-response.md b/packages/sdk/docs/models/get-entity-response.md new file mode 100644 index 000000000..8f7051a27 --- /dev/null +++ b/packages/sdk/docs/models/get-entity-response.md @@ -0,0 +1,81 @@ +# GetEntityResponse + +OK + +## Example Usage + +```typescript +import { GetEntityResponse } from "@useautumn/sdk"; + +let value: GetEntityResponse = { + id: "seat_42", + name: "Seat 42", + customerId: "cus_123", + featureId: "seats", + createdAt: 1771409161016, + env: "sandbox", + subscriptions: [ + { + planId: "pro_plan", + autoEnable: true, + addOn: false, + status: "active", + pastDue: false, + canceledAt: null, + expiresAt: null, + trialEndsAt: null, + startedAt: 1771431921437, + currentPeriodStart: 1771431921437, + currentPeriodEnd: 1771999921437, + quantity: 1, + }, + ], + purchases: [], + balances: { + "messages": { + featureId: "messages", + granted: 100, + remaining: 72, + usage: 28, + unlimited: false, + overageAllowed: false, + maxPurchase: null, + nextResetAt: 1773851121437, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "pro_plan", + includedGrant: 100, + prepaidGrant: 0, + remaining: 72, + usage: 28, + unlimited: false, + reset: { + interval: "month", + resetsAt: 1773851121437, + }, + price: null, + expiresAt: null, + }, + ], + }, + }, + invoices: [], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `autumnId` | *string* | :heavy_minus_sign: | N/A | +| `id` | *string* | :heavy_check_mark: | The unique identifier of the entity | +| `name` | *string* | :heavy_check_mark: | The name of the entity | +| `customerId` | *string* | :heavy_minus_sign: | The customer ID this entity belongs to | +| `featureId` | *string* | :heavy_minus_sign: | The feature ID this entity belongs to | +| `createdAt` | *number* | :heavy_check_mark: | Unix timestamp when the entity was created | +| `env` | [models.GetEntityEnv](../models/get-entity-env.md) | :heavy_check_mark: | The environment (sandbox/live) | +| `subscriptions` | [models.GetEntitySubscription](../models/get-entity-subscription.md)[] | :heavy_check_mark: | N/A | +| `purchases` | [models.GetEntityPurchase](../models/get-entity-purchase.md)[] | :heavy_check_mark: | N/A | +| `balances` | Record | :heavy_check_mark: | N/A | +| `invoices` | [models.GetEntityInvoice](../models/get-entity-invoice.md)[] | :heavy_minus_sign: | Invoices for this entity (only included when expand=invoices) | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-entity-rollover.md b/packages/sdk/docs/models/get-entity-rollover.md new file mode 100644 index 000000000..f3f8aacd6 --- /dev/null +++ b/packages/sdk/docs/models/get-entity-rollover.md @@ -0,0 +1,19 @@ +# GetEntityRollover + +## Example Usage + +```typescript +import { GetEntityRollover } from "@useautumn/sdk"; + +let value: GetEntityRollover = { + balance: 9974.52, + expiresAt: 6340.52, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `balance` | *number* | :heavy_check_mark: | Amount of balance rolled over from a previous period. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the rollover balance expires. | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-entity-status.md b/packages/sdk/docs/models/get-entity-status.md new file mode 100644 index 000000000..065cb9fd1 --- /dev/null +++ b/packages/sdk/docs/models/get-entity-status.md @@ -0,0 +1,19 @@ +# GetEntityStatus + +Current status of the subscription. + +## Example Usage + +```typescript +import { GetEntityStatus } from "@useautumn/sdk"; + +let value: GetEntityStatus = "scheduled"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"active" | "scheduled" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/get-entity-subscription.md b/packages/sdk/docs/models/get-entity-subscription.md new file mode 100644 index 000000000..77245e53a --- /dev/null +++ b/packages/sdk/docs/models/get-entity-subscription.md @@ -0,0 +1,40 @@ +# GetEntitySubscription + +## Example Usage + +```typescript +import { GetEntitySubscription } from "@useautumn/sdk"; + +let value: GetEntitySubscription = { + planId: "", + autoEnable: false, + addOn: false, + status: "scheduled", + pastDue: true, + canceledAt: 3931.12, + expiresAt: 5373.3, + trialEndsAt: 2145.3, + startedAt: 7157.85, + currentPeriodStart: 9214.48, + currentPeriodEnd: 6937.83, + quantity: 2176.73, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | +| `planId` | *string* | :heavy_check_mark: | The unique identifier of the subscribed plan. | +| `autoEnable` | *boolean* | :heavy_check_mark: | Whether the plan was automatically enabled for the customer. | +| `addOn` | *boolean* | :heavy_check_mark: | Whether this is an add-on plan rather than a base subscription. | +| `status` | [models.GetEntityStatus](../models/get-entity-status.md) | :heavy_check_mark: | Current status of the subscription. | +| `pastDue` | *boolean* | :heavy_check_mark: | Whether the subscription has overdue payments. | +| `canceledAt` | *number* | :heavy_check_mark: | Timestamp when the subscription was canceled, or null if not canceled. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the subscription will expire, or null if no expiry set. | +| `trialEndsAt` | *number* | :heavy_check_mark: | Timestamp when the trial period ends, or null if not on trial. | +| `startedAt` | *number* | :heavy_check_mark: | Timestamp when the subscription started. | +| `currentPeriodStart` | *number* | :heavy_check_mark: | Start timestamp of the current billing period. | +| `currentPeriodEnd` | *number* | :heavy_check_mark: | End timestamp of the current billing period. | +| `quantity` | *number* | :heavy_check_mark: | Number of units of this subscription (for per-seat plans). | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-entity-tier.md b/packages/sdk/docs/models/get-entity-tier.md new file mode 100644 index 000000000..1e1221648 --- /dev/null +++ b/packages/sdk/docs/models/get-entity-tier.md @@ -0,0 +1,19 @@ +# GetEntityTier + +## Example Usage + +```typescript +import { GetEntityTier } from "@useautumn/sdk"; + +let value: GetEntityTier = { + to: "", + amount: 9158.55, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------- | -------------------- | -------------------- | -------------------- | +| `to` | *models.GetEntityTo* | :heavy_check_mark: | N/A | +| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-to.md b/packages/sdk/docs/models/get-entity-to.md similarity index 85% rename from packages/sdk/docs/models/billing-preview-attach-to.md rename to packages/sdk/docs/models/get-entity-to.md index 7e23e7ea5..7f1b033fe 100644 --- a/packages/sdk/docs/models/billing-preview-attach-to.md +++ b/packages/sdk/docs/models/get-entity-to.md @@ -1,4 +1,4 @@ -# BillingPreviewAttachTo +# GetEntityTo ## Supported Types diff --git a/packages/sdk/docs/models/incoming-type.md b/packages/sdk/docs/models/get-entity-type.md similarity index 69% rename from packages/sdk/docs/models/incoming-type.md rename to packages/sdk/docs/models/get-entity-type.md index 24ad3e91f..5365c6a79 100644 --- a/packages/sdk/docs/models/incoming-type.md +++ b/packages/sdk/docs/models/get-entity-type.md @@ -1,11 +1,11 @@ -# IncomingType +# GetEntityType ## Example Usage ```typescript -import { IncomingType } from "@useautumn/sdk"; +import { GetEntityType } from "@useautumn/sdk"; -let value: IncomingType = "credit_system"; +let value: GetEntityType = "boolean"; ``` ## Values diff --git a/packages/sdk/docs/models/incoming-balances.md b/packages/sdk/docs/models/incoming-balances.md deleted file mode 100644 index d7aa18a43..000000000 --- a/packages/sdk/docs/models/incoming-balances.md +++ /dev/null @@ -1,34 +0,0 @@ -# IncomingBalances - -## Example Usage - -```typescript -import { IncomingBalances } from "@useautumn/sdk"; - -let value: IncomingBalances = { - featureId: "", - granted: 3885.87, - remaining: 4866.24, - usage: 4030.05, - unlimited: true, - overageAllowed: true, - maxPurchase: 8567.35, - nextResetAt: 5972.57, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `feature` | [models.IncomingFeature](../models/incoming-feature.md) | :heavy_minus_sign: | N/A | -| `granted` | *number* | :heavy_check_mark: | N/A | -| `remaining` | *number* | :heavy_check_mark: | N/A | -| `usage` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `overageAllowed` | *boolean* | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | -| `nextResetAt` | *number* | :heavy_check_mark: | N/A | -| `breakdown` | [models.IncomingBreakdown](../models/incoming-breakdown.md)[] | :heavy_minus_sign: | N/A | -| `rollovers` | [models.IncomingRollover](../models/incoming-rollover.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/incoming-breakdown.md b/packages/sdk/docs/models/incoming-breakdown.md deleted file mode 100644 index ef753ea99..000000000 --- a/packages/sdk/docs/models/incoming-breakdown.md +++ /dev/null @@ -1,41 +0,0 @@ -# IncomingBreakdown - -## Example Usage - -```typescript -import { IncomingBreakdown } from "@useautumn/sdk"; - -let value: IncomingBreakdown = { - planId: "", - includedGrant: 7793.91, - prepaidGrant: 8395.06, - remaining: 153.32, - usage: 4960.79, - unlimited: true, - reset: { - interval: "day", - resetsAt: null, - }, - price: { - billingUnits: 8324.03, - billingMethod: "prepaid", - maxPurchase: 6111.08, - }, - expiresAt: null, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | -| `id` | *string* | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `includedGrant` | *number* | :heavy_check_mark: | N/A | -| `prepaidGrant` | *number* | :heavy_check_mark: | N/A | -| `remaining` | *number* | :heavy_check_mark: | N/A | -| `usage` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `reset` | [models.IncomingReset](../models/incoming-reset.md) | :heavy_check_mark: | N/A | -| `price` | [models.IncomingPrice](../models/incoming-price.md) | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/incoming-feature-quantity.md b/packages/sdk/docs/models/incoming-feature-quantity.md deleted file mode 100644 index facaea982..000000000 --- a/packages/sdk/docs/models/incoming-feature-quantity.md +++ /dev/null @@ -1,19 +0,0 @@ -# IncomingFeatureQuantity - -## Example Usage - -```typescript -import { IncomingFeatureQuantity } from "@useautumn/sdk"; - -let value: IncomingFeatureQuantity = { - featureId: "", - quantity: 4438.78, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `quantity` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/incoming-feature.md b/packages/sdk/docs/models/incoming-feature.md deleted file mode 100644 index c3984fc7a..000000000 --- a/packages/sdk/docs/models/incoming-feature.md +++ /dev/null @@ -1,28 +0,0 @@ -# IncomingFeature - -## Example Usage - -```typescript -import { IncomingFeature } from "@useautumn/sdk"; - -let value: IncomingFeature = { - id: "", - name: "", - type: "credit_system", - consumable: true, - archived: true, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `id` | *string* | :heavy_check_mark: | N/A | -| `name` | *string* | :heavy_check_mark: | N/A | -| `type` | [models.IncomingType](../models/incoming-type.md) | :heavy_check_mark: | N/A | -| `consumable` | *boolean* | :heavy_check_mark: | N/A | -| `eventNames` | *string*[] | :heavy_minus_sign: | N/A | -| `creditSchema` | [models.IncomingCreditSchema](../models/incoming-credit-schema.md)[] | :heavy_minus_sign: | N/A | -| `display` | [models.IncomingDisplay](../models/incoming-display.md) | :heavy_minus_sign: | N/A | -| `archived` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/incoming-interval-union.md b/packages/sdk/docs/models/incoming-interval-union.md deleted file mode 100644 index 157784f89..000000000 --- a/packages/sdk/docs/models/incoming-interval-union.md +++ /dev/null @@ -1,17 +0,0 @@ -# IncomingIntervalUnion - - -## Supported Types - -### `models.IntervalIncomingEnum` - -```typescript -const value: models.IntervalIncomingEnum = "semi_annual"; -``` - -### `string` - -```typescript -const value: string = ""; -``` - diff --git a/packages/sdk/docs/models/incoming-price.md b/packages/sdk/docs/models/incoming-price.md deleted file mode 100644 index 6e46fe6c6..000000000 --- a/packages/sdk/docs/models/incoming-price.md +++ /dev/null @@ -1,23 +0,0 @@ -# IncomingPrice - -## Example Usage - -```typescript -import { IncomingPrice } from "@useautumn/sdk"; - -let value: IncomingPrice = { - billingUnits: 4983.46, - billingMethod: "usage_based", - maxPurchase: 2767.96, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `amount` | *number* | :heavy_minus_sign: | N/A | -| `tiers` | [models.IncomingTier](../models/incoming-tier.md)[] | :heavy_minus_sign: | N/A | -| `billingUnits` | *number* | :heavy_check_mark: | N/A | -| `billingMethod` | [models.IncomingBillingMethod](../models/incoming-billing-method.md) | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/incoming-reset.md b/packages/sdk/docs/models/incoming-reset.md deleted file mode 100644 index 78df4f2bb..000000000 --- a/packages/sdk/docs/models/incoming-reset.md +++ /dev/null @@ -1,20 +0,0 @@ -# IncomingReset - -## Example Usage - -```typescript -import { IncomingReset } from "@useautumn/sdk"; - -let value: IncomingReset = { - interval: "", - resetsAt: 8675.68, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | -| `interval` | *models.IncomingIntervalUnion* | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `resetsAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/incoming-rollover.md b/packages/sdk/docs/models/incoming-rollover.md deleted file mode 100644 index a7f1b9a30..000000000 --- a/packages/sdk/docs/models/incoming-rollover.md +++ /dev/null @@ -1,19 +0,0 @@ -# IncomingRollover - -## Example Usage - -```typescript -import { IncomingRollover } from "@useautumn/sdk"; - -let value: IncomingRollover = { - balance: 4251.81, - expiresAt: 8005.57, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `balance` | *number* | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/incoming-tier.md b/packages/sdk/docs/models/incoming-tier.md deleted file mode 100644 index 95aee5509..000000000 --- a/packages/sdk/docs/models/incoming-tier.md +++ /dev/null @@ -1,18 +0,0 @@ -# IncomingTier - -## Example Usage - -```typescript -import { IncomingTier } from "@useautumn/sdk"; - -let value: IncomingTier = { - amount: 1036.04, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `to` | *any* | :heavy_minus_sign: | N/A | -| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/incoming.md b/packages/sdk/docs/models/incoming.md deleted file mode 100644 index 14b39cf62..000000000 --- a/packages/sdk/docs/models/incoming.md +++ /dev/null @@ -1,71 +0,0 @@ -# Incoming - -## Example Usage - -```typescript -import { Incoming } from "@useautumn/sdk"; - -let value: Incoming = { - plan: { - id: "", - name: "", - description: "very neaten definitive psst geez times gah", - group: "", - version: 762.38, - addOn: false, - autoEnable: true, - price: { - amount: 3075.99, - interval: "one_off", - }, - items: [ - { - featureId: "", - included: 7842.81, - unlimited: false, - reset: { - interval: "year", - }, - price: { - interval: "one_off", - billingUnits: 5268.83, - billingMethod: "usage_based", - maxPurchase: 9846.03, - }, - }, - ], - createdAt: 7030.5, - env: "live", - archived: true, - baseVariantId: "", - }, - featureQuantities: [ - { - featureId: "", - quantity: 4242.71, - }, - ], - balances: { - "key": { - featureId: "", - granted: 3858.89, - remaining: 9478.44, - usage: 8.77, - unlimited: false, - overageAllowed: true, - maxPurchase: 7143.31, - nextResetAt: 4884.95, - }, - }, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `plan` | [models.Plan](../models/plan.md) | :heavy_check_mark: | N/A | -| `featureQuantities` | [models.IncomingFeatureQuantity](../models/incoming-feature-quantity.md)[] | :heavy_check_mark: | N/A | -| `balances` | Record | :heavy_check_mark: | N/A | -| `periodStart` | *number* | :heavy_minus_sign: | N/A | -| `periodEnd` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-balances.md b/packages/sdk/docs/models/list-customers-balances.md index 57123fe51..fe5d016e7 100644 --- a/packages/sdk/docs/models/list-customers-balances.md +++ b/packages/sdk/docs/models/list-customers-balances.md @@ -6,29 +6,46 @@ import { ListCustomersBalances } from "@useautumn/sdk"; let value: ListCustomersBalances = { - featureId: "", - granted: 2638.08, - remaining: 7638.23, - usage: 7770.47, + featureId: "messages", + granted: 100, + remaining: 72, + usage: 28, unlimited: false, overageAllowed: false, - maxPurchase: 1309.81, - nextResetAt: 1108.02, + maxPurchase: null, + nextResetAt: 1773851121437, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "pro_plan", + includedGrant: 100, + prepaidGrant: 0, + remaining: 72, + usage: 28, + unlimited: false, + reset: { + interval: "month", + resetsAt: 1773851121437, + }, + price: null, + expiresAt: null, + }, + ], }; ``` ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `feature` | [models.ListCustomersFeature](../models/list-customers-feature.md) | :heavy_minus_sign: | N/A | -| `granted` | *number* | :heavy_check_mark: | N/A | -| `remaining` | *number* | :heavy_check_mark: | N/A | -| `usage` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `overageAllowed` | *boolean* | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | -| `nextResetAt` | *number* | :heavy_check_mark: | N/A | -| `breakdown` | [models.ListCustomersBreakdown](../models/list-customers-breakdown.md)[] | :heavy_minus_sign: | N/A | -| `rollovers` | [models.ListCustomersRollover](../models/list-customers-rollover.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | The feature ID this balance is for. | +| `feature` | [models.ListCustomersFeature](../models/list-customers-feature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `granted` | *number* | :heavy_check_mark: | Total balance granted (included + prepaid). | +| `remaining` | *number* | :heavy_check_mark: | Remaining balance available for use. | +| `usage` | *number* | :heavy_check_mark: | Total usage consumed in the current period. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether this feature has unlimited usage. | +| `overageAllowed` | *boolean* | :heavy_check_mark: | Whether usage beyond the granted balance is allowed (with overage charges). | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum quantity that can be purchased as a top-up, or null for unlimited. | +| `nextResetAt` | *number* | :heavy_check_mark: | Timestamp when the balance will reset, or null for no reset. | +| `breakdown` | [models.ListCustomersBreakdown](../models/list-customers-breakdown.md)[] | :heavy_minus_sign: | Detailed breakdown of balance sources when stacking multiple plans or grants. | +| `rollovers` | [models.ListCustomersRollover](../models/list-customers-rollover.md)[] | :heavy_minus_sign: | Rollover balances carried over from previous periods. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-billing-method.md b/packages/sdk/docs/models/list-customers-billing-method.md index 3ddd429f5..7b56a65bc 100644 --- a/packages/sdk/docs/models/list-customers-billing-method.md +++ b/packages/sdk/docs/models/list-customers-billing-method.md @@ -1,5 +1,7 @@ # ListCustomersBillingMethod +Whether usage is prepaid or billed pay-per-use. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/list-customers-breakdown.md b/packages/sdk/docs/models/list-customers-breakdown.md index e24c52777..4e971a94d 100644 --- a/packages/sdk/docs/models/list-customers-breakdown.md +++ b/packages/sdk/docs/models/list-customers-breakdown.md @@ -27,15 +27,15 @@ let value: ListCustomersBreakdown = { ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `id` | *string* | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `includedGrant` | *number* | :heavy_check_mark: | N/A | -| `prepaidGrant` | *number* | :heavy_check_mark: | N/A | -| `remaining` | *number* | :heavy_check_mark: | N/A | -| `usage` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `reset` | [models.ListCustomersReset](../models/list-customers-reset.md) | :heavy_check_mark: | N/A | -| `price` | [models.ListCustomersPrice](../models/list-customers-price.md) | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | The unique identifier for this balance breakdown. | +| `planId` | *string* | :heavy_check_mark: | The plan ID this balance originates from, or null for standalone balances. | +| `includedGrant` | *number* | :heavy_check_mark: | Amount granted from the plan's included usage. | +| `prepaidGrant` | *number* | :heavy_check_mark: | Amount granted from prepaid purchases or top-ups. | +| `remaining` | *number* | :heavy_check_mark: | Remaining balance available for use. | +| `usage` | *number* | :heavy_check_mark: | Amount consumed in the current period. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether this balance has unlimited usage. | +| `reset` | [models.ListCustomersReset](../models/list-customers-reset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. | +| `price` | [models.ListCustomersPrice](../models/list-customers-price.md) | :heavy_check_mark: | Pricing configuration if this balance has usage-based pricing. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when this balance expires, or null for no expiration. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-feature.md b/packages/sdk/docs/models/list-customers-feature.md index 2f1607793..2bd98aaab 100644 --- a/packages/sdk/docs/models/list-customers-feature.md +++ b/packages/sdk/docs/models/list-customers-feature.md @@ -1,5 +1,7 @@ # ListCustomersFeature +The full feature object if expanded. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/list-customers-interval-union.md b/packages/sdk/docs/models/list-customers-interval-union.md index 9f90f9e8b..a7a56c95a 100644 --- a/packages/sdk/docs/models/list-customers-interval-union.md +++ b/packages/sdk/docs/models/list-customers-interval-union.md @@ -1,5 +1,7 @@ # ListCustomersIntervalUnion +The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + ## Supported Types diff --git a/packages/sdk/docs/models/list.md b/packages/sdk/docs/models/list-customers-list.md similarity index 79% rename from packages/sdk/docs/models/list.md rename to packages/sdk/docs/models/list-customers-list.md index 76fdf5d30..ee6aa8596 100644 --- a/packages/sdk/docs/models/list.md +++ b/packages/sdk/docs/models/list-customers-list.md @@ -1,32 +1,66 @@ -# List +# ListCustomersList ## Example Usage ```typescript -import { List } from "@useautumn/sdk"; +import { ListCustomersList } from "@useautumn/sdk"; -let value: List = { - id: "", - name: "", - email: "Cole_Kuhn@gmail.com", - createdAt: 9730.61, - fingerprint: "", +let value: ListCustomersList = { + id: "2ee25a41-0d81-4ad2-8451-ec1aadaefe58", + name: "Patrick", + email: "patrick@useautumn.com", + createdAt: 574.97, + fingerprint: null, stripeId: "", - env: "live", - metadata: { - "key": "", - }, + env: "sandbox", + metadata: {}, sendEmailReceipts: true, - subscriptions: [], - purchases: [ + subscriptions: [ { planId: "", - expiresAt: 4940.05, - startedAt: 1235.42, - quantity: 3895.4, + autoEnable: true, + addOn: true, + status: "active", + pastDue: false, + canceledAt: 7757.63, + expiresAt: 8860.2, + trialEndsAt: 3496.73, + startedAt: 2246.01, + currentPeriodStart: 3131.46, + currentPeriodEnd: 8448.31, + quantity: 1, }, ], - balances: {}, + purchases: [], + balances: { + "messages": { + featureId: "", + granted: 100, + remaining: 0, + usage: 100, + unlimited: false, + overageAllowed: true, + maxPurchase: 1038.15, + nextResetAt: 8293.76, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "", + includedGrant: 2263.99, + prepaidGrant: 9888.41, + remaining: 0, + usage: 100, + unlimited: false, + reset: { + interval: "month", + resetsAt: 6608.14, + }, + price: null, + expiresAt: null, + }, + ], + }, + }, }; ``` @@ -43,6 +77,6 @@ let value: List = { | `env` | [models.ListCustomersEnv](../models/list-customers-env.md) | :heavy_check_mark: | The environment this customer was created in. | | `metadata` | Record | :heavy_check_mark: | The metadata for the customer. | | `sendEmailReceipts` | *boolean* | :heavy_check_mark: | Whether to send email receipts to the customer. | -| `subscriptions` | [models.ListCustomersSubscription](../models/list-customers-subscription.md)[] | :heavy_check_mark: | N/A | -| `purchases` | [models.ListCustomersPurchase](../models/list-customers-purchase.md)[] | :heavy_check_mark: | N/A | -| `balances` | Record | :heavy_check_mark: | N/A | \ No newline at end of file +| `subscriptions` | [models.ListCustomersSubscription](../models/list-customers-subscription.md)[] | :heavy_check_mark: | Active and scheduled recurring plans that this customer has attached. | +| `purchases` | [models.ListCustomersPurchase](../models/list-customers-purchase.md)[] | :heavy_check_mark: | One-time purchases made by the customer. | +| `balances` | Record | :heavy_check_mark: | Feature balances keyed by feature ID, showing usage limits and remaining amounts. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-price.md b/packages/sdk/docs/models/list-customers-price.md index 9093cb2a1..9b10d7f90 100644 --- a/packages/sdk/docs/models/list-customers-price.md +++ b/packages/sdk/docs/models/list-customers-price.md @@ -16,8 +16,8 @@ let value: ListCustomersPrice = { | Field | Type | Required | Description | | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_minus_sign: | N/A | -| `tiers` | [models.ListCustomersTier](../models/list-customers-tier.md)[] | :heavy_minus_sign: | N/A | -| `billingUnits` | *number* | :heavy_check_mark: | N/A | -| `billingMethod` | [models.ListCustomersBillingMethod](../models/list-customers-billing-method.md) | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| `amount` | *number* | :heavy_minus_sign: | The per-unit price amount. | +| `tiers` | [models.ListCustomersTier](../models/list-customers-tier.md)[] | :heavy_minus_sign: | Tiered pricing configuration if applicable. | +| `billingUnits` | *number* | :heavy_check_mark: | The number of units per billing increment (eg. $9 / 250 units). | +| `billingMethod` | [models.ListCustomersBillingMethod](../models/list-customers-billing-method.md) | :heavy_check_mark: | Whether usage is prepaid or billed pay-per-use. | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum quantity that can be purchased, or null for unlimited. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-purchase.md b/packages/sdk/docs/models/list-customers-purchase.md index 15a224ea1..fe03aa7b5 100644 --- a/packages/sdk/docs/models/list-customers-purchase.md +++ b/packages/sdk/docs/models/list-customers-purchase.md @@ -15,10 +15,10 @@ let value: ListCustomersPurchase = { ## Fields -| Field | Type | Required | Description | -| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | -| `startedAt` | *number* | :heavy_check_mark: | N/A | -| `quantity` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | +| `planId` | *string* | :heavy_check_mark: | The unique identifier of the purchased plan. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the purchase expires, or null for lifetime access. | +| `startedAt` | *number* | :heavy_check_mark: | Timestamp when the purchase was made. | +| `quantity` | *number* | :heavy_check_mark: | Number of units purchased. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-reset.md b/packages/sdk/docs/models/list-customers-reset.md index 95dda29ba..fd9eb265d 100644 --- a/packages/sdk/docs/models/list-customers-reset.md +++ b/packages/sdk/docs/models/list-customers-reset.md @@ -13,8 +13,8 @@ let value: ListCustomersReset = { ## Fields -| Field | Type | Required | Description | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | -| `interval` | *models.ListCustomersIntervalUnion* | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `resetsAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `interval` | *models.ListCustomersIntervalUnion* | :heavy_check_mark: | The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets (eg. 2 for bi-monthly). | +| `resetsAt` | *number* | :heavy_check_mark: | Timestamp when the balance will next reset. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-response.md b/packages/sdk/docs/models/list-customers-response.md index 42ef6f233..b9c809a5b 100644 --- a/packages/sdk/docs/models/list-customers-response.md +++ b/packages/sdk/docs/models/list-customers-response.md @@ -10,42 +10,76 @@ import { ListCustomersResponse } from "@useautumn/sdk"; let value: ListCustomersResponse = { list: [ { - id: "", - name: "", - email: "Cole_Kuhn@gmail.com", - createdAt: 9730.61, - fingerprint: "", + id: "2ee25a41-0d81-4ad2-8451-ec1aadaefe58", + name: "Patrick", + email: "patrick@useautumn.com", + createdAt: 5879.38, + fingerprint: null, stripeId: "", - env: "live", - metadata: { - "key": "", - }, + env: "sandbox", + metadata: {}, sendEmailReceipts: true, - subscriptions: [], - purchases: [ + subscriptions: [ { planId: "", - expiresAt: 4940.05, - startedAt: 1235.42, - quantity: 3895.4, + autoEnable: true, + addOn: true, + status: "active", + pastDue: true, + canceledAt: 8709.2, + expiresAt: 9166.43, + trialEndsAt: null, + startedAt: 6729.25, + currentPeriodStart: 7132.91, + currentPeriodEnd: 9794.16, + quantity: 1, }, ], - balances: {}, + purchases: [], + balances: { + "messages": { + featureId: "", + granted: 100, + remaining: 0, + usage: 100, + unlimited: false, + overageAllowed: true, + maxPurchase: 8784.38, + nextResetAt: 5793.24, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "", + includedGrant: 3304.66, + prepaidGrant: 136.52, + remaining: 0, + usage: 100, + unlimited: false, + reset: { + interval: "month", + resetsAt: 6046.98, + }, + price: null, + expiresAt: null, + }, + ], + }, + }, }, ], hasMore: false, - offset: 2759.18, - limit: 4916.55, - total: 957.6, + offset: 0, + limit: 10, + total: 1, }; ``` ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -| `list` | [models.List](../models/list.md)[] | :heavy_check_mark: | Array of items for current page | -| `hasMore` | *boolean* | :heavy_check_mark: | Whether more results exist after this page | -| `offset` | *number* | :heavy_check_mark: | Current offset position | -| `limit` | *number* | :heavy_check_mark: | Limit passed in the request | -| `total` | *number* | :heavy_check_mark: | Total number of items returned in the current page | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `list` | [models.ListCustomersList](../models/list-customers-list.md)[] | :heavy_check_mark: | Array of items for current page | +| `hasMore` | *boolean* | :heavy_check_mark: | Whether more results exist after this page | +| `offset` | *number* | :heavy_check_mark: | Current offset position | +| `limit` | *number* | :heavy_check_mark: | Limit passed in the request | +| `total` | *number* | :heavy_check_mark: | Total number of items returned in the current page | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-rollover.md b/packages/sdk/docs/models/list-customers-rollover.md index e297b53d1..762f2e2dc 100644 --- a/packages/sdk/docs/models/list-customers-rollover.md +++ b/packages/sdk/docs/models/list-customers-rollover.md @@ -13,7 +13,7 @@ let value: ListCustomersRollover = { ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `balance` | *number* | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `balance` | *number* | :heavy_check_mark: | Amount of balance rolled over from a previous period. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the rollover balance expires. | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-status.md b/packages/sdk/docs/models/list-customers-status.md index 6972de2ec..cac7cc97a 100644 --- a/packages/sdk/docs/models/list-customers-status.md +++ b/packages/sdk/docs/models/list-customers-status.md @@ -1,11 +1,13 @@ # ListCustomersStatus +Current status of the subscription. + ## Example Usage ```typescript import { ListCustomersStatus } from "@useautumn/sdk"; -let value: ListCustomersStatus = "expired"; +let value: ListCustomersStatus = "scheduled"; ``` ## Values @@ -13,5 +15,5 @@ let value: ListCustomersStatus = "expired"; This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. ```typescript -"active" | "scheduled" | "expired" | Unrecognized +"active" | "scheduled" | Unrecognized ``` \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-subscription.md b/packages/sdk/docs/models/list-customers-subscription.md index 678d509b7..f81e735e0 100644 --- a/packages/sdk/docs/models/list-customers-subscription.md +++ b/packages/sdk/docs/models/list-customers-subscription.md @@ -23,18 +23,18 @@ let value: ListCustomersSubscription = { ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `autoEnable` | *boolean* | :heavy_check_mark: | N/A | -| `addOn` | *boolean* | :heavy_check_mark: | N/A | -| `status` | [models.ListCustomersStatus](../models/list-customers-status.md) | :heavy_check_mark: | N/A | -| `pastDue` | *boolean* | :heavy_check_mark: | N/A | -| `canceledAt` | *number* | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | -| `trialEndsAt` | *number* | :heavy_check_mark: | N/A | -| `startedAt` | *number* | :heavy_check_mark: | N/A | -| `currentPeriodStart` | *number* | :heavy_check_mark: | N/A | -| `currentPeriodEnd` | *number* | :heavy_check_mark: | N/A | -| `quantity` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | +| `planId` | *string* | :heavy_check_mark: | The unique identifier of the subscribed plan. | +| `autoEnable` | *boolean* | :heavy_check_mark: | Whether the plan was automatically enabled for the customer. | +| `addOn` | *boolean* | :heavy_check_mark: | Whether this is an add-on plan rather than a base subscription. | +| `status` | [models.ListCustomersStatus](../models/list-customers-status.md) | :heavy_check_mark: | Current status of the subscription. | +| `pastDue` | *boolean* | :heavy_check_mark: | Whether the subscription has overdue payments. | +| `canceledAt` | *number* | :heavy_check_mark: | Timestamp when the subscription was canceled, or null if not canceled. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the subscription will expire, or null if no expiry set. | +| `trialEndsAt` | *number* | :heavy_check_mark: | Timestamp when the trial period ends, or null if not on trial. | +| `startedAt` | *number* | :heavy_check_mark: | Timestamp when the subscription started. | +| `currentPeriodStart` | *number* | :heavy_check_mark: | Start timestamp of the current billing period. | +| `currentPeriodEnd` | *number* | :heavy_check_mark: | End timestamp of the current billing period. | +| `quantity` | *number* | :heavy_check_mark: | Number of units of this subscription (for per-seat plans). | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-events-custom-range.md b/packages/sdk/docs/models/list-events-custom-range.md new file mode 100644 index 000000000..95468d9cb --- /dev/null +++ b/packages/sdk/docs/models/list-events-custom-range.md @@ -0,0 +1,18 @@ +# ListEventsCustomRange + +Filter events by time range + +## Example Usage + +```typescript +import { ListEventsCustomRange } from "@useautumn/sdk"; + +let value: ListEventsCustomRange = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `start` | *number* | :heavy_minus_sign: | Filter events after this timestamp (epoch milliseconds) | +| `end` | *number* | :heavy_minus_sign: | Filter events before this timestamp (epoch milliseconds) | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-events-feature-id.md b/packages/sdk/docs/models/list-events-feature-id.md new file mode 100644 index 000000000..f7d9b81a1 --- /dev/null +++ b/packages/sdk/docs/models/list-events-feature-id.md @@ -0,0 +1,22 @@ +# ListEventsFeatureId + +Filter by specific feature ID(s) + + +## Supported Types + +### `string` + +```typescript +const value: string = ""; +``` + +### `string[]` + +```typescript +const value: string[] = [ + "", + "", +]; +``` + diff --git a/packages/sdk/docs/models/list-events-globals.md b/packages/sdk/docs/models/list-events-globals.md new file mode 100644 index 000000000..4a0f0f2d5 --- /dev/null +++ b/packages/sdk/docs/models/list-events-globals.md @@ -0,0 +1,15 @@ +# ListEventsGlobals + +## Example Usage + +```typescript +import { ListEventsGlobals } from "@useautumn/sdk"; + +let value: ListEventsGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-events-list.md b/packages/sdk/docs/models/list-events-list.md new file mode 100644 index 000000000..ee704864b --- /dev/null +++ b/packages/sdk/docs/models/list-events-list.md @@ -0,0 +1,27 @@ +# ListEventsList + +## Example Usage + +```typescript +import { ListEventsList } from "@useautumn/sdk"; + +let value: ListEventsList = { + id: "", + timestamp: 392.41, + featureId: "", + customerId: "", + value: 7636.8, + properties: {}, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `id` | *string* | :heavy_check_mark: | Event ID (KSUID) | +| `timestamp` | *number* | :heavy_check_mark: | Event timestamp (epoch milliseconds) | +| `featureId` | *string* | :heavy_check_mark: | ID of the feature that the event belongs to | +| `customerId` | *string* | :heavy_check_mark: | Customer identifier | +| `value` | *number* | :heavy_check_mark: | Event value/count | +| `properties` | [models.ListEventsProperties](../models/list-events-properties.md) | :heavy_check_mark: | Event properties (JSONB) | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-events-properties.md b/packages/sdk/docs/models/list-events-properties.md new file mode 100644 index 000000000..f54bd0dff --- /dev/null +++ b/packages/sdk/docs/models/list-events-properties.md @@ -0,0 +1,16 @@ +# ListEventsProperties + +Event properties (JSONB) + +## Example Usage + +```typescript +import { ListEventsProperties } from "@useautumn/sdk"; + +let value: ListEventsProperties = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-events-response.md b/packages/sdk/docs/models/list-events-response.md new file mode 100644 index 000000000..3957e220e --- /dev/null +++ b/packages/sdk/docs/models/list-events-response.md @@ -0,0 +1,44 @@ +# ListEventsResponse + +OK + +## Example Usage + +```typescript +import { ListEventsResponse } from "@useautumn/sdk"; + +let value: ListEventsResponse = { + list: [ + { + id: "evt_36xpk2TmuQX5zVPPQ8tCtnR5Weg", + timestamp: 1765958215459, + featureId: "credits", + customerId: "0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx", + value: 30, + properties: {}, + }, + { + id: "evt_36xmHxxjAkqxufDf9yHAPNfRrLM", + timestamp: 1765956512057, + featureId: "credits", + customerId: "0pCIbS4AMAFDB1iBMNhARWZt2gDtVwQx", + value: 49, + properties: {}, + }, + ], + hasMore: false, + offset: 0, + limit: 100, + total: 2, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `list` | [models.ListEventsList](../models/list-events-list.md)[] | :heavy_check_mark: | Array of items for current page | +| `hasMore` | *boolean* | :heavy_check_mark: | Whether more results exist after this page | +| `offset` | *number* | :heavy_check_mark: | Current offset position | +| `limit` | *number* | :heavy_check_mark: | Limit passed in the request | +| `total` | *number* | :heavy_check_mark: | Total number of items returned in the current page | \ No newline at end of file diff --git a/packages/sdk/docs/models/open-customer-portal-globals.md b/packages/sdk/docs/models/open-customer-portal-globals.md new file mode 100644 index 000000000..072dc3533 --- /dev/null +++ b/packages/sdk/docs/models/open-customer-portal-globals.md @@ -0,0 +1,15 @@ +# OpenCustomerPortalGlobals + +## Example Usage + +```typescript +import { OpenCustomerPortalGlobals } from "@useautumn/sdk"; + +let value: OpenCustomerPortalGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/open-customer-portal-params.md b/packages/sdk/docs/models/open-customer-portal-params.md new file mode 100644 index 000000000..11bbdcff1 --- /dev/null +++ b/packages/sdk/docs/models/open-customer-portal-params.md @@ -0,0 +1,20 @@ +# OpenCustomerPortalParams + +## Example Usage + +```typescript +import { OpenCustomerPortalParams } from "@useautumn/sdk"; + +let value: OpenCustomerPortalParams = { + customerId: "cus_123", + returnUrl: "https://useautumn.com", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer to open the billing portal for. | +| `configurationId` | *string* | :heavy_minus_sign: | Stripe billing portal configuration ID. Create configurations in your Stripe dashboard. | +| `returnUrl` | *string* | :heavy_minus_sign: | URL to redirect to when back button is clicked in the billing portal | \ No newline at end of file diff --git a/packages/sdk/docs/models/open-customer-portal-response.md b/packages/sdk/docs/models/open-customer-portal-response.md new file mode 100644 index 000000000..160d83408 --- /dev/null +++ b/packages/sdk/docs/models/open-customer-portal-response.md @@ -0,0 +1,21 @@ +# OpenCustomerPortalResponse + +OK + +## Example Usage + +```typescript +import { OpenCustomerPortalResponse } from "@useautumn/sdk"; + +let value: OpenCustomerPortalResponse = { + customerId: "cus_123", + url: "https://billing.stripe.com/session/...", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `customerId` | *string* | :heavy_check_mark: | The ID of the billing portal session | +| `url` | *string* | :heavy_check_mark: | URL to the billing portal | \ No newline at end of file diff --git a/packages/sdk/docs/models/outgoing-balances.md b/packages/sdk/docs/models/outgoing-balances.md deleted file mode 100644 index 33ccd99f1..000000000 --- a/packages/sdk/docs/models/outgoing-balances.md +++ /dev/null @@ -1,34 +0,0 @@ -# OutgoingBalances - -## Example Usage - -```typescript -import { OutgoingBalances } from "@useautumn/sdk"; - -let value: OutgoingBalances = { - featureId: "", - granted: 4580.63, - remaining: 1565.6, - usage: 5821.19, - unlimited: true, - overageAllowed: false, - maxPurchase: 1790.68, - nextResetAt: 2790.71, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `feature` | [models.OutgoingFeature](../models/outgoing-feature.md) | :heavy_minus_sign: | N/A | -| `granted` | *number* | :heavy_check_mark: | N/A | -| `remaining` | *number* | :heavy_check_mark: | N/A | -| `usage` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `overageAllowed` | *boolean* | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | -| `nextResetAt` | *number* | :heavy_check_mark: | N/A | -| `breakdown` | [models.OutgoingBreakdown](../models/outgoing-breakdown.md)[] | :heavy_minus_sign: | N/A | -| `rollovers` | [models.OutgoingRollover](../models/outgoing-rollover.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/outgoing-billing-method.md b/packages/sdk/docs/models/outgoing-billing-method.md deleted file mode 100644 index 4db5123b9..000000000 --- a/packages/sdk/docs/models/outgoing-billing-method.md +++ /dev/null @@ -1,17 +0,0 @@ -# OutgoingBillingMethod - -## Example Usage - -```typescript -import { OutgoingBillingMethod } from "@useautumn/sdk"; - -let value: OutgoingBillingMethod = "prepaid"; -``` - -## Values - -This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. - -```typescript -"prepaid" | "usage_based" | Unrecognized -``` \ No newline at end of file diff --git a/packages/sdk/docs/models/outgoing-breakdown.md b/packages/sdk/docs/models/outgoing-breakdown.md deleted file mode 100644 index 979288102..000000000 --- a/packages/sdk/docs/models/outgoing-breakdown.md +++ /dev/null @@ -1,41 +0,0 @@ -# OutgoingBreakdown - -## Example Usage - -```typescript -import { OutgoingBreakdown } from "@useautumn/sdk"; - -let value: OutgoingBreakdown = { - planId: "", - includedGrant: 1099.43, - prepaidGrant: 2387.81, - remaining: 558.65, - usage: 9479.41, - unlimited: true, - reset: { - interval: "month", - resetsAt: 1396.76, - }, - price: { - billingUnits: 2793.79, - billingMethod: "prepaid", - maxPurchase: 2550.73, - }, - expiresAt: 7533.43, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | -| `id` | *string* | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `includedGrant` | *number* | :heavy_check_mark: | N/A | -| `prepaidGrant` | *number* | :heavy_check_mark: | N/A | -| `remaining` | *number* | :heavy_check_mark: | N/A | -| `usage` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `reset` | [models.OutgoingReset](../models/outgoing-reset.md) | :heavy_check_mark: | N/A | -| `price` | [models.OutgoingPrice](../models/outgoing-price.md) | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/outgoing-feature-quantity.md b/packages/sdk/docs/models/outgoing-feature-quantity.md deleted file mode 100644 index a01d2fa30..000000000 --- a/packages/sdk/docs/models/outgoing-feature-quantity.md +++ /dev/null @@ -1,19 +0,0 @@ -# OutgoingFeatureQuantity - -## Example Usage - -```typescript -import { OutgoingFeatureQuantity } from "@useautumn/sdk"; - -let value: OutgoingFeatureQuantity = { - featureId: "", - quantity: 8165.03, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `quantity` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/outgoing-feature.md b/packages/sdk/docs/models/outgoing-feature.md deleted file mode 100644 index 104d8d0e2..000000000 --- a/packages/sdk/docs/models/outgoing-feature.md +++ /dev/null @@ -1,28 +0,0 @@ -# OutgoingFeature - -## Example Usage - -```typescript -import { OutgoingFeature } from "@useautumn/sdk"; - -let value: OutgoingFeature = { - id: "", - name: "", - type: "boolean", - consumable: true, - archived: false, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `id` | *string* | :heavy_check_mark: | N/A | -| `name` | *string* | :heavy_check_mark: | N/A | -| `type` | [models.OutgoingType](../models/outgoing-type.md) | :heavy_check_mark: | N/A | -| `consumable` | *boolean* | :heavy_check_mark: | N/A | -| `eventNames` | *string*[] | :heavy_minus_sign: | N/A | -| `creditSchema` | [models.OutgoingCreditSchema](../models/outgoing-credit-schema.md)[] | :heavy_minus_sign: | N/A | -| `display` | [models.OutgoingDisplay](../models/outgoing-display.md) | :heavy_minus_sign: | N/A | -| `archived` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/outgoing-interval-union.md b/packages/sdk/docs/models/outgoing-interval-union.md deleted file mode 100644 index 2b4f663b6..000000000 --- a/packages/sdk/docs/models/outgoing-interval-union.md +++ /dev/null @@ -1,17 +0,0 @@ -# OutgoingIntervalUnion - - -## Supported Types - -### `models.IntervalOutgoingEnum` - -```typescript -const value: models.IntervalOutgoingEnum = "month"; -``` - -### `string` - -```typescript -const value: string = ""; -``` - diff --git a/packages/sdk/docs/models/outgoing-price.md b/packages/sdk/docs/models/outgoing-price.md deleted file mode 100644 index d8c40c9ec..000000000 --- a/packages/sdk/docs/models/outgoing-price.md +++ /dev/null @@ -1,23 +0,0 @@ -# OutgoingPrice - -## Example Usage - -```typescript -import { OutgoingPrice } from "@useautumn/sdk"; - -let value: OutgoingPrice = { - billingUnits: 4961.88, - billingMethod: "usage_based", - maxPurchase: 7757.43, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `amount` | *number* | :heavy_minus_sign: | N/A | -| `tiers` | [models.OutgoingTier](../models/outgoing-tier.md)[] | :heavy_minus_sign: | N/A | -| `billingUnits` | *number* | :heavy_check_mark: | N/A | -| `billingMethod` | [models.OutgoingBillingMethod](../models/outgoing-billing-method.md) | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/outgoing-reset.md b/packages/sdk/docs/models/outgoing-reset.md deleted file mode 100644 index b3940e0f1..000000000 --- a/packages/sdk/docs/models/outgoing-reset.md +++ /dev/null @@ -1,20 +0,0 @@ -# OutgoingReset - -## Example Usage - -```typescript -import { OutgoingReset } from "@useautumn/sdk"; - -let value: OutgoingReset = { - interval: "year", - resetsAt: 7091.83, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | -| `interval` | *models.OutgoingIntervalUnion* | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `resetsAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/outgoing-rollover.md b/packages/sdk/docs/models/outgoing-rollover.md deleted file mode 100644 index 63a6eaf4f..000000000 --- a/packages/sdk/docs/models/outgoing-rollover.md +++ /dev/null @@ -1,19 +0,0 @@ -# OutgoingRollover - -## Example Usage - -```typescript -import { OutgoingRollover } from "@useautumn/sdk"; - -let value: OutgoingRollover = { - balance: 4576.32, - expiresAt: 749.61, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `balance` | *number* | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/outgoing-tier.md b/packages/sdk/docs/models/outgoing-tier.md deleted file mode 100644 index 5b7208924..000000000 --- a/packages/sdk/docs/models/outgoing-tier.md +++ /dev/null @@ -1,18 +0,0 @@ -# OutgoingTier - -## Example Usage - -```typescript -import { OutgoingTier } from "@useautumn/sdk"; - -let value: OutgoingTier = { - amount: 8873.7, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `to` | *any* | :heavy_minus_sign: | N/A | -| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/outgoing.md b/packages/sdk/docs/models/outgoing.md deleted file mode 100644 index 1bc95403e..000000000 --- a/packages/sdk/docs/models/outgoing.md +++ /dev/null @@ -1,66 +0,0 @@ -# Outgoing - -## Example Usage - -```typescript -import { Outgoing } from "@useautumn/sdk"; - -let value: Outgoing = { - plan: { - id: "", - name: "", - description: "very neaten definitive psst geez times gah", - group: "", - version: 762.38, - addOn: false, - autoEnable: true, - price: { - amount: 3075.99, - interval: "one_off", - }, - items: [ - { - featureId: "", - included: 7842.81, - unlimited: false, - reset: { - interval: "year", - }, - price: { - interval: "one_off", - billingUnits: 5268.83, - billingMethod: "usage_based", - maxPurchase: 9846.03, - }, - }, - ], - createdAt: 7030.5, - env: "live", - archived: true, - baseVariantId: "", - }, - featureQuantities: [], - balances: { - "key": { - featureId: "", - granted: 2003.63, - remaining: 7112.33, - usage: 4095.87, - unlimited: true, - overageAllowed: false, - maxPurchase: 6543.16, - nextResetAt: 8324.63, - }, - }, -}; -``` - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `plan` | [models.Plan](../models/plan.md) | :heavy_check_mark: | N/A | -| `featureQuantities` | [models.OutgoingFeatureQuantity](../models/outgoing-feature-quantity.md)[] | :heavy_check_mark: | N/A | -| `balances` | Record | :heavy_check_mark: | N/A | -| `periodStart` | *number* | :heavy_minus_sign: | N/A | -| `periodEnd` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-billing-behavior.md b/packages/sdk/docs/models/preview-attach-billing-behavior.md new file mode 100644 index 000000000..52a5ee918 --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-billing-behavior.md @@ -0,0 +1,17 @@ +# PreviewAttachBillingBehavior + +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. + +## Example Usage + +```typescript +import { PreviewAttachBillingBehavior } from "@useautumn/sdk"; + +let value: PreviewAttachBillingBehavior = "prorate_immediately"; +``` + +## Values + +```typescript +"prorate_immediately" | "next_cycle_only" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-billing-method.md b/packages/sdk/docs/models/preview-attach-billing-method.md new file mode 100644 index 000000000..7d5384ae1 --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-billing-method.md @@ -0,0 +1,15 @@ +# PreviewAttachBillingMethod + +## Example Usage + +```typescript +import { PreviewAttachBillingMethod } from "@useautumn/sdk"; + +let value: PreviewAttachBillingMethod = "prepaid"; +``` + +## Values + +```typescript +"prepaid" | "usage_based" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-customize.md b/packages/sdk/docs/models/preview-attach-customize.md new file mode 100644 index 000000000..31e70e3a3 --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-customize.md @@ -0,0 +1,18 @@ +# PreviewAttachCustomize + +Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. + +## Example Usage + +```typescript +import { PreviewAttachCustomize } from "@useautumn/sdk"; + +let value: PreviewAttachCustomize = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `price` | [models.PreviewAttachPrice](../models/preview-attach-price.md) | :heavy_minus_sign: | N/A | +| `items` | [models.PreviewAttachItem](../models/preview-attach-item.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-discount-request1.md b/packages/sdk/docs/models/preview-attach-discount-request1.md new file mode 100644 index 000000000..eafd005aa --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-discount-request1.md @@ -0,0 +1,17 @@ +# PreviewAttachDiscountRequest1 + +## Example Usage + +```typescript +import { PreviewAttachDiscountRequest1 } from "@useautumn/sdk"; + +let value: PreviewAttachDiscountRequest1 = { + rewardId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| `rewardId` | *string* | :heavy_check_mark: | The ID of the reward to apply as a discount. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-discount-request2.md b/packages/sdk/docs/models/preview-attach-discount-request2.md new file mode 100644 index 000000000..d21a18ae6 --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-discount-request2.md @@ -0,0 +1,17 @@ +# PreviewAttachDiscountRequest2 + +## Example Usage + +```typescript +import { PreviewAttachDiscountRequest2 } from "@useautumn/sdk"; + +let value: PreviewAttachDiscountRequest2 = { + promotionCode: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `promotionCode` | *string* | :heavy_check_mark: | The promotion code to apply as a discount. | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-discount-response.md b/packages/sdk/docs/models/preview-attach-discount-response.md similarity index 75% rename from packages/sdk/docs/models/billing-preview-attach-discount-response.md rename to packages/sdk/docs/models/preview-attach-discount-response.md index 61a38dd7b..7657b968b 100644 --- a/packages/sdk/docs/models/billing-preview-attach-discount-response.md +++ b/packages/sdk/docs/models/preview-attach-discount-response.md @@ -1,12 +1,12 @@ -# BillingPreviewAttachDiscountResponse +# PreviewAttachDiscountResponse ## Example Usage ```typescript -import { BillingPreviewAttachDiscountResponse } from "@useautumn/sdk"; +import { PreviewAttachDiscountResponse } from "@useautumn/sdk"; -let value: BillingPreviewAttachDiscountResponse = { - amountOff: 1732.78, +let value: PreviewAttachDiscountResponse = { + amountOff: 7288.13, }; ``` diff --git a/packages/sdk/docs/models/preview-attach-discount-union.md b/packages/sdk/docs/models/preview-attach-discount-union.md new file mode 100644 index 000000000..7d77c8d2c --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-discount-union.md @@ -0,0 +1,23 @@ +# PreviewAttachDiscountUnion + +A discount to apply. Can be either a reward ID or a promotion code. + + +## Supported Types + +### `models.PreviewAttachDiscountRequest1` + +```typescript +const value: models.PreviewAttachDiscountRequest1 = { + rewardId: "", +}; +``` + +### `models.PreviewAttachDiscountRequest2` + +```typescript +const value: models.PreviewAttachDiscountRequest2 = { + promotionCode: "", +}; +``` + diff --git a/packages/sdk/docs/models/preview-attach-duration-type.md b/packages/sdk/docs/models/preview-attach-duration-type.md new file mode 100644 index 000000000..c42259efc --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-duration-type.md @@ -0,0 +1,15 @@ +# PreviewAttachDurationType + +## Example Usage + +```typescript +import { PreviewAttachDurationType } from "@useautumn/sdk"; + +let value: PreviewAttachDurationType = "year"; +``` + +## Values + +```typescript +"day" | "month" | "year" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-expiry-duration-type.md b/packages/sdk/docs/models/preview-attach-expiry-duration-type.md new file mode 100644 index 000000000..9cfd61ebc --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-expiry-duration-type.md @@ -0,0 +1,15 @@ +# PreviewAttachExpiryDurationType + +## Example Usage + +```typescript +import { PreviewAttachExpiryDurationType } from "@useautumn/sdk"; + +let value: PreviewAttachExpiryDurationType = "month"; +``` + +## Values + +```typescript +"month" | "forever" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-attach-feature-quantities.md b/packages/sdk/docs/models/preview-attach-feature-quantity.md similarity index 75% rename from packages/sdk/docs/models/billing-preview-attach-feature-quantities.md rename to packages/sdk/docs/models/preview-attach-feature-quantity.md index 241b20999..8037d8cf7 100644 --- a/packages/sdk/docs/models/billing-preview-attach-feature-quantities.md +++ b/packages/sdk/docs/models/preview-attach-feature-quantity.md @@ -1,11 +1,11 @@ -# BillingPreviewAttachFeatureQuantities +# PreviewAttachFeatureQuantity ## Example Usage ```typescript -import { BillingPreviewAttachFeatureQuantities } from "@useautumn/sdk"; +import { PreviewAttachFeatureQuantity } from "@useautumn/sdk"; -let value: BillingPreviewAttachFeatureQuantities = { +let value: PreviewAttachFeatureQuantity = { featureId: "", }; ``` diff --git a/packages/sdk/docs/models/billing-preview-update-customize.md b/packages/sdk/docs/models/preview-attach-free-trial.md similarity index 52% rename from packages/sdk/docs/models/billing-preview-update-customize.md rename to packages/sdk/docs/models/preview-attach-free-trial.md index c452501c4..b65e3dcb3 100644 --- a/packages/sdk/docs/models/billing-preview-update-customize.md +++ b/packages/sdk/docs/models/preview-attach-free-trial.md @@ -1,18 +1,19 @@ -# BillingPreviewUpdateCustomize - -Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. +# PreviewAttachFreeTrial ## Example Usage ```typescript -import { BillingPreviewUpdateCustomize } from "@useautumn/sdk"; +import { PreviewAttachFreeTrial } from "@useautumn/sdk"; -let value: BillingPreviewUpdateCustomize = {}; +let value: PreviewAttachFreeTrial = { + durationLength: 4611.12, +}; ``` ## Fields | Field | Type | Required | Description | | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `price` | [models.BillingPreviewUpdatePrice](../models/billing-preview-update-price.md) | :heavy_minus_sign: | N/A | -| `items` | [models.BillingPreviewUpdateItem](../models/billing-preview-update-item.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file +| `durationLength` | *number* | :heavy_check_mark: | N/A | +| `durationType` | [models.PreviewAttachDurationType](../models/preview-attach-duration-type.md) | :heavy_minus_sign: | N/A | +| `cardRequired` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-globals.md b/packages/sdk/docs/models/preview-attach-globals.md new file mode 100644 index 000000000..cb8d444d5 --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-globals.md @@ -0,0 +1,15 @@ +# PreviewAttachGlobals + +## Example Usage + +```typescript +import { PreviewAttachGlobals } from "@useautumn/sdk"; + +let value: PreviewAttachGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-invoice-mode.md b/packages/sdk/docs/models/preview-attach-invoice-mode.md new file mode 100644 index 000000000..97e52602f --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-invoice-mode.md @@ -0,0 +1,21 @@ +# PreviewAttachInvoiceMode + +Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + +## Example Usage + +```typescript +import { PreviewAttachInvoiceMode } from "@useautumn/sdk"; + +let value: PreviewAttachInvoiceMode = { + enabled: false, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `enabled` | *boolean* | :heavy_check_mark: | When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. | +| `enablePlanImmediately` | *boolean* | :heavy_minus_sign: | If true, enables the plan immediately even though the invoice is not paid yet. | +| `finalize` | *boolean* | :heavy_minus_sign: | If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-item-price-interval.md b/packages/sdk/docs/models/preview-attach-item-price-interval.md new file mode 100644 index 000000000..26c8b425d --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-item-price-interval.md @@ -0,0 +1,15 @@ +# PreviewAttachItemPriceInterval + +## Example Usage + +```typescript +import { PreviewAttachItemPriceInterval } from "@useautumn/sdk"; + +let value: PreviewAttachItemPriceInterval = "one_off"; +``` + +## Values + +```typescript +"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" +``` \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancescheckfeature.md b/packages/sdk/docs/models/preview-attach-item-price.md similarity index 51% rename from others/python-sdk/docs/models/balancescheckfeature.md rename to packages/sdk/docs/models/preview-attach-item-price.md index bd137f0a3..204288b95 100644 --- a/others/python-sdk/docs/models/balancescheckfeature.md +++ b/packages/sdk/docs/models/preview-attach-item-price.md @@ -1,15 +1,24 @@ -# BalancesCheckFeature +# PreviewAttachItemPrice +## Example Usage + +```typescript +import { PreviewAttachItemPrice } from "@useautumn/sdk"; + +let value: PreviewAttachItemPrice = { + interval: "semi_annual", + billingMethod: "prepaid", +}; +``` ## Fields | Field | Type | Required | Description | | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | N/A | -| `name` | *str* | :heavy_check_mark: | N/A | -| `type` | [models.BalancesCheckBalanceType](../models/balancescheckbalancetype.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.BalancesCheckCreditSchema](../models/balancescheckcreditschema.md)] | :heavy_minus_sign: | N/A | -| `display` | [Optional[models.BalancesCheckBalanceDisplay]](../models/balancescheckbalancedisplay.md) | :heavy_minus_sign: | N/A | -| `archived` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file +| `amount` | *number* | :heavy_minus_sign: | N/A | +| `tiers` | [models.PreviewAttachTier](../models/preview-attach-tier.md)[] | :heavy_minus_sign: | N/A | +| `interval` | [models.PreviewAttachItemPriceInterval](../models/preview-attach-item-price-interval.md) | :heavy_check_mark: | N/A | +| `intervalCount` | *number* | :heavy_minus_sign: | N/A | +| `billingUnits` | *number* | :heavy_minus_sign: | N/A | +| `billingMethod` | [models.PreviewAttachBillingMethod](../models/preview-attach-billing-method.md) | :heavy_check_mark: | N/A | +| `maxPurchase` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-item.md b/packages/sdk/docs/models/preview-attach-item.md new file mode 100644 index 000000000..58d3071e9 --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-item.md @@ -0,0 +1,23 @@ +# PreviewAttachItem + +## Example Usage + +```typescript +import { PreviewAttachItem } from "@useautumn/sdk"; + +let value: PreviewAttachItem = { + featureId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | N/A | +| `included` | *number* | :heavy_minus_sign: | N/A | +| `unlimited` | *boolean* | :heavy_minus_sign: | N/A | +| `reset` | [models.PreviewAttachReset](../models/preview-attach-reset.md) | :heavy_minus_sign: | N/A | +| `price` | [models.PreviewAttachItemPrice](../models/preview-attach-item-price.md) | :heavy_minus_sign: | N/A | +| `proration` | [models.PreviewAttachProration](../models/preview-attach-proration.md) | :heavy_minus_sign: | N/A | +| `rollover` | [models.PreviewAttachRollover](../models/preview-attach-rollover.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-line-item.md b/packages/sdk/docs/models/preview-attach-line-item.md new file mode 100644 index 000000000..127b4dbac --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-line-item.md @@ -0,0 +1,22 @@ +# PreviewAttachLineItem + +## Example Usage + +```typescript +import { PreviewAttachLineItem } from "@useautumn/sdk"; + +let value: PreviewAttachLineItem = { + title: "", + description: "if brr boo", + amount: 4318.62, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | +| `title` | *string* | :heavy_check_mark: | The title of the line item. | +| `description` | *string* | :heavy_check_mark: | A detailed description of the line item. | +| `amount` | *number* | :heavy_check_mark: | The amount in cents for this line item. | +| `discounts` | [models.PreviewAttachDiscountResponse](../models/preview-attach-discount-response.md)[] | :heavy_minus_sign: | List of discounts applied to this line item. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-next-cycle.md b/packages/sdk/docs/models/preview-attach-next-cycle.md new file mode 100644 index 000000000..224836d3a --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-next-cycle.md @@ -0,0 +1,21 @@ +# PreviewAttachNextCycle + +Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. + +## Example Usage + +```typescript +import { PreviewAttachNextCycle } from "@useautumn/sdk"; + +let value: PreviewAttachNextCycle = { + startsAt: 8800.78, + total: 1852.37, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `startsAt` | *number* | :heavy_check_mark: | Unix timestamp (milliseconds) when the next billing cycle starts. | +| `total` | *number* | :heavy_check_mark: | The total amount in cents for the next cycle. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-on-decrease.md b/packages/sdk/docs/models/preview-attach-on-decrease.md new file mode 100644 index 000000000..7990abab7 --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-on-decrease.md @@ -0,0 +1,15 @@ +# PreviewAttachOnDecrease + +## Example Usage + +```typescript +import { PreviewAttachOnDecrease } from "@useautumn/sdk"; + +let value: PreviewAttachOnDecrease = "prorate_next_cycle"; +``` + +## Values + +```typescript +"prorate" | "prorate_immediately" | "prorate_next_cycle" | "none" | "no_prorations" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-on-increase.md b/packages/sdk/docs/models/preview-attach-on-increase.md new file mode 100644 index 000000000..f12893d76 --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-on-increase.md @@ -0,0 +1,15 @@ +# PreviewAttachOnIncrease + +## Example Usage + +```typescript +import { PreviewAttachOnIncrease } from "@useautumn/sdk"; + +let value: PreviewAttachOnIncrease = "prorate_immediately"; +``` + +## Values + +```typescript +"bill_immediately" | "prorate_immediately" | "prorate_next_cycle" | "bill_next_cycle" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-attach-request.md b/packages/sdk/docs/models/preview-attach-params.md similarity index 55% rename from packages/sdk/docs/models/billing-attach-request.md rename to packages/sdk/docs/models/preview-attach-params.md index 6115d4c5c..13b4eb9aa 100644 --- a/packages/sdk/docs/models/billing-attach-request.md +++ b/packages/sdk/docs/models/preview-attach-params.md @@ -1,31 +1,30 @@ -# BillingAttachRequest +# PreviewAttachParams ## Example Usage ```typescript -import { BillingAttachRequest } from "@useautumn/sdk"; +import { PreviewAttachParams } from "@useautumn/sdk"; -let value: BillingAttachRequest = { - customerId: "", - planId: "", +let value: PreviewAttachParams = { + customerId: "cus_123", + planId: "pro_plan", }; ``` ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `customerId` | *string* | :heavy_check_mark: | The ID of the customer to attach the plan to. | -| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | -| `featureQuantities` | [models.BillingAttachFeatureQuantities](../models/billing-attach-feature-quantities.md)[] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | -| `version` | *number* | :heavy_minus_sign: | The version of the plan to attach. | -| `freeTrial` | [models.BillingAttachFreeTrial](../models/billing-attach-free-trial.md) | :heavy_minus_sign: | N/A | -| `customize` | [models.BillingAttachCustomize](../models/billing-attach-customize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `invoiceMode` | [models.BillingAttachInvoiceMode](../models/billing-attach-invoice-mode.md) | :heavy_minus_sign: | N/A | -| `discounts` | *models.BillingAttachDiscountUnion*[] | :heavy_minus_sign: | N/A | -| `redirectMode` | [models.BillingAttachRedirectMode](../models/billing-attach-redirect-mode.md) | :heavy_minus_sign: | N/A | -| `successUrl` | *string* | :heavy_minus_sign: | N/A | -| `newBillingSubscription` | *boolean* | :heavy_minus_sign: | N/A | -| `planSchedule` | [models.BillingAttachPlanSchedule](../models/billing-attach-plan-schedule.md) | :heavy_minus_sign: | N/A | -| `billingBehavior` | [models.BillingAttachBillingBehavior](../models/billing-attach-billing-behavior.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer to attach the plan to. | +| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | +| `planId` | *string* | :heavy_check_mark: | The ID of the plan. | +| `featureQuantities` | [models.PreviewAttachFeatureQuantity](../models/preview-attach-feature-quantity.md)[] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | +| `version` | *number* | :heavy_minus_sign: | The version of the plan to attach. | +| `freeTrial` | [models.PreviewAttachFreeTrial](../models/preview-attach-free-trial.md) | :heavy_minus_sign: | Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. | +| `customize` | [models.PreviewAttachCustomize](../models/preview-attach-customize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | +| `invoiceMode` | [models.PreviewAttachInvoiceMode](../models/preview-attach-invoice-mode.md) | :heavy_minus_sign: | Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. | +| `billingBehavior` | [models.PreviewAttachBillingBehavior](../models/preview-attach-billing-behavior.md) | :heavy_minus_sign: | 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. | +| `discounts` | *models.PreviewAttachDiscountUnion*[] | :heavy_minus_sign: | List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. | +| `successUrl` | *string* | :heavy_minus_sign: | URL to redirect to after successful checkout. | +| `newBillingSubscription` | *boolean* | :heavy_minus_sign: | Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. | +| `planSchedule` | [models.PreviewAttachPlanSchedule](../models/preview-attach-plan-schedule.md) | :heavy_minus_sign: | When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-plan-schedule.md b/packages/sdk/docs/models/preview-attach-plan-schedule.md new file mode 100644 index 000000000..f805bd915 --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-plan-schedule.md @@ -0,0 +1,17 @@ +# PreviewAttachPlanSchedule + +When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + +## Example Usage + +```typescript +import { PreviewAttachPlanSchedule } from "@useautumn/sdk"; + +let value: PreviewAttachPlanSchedule = "end_of_cycle"; +``` + +## Values + +```typescript +"immediate" | "end_of_cycle" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-price-interval.md b/packages/sdk/docs/models/preview-attach-price-interval.md new file mode 100644 index 000000000..ec12dc9c2 --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-price-interval.md @@ -0,0 +1,15 @@ +# PreviewAttachPriceInterval + +## Example Usage + +```typescript +import { PreviewAttachPriceInterval } from "@useautumn/sdk"; + +let value: PreviewAttachPriceInterval = "year"; +``` + +## Values + +```typescript +"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-price.md b/packages/sdk/docs/models/preview-attach-price.md similarity index 56% rename from packages/sdk/docs/models/balances-check-price.md rename to packages/sdk/docs/models/preview-attach-price.md index 654cee9cc..fd9c14771 100644 --- a/packages/sdk/docs/models/balances-check-price.md +++ b/packages/sdk/docs/models/preview-attach-price.md @@ -1,14 +1,13 @@ -# BalancesCheckPrice +# PreviewAttachPrice ## Example Usage ```typescript -import { BalancesCheckPrice } from "@useautumn/sdk"; +import { PreviewAttachPrice } from "@useautumn/sdk"; -let value: BalancesCheckPrice = { - billingUnits: 1045.14, - billingMethod: "usage_based", - maxPurchase: 7190.36, +let value: PreviewAttachPrice = { + amount: 547.97, + interval: "year", }; ``` @@ -16,8 +15,6 @@ let value: BalancesCheckPrice = { | Field | Type | Required | Description | | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_minus_sign: | N/A | -| `tiers` | [models.BalancesCheckTier](../models/balances-check-tier.md)[] | :heavy_minus_sign: | N/A | -| `billingUnits` | *number* | :heavy_check_mark: | N/A | -| `billingMethod` | [models.BalancesCheckBillingMethod](../models/balances-check-billing-method.md) | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| `amount` | *number* | :heavy_check_mark: | N/A | +| `interval` | [models.PreviewAttachPriceInterval](../models/preview-attach-price-interval.md) | :heavy_check_mark: | N/A | +| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-proration.md b/packages/sdk/docs/models/preview-attach-proration.md new file mode 100644 index 000000000..0a47b28d0 --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-proration.md @@ -0,0 +1,19 @@ +# PreviewAttachProration + +## Example Usage + +```typescript +import { PreviewAttachProration } from "@useautumn/sdk"; + +let value: PreviewAttachProration = { + onIncrease: "bill_next_cycle", + onDecrease: "none", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| `onIncrease` | [models.PreviewAttachOnIncrease](../models/preview-attach-on-increase.md) | :heavy_check_mark: | N/A | +| `onDecrease` | [models.PreviewAttachOnDecrease](../models/preview-attach-on-decrease.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-create-interval.md b/packages/sdk/docs/models/preview-attach-reset-interval.md similarity index 53% rename from packages/sdk/docs/models/balances-create-interval.md rename to packages/sdk/docs/models/preview-attach-reset-interval.md index c26212ca8..45a0f9186 100644 --- a/packages/sdk/docs/models/balances-create-interval.md +++ b/packages/sdk/docs/models/preview-attach-reset-interval.md @@ -1,11 +1,11 @@ -# BalancesCreateInterval +# PreviewAttachResetInterval ## Example Usage ```typescript -import { BalancesCreateInterval } from "@useautumn/sdk"; +import { PreviewAttachResetInterval } from "@useautumn/sdk"; -let value: BalancesCreateInterval = "one_off"; +let value: PreviewAttachResetInterval = "one_off"; ``` ## Values diff --git a/packages/sdk/docs/models/preview-attach-reset.md b/packages/sdk/docs/models/preview-attach-reset.md new file mode 100644 index 000000000..25dcc11c8 --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-reset.md @@ -0,0 +1,18 @@ +# PreviewAttachReset + +## Example Usage + +```typescript +import { PreviewAttachReset } from "@useautumn/sdk"; + +let value: PreviewAttachReset = { + interval: "day", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| `interval` | [models.PreviewAttachResetInterval](../models/preview-attach-reset-interval.md) | :heavy_check_mark: | N/A | +| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-response.md b/packages/sdk/docs/models/preview-attach-response.md new file mode 100644 index 000000000..ee09a52b4 --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-response.md @@ -0,0 +1,26 @@ +# PreviewAttachResponse + +OK + +## Example Usage + +```typescript +import { PreviewAttachResponse } from "@useautumn/sdk"; + +let value: PreviewAttachResponse = { + customerId: "", + lineItems: [], + total: 20, + currency: "usd", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer. | +| `lineItems` | [models.PreviewAttachLineItem](../models/preview-attach-line-item.md)[] | :heavy_check_mark: | List of line items for the current billing period. | +| `total` | *number* | :heavy_check_mark: | The total amount in cents for the current billing period. | +| `currency` | *string* | :heavy_check_mark: | The three-letter ISO currency code (e.g., 'usd'). | +| `nextCycle` | [models.PreviewAttachNextCycle](../models/preview-attach-next-cycle.md) | :heavy_minus_sign: | Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balancestrackbalancereset.md b/packages/sdk/docs/models/preview-attach-rollover.md similarity index 66% rename from others/python-sdk/docs/models/balancestrackbalancereset.md rename to packages/sdk/docs/models/preview-attach-rollover.md index 898dd4da3..61746c7f9 100644 --- a/others/python-sdk/docs/models/balancestrackbalancereset.md +++ b/packages/sdk/docs/models/preview-attach-rollover.md @@ -1,10 +1,19 @@ -# BalancesTrackBalanceReset +# PreviewAttachRollover +## Example Usage + +```typescript +import { PreviewAttachRollover } from "@useautumn/sdk"; + +let value: PreviewAttachRollover = { + expiryDurationType: "forever", +}; +``` ## Fields | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `interval` | [models.BalancesTrackBalanceIntervalUnion](../models/balancestrackbalanceintervalunion.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `resets_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file +| `max` | *number* | :heavy_minus_sign: | N/A | +| `expiryDurationType` | [models.PreviewAttachExpiryDurationType](../models/preview-attach-expiry-duration-type.md) | :heavy_check_mark: | N/A | +| `expiryDurationLength` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-attach-tier.md b/packages/sdk/docs/models/preview-attach-tier.md new file mode 100644 index 000000000..d53b28297 --- /dev/null +++ b/packages/sdk/docs/models/preview-attach-tier.md @@ -0,0 +1,19 @@ +# PreviewAttachTier + +## Example Usage + +```typescript +import { PreviewAttachTier } from "@useautumn/sdk"; + +let value: PreviewAttachTier = { + to: 2489.38, + amount: 8529.96, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------ | ------------------------ | ------------------------ | ------------------------ | +| `to` | *models.PreviewAttachTo* | :heavy_check_mark: | N/A | +| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-balance-to.md b/packages/sdk/docs/models/preview-attach-to.md similarity index 85% rename from packages/sdk/docs/models/balances-track-balance-to.md rename to packages/sdk/docs/models/preview-attach-to.md index ee7789f05..e7f002535 100644 --- a/packages/sdk/docs/models/balances-track-balance-to.md +++ b/packages/sdk/docs/models/preview-attach-to.md @@ -1,4 +1,4 @@ -# BalancesTrackBalanceTo +# PreviewAttachTo ## Supported Types diff --git a/packages/sdk/docs/models/preview-update-billing-behavior.md b/packages/sdk/docs/models/preview-update-billing-behavior.md new file mode 100644 index 000000000..d576dca35 --- /dev/null +++ b/packages/sdk/docs/models/preview-update-billing-behavior.md @@ -0,0 +1,17 @@ +# PreviewUpdateBillingBehavior + +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. + +## Example Usage + +```typescript +import { PreviewUpdateBillingBehavior } from "@useautumn/sdk"; + +let value: PreviewUpdateBillingBehavior = "prorate_immediately"; +``` + +## Values + +```typescript +"prorate_immediately" | "next_cycle_only" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-billing-method.md b/packages/sdk/docs/models/preview-update-billing-method.md new file mode 100644 index 000000000..7e312adfb --- /dev/null +++ b/packages/sdk/docs/models/preview-update-billing-method.md @@ -0,0 +1,15 @@ +# PreviewUpdateBillingMethod + +## Example Usage + +```typescript +import { PreviewUpdateBillingMethod } from "@useautumn/sdk"; + +let value: PreviewUpdateBillingMethod = "prepaid"; +``` + +## Values + +```typescript +"prepaid" | "usage_based" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-cancel-action.md b/packages/sdk/docs/models/preview-update-cancel-action.md new file mode 100644 index 000000000..0bb67d6c2 --- /dev/null +++ b/packages/sdk/docs/models/preview-update-cancel-action.md @@ -0,0 +1,17 @@ +# PreviewUpdateCancelAction + +Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. + +## Example Usage + +```typescript +import { PreviewUpdateCancelAction } from "@useautumn/sdk"; + +let value: PreviewUpdateCancelAction = "uncancel"; +``` + +## Values + +```typescript +"cancel_immediately" | "cancel_end_of_cycle" | "uncancel" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-customize.md b/packages/sdk/docs/models/preview-update-customize.md new file mode 100644 index 000000000..6e85c1dac --- /dev/null +++ b/packages/sdk/docs/models/preview-update-customize.md @@ -0,0 +1,18 @@ +# PreviewUpdateCustomize + +Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. + +## Example Usage + +```typescript +import { PreviewUpdateCustomize } from "@useautumn/sdk"; + +let value: PreviewUpdateCustomize = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `price` | [models.PreviewUpdatePrice](../models/preview-update-price.md) | :heavy_minus_sign: | N/A | +| `items` | [models.PreviewUpdateItem](../models/preview-update-item.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-discount.md b/packages/sdk/docs/models/preview-update-discount.md similarity index 78% rename from packages/sdk/docs/models/billing-preview-update-discount.md rename to packages/sdk/docs/models/preview-update-discount.md index 373be10fc..1e1352886 100644 --- a/packages/sdk/docs/models/billing-preview-update-discount.md +++ b/packages/sdk/docs/models/preview-update-discount.md @@ -1,12 +1,12 @@ -# BillingPreviewUpdateDiscount +# PreviewUpdateDiscount ## Example Usage ```typescript -import { BillingPreviewUpdateDiscount } from "@useautumn/sdk"; +import { PreviewUpdateDiscount } from "@useautumn/sdk"; -let value: BillingPreviewUpdateDiscount = { - amountOff: 6580.55, +let value: PreviewUpdateDiscount = { + amountOff: 9330.2, }; ``` diff --git a/packages/sdk/docs/models/preview-update-duration-type.md b/packages/sdk/docs/models/preview-update-duration-type.md new file mode 100644 index 000000000..8e7a60015 --- /dev/null +++ b/packages/sdk/docs/models/preview-update-duration-type.md @@ -0,0 +1,15 @@ +# PreviewUpdateDurationType + +## Example Usage + +```typescript +import { PreviewUpdateDurationType } from "@useautumn/sdk"; + +let value: PreviewUpdateDurationType = "month"; +``` + +## Values + +```typescript +"day" | "month" | "year" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-expiry-duration-type.md b/packages/sdk/docs/models/preview-update-expiry-duration-type.md new file mode 100644 index 000000000..1f2e38a00 --- /dev/null +++ b/packages/sdk/docs/models/preview-update-expiry-duration-type.md @@ -0,0 +1,15 @@ +# PreviewUpdateExpiryDurationType + +## Example Usage + +```typescript +import { PreviewUpdateExpiryDurationType } from "@useautumn/sdk"; + +let value: PreviewUpdateExpiryDurationType = "month"; +``` + +## Values + +```typescript +"month" | "forever" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-feature-quantities.md b/packages/sdk/docs/models/preview-update-feature-quantity.md similarity index 75% rename from packages/sdk/docs/models/billing-preview-update-feature-quantities.md rename to packages/sdk/docs/models/preview-update-feature-quantity.md index 111ed8a9c..214107e1b 100644 --- a/packages/sdk/docs/models/billing-preview-update-feature-quantities.md +++ b/packages/sdk/docs/models/preview-update-feature-quantity.md @@ -1,11 +1,11 @@ -# BillingPreviewUpdateFeatureQuantities +# PreviewUpdateFeatureQuantity ## Example Usage ```typescript -import { BillingPreviewUpdateFeatureQuantities } from "@useautumn/sdk"; +import { PreviewUpdateFeatureQuantity } from "@useautumn/sdk"; -let value: BillingPreviewUpdateFeatureQuantities = { +let value: PreviewUpdateFeatureQuantity = { featureId: "", }; ``` diff --git a/packages/sdk/docs/models/preview-update-free-trial.md b/packages/sdk/docs/models/preview-update-free-trial.md new file mode 100644 index 000000000..c17094121 --- /dev/null +++ b/packages/sdk/docs/models/preview-update-free-trial.md @@ -0,0 +1,19 @@ +# PreviewUpdateFreeTrial + +## Example Usage + +```typescript +import { PreviewUpdateFreeTrial } from "@useautumn/sdk"; + +let value: PreviewUpdateFreeTrial = { + durationLength: 6564.24, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `durationLength` | *number* | :heavy_check_mark: | N/A | +| `durationType` | [models.PreviewUpdateDurationType](../models/preview-update-duration-type.md) | :heavy_minus_sign: | N/A | +| `cardRequired` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-globals.md b/packages/sdk/docs/models/preview-update-globals.md new file mode 100644 index 000000000..932c0343b --- /dev/null +++ b/packages/sdk/docs/models/preview-update-globals.md @@ -0,0 +1,15 @@ +# PreviewUpdateGlobals + +## Example Usage + +```typescript +import { PreviewUpdateGlobals } from "@useautumn/sdk"; + +let value: PreviewUpdateGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-invoice-mode.md b/packages/sdk/docs/models/preview-update-invoice-mode.md new file mode 100644 index 000000000..2cec59e4e --- /dev/null +++ b/packages/sdk/docs/models/preview-update-invoice-mode.md @@ -0,0 +1,21 @@ +# PreviewUpdateInvoiceMode + +Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + +## Example Usage + +```typescript +import { PreviewUpdateInvoiceMode } from "@useautumn/sdk"; + +let value: PreviewUpdateInvoiceMode = { + enabled: true, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `enabled` | *boolean* | :heavy_check_mark: | When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. | +| `enablePlanImmediately` | *boolean* | :heavy_minus_sign: | If true, enables the plan immediately even though the invoice is not paid yet. | +| `finalize` | *boolean* | :heavy_minus_sign: | If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-item-price-interval.md b/packages/sdk/docs/models/preview-update-item-price-interval.md new file mode 100644 index 000000000..331bff6f5 --- /dev/null +++ b/packages/sdk/docs/models/preview-update-item-price-interval.md @@ -0,0 +1,15 @@ +# PreviewUpdateItemPriceInterval + +## Example Usage + +```typescript +import { PreviewUpdateItemPriceInterval } from "@useautumn/sdk"; + +let value: PreviewUpdateItemPriceInterval = "one_off"; +``` + +## Values + +```typescript +"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-item-price.md b/packages/sdk/docs/models/preview-update-item-price.md new file mode 100644 index 000000000..220c9e373 --- /dev/null +++ b/packages/sdk/docs/models/preview-update-item-price.md @@ -0,0 +1,24 @@ +# PreviewUpdateItemPrice + +## Example Usage + +```typescript +import { PreviewUpdateItemPrice } from "@useautumn/sdk"; + +let value: PreviewUpdateItemPrice = { + interval: "one_off", + billingMethod: "usage_based", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `amount` | *number* | :heavy_minus_sign: | N/A | +| `tiers` | [models.PreviewUpdateTier](../models/preview-update-tier.md)[] | :heavy_minus_sign: | N/A | +| `interval` | [models.PreviewUpdateItemPriceInterval](../models/preview-update-item-price-interval.md) | :heavy_check_mark: | N/A | +| `intervalCount` | *number* | :heavy_minus_sign: | N/A | +| `billingUnits` | *number* | :heavy_minus_sign: | N/A | +| `billingMethod` | [models.PreviewUpdateBillingMethod](../models/preview-update-billing-method.md) | :heavy_check_mark: | N/A | +| `maxPurchase` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-item.md b/packages/sdk/docs/models/preview-update-item.md new file mode 100644 index 000000000..6f29adac3 --- /dev/null +++ b/packages/sdk/docs/models/preview-update-item.md @@ -0,0 +1,23 @@ +# PreviewUpdateItem + +## Example Usage + +```typescript +import { PreviewUpdateItem } from "@useautumn/sdk"; + +let value: PreviewUpdateItem = { + featureId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | N/A | +| `included` | *number* | :heavy_minus_sign: | N/A | +| `unlimited` | *boolean* | :heavy_minus_sign: | N/A | +| `reset` | [models.PreviewUpdateReset](../models/preview-update-reset.md) | :heavy_minus_sign: | N/A | +| `price` | [models.PreviewUpdateItemPrice](../models/preview-update-item-price.md) | :heavy_minus_sign: | N/A | +| `proration` | [models.PreviewUpdateProration](../models/preview-update-proration.md) | :heavy_minus_sign: | N/A | +| `rollover` | [models.PreviewUpdateRollover](../models/preview-update-rollover.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-line-item.md b/packages/sdk/docs/models/preview-update-line-item.md new file mode 100644 index 000000000..50f036c2b --- /dev/null +++ b/packages/sdk/docs/models/preview-update-line-item.md @@ -0,0 +1,22 @@ +# PreviewUpdateLineItem + +## Example Usage + +```typescript +import { PreviewUpdateLineItem } from "@useautumn/sdk"; + +let value: PreviewUpdateLineItem = { + title: "", + description: "summary embody unto swat distorted but", + amount: 7427.09, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `title` | *string* | :heavy_check_mark: | The title of the line item. | +| `description` | *string* | :heavy_check_mark: | A detailed description of the line item. | +| `amount` | *number* | :heavy_check_mark: | The amount in cents for this line item. | +| `discounts` | [models.PreviewUpdateDiscount](../models/preview-update-discount.md)[] | :heavy_minus_sign: | List of discounts applied to this line item. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-next-cycle.md b/packages/sdk/docs/models/preview-update-next-cycle.md new file mode 100644 index 000000000..b1733620a --- /dev/null +++ b/packages/sdk/docs/models/preview-update-next-cycle.md @@ -0,0 +1,21 @@ +# PreviewUpdateNextCycle + +Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. + +## Example Usage + +```typescript +import { PreviewUpdateNextCycle } from "@useautumn/sdk"; + +let value: PreviewUpdateNextCycle = { + startsAt: 5041.9, + total: 6009.99, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `startsAt` | *number* | :heavy_check_mark: | Unix timestamp (milliseconds) when the next billing cycle starts. | +| `total` | *number* | :heavy_check_mark: | The total amount in cents for the next cycle. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-on-decrease.md b/packages/sdk/docs/models/preview-update-on-decrease.md new file mode 100644 index 000000000..9015efdb6 --- /dev/null +++ b/packages/sdk/docs/models/preview-update-on-decrease.md @@ -0,0 +1,15 @@ +# PreviewUpdateOnDecrease + +## Example Usage + +```typescript +import { PreviewUpdateOnDecrease } from "@useautumn/sdk"; + +let value: PreviewUpdateOnDecrease = "none"; +``` + +## Values + +```typescript +"prorate" | "prorate_immediately" | "prorate_next_cycle" | "none" | "no_prorations" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-on-increase.md b/packages/sdk/docs/models/preview-update-on-increase.md new file mode 100644 index 000000000..2d0494cfb --- /dev/null +++ b/packages/sdk/docs/models/preview-update-on-increase.md @@ -0,0 +1,15 @@ +# PreviewUpdateOnIncrease + +## Example Usage + +```typescript +import { PreviewUpdateOnIncrease } from "@useautumn/sdk"; + +let value: PreviewUpdateOnIncrease = "bill_immediately"; +``` + +## Values + +```typescript +"bill_immediately" | "prorate_immediately" | "prorate_next_cycle" | "bill_next_cycle" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-request.md b/packages/sdk/docs/models/preview-update-params.md similarity index 56% rename from packages/sdk/docs/models/billing-preview-update-request.md rename to packages/sdk/docs/models/preview-update-params.md index 07a22eeaa..8f98d98b0 100644 --- a/packages/sdk/docs/models/billing-preview-update-request.md +++ b/packages/sdk/docs/models/preview-update-params.md @@ -1,26 +1,33 @@ -# BillingPreviewUpdateRequest +# PreviewUpdateParams ## Example Usage ```typescript -import { BillingPreviewUpdateRequest } from "@useautumn/sdk"; +import { PreviewUpdateParams } from "@useautumn/sdk"; -let value: BillingPreviewUpdateRequest = { - customerId: "", +let value: PreviewUpdateParams = { + customerId: "cus_123", + planId: "pro_plan", + featureQuantities: [ + { + featureId: "seats", + quantity: 15, + }, + ], }; ``` ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `customerId` | *string* | :heavy_check_mark: | The ID of the customer to attach the plan to. | -| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | -| `featureQuantities` | [models.BillingPreviewUpdateFeatureQuantities](../models/billing-preview-update-feature-quantities.md)[] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | -| `version` | *number* | :heavy_minus_sign: | The version of the plan to attach. | -| `freeTrial` | [models.BillingPreviewUpdateFreeTrial](../models/billing-preview-update-free-trial.md) | :heavy_minus_sign: | N/A | -| `customize` | [models.BillingPreviewUpdateCustomize](../models/billing-preview-update-customize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | -| `planId` | *string* | :heavy_minus_sign: | N/A | -| `invoiceMode` | [models.BillingPreviewUpdateInvoiceMode](../models/billing-preview-update-invoice-mode.md) | :heavy_minus_sign: | N/A | -| `cancelAction` | [models.BillingPreviewUpdateCancelAction](../models/billing-preview-update-cancel-action.md) | :heavy_minus_sign: | N/A | -| `billingBehavior` | [models.BillingPreviewUpdateBillingBehavior](../models/billing-preview-update-billing-behavior.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer to attach the plan to. | +| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | +| `planId` | *string* | :heavy_check_mark: | The ID of the plan. | +| `featureQuantities` | [models.PreviewUpdateFeatureQuantity](../models/preview-update-feature-quantity.md)[] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | +| `version` | *number* | :heavy_minus_sign: | The version of the plan to attach. | +| `freeTrial` | [models.PreviewUpdateFreeTrial](../models/preview-update-free-trial.md) | :heavy_minus_sign: | Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. | +| `customize` | [models.PreviewUpdateCustomize](../models/preview-update-customize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | +| `invoiceMode` | [models.PreviewUpdateInvoiceMode](../models/preview-update-invoice-mode.md) | :heavy_minus_sign: | Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. | +| `billingBehavior` | [models.PreviewUpdateBillingBehavior](../models/preview-update-billing-behavior.md) | :heavy_minus_sign: | 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. | +| `cancelAction` | [models.PreviewUpdateCancelAction](../models/preview-update-cancel-action.md) | :heavy_minus_sign: | Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-price-interval.md b/packages/sdk/docs/models/preview-update-price-interval.md new file mode 100644 index 000000000..b1a5ecd50 --- /dev/null +++ b/packages/sdk/docs/models/preview-update-price-interval.md @@ -0,0 +1,15 @@ +# PreviewUpdatePriceInterval + +## Example Usage + +```typescript +import { PreviewUpdatePriceInterval } from "@useautumn/sdk"; + +let value: PreviewUpdatePriceInterval = "semi_annual"; +``` + +## Values + +```typescript +"one_off" | "week" | "month" | "quarter" | "semi_annual" | "year" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-price.md b/packages/sdk/docs/models/preview-update-price.md new file mode 100644 index 000000000..2b270cb86 --- /dev/null +++ b/packages/sdk/docs/models/preview-update-price.md @@ -0,0 +1,20 @@ +# PreviewUpdatePrice + +## Example Usage + +```typescript +import { PreviewUpdatePrice } from "@useautumn/sdk"; + +let value: PreviewUpdatePrice = { + amount: 8816.64, + interval: "semi_annual", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| `amount` | *number* | :heavy_check_mark: | N/A | +| `interval` | [models.PreviewUpdatePriceInterval](../models/preview-update-price-interval.md) | :heavy_check_mark: | N/A | +| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-proration.md b/packages/sdk/docs/models/preview-update-proration.md new file mode 100644 index 000000000..a71c9503b --- /dev/null +++ b/packages/sdk/docs/models/preview-update-proration.md @@ -0,0 +1,19 @@ +# PreviewUpdateProration + +## Example Usage + +```typescript +import { PreviewUpdateProration } from "@useautumn/sdk"; + +let value: PreviewUpdateProration = { + onIncrease: "bill_immediately", + onDecrease: "no_prorations", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| `onIncrease` | [models.PreviewUpdateOnIncrease](../models/preview-update-on-increase.md) | :heavy_check_mark: | N/A | +| `onDecrease` | [models.PreviewUpdateOnDecrease](../models/preview-update-on-decrease.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-preview-update-reset-interval.md b/packages/sdk/docs/models/preview-update-reset-interval.md similarity index 50% rename from packages/sdk/docs/models/billing-preview-update-reset-interval.md rename to packages/sdk/docs/models/preview-update-reset-interval.md index 800d2758f..a95452f32 100644 --- a/packages/sdk/docs/models/billing-preview-update-reset-interval.md +++ b/packages/sdk/docs/models/preview-update-reset-interval.md @@ -1,11 +1,11 @@ -# BillingPreviewUpdateResetInterval +# PreviewUpdateResetInterval ## Example Usage ```typescript -import { BillingPreviewUpdateResetInterval } from "@useautumn/sdk"; +import { PreviewUpdateResetInterval } from "@useautumn/sdk"; -let value: BillingPreviewUpdateResetInterval = "month"; +let value: PreviewUpdateResetInterval = "quarter"; ``` ## Values diff --git a/packages/sdk/docs/models/preview-update-reset.md b/packages/sdk/docs/models/preview-update-reset.md new file mode 100644 index 000000000..0c1660a20 --- /dev/null +++ b/packages/sdk/docs/models/preview-update-reset.md @@ -0,0 +1,18 @@ +# PreviewUpdateReset + +## Example Usage + +```typescript +import { PreviewUpdateReset } from "@useautumn/sdk"; + +let value: PreviewUpdateReset = { + interval: "minute", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| `interval` | [models.PreviewUpdateResetInterval](../models/preview-update-reset-interval.md) | :heavy_check_mark: | N/A | +| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-response.md b/packages/sdk/docs/models/preview-update-response.md new file mode 100644 index 000000000..fd461344e --- /dev/null +++ b/packages/sdk/docs/models/preview-update-response.md @@ -0,0 +1,32 @@ +# PreviewUpdateResponse + +OK + +## Example Usage + +```typescript +import { PreviewUpdateResponse } from "@useautumn/sdk"; + +let value: PreviewUpdateResponse = { + customerId: "", + lineItems: [ + { + title: "", + description: "oof despite aha psst woot well", + amount: 1951, + }, + ], + total: 20, + currency: "usd", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer. | +| `lineItems` | [models.PreviewUpdateLineItem](../models/preview-update-line-item.md)[] | :heavy_check_mark: | List of line items for the current billing period. | +| `total` | *number* | :heavy_check_mark: | The total amount in cents for the current billing period. | +| `currency` | *string* | :heavy_check_mark: | The three-letter ISO currency code (e.g., 'usd'). | +| `nextCycle` | [models.PreviewUpdateNextCycle](../models/preview-update-next-cycle.md) | :heavy_minus_sign: | Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/billingpreviewattachpricerequest.md b/packages/sdk/docs/models/preview-update-rollover.md similarity index 66% rename from others/python-sdk/docs/models/billingpreviewattachpricerequest.md rename to packages/sdk/docs/models/preview-update-rollover.md index dfe34aae0..c9e3aa197 100644 --- a/others/python-sdk/docs/models/billingpreviewattachpricerequest.md +++ b/packages/sdk/docs/models/preview-update-rollover.md @@ -1,10 +1,19 @@ -# BillingPreviewAttachPriceRequest +# PreviewUpdateRollover +## Example Usage + +```typescript +import { PreviewUpdateRollover } from "@useautumn/sdk"; + +let value: PreviewUpdateRollover = { + expiryDurationType: "month", +}; +``` ## Fields | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `amount` | *float* | :heavy_check_mark: | N/A | -| `interval` | [models.BillingPreviewAttachPriceInterval](../models/billingpreviewattachpriceinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `max` | *number* | :heavy_minus_sign: | N/A | +| `expiryDurationType` | [models.PreviewUpdateExpiryDurationType](../models/preview-update-expiry-duration-type.md) | :heavy_check_mark: | N/A | +| `expiryDurationLength` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-tier.md b/packages/sdk/docs/models/preview-update-tier.md similarity index 70% rename from packages/sdk/docs/models/balances-track-tier.md rename to packages/sdk/docs/models/preview-update-tier.md index 47c19a3e9..6e170c5d8 100644 --- a/packages/sdk/docs/models/balances-track-tier.md +++ b/packages/sdk/docs/models/preview-update-tier.md @@ -1,13 +1,13 @@ -# BalancesTrackTier +# PreviewUpdateTier ## Example Usage ```typescript -import { BalancesTrackTier } from "@useautumn/sdk"; +import { PreviewUpdateTier } from "@useautumn/sdk"; -let value: BalancesTrackTier = { +let value: PreviewUpdateTier = { to: "", - amount: 834.02, + amount: 1898.77, }; ``` @@ -15,5 +15,5 @@ let value: BalancesTrackTier = { | Field | Type | Required | Description | | ------------------------ | ------------------------ | ------------------------ | ------------------------ | -| `to` | *models.BalancesTrackTo* | :heavy_check_mark: | N/A | +| `to` | *models.PreviewUpdateTo* | :heavy_check_mark: | N/A | | `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/preview-update-to.md b/packages/sdk/docs/models/preview-update-to.md new file mode 100644 index 000000000..fcda14627 --- /dev/null +++ b/packages/sdk/docs/models/preview-update-to.md @@ -0,0 +1,17 @@ +# PreviewUpdateTo + + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/preview.md b/packages/sdk/docs/models/preview.md index fc961659d..d38bd912d 100644 --- a/packages/sdk/docs/models/preview.md +++ b/packages/sdk/docs/models/preview.md @@ -1,5 +1,7 @@ # Preview +Upgrade/upsell information when access is denied. Only present if with_preview was true and allowed is false. + ## Example Usage ```typescript @@ -37,11 +39,11 @@ let value: Preview = { ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `scenario` | [models.BalancesCheckScenario](../models/balances-check-scenario.md) | :heavy_check_mark: | N/A | -| `title` | *string* | :heavy_check_mark: | N/A | -| `message` | *string* | :heavy_check_mark: | N/A | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `featureName` | *string* | :heavy_check_mark: | N/A | -| `products` | [models.Product](../models/product.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `scenario` | [models.CheckScenario](../models/check-scenario.md) | :heavy_check_mark: | The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. | +| `title` | *string* | :heavy_check_mark: | A title suitable for displaying in a paywall or upgrade modal. | +| `message` | *string* | :heavy_check_mark: | A message explaining why access was denied. | +| `featureId` | *string* | :heavy_check_mark: | The ID of the feature that was checked. | +| `featureName` | *string* | :heavy_check_mark: | The display name of the feature. | +| `products` | [models.Product](../models/product.md)[] | :heavy_check_mark: | Products that would grant access to this feature. Use to display upgrade options. | \ No newline at end of file diff --git a/packages/sdk/docs/models/product.md b/packages/sdk/docs/models/product.md index f28069380..6d1ae6a8f 100644 --- a/packages/sdk/docs/models/product.md +++ b/packages/sdk/docs/models/product.md @@ -33,14 +33,14 @@ let value: Product = { | `id` | *string* | :heavy_check_mark: | The ID of the product you set when creating the product | | `name` | *string* | :heavy_check_mark: | The name of the product | | `group` | *string* | :heavy_check_mark: | Product group which this product belongs to | -| `env` | [models.BalancesCheckEnv](../models/balances-check-env.md) | :heavy_check_mark: | The environment of the product | +| `env` | [models.CheckEnv](../models/check-env.md) | :heavy_check_mark: | The environment of the product | | `isAddOn` | *boolean* | :heavy_check_mark: | Whether the product is an add-on and can be purchased alongside other products | | `isDefault` | *boolean* | :heavy_check_mark: | Whether the product is the default product | | `archived` | *boolean* | :heavy_check_mark: | Whether this product has been archived and is no longer available | | `version` | *number* | :heavy_check_mark: | The current version of the product | | `createdAt` | *number* | :heavy_check_mark: | The timestamp of when the product was created in milliseconds since epoch | -| `items` | [models.BalancesCheckItem](../models/balances-check-item.md)[] | :heavy_check_mark: | Array of product items that define the product's features and pricing | -| `freeTrial` | [models.BalancesCheckFreeTrial](../models/balances-check-free-trial.md) | :heavy_check_mark: | Free trial configuration for this product, if available | +| `items` | [models.CheckItem](../models/check-item.md)[] | :heavy_check_mark: | Array of product items that define the product's features and pricing | +| `freeTrial` | [models.CheckFreeTrial](../models/check-free-trial.md) | :heavy_check_mark: | Free trial configuration for this product, if available | | `baseVariantId` | *string* | :heavy_check_mark: | ID of the base variant this product is derived from | | `scenario` | [models.ProductScenario](../models/product-scenario.md) | :heavy_minus_sign: | Scenario for when this product is used in attach flows | -| `properties` | [models.Properties](../models/properties.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `properties` | [models.CheckProperties](../models/check-properties.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/purchase.md b/packages/sdk/docs/models/purchase.md index 4454516ca..bb9d83c95 100644 --- a/packages/sdk/docs/models/purchase.md +++ b/packages/sdk/docs/models/purchase.md @@ -15,10 +15,10 @@ let value: Purchase = { ## Fields -| Field | Type | Required | Description | -| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | -| `startedAt` | *number* | :heavy_check_mark: | N/A | -| `quantity` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | +| `planId` | *string* | :heavy_check_mark: | The unique identifier of the purchased plan. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the purchase expires, or null for lifetime access. | +| `startedAt` | *number* | :heavy_check_mark: | Timestamp when the purchase was made. | +| `quantity` | *number* | :heavy_check_mark: | Number of units purchased. | \ No newline at end of file diff --git a/packages/sdk/docs/models/range.md b/packages/sdk/docs/models/range.md new file mode 100644 index 000000000..9ba10cd86 --- /dev/null +++ b/packages/sdk/docs/models/range.md @@ -0,0 +1,17 @@ +# Range + +Time range to aggregate events for. Either range or custom_range must be provided + +## Example Usage + +```typescript +import { Range } from "@useautumn/sdk"; + +let value: Range = "7d"; +``` + +## Values + +```typescript +"24h" | "7d" | "30d" | "90d" | "last_cycle" | "1bc" | "3bc" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/redeem-referral-code-globals.md b/packages/sdk/docs/models/redeem-referral-code-globals.md new file mode 100644 index 000000000..713cbd270 --- /dev/null +++ b/packages/sdk/docs/models/redeem-referral-code-globals.md @@ -0,0 +1,15 @@ +# RedeemReferralCodeGlobals + +## Example Usage + +```typescript +import { RedeemReferralCodeGlobals } from "@useautumn/sdk"; + +let value: RedeemReferralCodeGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/redeem-referral-code-params.md b/packages/sdk/docs/models/redeem-referral-code-params.md new file mode 100644 index 000000000..676c658ee --- /dev/null +++ b/packages/sdk/docs/models/redeem-referral-code-params.md @@ -0,0 +1,19 @@ +# RedeemReferralCodeParams + +## Example Usage + +```typescript +import { RedeemReferralCodeParams } from "@useautumn/sdk"; + +let value: RedeemReferralCodeParams = { + code: "REF123", + customerId: "cus_456", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `code` | *string* | :heavy_check_mark: | The referral code to redeem | +| `customerId` | *string* | :heavy_check_mark: | The unique identifier of the customer redeeming the code | \ No newline at end of file diff --git a/packages/sdk/docs/models/redeem-referral-code-response.md b/packages/sdk/docs/models/redeem-referral-code-response.md new file mode 100644 index 000000000..3fbb73fe1 --- /dev/null +++ b/packages/sdk/docs/models/redeem-referral-code-response.md @@ -0,0 +1,23 @@ +# RedeemReferralCodeResponse + +OK + +## Example Usage + +```typescript +import { RedeemReferralCodeResponse } from "@useautumn/sdk"; + +let value: RedeemReferralCodeResponse = { + id: "", + customerId: "", + rewardId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| `id` | *string* | :heavy_check_mark: | The ID of the redemption event | +| `customerId` | *string* | :heavy_check_mark: | Your unique identifier for the customer | +| `rewardId` | *string* | :heavy_check_mark: | The ID of the reward that will be granted | \ No newline at end of file diff --git a/packages/sdk/docs/models/status.md b/packages/sdk/docs/models/status.md index 041eaf0d0..69a5f31b0 100644 --- a/packages/sdk/docs/models/status.md +++ b/packages/sdk/docs/models/status.md @@ -1,5 +1,7 @@ # Status +Current status of the subscription. + ## Example Usage ```typescript @@ -13,5 +15,5 @@ let value: Status = "scheduled"; This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. ```typescript -"active" | "scheduled" | "expired" | Unrecognized +"active" | "scheduled" | Unrecognized ``` \ No newline at end of file diff --git a/packages/sdk/docs/models/subscription.md b/packages/sdk/docs/models/subscription.md index 4d0a253fd..ed4f767c1 100644 --- a/packages/sdk/docs/models/subscription.md +++ b/packages/sdk/docs/models/subscription.md @@ -23,18 +23,18 @@ let value: Subscription = { ## Fields -| Field | Type | Required | Description | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `autoEnable` | *boolean* | :heavy_check_mark: | N/A | -| `addOn` | *boolean* | :heavy_check_mark: | N/A | -| `status` | [models.Status](../models/status.md) | :heavy_check_mark: | N/A | -| `pastDue` | *boolean* | :heavy_check_mark: | N/A | -| `canceledAt` | *number* | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | -| `trialEndsAt` | *number* | :heavy_check_mark: | N/A | -| `startedAt` | *number* | :heavy_check_mark: | N/A | -| `currentPeriodStart` | *number* | :heavy_check_mark: | N/A | -| `currentPeriodEnd` | *number* | :heavy_check_mark: | N/A | -| `quantity` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | +| `planId` | *string* | :heavy_check_mark: | The unique identifier of the subscribed plan. | +| `autoEnable` | *boolean* | :heavy_check_mark: | Whether the plan was automatically enabled for the customer. | +| `addOn` | *boolean* | :heavy_check_mark: | Whether this is an add-on plan rather than a base subscription. | +| `status` | [models.Status](../models/status.md) | :heavy_check_mark: | Current status of the subscription. | +| `pastDue` | *boolean* | :heavy_check_mark: | Whether the subscription has overdue payments. | +| `canceledAt` | *number* | :heavy_check_mark: | Timestamp when the subscription was canceled, or null if not canceled. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the subscription will expire, or null if no expiry set. | +| `trialEndsAt` | *number* | :heavy_check_mark: | Timestamp when the trial period ends, or null if not on trial. | +| `startedAt` | *number* | :heavy_check_mark: | Timestamp when the subscription started. | +| `currentPeriodStart` | *number* | :heavy_check_mark: | Start timestamp of the current billing period. | +| `currentPeriodEnd` | *number* | :heavy_check_mark: | End timestamp of the current billing period. | +| `quantity` | *number* | :heavy_check_mark: | Number of units of this subscription (for per-seat plans). | \ No newline at end of file diff --git a/packages/sdk/docs/models/total.md b/packages/sdk/docs/models/total.md new file mode 100644 index 000000000..07b601a1e --- /dev/null +++ b/packages/sdk/docs/models/total.md @@ -0,0 +1,19 @@ +# Total + +## Example Usage + +```typescript +import { Total } from "@useautumn/sdk"; + +let value: Total = { + count: 6473.06, + sum: 1470.3, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `count` | *number* | :heavy_check_mark: | Number of events for this feature | +| `sum` | *number* | :heavy_check_mark: | Sum of event values for this feature | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-billing-method.md b/packages/sdk/docs/models/track-balance-billing-method.md similarity index 53% rename from packages/sdk/docs/models/balances-track-billing-method.md rename to packages/sdk/docs/models/track-balance-billing-method.md index 22f323f1f..c46f7278c 100644 --- a/packages/sdk/docs/models/balances-track-billing-method.md +++ b/packages/sdk/docs/models/track-balance-billing-method.md @@ -1,11 +1,13 @@ -# BalancesTrackBillingMethod +# TrackBalanceBillingMethod + +Whether usage is prepaid or billed pay-per-use. ## Example Usage ```typescript -import { BalancesTrackBillingMethod } from "@useautumn/sdk"; +import { TrackBalanceBillingMethod } from "@useautumn/sdk"; -let value: BalancesTrackBillingMethod = "prepaid"; +let value: TrackBalanceBillingMethod = "usage_based"; ``` ## Values diff --git a/packages/sdk/docs/models/track-balance-breakdown.md b/packages/sdk/docs/models/track-balance-breakdown.md new file mode 100644 index 000000000..23a2f6e3a --- /dev/null +++ b/packages/sdk/docs/models/track-balance-breakdown.md @@ -0,0 +1,37 @@ +# TrackBalanceBreakdown + +## Example Usage + +```typescript +import { TrackBalanceBreakdown } from "@useautumn/sdk"; + +let value: TrackBalanceBreakdown = { + planId: "", + includedGrant: 5298.68, + prepaidGrant: 6183.17, + remaining: 4520.51, + usage: 376.7, + unlimited: true, + reset: { + interval: "one_off", + resetsAt: 2544.52, + }, + price: null, + expiresAt: null, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | The unique identifier for this balance breakdown. | +| `planId` | *string* | :heavy_check_mark: | The plan ID this balance originates from, or null for standalone balances. | +| `includedGrant` | *number* | :heavy_check_mark: | Amount granted from the plan's included usage. | +| `prepaidGrant` | *number* | :heavy_check_mark: | Amount granted from prepaid purchases or top-ups. | +| `remaining` | *number* | :heavy_check_mark: | Remaining balance available for use. | +| `usage` | *number* | :heavy_check_mark: | Amount consumed in the current period. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether this balance has unlimited usage. | +| `reset` | [models.TrackBalanceReset](../models/track-balance-reset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. | +| `price` | [models.TrackBalancePrice](../models/track-balance-price.md) | :heavy_check_mark: | Pricing configuration if this balance has usage-based pricing. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when this balance expires, or null for no expiration. | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-credit-schema.md b/packages/sdk/docs/models/track-balance-credit-schema.md similarity index 73% rename from packages/sdk/docs/models/balances-check-credit-schema.md rename to packages/sdk/docs/models/track-balance-credit-schema.md index 93646a7b1..466a0da0e 100644 --- a/packages/sdk/docs/models/balances-check-credit-schema.md +++ b/packages/sdk/docs/models/track-balance-credit-schema.md @@ -1,13 +1,13 @@ -# BalancesCheckCreditSchema +# TrackBalanceCreditSchema ## Example Usage ```typescript -import { BalancesCheckCreditSchema } from "@useautumn/sdk"; +import { TrackBalanceCreditSchema } from "@useautumn/sdk"; -let value: BalancesCheckCreditSchema = { +let value: TrackBalanceCreditSchema = { meteredFeatureId: "", - creditCost: 8757.88, + creditCost: 8407.16, }; ``` diff --git a/packages/sdk/docs/models/balances-track-balance-display.md b/packages/sdk/docs/models/track-balance-display.md similarity index 74% rename from packages/sdk/docs/models/balances-track-balance-display.md rename to packages/sdk/docs/models/track-balance-display.md index 7ab4ed677..1308065bd 100644 --- a/packages/sdk/docs/models/balances-track-balance-display.md +++ b/packages/sdk/docs/models/track-balance-display.md @@ -1,11 +1,11 @@ -# BalancesTrackBalanceDisplay +# TrackBalanceDisplay ## Example Usage ```typescript -import { BalancesTrackBalanceDisplay } from "@useautumn/sdk"; +import { TrackBalanceDisplay } from "@useautumn/sdk"; -let value: BalancesTrackBalanceDisplay = {}; +let value: TrackBalanceDisplay = {}; ``` ## Fields diff --git a/packages/sdk/docs/models/track-balance-feature.md b/packages/sdk/docs/models/track-balance-feature.md new file mode 100644 index 000000000..4c19e6294 --- /dev/null +++ b/packages/sdk/docs/models/track-balance-feature.md @@ -0,0 +1,30 @@ +# TrackBalanceFeature + +The full feature object if expanded. + +## Example Usage + +```typescript +import { TrackBalanceFeature } from "@useautumn/sdk"; + +let value: TrackBalanceFeature = { + id: "", + name: "", + type: "boolean", + consumable: true, + archived: true, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | N/A | +| `name` | *string* | :heavy_check_mark: | N/A | +| `type` | [models.TrackBalanceType](../models/track-balance-type.md) | :heavy_check_mark: | N/A | +| `consumable` | *boolean* | :heavy_check_mark: | N/A | +| `eventNames` | *string*[] | :heavy_minus_sign: | N/A | +| `creditSchema` | [models.TrackBalanceCreditSchema](../models/track-balance-credit-schema.md)[] | :heavy_minus_sign: | N/A | +| `display` | [models.TrackBalanceDisplay](../models/track-balance-display.md) | :heavy_minus_sign: | N/A | +| `archived` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-check-balance-interval-enum.md b/packages/sdk/docs/models/track-balance-interval-enum.md similarity index 64% rename from packages/sdk/docs/models/balances-check-balance-interval-enum.md rename to packages/sdk/docs/models/track-balance-interval-enum.md index 136673145..2edc66f13 100644 --- a/packages/sdk/docs/models/balances-check-balance-interval-enum.md +++ b/packages/sdk/docs/models/track-balance-interval-enum.md @@ -1,11 +1,11 @@ -# BalancesCheckBalanceIntervalEnum +# TrackBalanceIntervalEnum ## Example Usage ```typescript -import { BalancesCheckBalanceIntervalEnum } from "@useautumn/sdk"; +import { TrackBalanceIntervalEnum } from "@useautumn/sdk"; -let value: BalancesCheckBalanceIntervalEnum = "year"; +let value: TrackBalanceIntervalEnum = "hour"; ``` ## Values diff --git a/packages/sdk/docs/models/track-balance-interval-union.md b/packages/sdk/docs/models/track-balance-interval-union.md new file mode 100644 index 000000000..17c27a8b2 --- /dev/null +++ b/packages/sdk/docs/models/track-balance-interval-union.md @@ -0,0 +1,19 @@ +# TrackBalanceIntervalUnion + +The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + +## Supported Types + +### `models.TrackBalanceIntervalEnum` + +```typescript +const value: models.TrackBalanceIntervalEnum = "year"; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/track-balance-price.md b/packages/sdk/docs/models/track-balance-price.md new file mode 100644 index 000000000..9d08305f6 --- /dev/null +++ b/packages/sdk/docs/models/track-balance-price.md @@ -0,0 +1,23 @@ +# TrackBalancePrice + +## Example Usage + +```typescript +import { TrackBalancePrice } from "@useautumn/sdk"; + +let value: TrackBalancePrice = { + billingUnits: 2578.38, + billingMethod: "prepaid", + maxPurchase: null, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `amount` | *number* | :heavy_minus_sign: | The per-unit price amount. | +| `tiers` | [models.TrackBalanceTier](../models/track-balance-tier.md)[] | :heavy_minus_sign: | Tiered pricing configuration if applicable. | +| `billingUnits` | *number* | :heavy_check_mark: | The number of units per billing increment (eg. $9 / 250 units). | +| `billingMethod` | [models.TrackBalanceBillingMethod](../models/track-balance-billing-method.md) | :heavy_check_mark: | Whether usage is prepaid or billed pay-per-use. | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum quantity that can be purchased, or null for unlimited. | \ No newline at end of file diff --git a/packages/sdk/docs/models/track-balance-reset.md b/packages/sdk/docs/models/track-balance-reset.md new file mode 100644 index 000000000..2ea4e0ab1 --- /dev/null +++ b/packages/sdk/docs/models/track-balance-reset.md @@ -0,0 +1,20 @@ +# TrackBalanceReset + +## Example Usage + +```typescript +import { TrackBalanceReset } from "@useautumn/sdk"; + +let value: TrackBalanceReset = { + interval: "quarter", + resetsAt: 9499.19, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `interval` | *models.TrackBalanceIntervalUnion* | :heavy_check_mark: | The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets (eg. 2 for bi-monthly). | +| `resetsAt` | *number* | :heavy_check_mark: | Timestamp when the balance will next reset. | \ No newline at end of file diff --git a/packages/sdk/docs/models/track-balance-rollover.md b/packages/sdk/docs/models/track-balance-rollover.md new file mode 100644 index 000000000..15d9f03c7 --- /dev/null +++ b/packages/sdk/docs/models/track-balance-rollover.md @@ -0,0 +1,19 @@ +# TrackBalanceRollover + +## Example Usage + +```typescript +import { TrackBalanceRollover } from "@useautumn/sdk"; + +let value: TrackBalanceRollover = { + balance: 1633.78, + expiresAt: 1333.49, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `balance` | *number* | :heavy_check_mark: | Amount of balance rolled over from a previous period. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the rollover balance expires. | \ No newline at end of file diff --git a/packages/sdk/docs/models/track-balance-tier.md b/packages/sdk/docs/models/track-balance-tier.md new file mode 100644 index 000000000..b479f4067 --- /dev/null +++ b/packages/sdk/docs/models/track-balance-tier.md @@ -0,0 +1,19 @@ +# TrackBalanceTier + +## Example Usage + +```typescript +import { TrackBalanceTier } from "@useautumn/sdk"; + +let value: TrackBalanceTier = { + to: "", + amount: 3403.24, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `to` | *models.TrackBalanceTo* | :heavy_check_mark: | N/A | +| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/track-balance-to.md b/packages/sdk/docs/models/track-balance-to.md new file mode 100644 index 000000000..56194a5a5 --- /dev/null +++ b/packages/sdk/docs/models/track-balance-to.md @@ -0,0 +1,17 @@ +# TrackBalanceTo + + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/balances-track-balance-type.md b/packages/sdk/docs/models/track-balance-type.md similarity index 63% rename from packages/sdk/docs/models/balances-track-balance-type.md rename to packages/sdk/docs/models/track-balance-type.md index 882d9d3dc..6a2179a2d 100644 --- a/packages/sdk/docs/models/balances-track-balance-type.md +++ b/packages/sdk/docs/models/track-balance-type.md @@ -1,11 +1,11 @@ -# BalancesTrackBalanceType +# TrackBalanceType ## Example Usage ```typescript -import { BalancesTrackBalanceType } from "@useautumn/sdk"; +import { TrackBalanceType } from "@useautumn/sdk"; -let value: BalancesTrackBalanceType = "boolean"; +let value: TrackBalanceType = "credit_system"; ``` ## Values diff --git a/packages/sdk/docs/models/track-balance.md b/packages/sdk/docs/models/track-balance.md new file mode 100644 index 000000000..f4968f02b --- /dev/null +++ b/packages/sdk/docs/models/track-balance.md @@ -0,0 +1,51 @@ +# TrackBalance + +## Example Usage + +```typescript +import { TrackBalance } from "@useautumn/sdk"; + +let value: TrackBalance = { + featureId: "messages", + granted: 100, + remaining: 72, + usage: 28, + unlimited: false, + overageAllowed: false, + maxPurchase: null, + nextResetAt: 1773851121437, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "pro_plan", + includedGrant: 100, + prepaidGrant: 0, + remaining: 72, + usage: 28, + unlimited: false, + reset: { + interval: "month", + resetsAt: 1773851121437, + }, + price: null, + expiresAt: null, + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | The feature ID this balance is for. | +| `feature` | [models.TrackBalanceFeature](../models/track-balance-feature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `granted` | *number* | :heavy_check_mark: | Total balance granted (included + prepaid). | +| `remaining` | *number* | :heavy_check_mark: | Remaining balance available for use. | +| `usage` | *number* | :heavy_check_mark: | Total usage consumed in the current period. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether this feature has unlimited usage. | +| `overageAllowed` | *boolean* | :heavy_check_mark: | Whether usage beyond the granted balance is allowed (with overage charges). | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum quantity that can be purchased as a top-up, or null for unlimited. | +| `nextResetAt` | *number* | :heavy_check_mark: | Timestamp when the balance will reset, or null for no reset. | +| `breakdown` | [models.TrackBalanceBreakdown](../models/track-balance-breakdown.md)[] | :heavy_minus_sign: | Detailed breakdown of balance sources when stacking multiple plans or grants. | +| `rollovers` | [models.TrackBalanceRollover](../models/track-balance-rollover.md)[] | :heavy_minus_sign: | Rollover balances carried over from previous periods. | \ No newline at end of file diff --git a/packages/sdk/docs/models/track-balances-billing-method.md b/packages/sdk/docs/models/track-balances-billing-method.md new file mode 100644 index 000000000..0432bd3e6 --- /dev/null +++ b/packages/sdk/docs/models/track-balances-billing-method.md @@ -0,0 +1,19 @@ +# TrackBalancesBillingMethod + +Whether usage is prepaid or billed pay-per-use. + +## Example Usage + +```typescript +import { TrackBalancesBillingMethod } from "@useautumn/sdk"; + +let value: TrackBalancesBillingMethod = "usage_based"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"prepaid" | "usage_based" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/track-balances-breakdown.md b/packages/sdk/docs/models/track-balances-breakdown.md new file mode 100644 index 000000000..ed05dd0f5 --- /dev/null +++ b/packages/sdk/docs/models/track-balances-breakdown.md @@ -0,0 +1,41 @@ +# TrackBalancesBreakdown + +## Example Usage + +```typescript +import { TrackBalancesBreakdown } from "@useautumn/sdk"; + +let value: TrackBalancesBreakdown = { + planId: "", + includedGrant: 6975.73, + prepaidGrant: 8920.32, + remaining: 1995.26, + usage: 6914.28, + unlimited: true, + reset: { + interval: "", + resetsAt: 4863.52, + }, + price: { + billingUnits: 7026.6, + billingMethod: "usage_based", + maxPurchase: 196.39, + }, + expiresAt: 3405.11, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | The unique identifier for this balance breakdown. | +| `planId` | *string* | :heavy_check_mark: | The plan ID this balance originates from, or null for standalone balances. | +| `includedGrant` | *number* | :heavy_check_mark: | Amount granted from the plan's included usage. | +| `prepaidGrant` | *number* | :heavy_check_mark: | Amount granted from prepaid purchases or top-ups. | +| `remaining` | *number* | :heavy_check_mark: | Remaining balance available for use. | +| `usage` | *number* | :heavy_check_mark: | Amount consumed in the current period. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether this balance has unlimited usage. | +| `reset` | [models.TrackBalancesReset](../models/track-balances-reset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. | +| `price` | [models.TrackBalancesPrice](../models/track-balances-price.md) | :heavy_check_mark: | Pricing configuration if this balance has usage-based pricing. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when this balance expires, or null for no expiration. | \ No newline at end of file diff --git a/packages/sdk/docs/models/track-balances-credit-schema.md b/packages/sdk/docs/models/track-balances-credit-schema.md new file mode 100644 index 000000000..208f1746d --- /dev/null +++ b/packages/sdk/docs/models/track-balances-credit-schema.md @@ -0,0 +1,19 @@ +# TrackBalancesCreditSchema + +## Example Usage + +```typescript +import { TrackBalancesCreditSchema } from "@useautumn/sdk"; + +let value: TrackBalancesCreditSchema = { + meteredFeatureId: "", + creditCost: 19.27, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `meteredFeatureId` | *string* | :heavy_check_mark: | N/A | +| `creditCost` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/track-balances-display.md b/packages/sdk/docs/models/track-balances-display.md new file mode 100644 index 000000000..6bea8f16e --- /dev/null +++ b/packages/sdk/docs/models/track-balances-display.md @@ -0,0 +1,16 @@ +# TrackBalancesDisplay + +## Example Usage + +```typescript +import { TrackBalancesDisplay } from "@useautumn/sdk"; + +let value: TrackBalancesDisplay = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `singular` | *string* | :heavy_minus_sign: | N/A | +| `plural` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-track-feature.md b/packages/sdk/docs/models/track-balances-feature.md similarity index 83% rename from packages/sdk/docs/models/balances-track-feature.md rename to packages/sdk/docs/models/track-balances-feature.md index 208527653..bef8890df 100644 --- a/packages/sdk/docs/models/balances-track-feature.md +++ b/packages/sdk/docs/models/track-balances-feature.md @@ -1,16 +1,18 @@ -# BalancesTrackFeature +# TrackBalancesFeature + +The full feature object if expanded. ## Example Usage ```typescript -import { BalancesTrackFeature } from "@useautumn/sdk"; +import { TrackBalancesFeature } from "@useautumn/sdk"; -let value: BalancesTrackFeature = { +let value: TrackBalancesFeature = { id: "", name: "", - type: "boolean", - consumable: true, - archived: true, + type: "metered", + consumable: false, + archived: false, }; ``` @@ -20,9 +22,9 @@ let value: BalancesTrackFeature = { | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | `id` | *string* | :heavy_check_mark: | N/A | | `name` | *string* | :heavy_check_mark: | N/A | -| `type` | [models.BalancesTrackType](../models/balances-track-type.md) | :heavy_check_mark: | N/A | +| `type` | [models.TrackBalancesType](../models/track-balances-type.md) | :heavy_check_mark: | N/A | | `consumable` | *boolean* | :heavy_check_mark: | N/A | | `eventNames` | *string*[] | :heavy_minus_sign: | N/A | -| `creditSchema` | [models.BalancesTrackCreditSchema](../models/balances-track-credit-schema.md)[] | :heavy_minus_sign: | N/A | -| `display` | [models.BalancesTrackDisplay](../models/balances-track-display.md) | :heavy_minus_sign: | N/A | +| `creditSchema` | [models.TrackBalancesCreditSchema](../models/track-balances-credit-schema.md)[] | :heavy_minus_sign: | N/A | +| `display` | [models.TrackBalancesDisplay](../models/track-balances-display.md) | :heavy_minus_sign: | N/A | | `archived` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/track-balances-interval-union.md b/packages/sdk/docs/models/track-balances-interval-union.md new file mode 100644 index 000000000..fc370cad4 --- /dev/null +++ b/packages/sdk/docs/models/track-balances-interval-union.md @@ -0,0 +1,19 @@ +# TrackBalancesIntervalUnion + +The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + + +## Supported Types + +### `models.TrackIntervalBalancesEnum` + +```typescript +const value: models.TrackIntervalBalancesEnum = "hour"; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/balances-track-price.md b/packages/sdk/docs/models/track-balances-price.md similarity index 58% rename from packages/sdk/docs/models/balances-track-price.md rename to packages/sdk/docs/models/track-balances-price.md index 19c58b388..98638229e 100644 --- a/packages/sdk/docs/models/balances-track-price.md +++ b/packages/sdk/docs/models/track-balances-price.md @@ -1,14 +1,14 @@ -# BalancesTrackPrice +# TrackBalancesPrice ## Example Usage ```typescript -import { BalancesTrackPrice } from "@useautumn/sdk"; +import { TrackBalancesPrice } from "@useautumn/sdk"; -let value: BalancesTrackPrice = { - billingUnits: 277.53, +let value: TrackBalancesPrice = { + billingUnits: 6878.57, billingMethod: "prepaid", - maxPurchase: 7619.94, + maxPurchase: 3245.19, }; ``` @@ -16,8 +16,8 @@ let value: BalancesTrackPrice = { | Field | Type | Required | Description | | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_minus_sign: | N/A | -| `tiers` | [models.BalancesTrackTier](../models/balances-track-tier.md)[] | :heavy_minus_sign: | N/A | -| `billingUnits` | *number* | :heavy_check_mark: | N/A | -| `billingMethod` | [models.BalancesTrackBillingMethod](../models/balances-track-billing-method.md) | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| `amount` | *number* | :heavy_minus_sign: | The per-unit price amount. | +| `tiers` | [models.TrackBalancesTier](../models/track-balances-tier.md)[] | :heavy_minus_sign: | Tiered pricing configuration if applicable. | +| `billingUnits` | *number* | :heavy_check_mark: | The number of units per billing increment (eg. $9 / 250 units). | +| `billingMethod` | [models.TrackBalancesBillingMethod](../models/track-balances-billing-method.md) | :heavy_check_mark: | Whether usage is prepaid or billed pay-per-use. | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum quantity that can be purchased, or null for unlimited. | \ No newline at end of file diff --git a/packages/sdk/docs/models/track-balances-reset.md b/packages/sdk/docs/models/track-balances-reset.md new file mode 100644 index 000000000..8afae68c1 --- /dev/null +++ b/packages/sdk/docs/models/track-balances-reset.md @@ -0,0 +1,20 @@ +# TrackBalancesReset + +## Example Usage + +```typescript +import { TrackBalancesReset } from "@useautumn/sdk"; + +let value: TrackBalancesReset = { + interval: "month", + resetsAt: 9910.48, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `interval` | *models.TrackBalancesIntervalUnion* | :heavy_check_mark: | The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets (eg. 2 for bi-monthly). | +| `resetsAt` | *number* | :heavy_check_mark: | Timestamp when the balance will next reset. | \ No newline at end of file diff --git a/packages/sdk/docs/models/track-balances-rollover.md b/packages/sdk/docs/models/track-balances-rollover.md new file mode 100644 index 000000000..ec6f47d7c --- /dev/null +++ b/packages/sdk/docs/models/track-balances-rollover.md @@ -0,0 +1,19 @@ +# TrackBalancesRollover + +## Example Usage + +```typescript +import { TrackBalancesRollover } from "@useautumn/sdk"; + +let value: TrackBalancesRollover = { + balance: 7020.23, + expiresAt: 7231.7, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `balance` | *number* | :heavy_check_mark: | Amount of balance rolled over from a previous period. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the rollover balance expires. | \ No newline at end of file diff --git a/packages/sdk/docs/models/track-balances-tier.md b/packages/sdk/docs/models/track-balances-tier.md new file mode 100644 index 000000000..4699fd151 --- /dev/null +++ b/packages/sdk/docs/models/track-balances-tier.md @@ -0,0 +1,19 @@ +# TrackBalancesTier + +## Example Usage + +```typescript +import { TrackBalancesTier } from "@useautumn/sdk"; + +let value: TrackBalancesTier = { + to: 5393.3, + amount: 8167.05, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------ | ------------------------ | ------------------------ | ------------------------ | +| `to` | *models.TrackBalancesTo* | :heavy_check_mark: | N/A | +| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/track-balances-to.md b/packages/sdk/docs/models/track-balances-to.md new file mode 100644 index 000000000..58f976847 --- /dev/null +++ b/packages/sdk/docs/models/track-balances-to.md @@ -0,0 +1,17 @@ +# TrackBalancesTo + + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/track-balances-type.md b/packages/sdk/docs/models/track-balances-type.md new file mode 100644 index 000000000..cdfe15ec5 --- /dev/null +++ b/packages/sdk/docs/models/track-balances-type.md @@ -0,0 +1,17 @@ +# TrackBalancesType + +## Example Usage + +```typescript +import { TrackBalancesType } from "@useautumn/sdk"; + +let value: TrackBalancesType = "boolean"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"boolean" | "metered" | "credit_system" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/track-balances.md b/packages/sdk/docs/models/track-balances.md new file mode 100644 index 000000000..e426f03ce --- /dev/null +++ b/packages/sdk/docs/models/track-balances.md @@ -0,0 +1,51 @@ +# TrackBalances + +## Example Usage + +```typescript +import { TrackBalances } from "@useautumn/sdk"; + +let value: TrackBalances = { + featureId: "messages", + granted: 100, + remaining: 72, + usage: 28, + unlimited: false, + overageAllowed: false, + maxPurchase: null, + nextResetAt: 1773851121437, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "pro_plan", + includedGrant: 100, + prepaidGrant: 0, + remaining: 72, + usage: 28, + unlimited: false, + reset: { + interval: "month", + resetsAt: 1773851121437, + }, + price: null, + expiresAt: null, + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | The feature ID this balance is for. | +| `feature` | [models.TrackBalancesFeature](../models/track-balances-feature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `granted` | *number* | :heavy_check_mark: | Total balance granted (included + prepaid). | +| `remaining` | *number* | :heavy_check_mark: | Remaining balance available for use. | +| `usage` | *number* | :heavy_check_mark: | Total usage consumed in the current period. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether this feature has unlimited usage. | +| `overageAllowed` | *boolean* | :heavy_check_mark: | Whether usage beyond the granted balance is allowed (with overage charges). | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum quantity that can be purchased as a top-up, or null for unlimited. | +| `nextResetAt` | *number* | :heavy_check_mark: | Timestamp when the balance will reset, or null for no reset. | +| `breakdown` | [models.TrackBalancesBreakdown](../models/track-balances-breakdown.md)[] | :heavy_minus_sign: | Detailed breakdown of balance sources when stacking multiple plans or grants. | +| `rollovers` | [models.TrackBalancesRollover](../models/track-balances-rollover.md)[] | :heavy_minus_sign: | Rollover balances carried over from previous periods. | \ No newline at end of file diff --git a/packages/sdk/docs/models/track-globals.md b/packages/sdk/docs/models/track-globals.md new file mode 100644 index 000000000..0589b3d84 --- /dev/null +++ b/packages/sdk/docs/models/track-globals.md @@ -0,0 +1,15 @@ +# TrackGlobals + +## Example Usage + +```typescript +import { TrackGlobals } from "@useautumn/sdk"; + +let value: TrackGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/track-interval-balances-enum.md b/packages/sdk/docs/models/track-interval-balances-enum.md new file mode 100644 index 000000000..c665cb949 --- /dev/null +++ b/packages/sdk/docs/models/track-interval-balances-enum.md @@ -0,0 +1,17 @@ +# TrackIntervalBalancesEnum + +## Example Usage + +```typescript +import { TrackIntervalBalancesEnum } from "@useautumn/sdk"; + +let value: TrackIntervalBalancesEnum = "one_off"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"one_off" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/track-params.md b/packages/sdk/docs/models/track-params.md new file mode 100644 index 000000000..eef55734f --- /dev/null +++ b/packages/sdk/docs/models/track-params.md @@ -0,0 +1,24 @@ +# TrackParams + +## Example Usage + +```typescript +import { TrackParams } from "@useautumn/sdk"; + +let value: TrackParams = { + customerId: "cus_123", + featureId: "messages", + value: 1, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer. | +| `featureId` | *string* | :heavy_minus_sign: | The ID of the feature to track usage for. Required if event_name is not provided. | +| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity for entity-scoped balances (e.g., per-seat limits). | +| `eventName` | *string* | :heavy_minus_sign: | Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. | +| `value` | *number* | :heavy_minus_sign: | The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). | +| `properties` | Record | :heavy_minus_sign: | Additional properties to attach to this usage event. | \ No newline at end of file diff --git a/packages/sdk/docs/models/track-response.md b/packages/sdk/docs/models/track-response.md new file mode 100644 index 000000000..cfd5df63d --- /dev/null +++ b/packages/sdk/docs/models/track-response.md @@ -0,0 +1,52 @@ +# TrackResponse + +OK + +## Example Usage + +```typescript +import { TrackResponse } from "@useautumn/sdk"; + +let value: TrackResponse = { + customerId: "cus_123", + value: 1, + balance: { + featureId: "messages", + granted: 100, + remaining: 72, + usage: 28, + unlimited: false, + overageAllowed: false, + maxPurchase: null, + nextResetAt: 1773851121437, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "pro_plan", + includedGrant: 100, + prepaidGrant: 0, + remaining: 72, + usage: 28, + unlimited: false, + reset: { + interval: "month", + resetsAt: 1773851121437, + }, + price: null, + expiresAt: null, + }, + ], + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer whose usage was tracked. | | +| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity, if entity-scoped tracking was performed. | | +| `eventName` | *string* | :heavy_minus_sign: | The event name that was tracked, if event_name was used instead of feature_id. | | +| `value` | *number* | :heavy_check_mark: | The amount of usage that was recorded. | | +| `balance` | [models.TrackBalance](../models/track-balance.md) | :heavy_check_mark: | The updated balance for the tracked feature. Null if tracking by event_name that affects multiple features. | {
"feature_id": "messages",
"granted": 100,
"remaining": 72,
"usage": 28,
"unlimited": false,
"overage_allowed": false,
"max_purchase": null,
"next_reset_at": 1773851121437,
"breakdown": [
{
"id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV",
"plan_id": "pro_plan",
"included_grant": 100,
"prepaid_grant": 0,
"remaining": 72,
"usage": 28,
"unlimited": false,
"reset": {
"interval": "month",
"resets_at": 1773851121437
},
"price": null,
"expires_at": null
}
]
} | +| `balances` | Record | :heavy_minus_sign: | Map of feature_id to updated balance when tracking by event_name affects multiple features. | | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-balance-globals.md b/packages/sdk/docs/models/update-balance-globals.md new file mode 100644 index 000000000..00afc64c0 --- /dev/null +++ b/packages/sdk/docs/models/update-balance-globals.md @@ -0,0 +1,15 @@ +# UpdateBalanceGlobals + +## Example Usage + +```typescript +import { UpdateBalanceGlobals } from "@useautumn/sdk"; + +let value: UpdateBalanceGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-balance-interval.md b/packages/sdk/docs/models/update-balance-interval.md new file mode 100644 index 000000000..926c9d233 --- /dev/null +++ b/packages/sdk/docs/models/update-balance-interval.md @@ -0,0 +1,17 @@ +# UpdateBalanceInterval + +Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals. + +## Example Usage + +```typescript +import { UpdateBalanceInterval } from "@useautumn/sdk"; + +let value: UpdateBalanceInterval = "hour"; +``` + +## Values + +```typescript +"one_off" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-balance-params.md b/packages/sdk/docs/models/update-balance-params.md new file mode 100644 index 000000000..0b869f0d4 --- /dev/null +++ b/packages/sdk/docs/models/update-balance-params.md @@ -0,0 +1,24 @@ +# UpdateBalanceParams + +## Example Usage + +```typescript +import { UpdateBalanceParams } from "@useautumn/sdk"; + +let value: UpdateBalanceParams = { + customerId: "cus_123", + featureId: "api_calls", + remaining: 5, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer. | +| `featureId` | *string* | :heavy_check_mark: | The ID of the feature. | +| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity for entity-scoped balances (e.g., per-seat limits). | +| `remaining` | *number* | :heavy_minus_sign: | Set the remaining balance to this exact value. Cannot be combined with add_to_balance. | +| `addToBalance` | *number* | :heavy_minus_sign: | Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance. | +| `interval` | [models.UpdateBalanceInterval](../models/update-balance-interval.md) | :heavy_minus_sign: | Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals. | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances-update-response.md b/packages/sdk/docs/models/update-balance-response.md similarity index 73% rename from packages/sdk/docs/models/balances-update-response.md rename to packages/sdk/docs/models/update-balance-response.md index ab7956e12..499e9e62b 100644 --- a/packages/sdk/docs/models/balances-update-response.md +++ b/packages/sdk/docs/models/update-balance-response.md @@ -1,13 +1,13 @@ -# BalancesUpdateResponse +# UpdateBalanceResponse OK ## Example Usage ```typescript -import { BalancesUpdateResponse } from "@useautumn/sdk"; +import { UpdateBalanceResponse } from "@useautumn/sdk"; -let value: BalancesUpdateResponse = { +let value: UpdateBalanceResponse = { success: false, }; ``` diff --git a/packages/sdk/docs/models/update-customer-balances.md b/packages/sdk/docs/models/update-customer-balances.md index 011ff0fe5..5fab89c30 100644 --- a/packages/sdk/docs/models/update-customer-balances.md +++ b/packages/sdk/docs/models/update-customer-balances.md @@ -6,29 +6,46 @@ import { UpdateCustomerBalances } from "@useautumn/sdk"; let value: UpdateCustomerBalances = { - featureId: "", - granted: 3659.37, - remaining: 1762.52, - usage: 5915.11, + featureId: "messages", + granted: 100, + remaining: 72, + usage: 28, unlimited: false, overageAllowed: false, - maxPurchase: 8309.89, - nextResetAt: 3915.29, + maxPurchase: null, + nextResetAt: 1773851121437, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "pro_plan", + includedGrant: 100, + prepaidGrant: 0, + remaining: 72, + usage: 28, + unlimited: false, + reset: { + interval: "month", + resetsAt: 1773851121437, + }, + price: null, + expiresAt: null, + }, + ], }; ``` ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `featureId` | *string* | :heavy_check_mark: | N/A | -| `feature` | [models.UpdateCustomerFeature](../models/update-customer-feature.md) | :heavy_minus_sign: | N/A | -| `granted` | *number* | :heavy_check_mark: | N/A | -| `remaining` | *number* | :heavy_check_mark: | N/A | -| `usage` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `overageAllowed` | *boolean* | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | -| `nextResetAt` | *number* | :heavy_check_mark: | N/A | -| `breakdown` | [models.UpdateCustomerBreakdown](../models/update-customer-breakdown.md)[] | :heavy_minus_sign: | N/A | -| `rollovers` | [models.UpdateCustomerRollover](../models/update-customer-rollover.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | The feature ID this balance is for. | +| `feature` | [models.UpdateCustomerFeature](../models/update-customer-feature.md) | :heavy_minus_sign: | The full feature object if expanded. | +| `granted` | *number* | :heavy_check_mark: | Total balance granted (included + prepaid). | +| `remaining` | *number* | :heavy_check_mark: | Remaining balance available for use. | +| `usage` | *number* | :heavy_check_mark: | Total usage consumed in the current period. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether this feature has unlimited usage. | +| `overageAllowed` | *boolean* | :heavy_check_mark: | Whether usage beyond the granted balance is allowed (with overage charges). | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum quantity that can be purchased as a top-up, or null for unlimited. | +| `nextResetAt` | *number* | :heavy_check_mark: | Timestamp when the balance will reset, or null for no reset. | +| `breakdown` | [models.UpdateCustomerBreakdown](../models/update-customer-breakdown.md)[] | :heavy_minus_sign: | Detailed breakdown of balance sources when stacking multiple plans or grants. | +| `rollovers` | [models.UpdateCustomerRollover](../models/update-customer-rollover.md)[] | :heavy_minus_sign: | Rollover balances carried over from previous periods. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-billing-method.md b/packages/sdk/docs/models/update-customer-billing-method.md index 8ce9fde5f..c5e64c366 100644 --- a/packages/sdk/docs/models/update-customer-billing-method.md +++ b/packages/sdk/docs/models/update-customer-billing-method.md @@ -1,5 +1,7 @@ # UpdateCustomerBillingMethod +Whether usage is prepaid or billed pay-per-use. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/update-customer-breakdown.md b/packages/sdk/docs/models/update-customer-breakdown.md index a39a9da7e..5b0f66cea 100644 --- a/packages/sdk/docs/models/update-customer-breakdown.md +++ b/packages/sdk/docs/models/update-customer-breakdown.md @@ -27,15 +27,15 @@ let value: UpdateCustomerBreakdown = { ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `id` | *string* | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `includedGrant` | *number* | :heavy_check_mark: | N/A | -| `prepaidGrant` | *number* | :heavy_check_mark: | N/A | -| `remaining` | *number* | :heavy_check_mark: | N/A | -| `usage` | *number* | :heavy_check_mark: | N/A | -| `unlimited` | *boolean* | :heavy_check_mark: | N/A | -| `reset` | [models.UpdateCustomerReset](../models/update-customer-reset.md) | :heavy_check_mark: | N/A | -| `price` | [models.UpdateCustomerPrice](../models/update-customer-price.md) | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | The unique identifier for this balance breakdown. | +| `planId` | *string* | :heavy_check_mark: | The plan ID this balance originates from, or null for standalone balances. | +| `includedGrant` | *number* | :heavy_check_mark: | Amount granted from the plan's included usage. | +| `prepaidGrant` | *number* | :heavy_check_mark: | Amount granted from prepaid purchases or top-ups. | +| `remaining` | *number* | :heavy_check_mark: | Remaining balance available for use. | +| `usage` | *number* | :heavy_check_mark: | Amount consumed in the current period. | +| `unlimited` | *boolean* | :heavy_check_mark: | Whether this balance has unlimited usage. | +| `reset` | [models.UpdateCustomerReset](../models/update-customer-reset.md) | :heavy_check_mark: | Reset configuration for this balance, or null if no reset. | +| `price` | [models.UpdateCustomerPrice](../models/update-customer-price.md) | :heavy_check_mark: | Pricing configuration if this balance has usage-based pricing. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when this balance expires, or null for no expiration. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-feature.md b/packages/sdk/docs/models/update-customer-feature.md index 91b2ad87b..c95e60c3c 100644 --- a/packages/sdk/docs/models/update-customer-feature.md +++ b/packages/sdk/docs/models/update-customer-feature.md @@ -1,5 +1,7 @@ # UpdateCustomerFeature +The full feature object if expanded. + ## Example Usage ```typescript diff --git a/packages/sdk/docs/models/update-customer-interval-union.md b/packages/sdk/docs/models/update-customer-interval-union.md index 84e1f9a87..2a1f4b520 100644 --- a/packages/sdk/docs/models/update-customer-interval-union.md +++ b/packages/sdk/docs/models/update-customer-interval-union.md @@ -1,5 +1,7 @@ # UpdateCustomerIntervalUnion +The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + ## Supported Types diff --git a/packages/sdk/docs/models/update-customer-price.md b/packages/sdk/docs/models/update-customer-price.md index 0c19b42f6..d1e7a2105 100644 --- a/packages/sdk/docs/models/update-customer-price.md +++ b/packages/sdk/docs/models/update-customer-price.md @@ -16,8 +16,8 @@ let value: UpdateCustomerPrice = { | Field | Type | Required | Description | | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | -| `amount` | *number* | :heavy_minus_sign: | N/A | -| `tiers` | [models.UpdateCustomerTier](../models/update-customer-tier.md)[] | :heavy_minus_sign: | N/A | -| `billingUnits` | *number* | :heavy_check_mark: | N/A | -| `billingMethod` | [models.UpdateCustomerBillingMethod](../models/update-customer-billing-method.md) | :heavy_check_mark: | N/A | -| `maxPurchase` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| `amount` | *number* | :heavy_minus_sign: | The per-unit price amount. | +| `tiers` | [models.UpdateCustomerTier](../models/update-customer-tier.md)[] | :heavy_minus_sign: | Tiered pricing configuration if applicable. | +| `billingUnits` | *number* | :heavy_check_mark: | The number of units per billing increment (eg. $9 / 250 units). | +| `billingMethod` | [models.UpdateCustomerBillingMethod](../models/update-customer-billing-method.md) | :heavy_check_mark: | Whether usage is prepaid or billed pay-per-use. | +| `maxPurchase` | *number* | :heavy_check_mark: | Maximum quantity that can be purchased, or null for unlimited. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-purchase.md b/packages/sdk/docs/models/update-customer-purchase.md index 1977be234..d72d42172 100644 --- a/packages/sdk/docs/models/update-customer-purchase.md +++ b/packages/sdk/docs/models/update-customer-purchase.md @@ -15,10 +15,10 @@ let value: UpdateCustomerPurchase = { ## Fields -| Field | Type | Required | Description | -| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | -| `startedAt` | *number* | :heavy_check_mark: | N/A | -| `quantity` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | +| `planId` | *string* | :heavy_check_mark: | The unique identifier of the purchased plan. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the purchase expires, or null for lifetime access. | +| `startedAt` | *number* | :heavy_check_mark: | Timestamp when the purchase was made. | +| `quantity` | *number* | :heavy_check_mark: | Number of units purchased. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-reset.md b/packages/sdk/docs/models/update-customer-reset.md index 2409db3ca..4c9a9168e 100644 --- a/packages/sdk/docs/models/update-customer-reset.md +++ b/packages/sdk/docs/models/update-customer-reset.md @@ -13,8 +13,8 @@ let value: UpdateCustomerReset = { ## Fields -| Field | Type | Required | Description | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `interval` | *models.UpdateCustomerIntervalUnion* | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `resetsAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `interval` | *models.UpdateCustomerIntervalUnion* | :heavy_check_mark: | The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. | +| `intervalCount` | *number* | :heavy_minus_sign: | Number of intervals between resets (eg. 2 for bi-monthly). | +| `resetsAt` | *number* | :heavy_check_mark: | Timestamp when the balance will next reset. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-response.md b/packages/sdk/docs/models/update-customer-response.md index 60066e6c2..1cf734950 100644 --- a/packages/sdk/docs/models/update-customer-response.md +++ b/packages/sdk/docs/models/update-customer-response.md @@ -8,36 +8,61 @@ OK import { UpdateCustomerResponse } from "@useautumn/sdk"; let value: UpdateCustomerResponse = { - id: "", - name: "", - email: "Nella63@yahoo.com", - createdAt: 1601.1, - fingerprint: "", + id: "2ee25a41-0d81-4ad2-8451-ec1aadaefe58", + name: "Patrick", + email: "patrick@useautumn.com", + createdAt: 7471.06, + fingerprint: null, stripeId: "", - env: "live", - metadata: { - "key": "", - "key1": "", - }, + env: "sandbox", + metadata: {}, sendEmailReceipts: true, subscriptions: [ { planId: "", - autoEnable: false, - addOn: true, - status: "scheduled", - pastDue: true, - canceledAt: 4476.93, - expiresAt: 6114.93, - trialEndsAt: 8136.42, - startedAt: 3369.97, - currentPeriodStart: 7857.72, - currentPeriodEnd: 200.12, - quantity: 8649.92, + autoEnable: true, + addOn: false, + status: "active", + pastDue: false, + canceledAt: 4772.78, + expiresAt: 8368.77, + trialEndsAt: 7907.84, + startedAt: 6480.13, + currentPeriodStart: 7337.08, + currentPeriodEnd: 7245.4, + quantity: 1, }, ], purchases: [], - balances: {}, + balances: { + "messages": { + featureId: "", + granted: 100, + remaining: 0, + usage: 100, + unlimited: false, + overageAllowed: false, + maxPurchase: 6641.52, + nextResetAt: 2397.96, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "", + includedGrant: 7896.98, + prepaidGrant: 6114.93, + remaining: 0, + usage: 100, + unlimited: false, + reset: { + interval: "month", + resetsAt: 8136.42, + }, + price: null, + expiresAt: 8820.39, + }, + ], + }, + }, }; ``` @@ -54,6 +79,6 @@ let value: UpdateCustomerResponse = { | `env` | [models.UpdateCustomerEnv](../models/update-customer-env.md) | :heavy_check_mark: | The environment this customer was created in. | | `metadata` | Record | :heavy_check_mark: | The metadata for the customer. | | `sendEmailReceipts` | *boolean* | :heavy_check_mark: | Whether to send email receipts to the customer. | -| `subscriptions` | [models.UpdateCustomerSubscription](../models/update-customer-subscription.md)[] | :heavy_check_mark: | N/A | -| `purchases` | [models.UpdateCustomerPurchase](../models/update-customer-purchase.md)[] | :heavy_check_mark: | N/A | -| `balances` | Record | :heavy_check_mark: | N/A | \ No newline at end of file +| `subscriptions` | [models.UpdateCustomerSubscription](../models/update-customer-subscription.md)[] | :heavy_check_mark: | Active and scheduled recurring plans that this customer has attached. | +| `purchases` | [models.UpdateCustomerPurchase](../models/update-customer-purchase.md)[] | :heavy_check_mark: | One-time purchases made by the customer. | +| `balances` | Record | :heavy_check_mark: | Feature balances keyed by feature ID, showing usage limits and remaining amounts. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-rollover.md b/packages/sdk/docs/models/update-customer-rollover.md index c48f80df1..8d22e4c64 100644 --- a/packages/sdk/docs/models/update-customer-rollover.md +++ b/packages/sdk/docs/models/update-customer-rollover.md @@ -13,7 +13,7 @@ let value: UpdateCustomerRollover = { ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `balance` | *number* | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `balance` | *number* | :heavy_check_mark: | Amount of balance rolled over from a previous period. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the rollover balance expires. | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-status.md b/packages/sdk/docs/models/update-customer-status.md index 50b58dd4f..666616765 100644 --- a/packages/sdk/docs/models/update-customer-status.md +++ b/packages/sdk/docs/models/update-customer-status.md @@ -1,5 +1,7 @@ # UpdateCustomerStatus +Current status of the subscription. + ## Example Usage ```typescript @@ -13,5 +15,5 @@ let value: UpdateCustomerStatus = "active"; This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. ```typescript -"active" | "scheduled" | "expired" | Unrecognized +"active" | "scheduled" | Unrecognized ``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-subscription.md b/packages/sdk/docs/models/update-customer-subscription.md index db98114fe..87c975e62 100644 --- a/packages/sdk/docs/models/update-customer-subscription.md +++ b/packages/sdk/docs/models/update-customer-subscription.md @@ -9,7 +9,7 @@ let value: UpdateCustomerSubscription = { planId: "", autoEnable: false, addOn: true, - status: "expired", + status: "scheduled", pastDue: false, canceledAt: 7892.35, expiresAt: 6728.93, @@ -23,18 +23,18 @@ let value: UpdateCustomerSubscription = { ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | -| `planId` | *string* | :heavy_check_mark: | N/A | -| `autoEnable` | *boolean* | :heavy_check_mark: | N/A | -| `addOn` | *boolean* | :heavy_check_mark: | N/A | -| `status` | [models.UpdateCustomerStatus](../models/update-customer-status.md) | :heavy_check_mark: | N/A | -| `pastDue` | *boolean* | :heavy_check_mark: | N/A | -| `canceledAt` | *number* | :heavy_check_mark: | N/A | -| `expiresAt` | *number* | :heavy_check_mark: | N/A | -| `trialEndsAt` | *number* | :heavy_check_mark: | N/A | -| `startedAt` | *number* | :heavy_check_mark: | N/A | -| `currentPeriodStart` | *number* | :heavy_check_mark: | N/A | -| `currentPeriodEnd` | *number* | :heavy_check_mark: | N/A | -| `quantity` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | +| `planId` | *string* | :heavy_check_mark: | The unique identifier of the subscribed plan. | +| `autoEnable` | *boolean* | :heavy_check_mark: | Whether the plan was automatically enabled for the customer. | +| `addOn` | *boolean* | :heavy_check_mark: | Whether this is an add-on plan rather than a base subscription. | +| `status` | [models.UpdateCustomerStatus](../models/update-customer-status.md) | :heavy_check_mark: | Current status of the subscription. | +| `pastDue` | *boolean* | :heavy_check_mark: | Whether the subscription has overdue payments. | +| `canceledAt` | *number* | :heavy_check_mark: | Timestamp when the subscription was canceled, or null if not canceled. | +| `expiresAt` | *number* | :heavy_check_mark: | Timestamp when the subscription will expire, or null if no expiry set. | +| `trialEndsAt` | *number* | :heavy_check_mark: | Timestamp when the trial period ends, or null if not on trial. | +| `startedAt` | *number* | :heavy_check_mark: | Timestamp when the subscription started. | +| `currentPeriodStart` | *number* | :heavy_check_mark: | Start timestamp of the current billing period. | +| `currentPeriodEnd` | *number* | :heavy_check_mark: | End timestamp of the current billing period. | +| `quantity` | *number* | :heavy_check_mark: | Number of units of this subscription (for per-seat plans). | \ No newline at end of file diff --git a/packages/sdk/docs/models/billing-update-request.md b/packages/sdk/docs/models/update-subscription-params.md similarity index 55% rename from packages/sdk/docs/models/billing-update-request.md rename to packages/sdk/docs/models/update-subscription-params.md index ad79f2483..6417bb668 100644 --- a/packages/sdk/docs/models/billing-update-request.md +++ b/packages/sdk/docs/models/update-subscription-params.md @@ -1,26 +1,33 @@ -# BillingUpdateRequest +# UpdateSubscriptionParams ## Example Usage ```typescript -import { BillingUpdateRequest } from "@useautumn/sdk"; +import { UpdateSubscriptionParams } from "@useautumn/sdk"; -let value: BillingUpdateRequest = { - customerId: "", +let value: UpdateSubscriptionParams = { + customerId: "cus_123", + planId: "pro_plan", + featureQuantities: [ + { + featureId: "seats", + quantity: 10, + }, + ], }; ``` ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `customerId` | *string* | :heavy_check_mark: | The ID of the customer to attach the plan to. | -| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | -| `featureQuantities` | [models.BillingUpdateFeatureQuantities](../models/billing-update-feature-quantities.md)[] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | -| `version` | *number* | :heavy_minus_sign: | The version of the plan to attach. | -| `freeTrial` | [models.BillingUpdateFreeTrial](../models/billing-update-free-trial.md) | :heavy_minus_sign: | N/A | -| `customize` | [models.BillingUpdateCustomize](../models/billing-update-customize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | -| `planId` | *string* | :heavy_minus_sign: | N/A | -| `invoiceMode` | [models.BillingUpdateInvoiceMode](../models/billing-update-invoice-mode.md) | :heavy_minus_sign: | N/A | -| `cancelAction` | [models.BillingUpdateCancelAction](../models/billing-update-cancel-action.md) | :heavy_minus_sign: | N/A | -| `billingBehavior` | [models.BillingUpdateBillingBehavior](../models/billing-update-billing-behavior.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `customerId` | *string* | :heavy_check_mark: | The ID of the customer to attach the plan to. | +| `entityId` | *string* | :heavy_minus_sign: | The ID of the entity to attach the plan to. | +| `planId` | *string* | :heavy_check_mark: | The ID of the plan. | +| `featureQuantities` | [models.BillingUpdateFeatureQuantity](../models/billing-update-feature-quantity.md)[] | :heavy_minus_sign: | If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. | +| `version` | *number* | :heavy_minus_sign: | The version of the plan to attach. | +| `freeTrial` | [models.BillingUpdateFreeTrial](../models/billing-update-free-trial.md) | :heavy_minus_sign: | Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. | +| `customize` | [models.BillingUpdateCustomize](../models/billing-update-customize.md) | :heavy_minus_sign: | Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. | +| `invoiceMode` | [models.BillingUpdateInvoiceMode](../models/billing-update-invoice-mode.md) | :heavy_minus_sign: | Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. | +| `billingBehavior` | [models.BillingUpdateBillingBehavior](../models/billing-update-billing-behavior.md) | :heavy_minus_sign: | 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. | +| `cancelAction` | [models.BillingUpdateCancelAction](../models/billing-update-cancel-action.md) | :heavy_minus_sign: | Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. | \ No newline at end of file diff --git a/packages/sdk/docs/sdks/autumn/README.md b/packages/sdk/docs/sdks/autumn/README.md new file mode 100644 index 000000000..3f79dd344 --- /dev/null +++ b/packages/sdk/docs/sdks/autumn/README.md @@ -0,0 +1,270 @@ +# Autumn SDK + +## Overview + +### Available Operations + +* [check](#check) - Checks whether a customer currently has enough balance to use a feature. + +Use this to gate access before a feature action. Enable sendEvent when you want to check and consume balance atomically in one request. + +@example +```typescript +// Check access for a feature +const response = await client.check({ customerId: "cus_123", featureId: "messages" }); +``` + +@example +```typescript +// Check and consume 3 units in one call +const response = await client.check({ + + customerId: "cus_123", + featureId: "messages", + requiredBalance: 3, + sendEvent: true, +}); +``` + +@param customerId - The ID of the customer. +@param featureId - The ID of the feature. +@param entityId - The ID of the entity for entity-scoped balances (e.g., per-seat limits). (optional) +@param requiredBalance - Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1. (optional) +@param properties - Additional properties to attach to the usage event if send_event is true. (optional) +@param sendEvent - If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. (optional) +@param withPreview - If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. (optional) + +@returns Whether access is allowed, plus the current balance for that feature. +* [track](#track) - Records usage for a customer feature and returns updated balances. + +Use this after an action happens to decrement usage, or send a negative value to credit balance back. + +@example +```typescript +// Track one message event +const response = await client.track({ customerId: "cus_123", featureId: "messages", value: 1 }); +``` + +@example +```typescript +// Track an event mapped to multiple features +const response = await client.track({ customerId: "cus_123", eventName: "ai_chat_request", value: 1 }); +``` + +@param customerId - The ID of the customer. +@param featureId - The ID of the feature to track usage for. Required if event_name is not provided. (optional) +@param entityId - The ID of the entity for entity-scoped balances (e.g., per-seat limits). (optional) +@param eventName - Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. (optional) +@param value - The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). (optional) +@param properties - Additional properties to attach to this usage event. (optional) + +@returns The usage value recorded, with either a single updated balance or a map of updated balances. + +## check + +Checks whether a customer currently has enough balance to use a feature. + +Use this to gate access before a feature action. Enable sendEvent when you want to check and consume balance atomically in one request. + +@example +```typescript +// Check access for a feature +const response = await client.check({ customerId: "cus_123", featureId: "messages" }); +``` + +@example +```typescript +// Check and consume 3 units in one call +const response = await client.check({ + + customerId: "cus_123", + featureId: "messages", + requiredBalance: 3, + sendEvent: true, +}); +``` + +@param customerId - The ID of the customer. +@param featureId - The ID of the feature. +@param entityId - The ID of the entity for entity-scoped balances (e.g., per-seat limits). (optional) +@param requiredBalance - Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1. (optional) +@param properties - Additional properties to attach to the usage event if send_event is true. (optional) +@param sendEvent - If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. (optional) +@param withPreview - If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. (optional) + +@returns Whether access is allowed, plus the current balance for that feature. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.check({ + customerId: "cus_123", + featureId: "messages", + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { check } from "@useautumn/sdk/funcs/check.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await check(autumn, { + customerId: "cus_123", + featureId: "messages", + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("check failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.CheckParams](../../models/check-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.CheckResponse](../../models/check-response.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## track + +Records usage for a customer feature and returns updated balances. + +Use this after an action happens to decrement usage, or send a negative value to credit balance back. + +@example +```typescript +// Track one message event +const response = await client.track({ customerId: "cus_123", featureId: "messages", value: 1 }); +``` + +@example +```typescript +// Track an event mapped to multiple features +const response = await client.track({ customerId: "cus_123", eventName: "ai_chat_request", value: 1 }); +``` + +@param customerId - The ID of the customer. +@param featureId - The ID of the feature to track usage for. Required if event_name is not provided. (optional) +@param entityId - The ID of the entity for entity-scoped balances (e.g., per-seat limits). (optional) +@param eventName - Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. (optional) +@param value - The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). (optional) +@param properties - Additional properties to attach to this usage event. (optional) + +@returns The usage value recorded, with either a single updated balance or a map of updated balances. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.track({ + customerId: "cus_123", + featureId: "messages", + value: 1, + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { track } from "@useautumn/sdk/funcs/track.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await track(autumn, { + customerId: "cus_123", + featureId: "messages", + value: 1, + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("track failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.TrackParams](../../models/track-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.TrackResponse](../../models/track-response.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/packages/sdk/docs/sdks/balances/README.md b/packages/sdk/docs/sdks/balances/README.md index bf8790cb4..fb242dffa 100644 --- a/packages/sdk/docs/sdks/balances/README.md +++ b/packages/sdk/docs/sdks/balances/README.md @@ -6,8 +6,6 @@ * [create](#create) - Create a balance for a customer feature. * [update](#update) - Update a customer balance. -* [check](#check) - Check whether usage is allowed for a customer feature. -* [track](#track) - Track usage for a customer feature. ## create @@ -15,7 +13,7 @@ Create a balance for a customer feature. ### Example Usage - + ```typescript import { Autumn } from "@useautumn/sdk"; @@ -26,8 +24,12 @@ const autumn = new Autumn({ async function run() { const result = await autumn.balances.create({ - featureId: "", - customerId: "", + customerId: "cus_123", + featureId: "api_calls", + included: 1000, + reset: { + interval: "month", + }, }); console.log(result); @@ -53,8 +55,12 @@ const autumn = new AutumnCore({ async function run() { const res = await balancesCreate(autumn, { - featureId: "", - customerId: "", + customerId: "cus_123", + featureId: "api_calls", + included: 1000, + reset: { + interval: "month", + }, }); if (res.ok) { const { value: result } = res; @@ -71,14 +77,14 @@ run(); | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [models.BalancesCreateRequest](../../models/balances-create-request.md) | :heavy_check_mark: | The request object to use for the request. | +| `request` | [models.CreateBalanceParams](../../models/create-balance-params.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response -**Promise\<[models.BalancesCreateResponse](../../models/balances-create-response.md)\>** +**Promise\<[models.CreateBalanceResponse](../../models/create-balance-response.md)\>** ### Errors @@ -92,7 +98,7 @@ Update a customer balance. ### Example Usage - + ```typescript import { Autumn } from "@useautumn/sdk"; @@ -103,8 +109,9 @@ const autumn = new Autumn({ async function run() { const result = await autumn.balances.update({ - customerId: "", - featureId: "", + customerId: "cus_123", + featureId: "api_calls", + remaining: 5, }); console.log(result); @@ -130,8 +137,9 @@ const autumn = new AutumnCore({ async function run() { const res = await balancesUpdate(autumn, { - customerId: "", - featureId: "", + customerId: "cus_123", + featureId: "api_calls", + remaining: 5, }); if (res.ok) { const { value: result } = res; @@ -148,166 +156,14 @@ run(); | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [models.BalancesUpdateRequest](../../models/balances-update-request.md) | :heavy_check_mark: | The request object to use for the request. | +| `request` | [models.UpdateBalanceParams](../../models/update-balance-params.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response -**Promise\<[models.BalancesUpdateResponse](../../models/balances-update-response.md)\>** - -### Errors - -| Error Type | Status Code | Content Type | -| ------------------------- | ------------------------- | ------------------------- | -| models.AutumnDefaultError | 4XX, 5XX | \*/\* | - -## check - -Check whether usage is allowed for a customer feature. - -### Example Usage - - -```typescript -import { Autumn } from "@useautumn/sdk"; - -const autumn = new Autumn({ - xApiVersion: "2.1", - secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", -}); - -async function run() { - const result = await autumn.balances.check({ - customerId: "", - featureId: "", - }); - - console.log(result); -} - -run(); -``` - -### Standalone function - -The standalone function version of this method: - -```typescript -import { AutumnCore } from "@useautumn/sdk/core.js"; -import { balancesCheck } from "@useautumn/sdk/funcs/balances-check.js"; - -// Use `AutumnCore` for best tree-shaking performance. -// You can create one instance of it to use across an application. -const autumn = new AutumnCore({ - xApiVersion: "2.1", - secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", -}); - -async function run() { - const res = await balancesCheck(autumn, { - customerId: "", - featureId: "", - }); - if (res.ok) { - const { value: result } = res; - console.log(result); - } else { - console.log("balancesCheck failed:", res.error); - } -} - -run(); -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [models.BalancesCheckRequest](../../models/balances-check-request.md) | :heavy_check_mark: | The request object to use for the request. | -| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | -| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | -| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | - -### Response - -**Promise\<[models.BalancesCheckResponse](../../models/balances-check-response.md)\>** - -### Errors - -| Error Type | Status Code | Content Type | -| ------------------------- | ------------------------- | ------------------------- | -| models.AutumnDefaultError | 4XX, 5XX | \*/\* | - -## track - -Track usage for a customer feature. - -### Example Usage - - -```typescript -import { Autumn } from "@useautumn/sdk"; - -const autumn = new Autumn({ - xApiVersion: "2.1", - secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", -}); - -async function run() { - const result = await autumn.balances.track({ - customerId: "", - }); - - console.log(result); -} - -run(); -``` - -### Standalone function - -The standalone function version of this method: - -```typescript -import { AutumnCore } from "@useautumn/sdk/core.js"; -import { balancesTrack } from "@useautumn/sdk/funcs/balances-track.js"; - -// Use `AutumnCore` for best tree-shaking performance. -// You can create one instance of it to use across an application. -const autumn = new AutumnCore({ - xApiVersion: "2.1", - secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", -}); - -async function run() { - const res = await balancesTrack(autumn, { - customerId: "", - }); - if (res.ok) { - const { value: result } = res; - console.log(result); - } else { - console.log("balancesTrack failed:", res.error); - } -} - -run(); -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [models.BalancesTrackRequest](../../models/balances-track-request.md) | :heavy_check_mark: | The request object to use for the request. | -| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | -| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | -| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | - -### Response - -**Promise\<[models.BalancesTrackResponse](../../models/balances-track-response.md)\>** +**Promise\<[models.UpdateBalanceResponse](../../models/update-balance-response.md)\>** ### Errors diff --git a/packages/sdk/docs/sdks/billing/README.md b/packages/sdk/docs/sdks/billing/README.md index b4b6ad4f7..3f8ef93ab 100644 --- a/packages/sdk/docs/sdks/billing/README.md +++ b/packages/sdk/docs/sdks/billing/README.md @@ -6,37 +6,161 @@ * [attach](#attach) - Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. +Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product. + @example ```typescript // Attach a plan to a customer -const response = await client.attach({ customerId: "cus_123", planId: "pro_plan" }); +const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan" }); +``` + +@example +```typescript +// Attach with a free trial +const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan", freeTrial: {"durationLength":14,"durationType":"day"} }); +``` + +@example +```typescript +// Attach with custom pricing +const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan", customize: {"price":{"amount":4900,"interval":"month"}} }); +``` + +@param customerId - The ID of the customer to attach the plan to. +@param entityId - The ID of the entity to attach the plan to. (optional) +@param planId - The ID of the plan. +@param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) +@param version - The version of the plan to attach. (optional) +@param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) +@param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) +@param billingBehavior - 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. (optional) +@param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) +@param successUrl - URL to redirect to after successful checkout. (optional) +@param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) +@param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + +@returns A billing response with customer ID, invoice details, and payment URL (if checkout required). +* [previewAttach](#previewattach) - Previews the billing changes that would occur when attaching a plan, without actually making any changes. + +Use this endpoint to show customers what they will be charged before confirming a subscription change. + +@example +```typescript +// Preview attaching a plan +const response = await client.billing.previewAttach({ customerId: "cus_123", planId: "pro_plan" }); +``` + +@param customerId - The ID of the customer to attach the plan to. +@param entityId - The ID of the entity to attach the plan to. (optional) +@param planId - The ID of the plan. +@param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) +@param version - The version of the plan to attach. (optional) +@param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) +@param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) +@param billingBehavior - 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. (optional) +@param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) +@param successUrl - URL to redirect to after successful checkout. (optional) +@param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) +@param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + +@returns A preview response with line items, totals, and effective dates for the proposed changes. +* [update](#update) - Updates an existing subscription. Use to modify feature quantities, cancel, or change plan configuration. + +Use this endpoint to update prepaid quantities, cancel a subscription (immediately or at end of cycle), or modify subscription settings. + +@example +```typescript +// Update prepaid feature quantity +const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", featureQuantities: [{"featureId":"seats","quantity":10}] }); +``` + +@example +```typescript +// Cancel a subscription at end of billing cycle +const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", cancelAction: "cancel_end_of_cycle" }); +``` + +@example +```typescript +// Uncancel a subscription at the end of the billing cycle +const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", cancelAction: "uncancel" }); ``` @param customerId - The ID of the customer to attach the plan to. @param entityId - The ID of the entity to attach the plan to. (optional) @param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) @param version - The version of the plan to attach. (optional) +@param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) -* [previewAttach](#previewattach) - Preview billing changes before attaching a plan. -* [update](#update) - Update an existing subscription. -* [previewUpdate](#previewupdate) - Preview billing changes before updating a subscription. -* [setupPayment](#setuppayment) - Create a setup payment session for a customer. +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) +@param billingBehavior - 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. (optional) +@param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional) + +@returns A billing response with customer ID, invoice details, and payment URL (if next action is required). +* [previewUpdate](#previewupdate) - Previews the billing changes that would occur when updating a subscription, without actually making any changes. + +Use this endpoint to show customers prorated charges or refunds before confirming subscription modifications. + +@example +```typescript +// Preview updating seat quantity +const response = await client.billing.previewUpdate({ customerId: "cus_123", planId: "pro_plan", featureQuantities: [{"featureId":"seats","quantity":15}] }); +``` + +@param customerId - The ID of the customer to attach the plan to. +@param entityId - The ID of the entity to attach the plan to. (optional) +@param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) +@param version - The version of the plan to attach. (optional) +@param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) +@param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) +@param billingBehavior - 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. (optional) +@param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional) + +@returns A preview response with line items showing prorated charges or credits for the proposed changes. +* [openCustomerPortal](#opencustomerportal) - Create a billing portal session for a customer to manage their subscription. ## attach Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. +Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product. + @example ```typescript // Attach a plan to a customer -const response = await client.attach({ customerId: "cus_123", planId: "pro_plan" }); +const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan" }); +``` + +@example +```typescript +// Attach with a free trial +const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan", freeTrial: {"durationLength":14,"durationType":"day"} }); +``` + +@example +```typescript +// Attach with custom pricing +const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan", customize: {"price":{"amount":4900,"interval":"month"}} }); ``` @param customerId - The ID of the customer to attach the plan to. @param entityId - The ID of the entity to attach the plan to. (optional) +@param planId - The ID of the plan. @param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) @param version - The version of the plan to attach. (optional) +@param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) +@param billingBehavior - 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. (optional) +@param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) +@param successUrl - URL to redirect to after successful checkout. (optional) +@param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) +@param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + +@returns A billing response with customer ID, invoice details, and payment URL (if checkout required). ### Example Usage @@ -51,8 +175,8 @@ const autumn = new Autumn({ async function run() { const result = await autumn.billing.attach({ - customerId: "", - planId: "", + customerId: "cus_123", + planId: "pro_plan", }); console.log(result); @@ -78,8 +202,8 @@ const autumn = new AutumnCore({ async function run() { const res = await billingAttach(autumn, { - customerId: "", - planId: "", + customerId: "cus_123", + planId: "pro_plan", }); if (res.ok) { const { value: result } = res; @@ -96,7 +220,7 @@ run(); | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [models.BillingAttachRequest](../../models/billing-attach-request.md) | :heavy_check_mark: | The request object to use for the request. | +| `request` | [models.AttachParams](../../models/attach-params.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | @@ -113,11 +237,35 @@ run(); ## previewAttach -Preview billing changes before attaching a plan. +Previews the billing changes that would occur when attaching a plan, without actually making any changes. + +Use this endpoint to show customers what they will be charged before confirming a subscription change. + +@example +```typescript +// Preview attaching a plan +const response = await client.billing.previewAttach({ customerId: "cus_123", planId: "pro_plan" }); +``` + +@param customerId - The ID of the customer to attach the plan to. +@param entityId - The ID of the entity to attach the plan to. (optional) +@param planId - The ID of the plan. +@param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) +@param version - The version of the plan to attach. (optional) +@param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) +@param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) +@param billingBehavior - 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. (optional) +@param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) +@param successUrl - URL to redirect to after successful checkout. (optional) +@param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) +@param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + +@returns A preview response with line items, totals, and effective dates for the proposed changes. ### Example Usage - + ```typescript import { Autumn } from "@useautumn/sdk"; @@ -128,8 +276,8 @@ const autumn = new Autumn({ async function run() { const result = await autumn.billing.previewAttach({ - customerId: "", - planId: "", + customerId: "cus_123", + planId: "pro_plan", }); console.log(result); @@ -155,8 +303,8 @@ const autumn = new AutumnCore({ async function run() { const res = await billingPreviewAttach(autumn, { - customerId: "", - planId: "", + customerId: "cus_123", + planId: "pro_plan", }); if (res.ok) { const { value: result } = res; @@ -173,14 +321,14 @@ run(); | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [models.BillingPreviewAttachRequest](../../models/billing-preview-attach-request.md) | :heavy_check_mark: | The request object to use for the request. | +| `request` | [models.PreviewAttachParams](../../models/preview-attach-params.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response -**Promise\<[models.BillingPreviewAttachResponse](../../models/billing-preview-attach-response.md)\>** +**Promise\<[models.PreviewAttachResponse](../../models/preview-attach-response.md)\>** ### Errors @@ -190,7 +338,39 @@ run(); ## update -Update an existing subscription. +Updates an existing subscription. Use to modify feature quantities, cancel, or change plan configuration. + +Use this endpoint to update prepaid quantities, cancel a subscription (immediately or at end of cycle), or modify subscription settings. + +@example +```typescript +// Update prepaid feature quantity +const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", featureQuantities: [{"featureId":"seats","quantity":10}] }); +``` + +@example +```typescript +// Cancel a subscription at end of billing cycle +const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", cancelAction: "cancel_end_of_cycle" }); +``` + +@example +```typescript +// Uncancel a subscription at the end of the billing cycle +const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", cancelAction: "uncancel" }); +``` + +@param customerId - The ID of the customer to attach the plan to. +@param entityId - The ID of the entity to attach the plan to. (optional) +@param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) +@param version - The version of the plan to attach. (optional) +@param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) +@param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) +@param billingBehavior - 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. (optional) +@param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional) + +@returns A billing response with customer ID, invoice details, and payment URL (if next action is required). ### Example Usage @@ -205,7 +385,14 @@ const autumn = new Autumn({ async function run() { const result = await autumn.billing.update({ - customerId: "", + customerId: "cus_123", + planId: "pro_plan", + featureQuantities: [ + { + featureId: "seats", + quantity: 10, + }, + ], }); console.log(result); @@ -231,7 +418,14 @@ const autumn = new AutumnCore({ async function run() { const res = await billingUpdate(autumn, { - customerId: "", + customerId: "cus_123", + planId: "pro_plan", + featureQuantities: [ + { + featureId: "seats", + quantity: 10, + }, + ], }); if (res.ok) { const { value: result } = res; @@ -248,7 +442,7 @@ run(); | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [models.BillingUpdateRequest](../../models/billing-update-request.md) | :heavy_check_mark: | The request object to use for the request. | +| `request` | [models.UpdateSubscriptionParams](../../models/update-subscription-params.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | @@ -265,11 +459,31 @@ run(); ## previewUpdate -Preview billing changes before updating a subscription. +Previews the billing changes that would occur when updating a subscription, without actually making any changes. + +Use this endpoint to show customers prorated charges or refunds before confirming subscription modifications. + +@example +```typescript +// Preview updating seat quantity +const response = await client.billing.previewUpdate({ customerId: "cus_123", planId: "pro_plan", featureQuantities: [{"featureId":"seats","quantity":15}] }); +``` + +@param customerId - The ID of the customer to attach the plan to. +@param entityId - The ID of the entity to attach the plan to. (optional) +@param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) +@param version - The version of the plan to attach. (optional) +@param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) +@param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) +@param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) +@param billingBehavior - 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. (optional) +@param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional) + +@returns A preview response with line items showing prorated charges or credits for the proposed changes. ### Example Usage - + ```typescript import { Autumn } from "@useautumn/sdk"; @@ -280,7 +494,14 @@ const autumn = new Autumn({ async function run() { const result = await autumn.billing.previewUpdate({ - customerId: "", + customerId: "cus_123", + planId: "pro_plan", + featureQuantities: [ + { + featureId: "seats", + quantity: 15, + }, + ], }); console.log(result); @@ -306,7 +527,14 @@ const autumn = new AutumnCore({ async function run() { const res = await billingPreviewUpdate(autumn, { - customerId: "", + customerId: "cus_123", + planId: "pro_plan", + featureQuantities: [ + { + featureId: "seats", + quantity: 15, + }, + ], }); if (res.ok) { const { value: result } = res; @@ -323,14 +551,14 @@ run(); | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [models.BillingPreviewUpdateRequest](../../models/billing-preview-update-request.md) | :heavy_check_mark: | The request object to use for the request. | +| `request` | [models.PreviewUpdateParams](../../models/preview-update-params.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response -**Promise\<[models.BillingPreviewUpdateResponse](../../models/billing-preview-update-response.md)\>** +**Promise\<[models.PreviewUpdateResponse](../../models/preview-update-response.md)\>** ### Errors @@ -338,13 +566,13 @@ run(); | ------------------------- | ------------------------- | ------------------------- | | models.AutumnDefaultError | 4XX, 5XX | \*/\* | -## setupPayment +## openCustomerPortal -Create a setup payment session for a customer. +Create a billing portal session for a customer to manage their subscription. ### Example Usage - + ```typescript import { Autumn } from "@useautumn/sdk"; @@ -354,8 +582,9 @@ const autumn = new Autumn({ }); async function run() { - const result = await autumn.billing.setupPayment({ - customerId: "", + const result = await autumn.billing.openCustomerPortal({ + customerId: "cus_123", + returnUrl: "https://useautumn.com", }); console.log(result); @@ -370,7 +599,7 @@ The standalone function version of this method: ```typescript import { AutumnCore } from "@useautumn/sdk/core.js"; -import { billingSetupPayment } from "@useautumn/sdk/funcs/billing-setup-payment.js"; +import { billingOpenCustomerPortal } from "@useautumn/sdk/funcs/billing-open-customer-portal.js"; // Use `AutumnCore` for best tree-shaking performance. // You can create one instance of it to use across an application. @@ -380,14 +609,15 @@ const autumn = new AutumnCore({ }); async function run() { - const res = await billingSetupPayment(autumn, { - customerId: "", + const res = await billingOpenCustomerPortal(autumn, { + customerId: "cus_123", + returnUrl: "https://useautumn.com", }); if (res.ok) { const { value: result } = res; console.log(result); } else { - console.log("billingSetupPayment failed:", res.error); + console.log("billingOpenCustomerPortal failed:", res.error); } } @@ -398,14 +628,14 @@ run(); | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [models.BillingSetupPaymentRequest](../../models/billing-setup-payment-request.md) | :heavy_check_mark: | The request object to use for the request. | +| `request` | [models.OpenCustomerPortalParams](../../models/open-customer-portal-params.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response -**Promise\<[models.BillingSetupPaymentResponse](../../models/billing-setup-payment-response.md)\>** +**Promise\<[models.OpenCustomerPortalResponse](../../models/open-customer-portal-response.md)\>** ### Errors diff --git a/packages/sdk/docs/sdks/entities/README.md b/packages/sdk/docs/sdks/entities/README.md new file mode 100644 index 000000000..a53d08371 --- /dev/null +++ b/packages/sdk/docs/sdks/entities/README.md @@ -0,0 +1,350 @@ +# Entities + +## Overview + +### Available Operations + +* [create](#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. + +@example +```typescript +// Create a seat entity +const response = await client.entities.create({ + + customerId: "cus_123", + entityId: "seat_42", + featureId: "seats", + name: "Seat 42", +}); +``` + +@param name - The name of the entity (optional) +@param featureId - The ID of the feature this entity is associated with +@param customerData - Customer attributes used to resolve the customer when customer_id is not provided. (optional) +@param customerId - The ID of the customer to create the entity for. +@param entityId - The ID of the entity. + +@returns The created entity object including its current subscriptions, purchases, and balances. +* [get](#get) - Fetches a single entity by entity ID. + +Use this to read one entity's current state. Pass customerId when you want to scope the lookup to a specific customer. + +@example +```typescript +// Fetch a seat entity +const response = await client.entities.get({ entityId: "seat_42" }); +``` + +@example +```typescript +// Fetch a seat entity for a specific customer +const response = await client.entities.get({ customerId: "cus_123", entityId: "seat_42" }); +``` + +@param customerId - The ID of the customer to create the entity for. (optional) +@param entityId - The ID of the entity. + +@returns The entity object including its current subscriptions, purchases, and balances. +* [delete](#delete) - Deletes an entity by entity ID. + +Use this when the underlying resource is removed and you no longer want entity-scoped balances or subscriptions tracked for it. + +@example +```typescript +// Delete a seat entity +const response = await client.entities.delete({ entityId: "seat_42" }); +``` + +@param customerId - The ID of the customer. (optional) +@param entityId - The ID of the entity. + +@returns A success flag indicating the entity was deleted. + +## 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. + +@example +```typescript +// Create a seat entity +const response = await client.entities.create({ + + customerId: "cus_123", + entityId: "seat_42", + featureId: "seats", + name: "Seat 42", +}); +``` + +@param name - The name of the entity (optional) +@param featureId - The ID of the feature this entity is associated with +@param customerData - Customer attributes used to resolve the customer when customer_id is not provided. (optional) +@param customerId - The ID of the customer to create the entity for. +@param entityId - The ID of the entity. + +@returns The created entity object including its current subscriptions, purchases, and balances. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.entities.create({ + name: "Seat 42", + featureId: "seats", + customerId: "cus_123", + entityId: "seat_42", + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { entitiesCreate } from "@useautumn/sdk/funcs/entities-create.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await entitiesCreate(autumn, { + name: "Seat 42", + featureId: "seats", + customerId: "cus_123", + entityId: "seat_42", + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("entitiesCreate failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.CreateEntityParams](../../models/create-entity-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.CreateEntityResponse](../../models/create-entity-response.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## get + +Fetches a single entity by entity ID. + +Use this to read one entity's current state. Pass customerId when you want to scope the lookup to a specific customer. + +@example +```typescript +// Fetch a seat entity +const response = await client.entities.get({ entityId: "seat_42" }); +``` + +@example +```typescript +// Fetch a seat entity for a specific customer +const response = await client.entities.get({ customerId: "cus_123", entityId: "seat_42" }); +``` + +@param customerId - The ID of the customer to create the entity for. (optional) +@param entityId - The ID of the entity. + +@returns The entity object including its current subscriptions, purchases, and balances. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.entities.get({ + entityId: "seat_42", + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { entitiesGet } from "@useautumn/sdk/funcs/entities-get.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await entitiesGet(autumn, { + entityId: "seat_42", + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("entitiesGet failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.GetEntityParams](../../models/get-entity-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.GetEntityResponse](../../models/get-entity-response.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## delete + +Deletes an entity by entity ID. + +Use this when the underlying resource is removed and you no longer want entity-scoped balances or subscriptions tracked for it. + +@example +```typescript +// Delete a seat entity +const response = await client.entities.delete({ entityId: "seat_42" }); +``` + +@param customerId - The ID of the customer. (optional) +@param entityId - The ID of the entity. + +@returns A success flag indicating the entity was deleted. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.entities.delete({ + customerId: "cus_123", + entityId: "seat_42", + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { entitiesDelete } from "@useautumn/sdk/funcs/entities-delete.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await entitiesDelete(autumn, { + customerId: "cus_123", + entityId: "seat_42", + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("entitiesDelete failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.DeleteEntityParams](../../models/delete-entity-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.DeleteEntityResponse](../../models/delete-entity-response.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/packages/sdk/docs/sdks/events/README.md b/packages/sdk/docs/sdks/events/README.md new file mode 100644 index 000000000..7e53035a1 --- /dev/null +++ b/packages/sdk/docs/sdks/events/README.md @@ -0,0 +1,164 @@ +# Events + +## Overview + +### Available Operations + +* [list](#list) - List usage events for your organization. Filter by customer, feature, or time range. +* [aggregate](#aggregate) - Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property. + +## list + +List usage events for your organization. Filter by customer, feature, or time range. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.events.list({ + limit: 50, + customerId: "cus_123", + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { eventsList } from "@useautumn/sdk/funcs/events-list.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await eventsList(autumn, { + limit: 50, + customerId: "cus_123", + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("eventsList failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.EventsListParams](../../models/events-list-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.ListEventsResponse](../../models/list-events-response.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## aggregate + +Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.events.aggregate({ + customerId: "cus_123", + featureId: "api_calls", + range: "30d", + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { eventsAggregate } from "@useautumn/sdk/funcs/events-aggregate.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await eventsAggregate(autumn, { + customerId: "cus_123", + featureId: "api_calls", + range: "30d", + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("eventsAggregate failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.EventsAggregateParams](../../models/events-aggregate-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.AggregateEventsResponse](../../models/aggregate-events-response.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/packages/sdk/docs/sdks/referrals/README.md b/packages/sdk/docs/sdks/referrals/README.md new file mode 100644 index 000000000..9ae45ec38 --- /dev/null +++ b/packages/sdk/docs/sdks/referrals/README.md @@ -0,0 +1,162 @@ +# Referrals + +## Overview + +### Available Operations + +* [createCode](#createcode) - Create or fetch a referral code for a customer in a referral program. +* [redeemCode](#redeemcode) - Redeem a referral code for a customer. + +## createCode + +Create or fetch a referral code for a customer in a referral program. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.referrals.createCode({ + customerId: "cus_123", + programId: "prog_123", + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { referralsCreateCode } from "@useautumn/sdk/funcs/referrals-create-code.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await referralsCreateCode(autumn, { + customerId: "cus_123", + programId: "prog_123", + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("referralsCreateCode failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.CreateReferralCodeParams](../../models/create-referral-code-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.CreateReferralCodeResponse](../../models/create-referral-code-response.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## redeemCode + +Redeem a referral code for a customer. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.referrals.redeemCode({ + code: "REF123", + customerId: "cus_456", + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { referralsRedeemCode } from "@useautumn/sdk/funcs/referrals-redeem-code.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await referralsRedeemCode(autumn, { + code: "REF123", + customerId: "cus_456", + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("referralsRedeemCode failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.RedeemReferralCodeParams](../../models/redeem-referral-code-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.RedeemReferralCodeResponse](../../models/redeem-referral-code-response.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/packages/sdk/examples/customersGetOrCreate.example.ts b/packages/sdk/examples/check.example.ts similarity index 74% rename from packages/sdk/examples/customersGetOrCreate.example.ts rename to packages/sdk/examples/check.example.ts index b6af2731f..9153d3e13 100644 --- a/packages/sdk/examples/customersGetOrCreate.example.ts +++ b/packages/sdk/examples/check.example.ts @@ -8,7 +8,7 @@ dotenv.config(); * Example usage of the @useautumn/sdk SDK * * To run this example from the examples directory: - * npm run build && npx tsx customersGetOrCreate.example.ts + * npm run build && npx tsx check.example.ts */ import { Autumn } from "@useautumn/sdk"; @@ -19,10 +19,9 @@ const autumn = new Autumn({ }); async function main() { - const result = await autumn.customers.getOrCreate({ + const result = await autumn.check({ customerId: "cus_123", - name: "John Doe", - email: "john@example.com", + featureId: "messages", }); console.log(result); diff --git a/packages/sdk/jsr.json b/packages/sdk/jsr.json index 1d4fc089e..ead314f89 100644 --- a/packages/sdk/jsr.json +++ b/packages/sdk/jsr.json @@ -2,7 +2,7 @@ { "name": "@useautumn/sdk", - "version": "0.8.27", + "version": "0.10.4", "exports": { ".": "./src/index.ts", "./models": "./src/models/index.ts", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 6b23cc4dd..389efc22a 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@useautumn/sdk", - "version": "0.8.27", + "version": "0.10.4", "author": "Speakeasy", "main": "./dist/commonjs/index.js", "module": "./dist/esm/index.js", diff --git a/packages/sdk/src/funcs/balances-create.ts b/packages/sdk/src/funcs/balances-create.ts index 2e31fd672..38d61f930 100644 --- a/packages/sdk/src/funcs/balances-create.ts +++ b/packages/sdk/src/funcs/balances-create.ts @@ -30,11 +30,11 @@ import { Result } from "../types/fp.js"; */ export function balancesCreate( client: AutumnCore, - request: models.BalancesCreateRequest, + request: models.CreateBalanceParams, options?: RequestOptions, ): APIPromise< Result< - models.BalancesCreateResponse, + models.CreateBalanceResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -54,12 +54,12 @@ export function balancesCreate( async function $do( client: AutumnCore, - request: models.BalancesCreateRequest, + request: models.CreateBalanceParams, options?: RequestOptions, ): Promise< [ Result< - models.BalancesCreateResponse, + models.CreateBalanceResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -74,7 +74,7 @@ async function $do( > { const parsed = safeParse( request, - (value) => z.parse(models.BalancesCreateRequest$outboundSchema, value), + (value) => z.parse(models.CreateBalanceParams$outboundSchema, value), "Input validation failed", ); if (!parsed.ok) { @@ -102,7 +102,7 @@ async function $do( const context = { options: client._options, baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "balancesCreate", + operationID: "createBalance", oAuth2Scopes: null, resolvedSecurity: requestSecurity, @@ -141,7 +141,7 @@ async function $do( const response = doResult.value; const [result] = await M.match< - models.BalancesCreateResponse, + models.CreateBalanceResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -151,7 +151,7 @@ async function $do( | UnexpectedClientError | SDKValidationError >( - M.json(200, models.BalancesCreateResponse$inboundSchema), + M.json(200, models.CreateBalanceResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"), )(response, req); diff --git a/packages/sdk/src/funcs/balances-update.ts b/packages/sdk/src/funcs/balances-update.ts index e3f89175f..5cbdc17fa 100644 --- a/packages/sdk/src/funcs/balances-update.ts +++ b/packages/sdk/src/funcs/balances-update.ts @@ -30,11 +30,11 @@ import { Result } from "../types/fp.js"; */ export function balancesUpdate( client: AutumnCore, - request: models.BalancesUpdateRequest, + request: models.UpdateBalanceParams, options?: RequestOptions, ): APIPromise< Result< - models.BalancesUpdateResponse, + models.UpdateBalanceResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -54,12 +54,12 @@ export function balancesUpdate( async function $do( client: AutumnCore, - request: models.BalancesUpdateRequest, + request: models.UpdateBalanceParams, options?: RequestOptions, ): Promise< [ Result< - models.BalancesUpdateResponse, + models.UpdateBalanceResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -74,7 +74,7 @@ async function $do( > { const parsed = safeParse( request, - (value) => z.parse(models.BalancesUpdateRequest$outboundSchema, value), + (value) => z.parse(models.UpdateBalanceParams$outboundSchema, value), "Input validation failed", ); if (!parsed.ok) { @@ -102,7 +102,7 @@ async function $do( const context = { options: client._options, baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "balancesUpdate", + operationID: "updateBalance", oAuth2Scopes: null, resolvedSecurity: requestSecurity, @@ -141,7 +141,7 @@ async function $do( const response = doResult.value; const [result] = await M.match< - models.BalancesUpdateResponse, + models.UpdateBalanceResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -151,7 +151,7 @@ async function $do( | UnexpectedClientError | SDKValidationError >( - M.json(200, models.BalancesUpdateResponse$inboundSchema), + M.json(200, models.UpdateBalanceResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"), )(response, req); diff --git a/packages/sdk/src/funcs/billing-attach.ts b/packages/sdk/src/funcs/billing-attach.ts index 2730fb8f3..be3db0e91 100644 --- a/packages/sdk/src/funcs/billing-attach.ts +++ b/packages/sdk/src/funcs/billing-attach.ts @@ -28,21 +28,45 @@ import { Result } from "../types/fp.js"; /** * Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. * + * Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product. + * * @example * ```typescript * // Attach a plan to a customer - * const response = await client.attach({ customerId: "cus_123", planId: "pro_plan" }); + * const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan" }); + * ``` + * + * @example + * ```typescript + * // Attach with a free trial + * const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan", freeTrial: {"durationLength":14,"durationType":"day"} }); + * ``` + * + * @example + * ```typescript + * // Attach with custom pricing + * const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan", customize: {"price":{"amount":4900,"interval":"month"}} }); * ``` * * @param customerId - The ID of the customer to attach the plan to. * @param entityId - The ID of the entity to attach the plan to. (optional) + * @param planId - The ID of the plan. * @param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) * @param version - The version of the plan to attach. (optional) + * @param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) * @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) + * @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) + * @param billingBehavior - 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. (optional) + * @param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) + * @param successUrl - URL to redirect to after successful checkout. (optional) + * @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) + * @param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + * + * @returns A billing response with customer ID, invoice details, and payment URL (if checkout required). */ export function billingAttach( client: AutumnCore, - request: models.BillingAttachRequest, + request: models.AttachParams, options?: RequestOptions, ): APIPromise< Result< @@ -66,7 +90,7 @@ export function billingAttach( async function $do( client: AutumnCore, - request: models.BillingAttachRequest, + request: models.AttachParams, options?: RequestOptions, ): Promise< [ @@ -86,7 +110,7 @@ async function $do( > { const parsed = safeParse( request, - (value) => z.parse(models.BillingAttachRequest$outboundSchema, value), + (value) => z.parse(models.AttachParams$outboundSchema, value), "Input validation failed", ); if (!parsed.ok) { diff --git a/packages/sdk/src/funcs/billing-open-customer-portal.ts b/packages/sdk/src/funcs/billing-open-customer-portal.ts new file mode 100644 index 000000000..fac464908 --- /dev/null +++ b/packages/sdk/src/funcs/billing-open-customer-portal.ts @@ -0,0 +1,163 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { AutumnCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { AutumnError } from "../models/autumn-error.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/http-client-errors.js"; +import * as models from "../models/index.js"; +import { ResponseValidationError } from "../models/response-validation-error.js"; +import { SDKValidationError } from "../models/sdk-validation-error.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Create a billing portal session for a customer to manage their subscription. + */ +export function billingOpenCustomerPortal( + client: AutumnCore, + request: models.OpenCustomerPortalParams, + options?: RequestOptions, +): APIPromise< + Result< + models.OpenCustomerPortalResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request: models.OpenCustomerPortalParams, + options?: RequestOptions, +): Promise< + [ + Result< + models.OpenCustomerPortalResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => z.parse(models.OpenCustomerPortalParams$outboundSchema, value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/billing.open_customer_portal")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "x-api-version": encodeSimple( + "x-api-version", + client._options.xApiVersion, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.secretKey); + const securityInput = secConfig == null ? {} : { secretKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "openCustomerPortal", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.secretKey, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["4XX", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const [result] = await M.match< + models.OpenCustomerPortalResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.OpenCustomerPortalResponse$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/packages/sdk/src/funcs/billing-preview-attach.ts b/packages/sdk/src/funcs/billing-preview-attach.ts index 844a7c372..238dcea67 100644 --- a/packages/sdk/src/funcs/billing-preview-attach.ts +++ b/packages/sdk/src/funcs/billing-preview-attach.ts @@ -26,15 +26,39 @@ import { APICall, APIPromise } from "../types/async.js"; import { Result } from "../types/fp.js"; /** - * Preview billing changes before attaching a plan. + * Previews the billing changes that would occur when attaching a plan, without actually making any changes. + * + * Use this endpoint to show customers what they will be charged before confirming a subscription change. + * + * @example + * ```typescript + * // Preview attaching a plan + * const response = await client.billing.previewAttach({ customerId: "cus_123", planId: "pro_plan" }); + * ``` + * + * @param customerId - The ID of the customer to attach the plan to. + * @param entityId - The ID of the entity to attach the plan to. (optional) + * @param planId - The ID of the plan. + * @param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) + * @param version - The version of the plan to attach. (optional) + * @param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) + * @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) + * @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) + * @param billingBehavior - 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. (optional) + * @param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) + * @param successUrl - URL to redirect to after successful checkout. (optional) + * @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) + * @param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + * + * @returns A preview response with line items, totals, and effective dates for the proposed changes. */ export function billingPreviewAttach( client: AutumnCore, - request: models.BillingPreviewAttachRequest, + request: models.PreviewAttachParams, options?: RequestOptions, ): APIPromise< Result< - models.BillingPreviewAttachResponse, + models.PreviewAttachResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -54,12 +78,12 @@ export function billingPreviewAttach( async function $do( client: AutumnCore, - request: models.BillingPreviewAttachRequest, + request: models.PreviewAttachParams, options?: RequestOptions, ): Promise< [ Result< - models.BillingPreviewAttachResponse, + models.PreviewAttachResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -74,8 +98,7 @@ async function $do( > { const parsed = safeParse( request, - (value) => - z.parse(models.BillingPreviewAttachRequest$outboundSchema, value), + (value) => z.parse(models.PreviewAttachParams$outboundSchema, value), "Input validation failed", ); if (!parsed.ok) { @@ -103,7 +126,7 @@ async function $do( const context = { options: client._options, baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "billingPreviewAttach", + operationID: "previewAttach", oAuth2Scopes: null, resolvedSecurity: requestSecurity, @@ -142,7 +165,7 @@ async function $do( const response = doResult.value; const [result] = await M.match< - models.BillingPreviewAttachResponse, + models.PreviewAttachResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -152,7 +175,7 @@ async function $do( | UnexpectedClientError | SDKValidationError >( - M.json(200, models.BillingPreviewAttachResponse$inboundSchema), + M.json(200, models.PreviewAttachResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"), )(response, req); diff --git a/packages/sdk/src/funcs/billing-preview-update.ts b/packages/sdk/src/funcs/billing-preview-update.ts index f9180f868..2721f3c74 100644 --- a/packages/sdk/src/funcs/billing-preview-update.ts +++ b/packages/sdk/src/funcs/billing-preview-update.ts @@ -26,15 +26,35 @@ import { APICall, APIPromise } from "../types/async.js"; import { Result } from "../types/fp.js"; /** - * Preview billing changes before updating a subscription. + * Previews the billing changes that would occur when updating a subscription, without actually making any changes. + * + * Use this endpoint to show customers prorated charges or refunds before confirming subscription modifications. + * + * @example + * ```typescript + * // Preview updating seat quantity + * const response = await client.billing.previewUpdate({ customerId: "cus_123", planId: "pro_plan", featureQuantities: [{"featureId":"seats","quantity":15}] }); + * ``` + * + * @param customerId - The ID of the customer to attach the plan to. + * @param entityId - The ID of the entity to attach the plan to. (optional) + * @param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) + * @param version - The version of the plan to attach. (optional) + * @param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) + * @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) + * @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) + * @param billingBehavior - 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. (optional) + * @param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional) + * + * @returns A preview response with line items showing prorated charges or credits for the proposed changes. */ export function billingPreviewUpdate( client: AutumnCore, - request: models.BillingPreviewUpdateRequest, + request: models.PreviewUpdateParams, options?: RequestOptions, ): APIPromise< Result< - models.BillingPreviewUpdateResponse, + models.PreviewUpdateResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -54,12 +74,12 @@ export function billingPreviewUpdate( async function $do( client: AutumnCore, - request: models.BillingPreviewUpdateRequest, + request: models.PreviewUpdateParams, options?: RequestOptions, ): Promise< [ Result< - models.BillingPreviewUpdateResponse, + models.PreviewUpdateResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -74,8 +94,7 @@ async function $do( > { const parsed = safeParse( request, - (value) => - z.parse(models.BillingPreviewUpdateRequest$outboundSchema, value), + (value) => z.parse(models.PreviewUpdateParams$outboundSchema, value), "Input validation failed", ); if (!parsed.ok) { @@ -103,7 +122,7 @@ async function $do( const context = { options: client._options, baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "billingPreviewUpdate", + operationID: "previewUpdate", oAuth2Scopes: null, resolvedSecurity: requestSecurity, @@ -142,7 +161,7 @@ async function $do( const response = doResult.value; const [result] = await M.match< - models.BillingPreviewUpdateResponse, + models.PreviewUpdateResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -152,7 +171,7 @@ async function $do( | UnexpectedClientError | SDKValidationError >( - M.json(200, models.BillingPreviewUpdateResponse$inboundSchema), + M.json(200, models.PreviewUpdateResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"), )(response, req); diff --git a/packages/sdk/src/funcs/billing-update.ts b/packages/sdk/src/funcs/billing-update.ts index b1031d833..06ebedff0 100644 --- a/packages/sdk/src/funcs/billing-update.ts +++ b/packages/sdk/src/funcs/billing-update.ts @@ -26,11 +26,43 @@ import { APICall, APIPromise } from "../types/async.js"; import { Result } from "../types/fp.js"; /** - * Update an existing subscription. + * Updates an existing subscription. Use to modify feature quantities, cancel, or change plan configuration. + * + * Use this endpoint to update prepaid quantities, cancel a subscription (immediately or at end of cycle), or modify subscription settings. + * + * @example + * ```typescript + * // Update prepaid feature quantity + * const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", featureQuantities: [{"featureId":"seats","quantity":10}] }); + * ``` + * + * @example + * ```typescript + * // Cancel a subscription at end of billing cycle + * const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", cancelAction: "cancel_end_of_cycle" }); + * ``` + * + * @example + * ```typescript + * // Uncancel a subscription at the end of the billing cycle + * const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", cancelAction: "uncancel" }); + * ``` + * + * @param customerId - The ID of the customer to attach the plan to. + * @param entityId - The ID of the entity to attach the plan to. (optional) + * @param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) + * @param version - The version of the plan to attach. (optional) + * @param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) + * @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) + * @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) + * @param billingBehavior - 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. (optional) + * @param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional) + * + * @returns A billing response with customer ID, invoice details, and payment URL (if next action is required). */ export function billingUpdate( client: AutumnCore, - request: models.BillingUpdateRequest, + request: models.UpdateSubscriptionParams, options?: RequestOptions, ): APIPromise< Result< @@ -54,7 +86,7 @@ export function billingUpdate( async function $do( client: AutumnCore, - request: models.BillingUpdateRequest, + request: models.UpdateSubscriptionParams, options?: RequestOptions, ): Promise< [ @@ -74,7 +106,7 @@ async function $do( > { const parsed = safeParse( request, - (value) => z.parse(models.BillingUpdateRequest$outboundSchema, value), + (value) => z.parse(models.UpdateSubscriptionParams$outboundSchema, value), "Input validation failed", ); if (!parsed.ok) { diff --git a/packages/sdk/src/funcs/check.ts b/packages/sdk/src/funcs/check.ts new file mode 100644 index 000000000..ba2d6ef7e --- /dev/null +++ b/packages/sdk/src/funcs/check.ts @@ -0,0 +1,193 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { AutumnCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { AutumnError } from "../models/autumn-error.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/http-client-errors.js"; +import * as models from "../models/index.js"; +import { ResponseValidationError } from "../models/response-validation-error.js"; +import { SDKValidationError } from "../models/sdk-validation-error.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Checks whether a customer currently has enough balance to use a feature. + * + * Use this to gate access before a feature action. Enable sendEvent when you want to check and consume balance atomically in one request. + * + * @example + * ```typescript + * // Check access for a feature + * const response = await client.check({ customerId: "cus_123", featureId: "messages" }); + * ``` + * + * @example + * ```typescript + * // Check and consume 3 units in one call + * const response = await client.check({ + * + * customerId: "cus_123", + * featureId: "messages", + * requiredBalance: 3, + * sendEvent: true, + * }); + * ``` + * + * @param customerId - The ID of the customer. + * @param featureId - The ID of the feature. + * @param entityId - The ID of the entity for entity-scoped balances (e.g., per-seat limits). (optional) + * @param requiredBalance - Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1. (optional) + * @param properties - Additional properties to attach to the usage event if send_event is true. (optional) + * @param sendEvent - If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. (optional) + * @param withPreview - If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. (optional) + * + * @returns Whether access is allowed, plus the current balance for that feature. + */ +export function check( + client: AutumnCore, + request: models.CheckParams, + options?: RequestOptions, +): APIPromise< + Result< + models.CheckResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request: models.CheckParams, + options?: RequestOptions, +): Promise< + [ + Result< + models.CheckResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => z.parse(models.CheckParams$outboundSchema, value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/balances.check")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "x-api-version": encodeSimple( + "x-api-version", + client._options.xApiVersion, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.secretKey); + const securityInput = secConfig == null ? {} : { secretKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "check", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.secretKey, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["4XX", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const [result] = await M.match< + models.CheckResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.CheckResponse$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/packages/sdk/src/funcs/entities-create.ts b/packages/sdk/src/funcs/entities-create.ts new file mode 100644 index 000000000..868cba5cf --- /dev/null +++ b/packages/sdk/src/funcs/entities-create.ts @@ -0,0 +1,185 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { AutumnCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { AutumnError } from "../models/autumn-error.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/http-client-errors.js"; +import * as models from "../models/index.js"; +import { ResponseValidationError } from "../models/response-validation-error.js"; +import { SDKValidationError } from "../models/sdk-validation-error.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * 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. + * + * @example + * ```typescript + * // Create a seat entity + * const response = await client.entities.create({ + * + * customerId: "cus_123", + * entityId: "seat_42", + * featureId: "seats", + * name: "Seat 42", + * }); + * ``` + * + * @param name - The name of the entity (optional) + * @param featureId - The ID of the feature this entity is associated with + * @param customerData - Customer attributes used to resolve the customer when customer_id is not provided. (optional) + * @param customerId - The ID of the customer to create the entity for. + * @param entityId - The ID of the entity. + * + * @returns The created entity object including its current subscriptions, purchases, and balances. + */ +export function entitiesCreate( + client: AutumnCore, + request: models.CreateEntityParams, + options?: RequestOptions, +): APIPromise< + Result< + models.CreateEntityResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request: models.CreateEntityParams, + options?: RequestOptions, +): Promise< + [ + Result< + models.CreateEntityResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => z.parse(models.CreateEntityParams$outboundSchema, value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/entities.create")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "x-api-version": encodeSimple( + "x-api-version", + client._options.xApiVersion, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.secretKey); + const securityInput = secConfig == null ? {} : { secretKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "createEntity", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.secretKey, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["4XX", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const [result] = await M.match< + models.CreateEntityResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.CreateEntityResponse$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/packages/sdk/src/funcs/entities-delete.ts b/packages/sdk/src/funcs/entities-delete.ts new file mode 100644 index 000000000..1e8195741 --- /dev/null +++ b/packages/sdk/src/funcs/entities-delete.ts @@ -0,0 +1,176 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { AutumnCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { AutumnError } from "../models/autumn-error.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/http-client-errors.js"; +import * as models from "../models/index.js"; +import { ResponseValidationError } from "../models/response-validation-error.js"; +import { SDKValidationError } from "../models/sdk-validation-error.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Deletes an entity by entity ID. + * + * Use this when the underlying resource is removed and you no longer want entity-scoped balances or subscriptions tracked for it. + * + * @example + * ```typescript + * // Delete a seat entity + * const response = await client.entities.delete({ entityId: "seat_42" }); + * ``` + * + * @param customerId - The ID of the customer. (optional) + * @param entityId - The ID of the entity. + * + * @returns A success flag indicating the entity was deleted. + */ +export function entitiesDelete( + client: AutumnCore, + request: models.DeleteEntityParams, + options?: RequestOptions, +): APIPromise< + Result< + models.DeleteEntityResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request: models.DeleteEntityParams, + options?: RequestOptions, +): Promise< + [ + Result< + models.DeleteEntityResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => z.parse(models.DeleteEntityParams$outboundSchema, value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/entities.delete")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "x-api-version": encodeSimple( + "x-api-version", + client._options.xApiVersion, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.secretKey); + const securityInput = secConfig == null ? {} : { secretKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "deleteEntity", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.secretKey, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["4XX", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const [result] = await M.match< + models.DeleteEntityResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.DeleteEntityResponse$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/packages/sdk/src/funcs/entities-get.ts b/packages/sdk/src/funcs/entities-get.ts new file mode 100644 index 000000000..f19d6bb5c --- /dev/null +++ b/packages/sdk/src/funcs/entities-get.ts @@ -0,0 +1,182 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { AutumnCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { AutumnError } from "../models/autumn-error.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/http-client-errors.js"; +import * as models from "../models/index.js"; +import { ResponseValidationError } from "../models/response-validation-error.js"; +import { SDKValidationError } from "../models/sdk-validation-error.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Fetches a single entity by entity ID. + * + * Use this to read one entity's current state. Pass customerId when you want to scope the lookup to a specific customer. + * + * @example + * ```typescript + * // Fetch a seat entity + * const response = await client.entities.get({ entityId: "seat_42" }); + * ``` + * + * @example + * ```typescript + * // Fetch a seat entity for a specific customer + * const response = await client.entities.get({ customerId: "cus_123", entityId: "seat_42" }); + * ``` + * + * @param customerId - The ID of the customer to create the entity for. (optional) + * @param entityId - The ID of the entity. + * + * @returns The entity object including its current subscriptions, purchases, and balances. + */ +export function entitiesGet( + client: AutumnCore, + request: models.GetEntityParams, + options?: RequestOptions, +): APIPromise< + Result< + models.GetEntityResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request: models.GetEntityParams, + options?: RequestOptions, +): Promise< + [ + Result< + models.GetEntityResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => z.parse(models.GetEntityParams$outboundSchema, value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/entities.get")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "x-api-version": encodeSimple( + "x-api-version", + client._options.xApiVersion, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.secretKey); + const securityInput = secConfig == null ? {} : { secretKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "getEntity", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.secretKey, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["4XX", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const [result] = await M.match< + models.GetEntityResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.GetEntityResponse$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/packages/sdk/src/funcs/events-aggregate.ts b/packages/sdk/src/funcs/events-aggregate.ts new file mode 100644 index 000000000..47d6e11d0 --- /dev/null +++ b/packages/sdk/src/funcs/events-aggregate.ts @@ -0,0 +1,163 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { AutumnCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { AutumnError } from "../models/autumn-error.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/http-client-errors.js"; +import * as models from "../models/index.js"; +import { ResponseValidationError } from "../models/response-validation-error.js"; +import { SDKValidationError } from "../models/sdk-validation-error.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property. + */ +export function eventsAggregate( + client: AutumnCore, + request: models.EventsAggregateParams, + options?: RequestOptions, +): APIPromise< + Result< + models.AggregateEventsResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request: models.EventsAggregateParams, + options?: RequestOptions, +): Promise< + [ + Result< + models.AggregateEventsResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => z.parse(models.EventsAggregateParams$outboundSchema, value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/events.aggregate")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "x-api-version": encodeSimple( + "x-api-version", + client._options.xApiVersion, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.secretKey); + const securityInput = secConfig == null ? {} : { secretKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "aggregateEvents", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.secretKey, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["4XX", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const [result] = await M.match< + models.AggregateEventsResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.AggregateEventsResponse$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/packages/sdk/src/funcs/balances-track.ts b/packages/sdk/src/funcs/events-list.ts similarity index 89% rename from packages/sdk/src/funcs/balances-track.ts rename to packages/sdk/src/funcs/events-list.ts index efb27297c..b79aaad0e 100644 --- a/packages/sdk/src/funcs/balances-track.ts +++ b/packages/sdk/src/funcs/events-list.ts @@ -26,15 +26,15 @@ import { APICall, APIPromise } from "../types/async.js"; import { Result } from "../types/fp.js"; /** - * Track usage for a customer feature. + * List usage events for your organization. Filter by customer, feature, or time range. */ -export function balancesTrack( +export function eventsList( client: AutumnCore, - request: models.BalancesTrackRequest, + request: models.EventsListParams, options?: RequestOptions, ): APIPromise< Result< - models.BalancesTrackResponse, + models.ListEventsResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -54,12 +54,12 @@ export function balancesTrack( async function $do( client: AutumnCore, - request: models.BalancesTrackRequest, + request: models.EventsListParams, options?: RequestOptions, ): Promise< [ Result< - models.BalancesTrackResponse, + models.ListEventsResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -74,7 +74,7 @@ async function $do( > { const parsed = safeParse( request, - (value) => z.parse(models.BalancesTrackRequest$outboundSchema, value), + (value) => z.parse(models.EventsListParams$outboundSchema, value), "Input validation failed", ); if (!parsed.ok) { @@ -83,7 +83,7 @@ async function $do( const payload = parsed.value; const body = encodeJSON("body", payload, { explode: true }); - const path = pathToFunc("/v1/balances.track")(); + const path = pathToFunc("/v1/events.list")(); const headers = new Headers(compactMap({ "Content-Type": "application/json", @@ -102,7 +102,7 @@ async function $do( const context = { options: client._options, baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "balancesTrack", + operationID: "listEvents", oAuth2Scopes: null, resolvedSecurity: requestSecurity, @@ -141,7 +141,7 @@ async function $do( const response = doResult.value; const [result] = await M.match< - models.BalancesTrackResponse, + models.ListEventsResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -151,7 +151,7 @@ async function $do( | UnexpectedClientError | SDKValidationError >( - M.json(200, models.BalancesTrackResponse$inboundSchema), + M.json(200, models.ListEventsResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"), )(response, req); diff --git a/packages/sdk/src/funcs/billing-setup-payment.ts b/packages/sdk/src/funcs/referrals-create-code.ts similarity index 87% rename from packages/sdk/src/funcs/billing-setup-payment.ts rename to packages/sdk/src/funcs/referrals-create-code.ts index 6521e8638..704d13b41 100644 --- a/packages/sdk/src/funcs/billing-setup-payment.ts +++ b/packages/sdk/src/funcs/referrals-create-code.ts @@ -26,15 +26,15 @@ import { APICall, APIPromise } from "../types/async.js"; import { Result } from "../types/fp.js"; /** - * Create a setup payment session for a customer. + * Create or fetch a referral code for a customer in a referral program. */ -export function billingSetupPayment( +export function referralsCreateCode( client: AutumnCore, - request: models.BillingSetupPaymentRequest, + request: models.CreateReferralCodeParams, options?: RequestOptions, ): APIPromise< Result< - models.BillingSetupPaymentResponse, + models.CreateReferralCodeResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -54,12 +54,12 @@ export function billingSetupPayment( async function $do( client: AutumnCore, - request: models.BillingSetupPaymentRequest, + request: models.CreateReferralCodeParams, options?: RequestOptions, ): Promise< [ Result< - models.BillingSetupPaymentResponse, + models.CreateReferralCodeResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -74,7 +74,7 @@ async function $do( > { const parsed = safeParse( request, - (value) => z.parse(models.BillingSetupPaymentRequest$outboundSchema, value), + (value) => z.parse(models.CreateReferralCodeParams$outboundSchema, value), "Input validation failed", ); if (!parsed.ok) { @@ -83,7 +83,7 @@ async function $do( const payload = parsed.value; const body = encodeJSON("body", payload, { explode: true }); - const path = pathToFunc("/v1/billing.setup_payment")(); + const path = pathToFunc("/v1/referrals.create_code")(); const headers = new Headers(compactMap({ "Content-Type": "application/json", @@ -102,7 +102,7 @@ async function $do( const context = { options: client._options, baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "billingSetupPayment", + operationID: "createReferralCode", oAuth2Scopes: null, resolvedSecurity: requestSecurity, @@ -141,7 +141,7 @@ async function $do( const response = doResult.value; const [result] = await M.match< - models.BillingSetupPaymentResponse, + models.CreateReferralCodeResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -151,7 +151,7 @@ async function $do( | UnexpectedClientError | SDKValidationError >( - M.json(200, models.BillingSetupPaymentResponse$inboundSchema), + M.json(200, models.CreateReferralCodeResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"), )(response, req); diff --git a/packages/sdk/src/funcs/balances-check.ts b/packages/sdk/src/funcs/referrals-redeem-code.ts similarity index 88% rename from packages/sdk/src/funcs/balances-check.ts rename to packages/sdk/src/funcs/referrals-redeem-code.ts index bbd9a6fca..5d218a3b4 100644 --- a/packages/sdk/src/funcs/balances-check.ts +++ b/packages/sdk/src/funcs/referrals-redeem-code.ts @@ -26,15 +26,15 @@ import { APICall, APIPromise } from "../types/async.js"; import { Result } from "../types/fp.js"; /** - * Check whether usage is allowed for a customer feature. + * Redeem a referral code for a customer. */ -export function balancesCheck( +export function referralsRedeemCode( client: AutumnCore, - request: models.BalancesCheckRequest, + request: models.RedeemReferralCodeParams, options?: RequestOptions, ): APIPromise< Result< - models.BalancesCheckResponse, + models.RedeemReferralCodeResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -54,12 +54,12 @@ export function balancesCheck( async function $do( client: AutumnCore, - request: models.BalancesCheckRequest, + request: models.RedeemReferralCodeParams, options?: RequestOptions, ): Promise< [ Result< - models.BalancesCheckResponse, + models.RedeemReferralCodeResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -74,7 +74,7 @@ async function $do( > { const parsed = safeParse( request, - (value) => z.parse(models.BalancesCheckRequest$outboundSchema, value), + (value) => z.parse(models.RedeemReferralCodeParams$outboundSchema, value), "Input validation failed", ); if (!parsed.ok) { @@ -83,7 +83,7 @@ async function $do( const payload = parsed.value; const body = encodeJSON("body", payload, { explode: true }); - const path = pathToFunc("/v1/balances.check")(); + const path = pathToFunc("/v1/referrals.redeem_code")(); const headers = new Headers(compactMap({ "Content-Type": "application/json", @@ -102,7 +102,7 @@ async function $do( const context = { options: client._options, baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "balancesCheck", + operationID: "redeemReferralCode", oAuth2Scopes: null, resolvedSecurity: requestSecurity, @@ -141,7 +141,7 @@ async function $do( const response = doResult.value; const [result] = await M.match< - models.BalancesCheckResponse, + models.RedeemReferralCodeResponse, | AutumnError | ResponseValidationError | ConnectionError @@ -151,7 +151,7 @@ async function $do( | UnexpectedClientError | SDKValidationError >( - M.json(200, models.BalancesCheckResponse$inboundSchema), + M.json(200, models.RedeemReferralCodeResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"), )(response, req); diff --git a/packages/sdk/src/funcs/track.ts b/packages/sdk/src/funcs/track.ts new file mode 100644 index 000000000..d37789d33 --- /dev/null +++ b/packages/sdk/src/funcs/track.ts @@ -0,0 +1,186 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { AutumnCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { AutumnError } from "../models/autumn-error.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/http-client-errors.js"; +import * as models from "../models/index.js"; +import { ResponseValidationError } from "../models/response-validation-error.js"; +import { SDKValidationError } from "../models/sdk-validation-error.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Records usage for a customer feature and returns updated balances. + * + * Use this after an action happens to decrement usage, or send a negative value to credit balance back. + * + * @example + * ```typescript + * // Track one message event + * const response = await client.track({ customerId: "cus_123", featureId: "messages", value: 1 }); + * ``` + * + * @example + * ```typescript + * // Track an event mapped to multiple features + * const response = await client.track({ customerId: "cus_123", eventName: "ai_chat_request", value: 1 }); + * ``` + * + * @param customerId - The ID of the customer. + * @param featureId - The ID of the feature to track usage for. Required if event_name is not provided. (optional) + * @param entityId - The ID of the entity for entity-scoped balances (e.g., per-seat limits). (optional) + * @param eventName - Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. (optional) + * @param value - The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). (optional) + * @param properties - Additional properties to attach to this usage event. (optional) + * + * @returns The usage value recorded, with either a single updated balance or a map of updated balances. + */ +export function track( + client: AutumnCore, + request: models.TrackParams, + options?: RequestOptions, +): APIPromise< + Result< + models.TrackResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request: models.TrackParams, + options?: RequestOptions, +): Promise< + [ + Result< + models.TrackResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => z.parse(models.TrackParams$outboundSchema, value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/balances.track")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "x-api-version": encodeSimple( + "x-api-version", + client._options.xApiVersion, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.secretKey); + const securityInput = secConfig == null ? {} : { secretKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "track", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.secretKey, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["4XX", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const [result] = await M.match< + models.TrackResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.TrackResponse$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/packages/sdk/src/lib/config.ts b/packages/sdk/src/lib/config.ts index 7cb7a90db..2ac499055 100644 --- a/packages/sdk/src/lib/config.ts +++ b/packages/sdk/src/lib/config.ts @@ -66,7 +66,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "2.1.0", - sdkVersion: "0.8.27", + sdkVersion: "0.10.4", genVersion: "2.824.1", - userAgent: "speakeasy-sdk/typescript 0.8.27 2.824.1 2.1.0 @useautumn/sdk", + userAgent: "speakeasy-sdk/typescript 0.10.4 2.824.1 2.1.0 @useautumn/sdk", } as const; diff --git a/packages/sdk/src/models/aggregate-events-op.ts b/packages/sdk/src/models/aggregate-events-op.ts new file mode 100644 index 000000000..112c7189b --- /dev/null +++ b/packages/sdk/src/models/aggregate-events-op.ts @@ -0,0 +1,282 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { ClosedEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { smartUnion } from "../types/smart-union.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type AggregateEventsGlobals = { + xApiVersion?: string | undefined; +}; + +/** + * Feature ID(s) to aggregate events for + */ +export type AggregateEventsFeatureId = string | Array; + +/** + * Time range to aggregate events for. Either range or custom_range must be provided + */ +export const Range = { + TwentyFourh: "24h", + Sevend: "7d", + Thirtyd: "30d", + Ninetyd: "90d", + LastCycle: "last_cycle", + Onebc: "1bc", + Threebc: "3bc", +} as const; +/** + * Time range to aggregate events for. Either range or custom_range must be provided + */ +export type Range = ClosedEnum; + +/** + * Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day + */ +export const BinSize = { + Day: "day", + Hour: "hour", + Month: "month", +} as const; +/** + * Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day + */ +export type BinSize = ClosedEnum; + +/** + * Custom time range to aggregate events for. If provided, range must not be provided + */ +export type AggregateEventsCustomRange = { + start: number; + end: number; +}; + +export type EventsAggregateParams = { + /** + * Customer ID to aggregate events for + */ + customerId: string; + /** + * Feature ID(s) to aggregate events for + */ + featureId: string | Array; + /** + * Property to group events by. If provided, each key in the response will be an object with distinct groups as the keys + */ + groupBy?: string | undefined; + /** + * Time range to aggregate events for. Either range or custom_range must be provided + */ + range?: Range | undefined; + /** + * Size of the time bins to aggregate events for. Defaults to hour if range is 24h, otherwise day + */ + binSize?: BinSize | undefined; + /** + * Custom time range to aggregate events for. If provided, range must not be provided + */ + customRange?: AggregateEventsCustomRange | undefined; +}; + +export type AggregateEventsList = { + /** + * Unix timestamp (epoch ms) for this time period + */ + period: number; + /** + * Aggregated values per feature: { [featureId]: number } + */ + values: { [k: string]: number }; + /** + * Values broken down by group (only present when group_by is used): { [featureId]: { [groupValue]: number } } + */ + groupedValues?: { [k: string]: { [k: string]: number } } | undefined; +}; + +export type Total = { + /** + * Number of events for this feature + */ + count: number; + /** + * Sum of event values for this feature + */ + sum: number; +}; + +/** + * OK + */ +export type AggregateEventsResponse = { + /** + * Array of time periods with aggregated values + */ + list: Array; + /** + * Total aggregations per feature. Keys are feature IDs, values contain count and sum. + */ + total: { [k: string]: Total }; +}; + +/** @internal */ +export type AggregateEventsFeatureId$Outbound = string | Array; + +/** @internal */ +export const AggregateEventsFeatureId$outboundSchema: z.ZodMiniType< + AggregateEventsFeatureId$Outbound, + AggregateEventsFeatureId +> = smartUnion([z.string(), z.array(z.string())]); + +export function aggregateEventsFeatureIdToJSON( + aggregateEventsFeatureId: AggregateEventsFeatureId, +): string { + return JSON.stringify( + AggregateEventsFeatureId$outboundSchema.parse(aggregateEventsFeatureId), + ); +} + +/** @internal */ +export const Range$outboundSchema: z.ZodMiniEnum = z.enum(Range); + +/** @internal */ +export const BinSize$outboundSchema: z.ZodMiniEnum = z.enum( + BinSize, +); + +/** @internal */ +export type AggregateEventsCustomRange$Outbound = { + start: number; + end: number; +}; + +/** @internal */ +export const AggregateEventsCustomRange$outboundSchema: z.ZodMiniType< + AggregateEventsCustomRange$Outbound, + AggregateEventsCustomRange +> = z.object({ + start: z.number(), + end: z.number(), +}); + +export function aggregateEventsCustomRangeToJSON( + aggregateEventsCustomRange: AggregateEventsCustomRange, +): string { + return JSON.stringify( + AggregateEventsCustomRange$outboundSchema.parse(aggregateEventsCustomRange), + ); +} + +/** @internal */ +export type EventsAggregateParams$Outbound = { + customer_id: string; + feature_id: string | Array; + group_by?: string | undefined; + range?: string | undefined; + bin_size: string; + custom_range?: AggregateEventsCustomRange$Outbound | undefined; +}; + +/** @internal */ +export const EventsAggregateParams$outboundSchema: z.ZodMiniType< + EventsAggregateParams$Outbound, + EventsAggregateParams +> = z.pipe( + z.object({ + customerId: z.string(), + featureId: smartUnion([z.string(), z.array(z.string())]), + groupBy: z.optional(z.string()), + range: z.optional(Range$outboundSchema), + binSize: z._default(BinSize$outboundSchema, "day"), + customRange: z.optional( + z.lazy(() => AggregateEventsCustomRange$outboundSchema), + ), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + featureId: "feature_id", + groupBy: "group_by", + binSize: "bin_size", + customRange: "custom_range", + }); + }), +); + +export function eventsAggregateParamsToJSON( + eventsAggregateParams: EventsAggregateParams, +): string { + return JSON.stringify( + EventsAggregateParams$outboundSchema.parse(eventsAggregateParams), + ); +} + +/** @internal */ +export const AggregateEventsList$inboundSchema: z.ZodMiniType< + AggregateEventsList, + unknown +> = z.pipe( + z.object({ + period: types.number(), + values: z.record(z.string(), types.number()), + grouped_values: types.optional( + z.record(z.string(), z.record(z.string(), types.number())), + ), + }), + z.transform((v) => { + return remap$(v, { + "grouped_values": "groupedValues", + }); + }), +); + +export function aggregateEventsListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => AggregateEventsList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AggregateEventsList' from JSON`, + ); +} + +/** @internal */ +export const Total$inboundSchema: z.ZodMiniType = z.object({ + count: types.number(), + sum: types.number(), +}); + +export function totalFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Total$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Total' from JSON`, + ); +} + +/** @internal */ +export const AggregateEventsResponse$inboundSchema: z.ZodMiniType< + AggregateEventsResponse, + unknown +> = z.object({ + list: z.array(z.lazy(() => AggregateEventsList$inboundSchema)), + total: z.record(z.string(), z.lazy(() => Total$inboundSchema)), +}); + +export function aggregateEventsResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => AggregateEventsResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AggregateEventsResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/balances-create-op.ts b/packages/sdk/src/models/balances-create-op.ts deleted file mode 100644 index 4691d74f2..000000000 --- a/packages/sdk/src/models/balances-create-op.ts +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod/v4-mini"; -import { remap as remap$ } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { ClosedEnum } from "../types/enums.js"; -import { Result as SafeParseResult } from "../types/fp.js"; -import * as types from "../types/primitives.js"; -import { SDKValidationError } from "./sdk-validation-error.js"; - -export type BalancesCreateGlobals = { - xApiVersion?: string | undefined; -}; - -export const BalancesCreateInterval = { - OneOff: "one_off", - Minute: "minute", - Hour: "hour", - Day: "day", - Week: "week", - Month: "month", - Quarter: "quarter", - SemiAnnual: "semi_annual", - Year: "year", -} as const; -export type BalancesCreateInterval = ClosedEnum; - -/** - * Reset configuration for the balance - */ -export type BalancesCreateReset = { - interval: BalancesCreateInterval; - intervalCount?: number | undefined; -}; - -export type BalancesCreateRequest = { - /** - * The feature ID to create the balance for - */ - featureId: string; - /** - * The customer ID to assign the balance to - */ - customerId: string; - /** - * Entity ID for entity-scoped balances - */ - entityId?: string | undefined; - /** - * The initial balance amount to grant - */ - included?: number | undefined; - /** - * Whether the balance is unlimited - */ - unlimited?: boolean | undefined; - /** - * Reset configuration for the balance - */ - reset?: BalancesCreateReset | undefined; - /** - * Unix timestamp (milliseconds) when the balance expires - */ - expiresAt?: number | undefined; - grantedBalance?: number | undefined; -}; - -/** - * OK - */ -export type BalancesCreateResponse = { - success: boolean; -}; - -/** @internal */ -export const BalancesCreateInterval$outboundSchema: z.ZodMiniEnum< - typeof BalancesCreateInterval -> = z.enum(BalancesCreateInterval); - -/** @internal */ -export type BalancesCreateReset$Outbound = { - interval: string; - interval_count?: number | undefined; -}; - -/** @internal */ -export const BalancesCreateReset$outboundSchema: z.ZodMiniType< - BalancesCreateReset$Outbound, - BalancesCreateReset -> = z.pipe( - z.object({ - interval: BalancesCreateInterval$outboundSchema, - intervalCount: z.optional(z.number()), - }), - z.transform((v) => { - return remap$(v, { - intervalCount: "interval_count", - }); - }), -); - -export function balancesCreateResetToJSON( - balancesCreateReset: BalancesCreateReset, -): string { - return JSON.stringify( - BalancesCreateReset$outboundSchema.parse(balancesCreateReset), - ); -} - -/** @internal */ -export type BalancesCreateRequest$Outbound = { - feature_id: string; - customer_id: string; - entity_id?: string | undefined; - included?: number | undefined; - unlimited?: boolean | undefined; - reset?: BalancesCreateReset$Outbound | undefined; - expires_at?: number | undefined; - granted_balance?: number | undefined; -}; - -/** @internal */ -export const BalancesCreateRequest$outboundSchema: z.ZodMiniType< - BalancesCreateRequest$Outbound, - BalancesCreateRequest -> = z.pipe( - z.object({ - featureId: z.string(), - customerId: z.string(), - entityId: z.optional(z.string()), - included: z.optional(z.number()), - unlimited: z.optional(z.boolean()), - reset: z.optional(z.lazy(() => BalancesCreateReset$outboundSchema)), - expiresAt: z.optional(z.number()), - grantedBalance: z.optional(z.number()), - }), - z.transform((v) => { - return remap$(v, { - featureId: "feature_id", - customerId: "customer_id", - entityId: "entity_id", - expiresAt: "expires_at", - grantedBalance: "granted_balance", - }); - }), -); - -export function balancesCreateRequestToJSON( - balancesCreateRequest: BalancesCreateRequest, -): string { - return JSON.stringify( - BalancesCreateRequest$outboundSchema.parse(balancesCreateRequest), - ); -} - -/** @internal */ -export const BalancesCreateResponse$inboundSchema: z.ZodMiniType< - BalancesCreateResponse, - unknown -> = z.object({ - success: types.boolean(), -}); - -export function balancesCreateResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesCreateResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesCreateResponse' from JSON`, - ); -} diff --git a/packages/sdk/src/models/balances-track-op.ts b/packages/sdk/src/models/balances-track-op.ts deleted file mode 100644 index c4a0072f6..000000000 --- a/packages/sdk/src/models/balances-track-op.ts +++ /dev/null @@ -1,1012 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod/v4-mini"; -import { remap as remap$ } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import * as openEnums from "../types/enums.js"; -import { OpenEnum } from "../types/enums.js"; -import { Result as SafeParseResult } from "../types/fp.js"; -import * as types from "../types/primitives.js"; -import { smartUnion } from "../types/smart-union.js"; -import { SDKValidationError } from "./sdk-validation-error.js"; - -export type BalancesTrackGlobals = { - xApiVersion?: string | undefined; -}; - -export type BalancesTrackRequest = { - /** - * ID which you provided when creating the customer - */ - customerId: string; - /** - * ID of the feature to track usage for. Required if event_name is not provided. Use this for direct feature tracking. - */ - featureId?: string | undefined; - /** - * An [event name](/features/tracking-usage#using-event-names) can be used in place of feature_id. This can be used if multiple features are tracked in the same event. - */ - eventName?: string | undefined; - /** - * The amount of usage to record. Defaults to 1. Can be negative to increase the balance (e.g., when removing a seat). - */ - value?: number | undefined; - /** - * Additional properties to attach to this usage event. - */ - properties?: { [k: string]: any } | undefined; - /** - * Unique key to prevent duplicate event recording. Use this to safely retry requests without creating duplicate usage records. - */ - idempotencyKey?: string | undefined; - /** - * If using [entity balances](/features/feature-entities) (eg, seats), the entity ID to track usage for. - */ - entityId?: string | undefined; -}; - -export const BalancesTrackBalanceType = { - Boolean: "boolean", - Metered: "metered", - CreditSystem: "credit_system", -} as const; -export type BalancesTrackBalanceType = OpenEnum< - typeof BalancesTrackBalanceType ->; - -export type BalancesTrackBalanceCreditSchema = { - meteredFeatureId: string; - creditCost: number; -}; - -export type BalancesTrackBalanceDisplay = { - singular?: string | null | undefined; - plural?: string | null | undefined; -}; - -export type BalancesTrackBalanceFeature = { - id: string; - name: string; - type: BalancesTrackBalanceType; - consumable: boolean; - eventNames?: Array | undefined; - creditSchema?: Array | undefined; - display?: BalancesTrackBalanceDisplay | undefined; - archived: boolean; -}; - -export const BalancesTrackBalanceIntervalEnum = { - OneOff: "one_off", - Minute: "minute", - Hour: "hour", - Day: "day", - Week: "week", - Month: "month", - Quarter: "quarter", - SemiAnnual: "semi_annual", - Year: "year", -} as const; -export type BalancesTrackBalanceIntervalEnum = OpenEnum< - typeof BalancesTrackBalanceIntervalEnum ->; - -export type BalancesTrackBalanceIntervalUnion = - | BalancesTrackBalanceIntervalEnum - | string; - -export type BalancesTrackBalanceReset = { - interval: BalancesTrackBalanceIntervalEnum | string; - intervalCount?: number | undefined; - resetsAt: number | null; -}; - -export type BalancesTrackBalanceTo = number | string; - -export type BalancesTrackBalanceTier = { - to: number | string; - amount: number; -}; - -export const BalancesTrackBalanceBillingMethod = { - Prepaid: "prepaid", - UsageBased: "usage_based", -} as const; -export type BalancesTrackBalanceBillingMethod = OpenEnum< - typeof BalancesTrackBalanceBillingMethod ->; - -export type BalancesTrackBalancePrice = { - amount?: number | undefined; - tiers?: Array | undefined; - billingUnits: number; - billingMethod: BalancesTrackBalanceBillingMethod; - maxPurchase: number | null; -}; - -export type BalancesTrackBalanceBreakdown = { - id: string; - planId: string | null; - includedGrant: number; - prepaidGrant: number; - remaining: number; - usage: number; - unlimited: boolean; - reset: BalancesTrackBalanceReset | null; - price: BalancesTrackBalancePrice | null; - expiresAt: number | null; -}; - -export type BalancesTrackBalanceRollover = { - balance: number; - expiresAt: number; -}; - -export type BalancesTrackBalance = { - featureId: string; - feature?: BalancesTrackBalanceFeature | undefined; - granted: number; - remaining: number; - usage: number; - unlimited: boolean; - overageAllowed: boolean; - maxPurchase: number | null; - nextResetAt: number | null; - breakdown?: Array | undefined; - rollovers?: Array | undefined; -}; - -export const BalancesTrackType = { - Boolean: "boolean", - Metered: "metered", - CreditSystem: "credit_system", -} as const; -export type BalancesTrackType = OpenEnum; - -export type BalancesTrackCreditSchema = { - meteredFeatureId: string; - creditCost: number; -}; - -export type BalancesTrackDisplay = { - singular?: string | null | undefined; - plural?: string | null | undefined; -}; - -export type BalancesTrackFeature = { - id: string; - name: string; - type: BalancesTrackType; - consumable: boolean; - eventNames?: Array | undefined; - creditSchema?: Array | undefined; - display?: BalancesTrackDisplay | undefined; - archived: boolean; -}; - -export const BalancesTrackIntervalEnum = { - OneOff: "one_off", - Minute: "minute", - Hour: "hour", - Day: "day", - Week: "week", - Month: "month", - Quarter: "quarter", - SemiAnnual: "semi_annual", - Year: "year", -} as const; -export type BalancesTrackIntervalEnum = OpenEnum< - typeof BalancesTrackIntervalEnum ->; - -export type BalancesTrackIntervalUnion = BalancesTrackIntervalEnum | string; - -export type BalancesTrackReset = { - interval: BalancesTrackIntervalEnum | string; - intervalCount?: number | undefined; - resetsAt: number | null; -}; - -export type BalancesTrackTo = number | string; - -export type BalancesTrackTier = { - to: number | string; - amount: number; -}; - -export const BalancesTrackBillingMethod = { - Prepaid: "prepaid", - UsageBased: "usage_based", -} as const; -export type BalancesTrackBillingMethod = OpenEnum< - typeof BalancesTrackBillingMethod ->; - -export type BalancesTrackPrice = { - amount?: number | undefined; - tiers?: Array | undefined; - billingUnits: number; - billingMethod: BalancesTrackBillingMethod; - maxPurchase: number | null; -}; - -export type BalancesTrackBreakdown = { - id: string; - planId: string | null; - includedGrant: number; - prepaidGrant: number; - remaining: number; - usage: number; - unlimited: boolean; - reset: BalancesTrackReset | null; - price: BalancesTrackPrice | null; - expiresAt: number | null; -}; - -export type BalancesTrackRollover = { - balance: number; - expiresAt: number; -}; - -export type BalancesTrackBalances = { - featureId: string; - feature?: BalancesTrackFeature | undefined; - granted: number; - remaining: number; - usage: number; - unlimited: boolean; - overageAllowed: boolean; - maxPurchase: number | null; - nextResetAt: number | null; - breakdown?: Array | undefined; - rollovers?: Array | undefined; -}; - -/** - * OK - */ -export type BalancesTrackResponse = { - /** - * The ID of the customer - */ - customerId: string; - /** - * The ID of the entity (if provided) - */ - entityId?: string | undefined; - /** - * The name of the event - */ - eventName?: string | undefined; - value: number; - balance: BalancesTrackBalance | null; - balances?: { [k: string]: BalancesTrackBalances } | undefined; -}; - -/** @internal */ -export type BalancesTrackRequest$Outbound = { - customer_id: string; - feature_id?: string | undefined; - event_name?: string | undefined; - value?: number | undefined; - properties?: { [k: string]: any } | undefined; - idempotency_key?: string | undefined; - entity_id?: string | undefined; -}; - -/** @internal */ -export const BalancesTrackRequest$outboundSchema: z.ZodMiniType< - BalancesTrackRequest$Outbound, - BalancesTrackRequest -> = z.pipe( - z.object({ - customerId: z.string(), - featureId: z.optional(z.string()), - eventName: z.optional(z.string()), - value: z.optional(z.number()), - properties: z.optional(z.record(z.string(), z.any())), - idempotencyKey: z.optional(z.string()), - entityId: z.optional(z.string()), - }), - z.transform((v) => { - return remap$(v, { - customerId: "customer_id", - featureId: "feature_id", - eventName: "event_name", - idempotencyKey: "idempotency_key", - entityId: "entity_id", - }); - }), -); - -export function balancesTrackRequestToJSON( - balancesTrackRequest: BalancesTrackRequest, -): string { - return JSON.stringify( - BalancesTrackRequest$outboundSchema.parse(balancesTrackRequest), - ); -} - -/** @internal */ -export const BalancesTrackBalanceType$inboundSchema: z.ZodMiniType< - BalancesTrackBalanceType, - unknown -> = openEnums.inboundSchema(BalancesTrackBalanceType); - -/** @internal */ -export const BalancesTrackBalanceCreditSchema$inboundSchema: z.ZodMiniType< - BalancesTrackBalanceCreditSchema, - unknown -> = z.pipe( - z.object({ - metered_feature_id: types.string(), - credit_cost: types.number(), - }), - z.transform((v) => { - return remap$(v, { - "metered_feature_id": "meteredFeatureId", - "credit_cost": "creditCost", - }); - }), -); - -export function balancesTrackBalanceCreditSchemaFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackBalanceCreditSchema$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackBalanceCreditSchema' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackBalanceDisplay$inboundSchema: z.ZodMiniType< - BalancesTrackBalanceDisplay, - unknown -> = z.object({ - singular: z.optional(z.nullable(types.string())), - plural: z.optional(z.nullable(types.string())), -}); - -export function balancesTrackBalanceDisplayFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackBalanceDisplay$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackBalanceDisplay' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackBalanceFeature$inboundSchema: z.ZodMiniType< - BalancesTrackBalanceFeature, - unknown -> = z.pipe( - z.object({ - id: types.string(), - name: types.string(), - type: BalancesTrackBalanceType$inboundSchema, - consumable: types.boolean(), - event_names: types.optional(z.array(types.string())), - credit_schema: types.optional( - z.array(z.lazy(() => BalancesTrackBalanceCreditSchema$inboundSchema)), - ), - display: types.optional( - z.lazy(() => BalancesTrackBalanceDisplay$inboundSchema), - ), - archived: types.boolean(), - }), - z.transform((v) => { - return remap$(v, { - "event_names": "eventNames", - "credit_schema": "creditSchema", - }); - }), -); - -export function balancesTrackBalanceFeatureFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackBalanceFeature$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackBalanceFeature' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackBalanceIntervalEnum$inboundSchema: z.ZodMiniType< - BalancesTrackBalanceIntervalEnum, - unknown -> = openEnums.inboundSchema(BalancesTrackBalanceIntervalEnum); - -/** @internal */ -export const BalancesTrackBalanceIntervalUnion$inboundSchema: z.ZodMiniType< - BalancesTrackBalanceIntervalUnion, - unknown -> = smartUnion([ - BalancesTrackBalanceIntervalEnum$inboundSchema, - types.string(), -]); - -export function balancesTrackBalanceIntervalUnionFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackBalanceIntervalUnion$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackBalanceIntervalUnion' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackBalanceReset$inboundSchema: z.ZodMiniType< - BalancesTrackBalanceReset, - unknown -> = z.pipe( - z.object({ - interval: smartUnion([ - BalancesTrackBalanceIntervalEnum$inboundSchema, - types.string(), - ]), - interval_count: types.optional(types.number()), - resets_at: types.nullable(types.number()), - }), - z.transform((v) => { - return remap$(v, { - "interval_count": "intervalCount", - "resets_at": "resetsAt", - }); - }), -); - -export function balancesTrackBalanceResetFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackBalanceReset$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackBalanceReset' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackBalanceTo$inboundSchema: z.ZodMiniType< - BalancesTrackBalanceTo, - unknown -> = smartUnion([types.number(), types.string()]); - -export function balancesTrackBalanceToFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackBalanceTo$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackBalanceTo' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackBalanceTier$inboundSchema: z.ZodMiniType< - BalancesTrackBalanceTier, - unknown -> = z.object({ - to: smartUnion([types.number(), types.string()]), - amount: types.number(), -}); - -export function balancesTrackBalanceTierFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackBalanceTier$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackBalanceTier' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackBalanceBillingMethod$inboundSchema: z.ZodMiniType< - BalancesTrackBalanceBillingMethod, - unknown -> = openEnums.inboundSchema(BalancesTrackBalanceBillingMethod); - -/** @internal */ -export const BalancesTrackBalancePrice$inboundSchema: z.ZodMiniType< - BalancesTrackBalancePrice, - unknown -> = z.pipe( - z.object({ - amount: types.optional(types.number()), - tiers: types.optional( - z.array(z.lazy(() => BalancesTrackBalanceTier$inboundSchema)), - ), - billing_units: types.number(), - billing_method: BalancesTrackBalanceBillingMethod$inboundSchema, - max_purchase: types.nullable(types.number()), - }), - z.transform((v) => { - return remap$(v, { - "billing_units": "billingUnits", - "billing_method": "billingMethod", - "max_purchase": "maxPurchase", - }); - }), -); - -export function balancesTrackBalancePriceFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackBalancePrice$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackBalancePrice' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackBalanceBreakdown$inboundSchema: z.ZodMiniType< - BalancesTrackBalanceBreakdown, - unknown -> = z.pipe( - z.object({ - id: z._default(types.string(), ""), - plan_id: types.nullable(types.string()), - included_grant: types.number(), - prepaid_grant: types.number(), - remaining: types.number(), - usage: types.number(), - unlimited: types.boolean(), - reset: types.nullable( - z.lazy(() => BalancesTrackBalanceReset$inboundSchema), - ), - price: types.nullable( - z.lazy(() => BalancesTrackBalancePrice$inboundSchema), - ), - expires_at: types.nullable(types.number()), - }), - z.transform((v) => { - return remap$(v, { - "plan_id": "planId", - "included_grant": "includedGrant", - "prepaid_grant": "prepaidGrant", - "expires_at": "expiresAt", - }); - }), -); - -export function balancesTrackBalanceBreakdownFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackBalanceBreakdown$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackBalanceBreakdown' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackBalanceRollover$inboundSchema: z.ZodMiniType< - BalancesTrackBalanceRollover, - unknown -> = z.pipe( - z.object({ - balance: types.number(), - expires_at: types.number(), - }), - z.transform((v) => { - return remap$(v, { - "expires_at": "expiresAt", - }); - }), -); - -export function balancesTrackBalanceRolloverFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackBalanceRollover$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackBalanceRollover' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackBalance$inboundSchema: z.ZodMiniType< - BalancesTrackBalance, - unknown -> = z.pipe( - z.object({ - feature_id: types.string(), - feature: types.optional( - z.lazy(() => BalancesTrackBalanceFeature$inboundSchema), - ), - granted: types.number(), - remaining: types.number(), - usage: types.number(), - unlimited: types.boolean(), - overage_allowed: types.boolean(), - max_purchase: types.nullable(types.number()), - next_reset_at: types.nullable(types.number()), - breakdown: types.optional( - z.array(z.lazy(() => BalancesTrackBalanceBreakdown$inboundSchema)), - ), - rollovers: types.optional( - z.array(z.lazy(() => BalancesTrackBalanceRollover$inboundSchema)), - ), - }), - z.transform((v) => { - return remap$(v, { - "feature_id": "featureId", - "overage_allowed": "overageAllowed", - "max_purchase": "maxPurchase", - "next_reset_at": "nextResetAt", - }); - }), -); - -export function balancesTrackBalanceFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackBalance$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackBalance' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackType$inboundSchema: z.ZodMiniType< - BalancesTrackType, - unknown -> = openEnums.inboundSchema(BalancesTrackType); - -/** @internal */ -export const BalancesTrackCreditSchema$inboundSchema: z.ZodMiniType< - BalancesTrackCreditSchema, - unknown -> = z.pipe( - z.object({ - metered_feature_id: types.string(), - credit_cost: types.number(), - }), - z.transform((v) => { - return remap$(v, { - "metered_feature_id": "meteredFeatureId", - "credit_cost": "creditCost", - }); - }), -); - -export function balancesTrackCreditSchemaFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackCreditSchema$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackCreditSchema' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackDisplay$inboundSchema: z.ZodMiniType< - BalancesTrackDisplay, - unknown -> = z.object({ - singular: z.optional(z.nullable(types.string())), - plural: z.optional(z.nullable(types.string())), -}); - -export function balancesTrackDisplayFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackDisplay$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackDisplay' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackFeature$inboundSchema: z.ZodMiniType< - BalancesTrackFeature, - unknown -> = z.pipe( - z.object({ - id: types.string(), - name: types.string(), - type: BalancesTrackType$inboundSchema, - consumable: types.boolean(), - event_names: types.optional(z.array(types.string())), - credit_schema: types.optional( - z.array(z.lazy(() => BalancesTrackCreditSchema$inboundSchema)), - ), - display: types.optional(z.lazy(() => BalancesTrackDisplay$inboundSchema)), - archived: types.boolean(), - }), - z.transform((v) => { - return remap$(v, { - "event_names": "eventNames", - "credit_schema": "creditSchema", - }); - }), -); - -export function balancesTrackFeatureFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackFeature$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackFeature' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackIntervalEnum$inboundSchema: z.ZodMiniType< - BalancesTrackIntervalEnum, - unknown -> = openEnums.inboundSchema(BalancesTrackIntervalEnum); - -/** @internal */ -export const BalancesTrackIntervalUnion$inboundSchema: z.ZodMiniType< - BalancesTrackIntervalUnion, - unknown -> = smartUnion([BalancesTrackIntervalEnum$inboundSchema, types.string()]); - -export function balancesTrackIntervalUnionFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackIntervalUnion$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackIntervalUnion' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackReset$inboundSchema: z.ZodMiniType< - BalancesTrackReset, - unknown -> = z.pipe( - z.object({ - interval: smartUnion([ - BalancesTrackIntervalEnum$inboundSchema, - types.string(), - ]), - interval_count: types.optional(types.number()), - resets_at: types.nullable(types.number()), - }), - z.transform((v) => { - return remap$(v, { - "interval_count": "intervalCount", - "resets_at": "resetsAt", - }); - }), -); - -export function balancesTrackResetFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackReset$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackReset' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackTo$inboundSchema: z.ZodMiniType< - BalancesTrackTo, - unknown -> = smartUnion([types.number(), types.string()]); - -export function balancesTrackToFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackTo$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackTo' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackTier$inboundSchema: z.ZodMiniType< - BalancesTrackTier, - unknown -> = z.object({ - to: smartUnion([types.number(), types.string()]), - amount: types.number(), -}); - -export function balancesTrackTierFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackTier$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackTier' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackBillingMethod$inboundSchema: z.ZodMiniType< - BalancesTrackBillingMethod, - unknown -> = openEnums.inboundSchema(BalancesTrackBillingMethod); - -/** @internal */ -export const BalancesTrackPrice$inboundSchema: z.ZodMiniType< - BalancesTrackPrice, - unknown -> = z.pipe( - z.object({ - amount: types.optional(types.number()), - tiers: types.optional( - z.array(z.lazy(() => BalancesTrackTier$inboundSchema)), - ), - billing_units: types.number(), - billing_method: BalancesTrackBillingMethod$inboundSchema, - max_purchase: types.nullable(types.number()), - }), - z.transform((v) => { - return remap$(v, { - "billing_units": "billingUnits", - "billing_method": "billingMethod", - "max_purchase": "maxPurchase", - }); - }), -); - -export function balancesTrackPriceFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackPrice$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackPrice' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackBreakdown$inboundSchema: z.ZodMiniType< - BalancesTrackBreakdown, - unknown -> = z.pipe( - z.object({ - id: z._default(types.string(), ""), - plan_id: types.nullable(types.string()), - included_grant: types.number(), - prepaid_grant: types.number(), - remaining: types.number(), - usage: types.number(), - unlimited: types.boolean(), - reset: types.nullable(z.lazy(() => BalancesTrackReset$inboundSchema)), - price: types.nullable(z.lazy(() => BalancesTrackPrice$inboundSchema)), - expires_at: types.nullable(types.number()), - }), - z.transform((v) => { - return remap$(v, { - "plan_id": "planId", - "included_grant": "includedGrant", - "prepaid_grant": "prepaidGrant", - "expires_at": "expiresAt", - }); - }), -); - -export function balancesTrackBreakdownFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackBreakdown$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackBreakdown' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackRollover$inboundSchema: z.ZodMiniType< - BalancesTrackRollover, - unknown -> = z.pipe( - z.object({ - balance: types.number(), - expires_at: types.number(), - }), - z.transform((v) => { - return remap$(v, { - "expires_at": "expiresAt", - }); - }), -); - -export function balancesTrackRolloverFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackRollover$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackRollover' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackBalances$inboundSchema: z.ZodMiniType< - BalancesTrackBalances, - unknown -> = z.pipe( - z.object({ - feature_id: types.string(), - feature: types.optional(z.lazy(() => BalancesTrackFeature$inboundSchema)), - granted: types.number(), - remaining: types.number(), - usage: types.number(), - unlimited: types.boolean(), - overage_allowed: types.boolean(), - max_purchase: types.nullable(types.number()), - next_reset_at: types.nullable(types.number()), - breakdown: types.optional( - z.array(z.lazy(() => BalancesTrackBreakdown$inboundSchema)), - ), - rollovers: types.optional( - z.array(z.lazy(() => BalancesTrackRollover$inboundSchema)), - ), - }), - z.transform((v) => { - return remap$(v, { - "feature_id": "featureId", - "overage_allowed": "overageAllowed", - "max_purchase": "maxPurchase", - "next_reset_at": "nextResetAt", - }); - }), -); - -export function balancesTrackBalancesFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackBalances$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackBalances' from JSON`, - ); -} - -/** @internal */ -export const BalancesTrackResponse$inboundSchema: z.ZodMiniType< - BalancesTrackResponse, - unknown -> = z.pipe( - z.object({ - customer_id: types.string(), - entity_id: types.optional(types.string()), - event_name: types.optional(types.string()), - value: types.number(), - balance: types.nullable(z.lazy(() => BalancesTrackBalance$inboundSchema)), - balances: types.optional( - z.record(z.string(), z.lazy(() => BalancesTrackBalances$inboundSchema)), - ), - }), - z.transform((v) => { - return remap$(v, { - "customer_id": "customerId", - "entity_id": "entityId", - "event_name": "eventName", - }); - }), -); - -export function balancesTrackResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesTrackResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesTrackResponse' from JSON`, - ); -} diff --git a/packages/sdk/src/models/balances-update-op.ts b/packages/sdk/src/models/balances-update-op.ts deleted file mode 100644 index 111f5ade1..000000000 --- a/packages/sdk/src/models/balances-update-op.ts +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod/v4-mini"; -import { remap as remap$ } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { ClosedEnum } from "../types/enums.js"; -import { Result as SafeParseResult } from "../types/fp.js"; -import * as types from "../types/primitives.js"; -import { SDKValidationError } from "./sdk-validation-error.js"; - -export type BalancesUpdateGlobals = { - xApiVersion?: string | undefined; -}; - -/** - * The interval to update balance for. - */ -export const BalancesUpdateInterval = { - OneOff: "one_off", - Minute: "minute", - Hour: "hour", - Day: "day", - Week: "week", - Month: "month", - Quarter: "quarter", - SemiAnnual: "semi_annual", - Year: "year", -} as const; -/** - * The interval to update balance for. - */ -export type BalancesUpdateInterval = ClosedEnum; - -export type BalancesUpdateRequest = { - /** - * The ID of the customer. - */ - customerId: string; - /** - * The ID of the entity to update balance for (if using entity balances). - */ - entityId?: string | undefined; - /** - * The ID of the feature to update balance for. - */ - featureId: string; - /** - * The new balance value to set. - */ - currentBalance?: number | undefined; - /** - * The interval to update balance for. - */ - interval?: BalancesUpdateInterval | undefined; - grantedBalance?: number | undefined; - usage?: number | undefined; - customerEntitlementId?: string | undefined; - nextResetAt?: number | undefined; - addToBalance?: number | undefined; -}; - -/** - * OK - */ -export type BalancesUpdateResponse = { - success: boolean; -}; - -/** @internal */ -export const BalancesUpdateInterval$outboundSchema: z.ZodMiniEnum< - typeof BalancesUpdateInterval -> = z.enum(BalancesUpdateInterval); - -/** @internal */ -export type BalancesUpdateRequest$Outbound = { - customer_id: string; - entity_id?: string | undefined; - feature_id: string; - current_balance?: number | undefined; - interval?: string | undefined; - granted_balance?: number | undefined; - usage?: number | undefined; - customer_entitlement_id?: string | undefined; - next_reset_at?: number | undefined; - add_to_balance?: number | undefined; -}; - -/** @internal */ -export const BalancesUpdateRequest$outboundSchema: z.ZodMiniType< - BalancesUpdateRequest$Outbound, - BalancesUpdateRequest -> = z.pipe( - z.object({ - customerId: z.string(), - entityId: z.optional(z.string()), - featureId: z.string(), - currentBalance: z.optional(z.number()), - interval: z.optional(BalancesUpdateInterval$outboundSchema), - grantedBalance: z.optional(z.number()), - usage: z.optional(z.number()), - customerEntitlementId: z.optional(z.string()), - nextResetAt: z.optional(z.number()), - addToBalance: z.optional(z.number()), - }), - z.transform((v) => { - return remap$(v, { - customerId: "customer_id", - entityId: "entity_id", - featureId: "feature_id", - currentBalance: "current_balance", - grantedBalance: "granted_balance", - customerEntitlementId: "customer_entitlement_id", - nextResetAt: "next_reset_at", - addToBalance: "add_to_balance", - }); - }), -); - -export function balancesUpdateRequestToJSON( - balancesUpdateRequest: BalancesUpdateRequest, -): string { - return JSON.stringify( - BalancesUpdateRequest$outboundSchema.parse(balancesUpdateRequest), - ); -} - -/** @internal */ -export const BalancesUpdateResponse$inboundSchema: z.ZodMiniType< - BalancesUpdateResponse, - unknown -> = z.object({ - success: types.boolean(), -}); - -export function balancesUpdateResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BalancesUpdateResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesUpdateResponse' from JSON`, - ); -} diff --git a/packages/sdk/src/models/billing-attach-op.ts b/packages/sdk/src/models/billing-attach-op.ts index a80e00630..821ac49b5 100644 --- a/packages/sdk/src/models/billing-attach-op.ts +++ b/packages/sdk/src/models/billing-attach-op.ts @@ -16,7 +16,7 @@ export type BillingAttachGlobals = { xApiVersion?: string | undefined; }; -export type BillingAttachFeatureQuantities = { +export type BillingAttachFeatureQuantity = { featureId: string; quantity?: number | undefined; adjustable?: boolean | undefined; @@ -170,50 +170,74 @@ export type BillingAttachCustomize = { items?: Array | undefined; }; +/** + * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + */ export type BillingAttachInvoiceMode = { + /** + * When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. + */ enabled: boolean; + /** + * If true, enables the plan immediately even though the invoice is not paid yet. + */ enablePlanImmediately?: boolean | undefined; + /** + * If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. + */ finalize?: boolean | undefined; }; -export type BillingAttachDiscount2 = { - promotionCode: string; -}; - -export type BillingAttachDiscount1 = { - rewardId: string; -}; - -export type BillingAttachDiscountUnion = - | BillingAttachDiscount1 - | BillingAttachDiscount2; - -export const BillingAttachRedirectMode = { - Always: "always", - IfRequired: "if_required", - Never: "never", -} as const; -export type BillingAttachRedirectMode = ClosedEnum< - typeof BillingAttachRedirectMode ->; - -export const BillingAttachPlanSchedule = { - Immediate: "immediate", - EndOfCycle: "end_of_cycle", -} as const; -export type BillingAttachPlanSchedule = ClosedEnum< - typeof BillingAttachPlanSchedule ->; - +/** + * 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. + */ export const BillingAttachBillingBehavior = { ProrateImmediately: "prorate_immediately", NextCycleOnly: "next_cycle_only", } as const; +/** + * 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. + */ export type BillingAttachBillingBehavior = ClosedEnum< typeof BillingAttachBillingBehavior >; -export type BillingAttachRequest = { +export type BillingAttachDiscount2 = { + /** + * The promotion code to apply as a discount. + */ + promotionCode: string; +}; + +export type BillingAttachDiscount1 = { + /** + * The ID of the reward to apply as a discount. + */ + rewardId: string; +}; + +/** + * A discount to apply. Can be either a reward ID or a promotion code. + */ +export type BillingAttachDiscountUnion = + | BillingAttachDiscount1 + | BillingAttachDiscount2; + +/** + * When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + */ +export const BillingAttachPlanSchedule = { + Immediate: "immediate", + EndOfCycle: "end_of_cycle", +} as const; +/** + * When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + */ +export type BillingAttachPlanSchedule = ClosedEnum< + typeof BillingAttachPlanSchedule +>; + +export type AttachParams = { /** * The ID of the customer to attach the plan to. */ @@ -221,49 +245,105 @@ export type BillingAttachRequest = { /** * The ID of the entity to attach the plan to. */ - entityId?: string | null | undefined; + entityId?: string | undefined; + /** + * The ID of the plan. + */ + planId: string; /** * If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. */ - featureQuantities?: Array | null | undefined; + featureQuantities?: Array | undefined; /** * The version of the plan to attach. */ version?: number | undefined; + /** + * Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. + */ freeTrial?: BillingAttachFreeTrial | null | undefined; /** * Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. */ customize?: BillingAttachCustomize | undefined; - planId: string; + /** + * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + */ invoiceMode?: BillingAttachInvoiceMode | undefined; + /** + * 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. + */ + billingBehavior?: BillingAttachBillingBehavior | undefined; + /** + * List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + */ discounts?: | Array | undefined; - redirectMode?: BillingAttachRedirectMode | undefined; + /** + * URL to redirect to after successful checkout. + */ successUrl?: string | undefined; + /** + * Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + */ newBillingSubscription?: boolean | undefined; + /** + * When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + */ planSchedule?: BillingAttachPlanSchedule | undefined; - billingBehavior?: BillingAttachBillingBehavior | undefined; }; +/** + * Invoice details if an invoice was created. Only present when a charge was made. + */ export type BillingAttachInvoice = { + /** + * The status of the invoice (e.g., 'paid', 'open', 'draft'). + */ status: string | null; + /** + * The Stripe invoice ID. + */ stripeId: string; + /** + * The total amount of the invoice in cents. + */ total: number; + /** + * The three-letter ISO currency code (e.g., 'usd'). + */ currency: string; + /** + * URL to the hosted invoice page where the customer can view and pay the invoice. + */ hostedInvoiceUrl: string | null; }; +/** + * The type of action required to complete the payment. + */ export const BillingAttachCode = { ThreedsRequired: "3ds_required", PaymentMethodRequired: "payment_method_required", PaymentFailed: "payment_failed", } as const; +/** + * The type of action required to complete the payment. + */ export type BillingAttachCode = OpenEnum; +/** + * Details about any action required to complete the payment. Present when the payment could not be processed automatically. + */ export type BillingAttachRequiredAction = { + /** + * The type of action required to complete the payment. + */ code: BillingAttachCode; + /** + * A human-readable explanation of why this action is required. + */ reason: string; }; @@ -271,24 +351,39 @@ export type BillingAttachRequiredAction = { * OK */ export type BillingAttachResponse = { + /** + * The ID of the customer. + */ customerId: string; + /** + * The ID of the entity, if the plan was attached to an entity. + */ entityId?: string | undefined; + /** + * Invoice details if an invoice was created. Only present when a charge was made. + */ invoice?: BillingAttachInvoice | undefined; + /** + * URL to redirect the customer to complete payment. Null if no payment action is required. + */ paymentUrl: string | null; + /** + * Details about any action required to complete the payment. Present when the payment could not be processed automatically. + */ requiredAction?: BillingAttachRequiredAction | undefined; }; /** @internal */ -export type BillingAttachFeatureQuantities$Outbound = { +export type BillingAttachFeatureQuantity$Outbound = { feature_id: string; quantity?: number | undefined; adjustable?: boolean | undefined; }; /** @internal */ -export const BillingAttachFeatureQuantities$outboundSchema: z.ZodMiniType< - BillingAttachFeatureQuantities$Outbound, - BillingAttachFeatureQuantities +export const BillingAttachFeatureQuantity$outboundSchema: z.ZodMiniType< + BillingAttachFeatureQuantity$Outbound, + BillingAttachFeatureQuantity > = z.pipe( z.object({ featureId: z.string(), @@ -302,12 +397,12 @@ export const BillingAttachFeatureQuantities$outboundSchema: z.ZodMiniType< }), ); -export function billingAttachFeatureQuantitiesToJSON( - billingAttachFeatureQuantities: BillingAttachFeatureQuantities, +export function billingAttachFeatureQuantityToJSON( + billingAttachFeatureQuantity: BillingAttachFeatureQuantity, ): string { return JSON.stringify( - BillingAttachFeatureQuantities$outboundSchema.parse( - billingAttachFeatureQuantities, + BillingAttachFeatureQuantity$outboundSchema.parse( + billingAttachFeatureQuantity, ), ); } @@ -690,6 +785,11 @@ export function billingAttachInvoiceModeToJSON( ); } +/** @internal */ +export const BillingAttachBillingBehavior$outboundSchema: z.ZodMiniEnum< + typeof BillingAttachBillingBehavior +> = z.enum(BillingAttachBillingBehavior); + /** @internal */ export type BillingAttachDiscount2$Outbound = { promotion_code: string; @@ -768,104 +868,79 @@ export function billingAttachDiscountUnionToJSON( ); } -/** @internal */ -export const BillingAttachRedirectMode$outboundSchema: z.ZodMiniEnum< - typeof BillingAttachRedirectMode -> = z.enum(BillingAttachRedirectMode); - /** @internal */ export const BillingAttachPlanSchedule$outboundSchema: z.ZodMiniEnum< typeof BillingAttachPlanSchedule > = z.enum(BillingAttachPlanSchedule); /** @internal */ -export const BillingAttachBillingBehavior$outboundSchema: z.ZodMiniEnum< - typeof BillingAttachBillingBehavior -> = z.enum(BillingAttachBillingBehavior); - -/** @internal */ -export type BillingAttachRequest$Outbound = { +export type AttachParams$Outbound = { customer_id: string; - entity_id?: string | null | undefined; - feature_quantities?: - | Array - | null - | undefined; + entity_id?: string | undefined; + plan_id: string; + feature_quantities?: Array | undefined; version?: number | undefined; free_trial?: BillingAttachFreeTrial$Outbound | null | undefined; customize?: BillingAttachCustomize$Outbound | undefined; - plan_id: string; invoice_mode?: BillingAttachInvoiceMode$Outbound | undefined; + billing_behavior?: string | undefined; discounts?: | Array | undefined; - redirect_mode: string; success_url?: string | undefined; new_billing_subscription?: boolean | undefined; plan_schedule?: string | undefined; - billing_behavior?: string | undefined; }; /** @internal */ -export const BillingAttachRequest$outboundSchema: z.ZodMiniType< - BillingAttachRequest$Outbound, - BillingAttachRequest +export const AttachParams$outboundSchema: z.ZodMiniType< + AttachParams$Outbound, + AttachParams > = z.pipe( z.object({ customerId: z.string(), - entityId: z.optional(z.nullable(z.string())), - featureQuantities: z.optional(z.nullable(z.array(z.lazy(() => - BillingAttachFeatureQuantities$outboundSchema - )))), - version: z.optional(z.number()), - freeTrial: z.optional(z.nullable(z.lazy(() => - BillingAttachFreeTrial$outboundSchema - ))), - customize: z.optional(z.lazy(() => - BillingAttachCustomize$outboundSchema - )), + entityId: z.optional(z.string()), planId: z.string(), + featureQuantities: z.optional( + z.array(z.lazy(() => BillingAttachFeatureQuantity$outboundSchema)), + ), + version: z.optional(z.number()), + freeTrial: z.optional( + z.nullable(z.lazy(() => BillingAttachFreeTrial$outboundSchema)), + ), + customize: z.optional(z.lazy(() => BillingAttachCustomize$outboundSchema)), invoiceMode: z.optional( z.lazy(() => BillingAttachInvoiceMode$outboundSchema), ), + billingBehavior: z.optional(BillingAttachBillingBehavior$outboundSchema), discounts: z.optional(z.array(smartUnion([ z.lazy(() => BillingAttachDiscount1$outboundSchema), z.lazy(() => BillingAttachDiscount2$outboundSchema ), ]))), - redirectMode: z._default( - BillingAttachRedirectMode$outboundSchema, - "always", - ), successUrl: z.optional(z.string()), newBillingSubscription: z.optional(z.boolean()), planSchedule: z.optional(BillingAttachPlanSchedule$outboundSchema), - billingBehavior: z.optional(BillingAttachBillingBehavior$outboundSchema), }), z.transform((v) => { return remap$(v, { customerId: "customer_id", entityId: "entity_id", + planId: "plan_id", featureQuantities: "feature_quantities", freeTrial: "free_trial", - planId: "plan_id", invoiceMode: "invoice_mode", - redirectMode: "redirect_mode", + billingBehavior: "billing_behavior", successUrl: "success_url", newBillingSubscription: "new_billing_subscription", planSchedule: "plan_schedule", - billingBehavior: "billing_behavior", }); }), ); -export function billingAttachRequestToJSON( - billingAttachRequest: BillingAttachRequest, -): string { - return JSON.stringify( - BillingAttachRequest$outboundSchema.parse(billingAttachRequest), - ); +export function attachParamsToJSON(attachParams: AttachParams): string { + return JSON.stringify(AttachParams$outboundSchema.parse(attachParams)); } /** @internal */ diff --git a/packages/sdk/src/models/billing-preview-attach-op.ts b/packages/sdk/src/models/billing-preview-attach-op.ts deleted file mode 100644 index 8cad4b5fe..000000000 --- a/packages/sdk/src/models/billing-preview-attach-op.ts +++ /dev/null @@ -1,2162 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod/v4-mini"; -import { remap as remap$ } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import * as openEnums from "../types/enums.js"; -import { ClosedEnum, OpenEnum } from "../types/enums.js"; -import { Result as SafeParseResult } from "../types/fp.js"; -import * as types from "../types/primitives.js"; -import { smartUnion } from "../types/smart-union.js"; -import { Plan, Plan$inboundSchema } from "./plan.js"; -import { SDKValidationError } from "./sdk-validation-error.js"; - -export type BillingPreviewAttachGlobals = { - xApiVersion?: string | undefined; -}; - -export type BillingPreviewAttachFeatureQuantities = { - featureId: string; - quantity?: number | undefined; - adjustable?: boolean | undefined; -}; - -export const BillingPreviewAttachDurationType = { - Day: "day", - Month: "month", - Year: "year", -} as const; -export type BillingPreviewAttachDurationType = ClosedEnum< - typeof BillingPreviewAttachDurationType ->; - -export type BillingPreviewAttachFreeTrial = { - durationLength: number; - durationType?: BillingPreviewAttachDurationType | undefined; - cardRequired?: boolean | undefined; -}; - -export const BillingPreviewAttachPriceInterval = { - OneOff: "one_off", - Week: "week", - Month: "month", - Quarter: "quarter", - SemiAnnual: "semi_annual", - Year: "year", -} as const; -export type BillingPreviewAttachPriceInterval = ClosedEnum< - typeof BillingPreviewAttachPriceInterval ->; - -export type BillingPreviewAttachPriceRequest = { - amount: number; - interval: BillingPreviewAttachPriceInterval; - intervalCount?: number | undefined; -}; - -export const BillingPreviewAttachItemResetInterval = { - OneOff: "one_off", - Minute: "minute", - Hour: "hour", - Day: "day", - Week: "week", - Month: "month", - Quarter: "quarter", - SemiAnnual: "semi_annual", - Year: "year", -} as const; -export type BillingPreviewAttachItemResetInterval = ClosedEnum< - typeof BillingPreviewAttachItemResetInterval ->; - -export type BillingPreviewAttachCustomizeReset = { - interval: BillingPreviewAttachItemResetInterval; - intervalCount?: number | undefined; -}; - -export type BillingPreviewAttachTo = number | string; - -export type BillingPreviewAttachTierRequest = { - to: number | string; - amount: number; -}; - -export const BillingPreviewAttachItemPriceInterval = { - OneOff: "one_off", - Week: "week", - Month: "month", - Quarter: "quarter", - SemiAnnual: "semi_annual", - Year: "year", -} as const; -export type BillingPreviewAttachItemPriceInterval = ClosedEnum< - typeof BillingPreviewAttachItemPriceInterval ->; - -export const BillingPreviewAttachBillingMethodRequest = { - Prepaid: "prepaid", - UsageBased: "usage_based", -} as const; -export type BillingPreviewAttachBillingMethodRequest = ClosedEnum< - typeof BillingPreviewAttachBillingMethodRequest ->; - -export type BillingPreviewAttachItemPrice = { - amount?: number | undefined; - tiers?: Array | undefined; - interval: BillingPreviewAttachItemPriceInterval; - intervalCount?: number | undefined; - billingUnits?: number | undefined; - billingMethod: BillingPreviewAttachBillingMethodRequest; - maxPurchase?: number | undefined; -}; - -export const BillingPreviewAttachOnIncrease = { - BillImmediately: "bill_immediately", - ProrateImmediately: "prorate_immediately", - ProrateNextCycle: "prorate_next_cycle", - BillNextCycle: "bill_next_cycle", -} as const; -export type BillingPreviewAttachOnIncrease = ClosedEnum< - typeof BillingPreviewAttachOnIncrease ->; - -export const BillingPreviewAttachOnDecrease = { - Prorate: "prorate", - ProrateImmediately: "prorate_immediately", - ProrateNextCycle: "prorate_next_cycle", - None: "none", - NoProrations: "no_prorations", -} as const; -export type BillingPreviewAttachOnDecrease = ClosedEnum< - typeof BillingPreviewAttachOnDecrease ->; - -export type BillingPreviewAttachProration = { - onIncrease: BillingPreviewAttachOnIncrease; - onDecrease: BillingPreviewAttachOnDecrease; -}; - -export const BillingPreviewAttachExpiryDurationType = { - Month: "month", - Forever: "forever", -} as const; -export type BillingPreviewAttachExpiryDurationType = ClosedEnum< - typeof BillingPreviewAttachExpiryDurationType ->; - -export type BillingPreviewAttachRolloverRequest = { - max?: number | undefined; - expiryDurationType: BillingPreviewAttachExpiryDurationType; - expiryDurationLength?: number | undefined; -}; - -export type BillingPreviewAttachItem = { - featureId: string; - included?: number | undefined; - unlimited?: boolean | undefined; - reset?: BillingPreviewAttachCustomizeReset | undefined; - price?: BillingPreviewAttachItemPrice | undefined; - proration?: BillingPreviewAttachProration | undefined; - rollover?: BillingPreviewAttachRolloverRequest | undefined; -}; - -/** - * Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - */ -export type BillingPreviewAttachCustomize = { - price?: BillingPreviewAttachPriceRequest | null | undefined; - items?: Array | undefined; -}; - -export type BillingPreviewAttachInvoiceMode = { - enabled: boolean; - enablePlanImmediately?: boolean | undefined; - finalize?: boolean | undefined; -}; - -export type BillingPreviewAttachDiscountRequest2 = { - promotionCode: string; -}; - -export type BillingPreviewAttachDiscountRequest1 = { - rewardId: string; -}; - -export type BillingPreviewAttachDiscountUnion = - | BillingPreviewAttachDiscountRequest1 - | BillingPreviewAttachDiscountRequest2; - -export const BillingPreviewAttachRedirectMode = { - Always: "always", - IfRequired: "if_required", - Never: "never", -} as const; -export type BillingPreviewAttachRedirectMode = ClosedEnum< - typeof BillingPreviewAttachRedirectMode ->; - -export const BillingPreviewAttachPlanSchedule = { - Immediate: "immediate", - EndOfCycle: "end_of_cycle", -} as const; -export type BillingPreviewAttachPlanSchedule = ClosedEnum< - typeof BillingPreviewAttachPlanSchedule ->; - -export const BillingPreviewAttachBillingBehavior = { - ProrateImmediately: "prorate_immediately", - NextCycleOnly: "next_cycle_only", -} as const; -export type BillingPreviewAttachBillingBehavior = ClosedEnum< - typeof BillingPreviewAttachBillingBehavior ->; - -export type BillingPreviewAttachRequest = { - /** - * The ID of the customer to attach the plan to. - */ - customerId: string; - /** - * The ID of the entity to attach the plan to. - */ - entityId?: string | null | undefined; - /** - * If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. - */ - featureQuantities?: - | Array - | null - | undefined; - /** - * The version of the plan to attach. - */ - version?: number | undefined; - freeTrial?: BillingPreviewAttachFreeTrial | null | undefined; - /** - * Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - */ - customize?: BillingPreviewAttachCustomize | undefined; - planId: string; - invoiceMode?: BillingPreviewAttachInvoiceMode | undefined; - discounts?: - | Array< - | BillingPreviewAttachDiscountRequest1 - | BillingPreviewAttachDiscountRequest2 - > - | undefined; - redirectMode?: BillingPreviewAttachRedirectMode | undefined; - successUrl?: string | undefined; - newBillingSubscription?: boolean | undefined; - planSchedule?: BillingPreviewAttachPlanSchedule | undefined; - billingBehavior?: BillingPreviewAttachBillingBehavior | undefined; -}; - -export type BillingPreviewAttachDiscountResponse = { - amountOff: number; - percentOff?: number | undefined; - stripeCouponId?: string | undefined; - couponName?: string | undefined; -}; - -export type BillingPreviewAttachEffectivePeriod = { - start: number; - end: number; -}; - -export type BillingPreviewAttachLineItem = { - title: string; - description: string; - amount: number; - discounts?: Array | undefined; - planId: string; - totalQuantity: number; - paidQuantity: number; - deferredForTrial?: boolean | undefined; - effectivePeriod?: BillingPreviewAttachEffectivePeriod | undefined; - isBase?: boolean | undefined; -}; - -export type BillingPreviewAttachNextCycleDiscount = { - amountOff: number; - percentOff?: number | undefined; - stripeCouponId?: string | undefined; - couponName?: string | undefined; -}; - -export type BillingPreviewAttachNextCycleEffectivePeriod = { - start: number; - end: number; -}; - -export type BillingPreviewAttachNextCycleLineItem = { - title: string; - description: string; - amount: number; - discounts?: Array | undefined; - planId: string; - totalQuantity: number; - paidQuantity: number; - deferredForTrial?: boolean | undefined; - effectivePeriod?: BillingPreviewAttachNextCycleEffectivePeriod | undefined; - isBase?: boolean | undefined; -}; - -export type BillingPreviewAttachNextCycle = { - startsAt: number; - total: number; - lineItems: Array; -}; - -export type IncomingFeatureQuantity = { - featureId: string; - quantity: number; -}; - -export const IncomingType = { - Boolean: "boolean", - Metered: "metered", - CreditSystem: "credit_system", -} as const; -export type IncomingType = OpenEnum; - -export type IncomingCreditSchema = { - meteredFeatureId: string; - creditCost: number; -}; - -export type IncomingDisplay = { - singular?: string | null | undefined; - plural?: string | null | undefined; -}; - -export type IncomingFeature = { - id: string; - name: string; - type: IncomingType; - consumable: boolean; - eventNames?: Array | undefined; - creditSchema?: Array | undefined; - display?: IncomingDisplay | undefined; - archived: boolean; -}; - -export const IntervalIncomingEnum = { - OneOff: "one_off", - Minute: "minute", - Hour: "hour", - Day: "day", - Week: "week", - Month: "month", - Quarter: "quarter", - SemiAnnual: "semi_annual", - Year: "year", -} as const; -export type IntervalIncomingEnum = OpenEnum; - -export type IncomingIntervalUnion = IntervalIncomingEnum | string; - -export type IncomingReset = { - interval: IntervalIncomingEnum | string; - intervalCount?: number | undefined; - resetsAt: number | null; -}; - -export type IncomingTier = { - to?: any | undefined; - amount: number; -}; - -export const IncomingBillingMethod = { - Prepaid: "prepaid", - UsageBased: "usage_based", -} as const; -export type IncomingBillingMethod = OpenEnum; - -export type IncomingPrice = { - amount?: number | undefined; - tiers?: Array | undefined; - billingUnits: number; - billingMethod: IncomingBillingMethod; - maxPurchase: number | null; -}; - -export type IncomingBreakdown = { - id: string; - planId: string | null; - includedGrant: number; - prepaidGrant: number; - remaining: number; - usage: number; - unlimited: boolean; - reset: IncomingReset | null; - price: IncomingPrice | null; - expiresAt: number | null; -}; - -export type IncomingRollover = { - balance: number; - expiresAt: number; -}; - -export type IncomingBalances = { - featureId: string; - feature?: IncomingFeature | undefined; - granted: number; - remaining: number; - usage: number; - unlimited: boolean; - overageAllowed: boolean; - maxPurchase: number | null; - nextResetAt: number | null; - breakdown?: Array | undefined; - rollovers?: Array | undefined; -}; - -export type Incoming = { - plan: Plan; - featureQuantities: Array; - balances: { [k: string]: IncomingBalances }; - periodStart?: number | undefined; - periodEnd?: number | undefined; -}; - -export type OutgoingFeatureQuantity = { - featureId: string; - quantity: number; -}; - -export const OutgoingType = { - Boolean: "boolean", - Metered: "metered", - CreditSystem: "credit_system", -} as const; -export type OutgoingType = OpenEnum; - -export type OutgoingCreditSchema = { - meteredFeatureId: string; - creditCost: number; -}; - -export type OutgoingDisplay = { - singular?: string | null | undefined; - plural?: string | null | undefined; -}; - -export type OutgoingFeature = { - id: string; - name: string; - type: OutgoingType; - consumable: boolean; - eventNames?: Array | undefined; - creditSchema?: Array | undefined; - display?: OutgoingDisplay | undefined; - archived: boolean; -}; - -export const IntervalOutgoingEnum = { - OneOff: "one_off", - Minute: "minute", - Hour: "hour", - Day: "day", - Week: "week", - Month: "month", - Quarter: "quarter", - SemiAnnual: "semi_annual", - Year: "year", -} as const; -export type IntervalOutgoingEnum = OpenEnum; - -export type OutgoingIntervalUnion = IntervalOutgoingEnum | string; - -export type OutgoingReset = { - interval: IntervalOutgoingEnum | string; - intervalCount?: number | undefined; - resetsAt: number | null; -}; - -export type OutgoingTier = { - to?: any | undefined; - amount: number; -}; - -export const OutgoingBillingMethod = { - Prepaid: "prepaid", - UsageBased: "usage_based", -} as const; -export type OutgoingBillingMethod = OpenEnum; - -export type OutgoingPrice = { - amount?: number | undefined; - tiers?: Array | undefined; - billingUnits: number; - billingMethod: OutgoingBillingMethod; - maxPurchase: number | null; -}; - -export type OutgoingBreakdown = { - id: string; - planId: string | null; - includedGrant: number; - prepaidGrant: number; - remaining: number; - usage: number; - unlimited: boolean; - reset: OutgoingReset | null; - price: OutgoingPrice | null; - expiresAt: number | null; -}; - -export type OutgoingRollover = { - balance: number; - expiresAt: number; -}; - -export type OutgoingBalances = { - featureId: string; - feature?: OutgoingFeature | undefined; - granted: number; - remaining: number; - usage: number; - unlimited: boolean; - overageAllowed: boolean; - maxPurchase: number | null; - nextResetAt: number | null; - breakdown?: Array | undefined; - rollovers?: Array | undefined; -}; - -export type Outgoing = { - plan: Plan; - featureQuantities: Array; - balances: { [k: string]: OutgoingBalances }; - periodStart?: number | undefined; - periodEnd?: number | undefined; -}; - -export const RedirectType = { - StripeCheckout: "stripe_checkout", - AutumnCheckout: "autumn_checkout", -} as const; -export type RedirectType = OpenEnum; - -/** - * OK - */ -export type BillingPreviewAttachResponse = { - customerId: string; - lineItems: Array; - total: number; - currency: string; - periodStart?: number | undefined; - periodEnd?: number | undefined; - nextCycle?: BillingPreviewAttachNextCycle | undefined; - incoming: Array; - outgoing: Array; - redirectType: RedirectType | null; -}; - -/** @internal */ -export type BillingPreviewAttachFeatureQuantities$Outbound = { - feature_id: string; - quantity?: number | undefined; - adjustable?: boolean | undefined; -}; - -/** @internal */ -export const BillingPreviewAttachFeatureQuantities$outboundSchema: - z.ZodMiniType< - BillingPreviewAttachFeatureQuantities$Outbound, - BillingPreviewAttachFeatureQuantities - > = z.pipe( - z.object({ - featureId: z.string(), - quantity: z.optional(z.number()), - adjustable: z.optional(z.boolean()), - }), - z.transform((v) => { - return remap$(v, { - featureId: "feature_id", - }); - }), - ); - -export function billingPreviewAttachFeatureQuantitiesToJSON( - billingPreviewAttachFeatureQuantities: BillingPreviewAttachFeatureQuantities, -): string { - return JSON.stringify( - BillingPreviewAttachFeatureQuantities$outboundSchema.parse( - billingPreviewAttachFeatureQuantities, - ), - ); -} - -/** @internal */ -export const BillingPreviewAttachDurationType$outboundSchema: z.ZodMiniEnum< - typeof BillingPreviewAttachDurationType -> = z.enum(BillingPreviewAttachDurationType); - -/** @internal */ -export type BillingPreviewAttachFreeTrial$Outbound = { - duration_length: number; - duration_type: string; - card_required: boolean; -}; - -/** @internal */ -export const BillingPreviewAttachFreeTrial$outboundSchema: z.ZodMiniType< - BillingPreviewAttachFreeTrial$Outbound, - BillingPreviewAttachFreeTrial -> = z.pipe( - z.object({ - durationLength: z.number(), - durationType: z._default( - BillingPreviewAttachDurationType$outboundSchema, - "month", - ), - cardRequired: z._default(z.boolean(), true), - }), - z.transform((v) => { - return remap$(v, { - durationLength: "duration_length", - durationType: "duration_type", - cardRequired: "card_required", - }); - }), -); - -export function billingPreviewAttachFreeTrialToJSON( - billingPreviewAttachFreeTrial: BillingPreviewAttachFreeTrial, -): string { - return JSON.stringify( - BillingPreviewAttachFreeTrial$outboundSchema.parse( - billingPreviewAttachFreeTrial, - ), - ); -} - -/** @internal */ -export const BillingPreviewAttachPriceInterval$outboundSchema: z.ZodMiniEnum< - typeof BillingPreviewAttachPriceInterval -> = z.enum(BillingPreviewAttachPriceInterval); - -/** @internal */ -export type BillingPreviewAttachPriceRequest$Outbound = { - amount: number; - interval: string; - interval_count?: number | undefined; -}; - -/** @internal */ -export const BillingPreviewAttachPriceRequest$outboundSchema: z.ZodMiniType< - BillingPreviewAttachPriceRequest$Outbound, - BillingPreviewAttachPriceRequest -> = z.pipe( - z.object({ - amount: z.number(), - interval: BillingPreviewAttachPriceInterval$outboundSchema, - intervalCount: z.optional(z.number()), - }), - z.transform((v) => { - return remap$(v, { - intervalCount: "interval_count", - }); - }), -); - -export function billingPreviewAttachPriceRequestToJSON( - billingPreviewAttachPriceRequest: BillingPreviewAttachPriceRequest, -): string { - return JSON.stringify( - BillingPreviewAttachPriceRequest$outboundSchema.parse( - billingPreviewAttachPriceRequest, - ), - ); -} - -/** @internal */ -export const BillingPreviewAttachItemResetInterval$outboundSchema: - z.ZodMiniEnum = z.enum( - BillingPreviewAttachItemResetInterval, - ); - -/** @internal */ -export type BillingPreviewAttachCustomizeReset$Outbound = { - interval: string; - interval_count?: number | undefined; -}; - -/** @internal */ -export const BillingPreviewAttachCustomizeReset$outboundSchema: z.ZodMiniType< - BillingPreviewAttachCustomizeReset$Outbound, - BillingPreviewAttachCustomizeReset -> = z.pipe( - z.object({ - interval: BillingPreviewAttachItemResetInterval$outboundSchema, - intervalCount: z.optional(z.number()), - }), - z.transform((v) => { - return remap$(v, { - intervalCount: "interval_count", - }); - }), -); - -export function billingPreviewAttachCustomizeResetToJSON( - billingPreviewAttachCustomizeReset: BillingPreviewAttachCustomizeReset, -): string { - return JSON.stringify( - BillingPreviewAttachCustomizeReset$outboundSchema.parse( - billingPreviewAttachCustomizeReset, - ), - ); -} - -/** @internal */ -export type BillingPreviewAttachTo$Outbound = number | string; - -/** @internal */ -export const BillingPreviewAttachTo$outboundSchema: z.ZodMiniType< - BillingPreviewAttachTo$Outbound, - BillingPreviewAttachTo -> = smartUnion([z.number(), z.string()]); - -export function billingPreviewAttachToToJSON( - billingPreviewAttachTo: BillingPreviewAttachTo, -): string { - return JSON.stringify( - BillingPreviewAttachTo$outboundSchema.parse(billingPreviewAttachTo), - ); -} - -/** @internal */ -export type BillingPreviewAttachTierRequest$Outbound = { - to: number | string; - amount: number; -}; - -/** @internal */ -export const BillingPreviewAttachTierRequest$outboundSchema: z.ZodMiniType< - BillingPreviewAttachTierRequest$Outbound, - BillingPreviewAttachTierRequest -> = z.object({ - to: smartUnion([z.number(), z.string()]), - amount: z.number(), -}); - -export function billingPreviewAttachTierRequestToJSON( - billingPreviewAttachTierRequest: BillingPreviewAttachTierRequest, -): string { - return JSON.stringify( - BillingPreviewAttachTierRequest$outboundSchema.parse( - billingPreviewAttachTierRequest, - ), - ); -} - -/** @internal */ -export const BillingPreviewAttachItemPriceInterval$outboundSchema: - z.ZodMiniEnum = z.enum( - BillingPreviewAttachItemPriceInterval, - ); - -/** @internal */ -export const BillingPreviewAttachBillingMethodRequest$outboundSchema: - z.ZodMiniEnum = z.enum( - BillingPreviewAttachBillingMethodRequest, - ); - -/** @internal */ -export type BillingPreviewAttachItemPrice$Outbound = { - amount?: number | undefined; - tiers?: Array | undefined; - interval: string; - interval_count: number; - billing_units: number; - billing_method: string; - max_purchase?: number | undefined; -}; - -/** @internal */ -export const BillingPreviewAttachItemPrice$outboundSchema: z.ZodMiniType< - BillingPreviewAttachItemPrice$Outbound, - BillingPreviewAttachItemPrice -> = z.pipe( - z.object({ - amount: z.optional(z.number()), - tiers: z.optional( - z.array(z.lazy(() => BillingPreviewAttachTierRequest$outboundSchema)), - ), - interval: BillingPreviewAttachItemPriceInterval$outboundSchema, - intervalCount: z._default(z.number(), 1), - billingUnits: z._default(z.number(), 1), - billingMethod: BillingPreviewAttachBillingMethodRequest$outboundSchema, - maxPurchase: z.optional(z.number()), - }), - z.transform((v) => { - return remap$(v, { - intervalCount: "interval_count", - billingUnits: "billing_units", - billingMethod: "billing_method", - maxPurchase: "max_purchase", - }); - }), -); - -export function billingPreviewAttachItemPriceToJSON( - billingPreviewAttachItemPrice: BillingPreviewAttachItemPrice, -): string { - return JSON.stringify( - BillingPreviewAttachItemPrice$outboundSchema.parse( - billingPreviewAttachItemPrice, - ), - ); -} - -/** @internal */ -export const BillingPreviewAttachOnIncrease$outboundSchema: z.ZodMiniEnum< - typeof BillingPreviewAttachOnIncrease -> = z.enum(BillingPreviewAttachOnIncrease); - -/** @internal */ -export const BillingPreviewAttachOnDecrease$outboundSchema: z.ZodMiniEnum< - typeof BillingPreviewAttachOnDecrease -> = z.enum(BillingPreviewAttachOnDecrease); - -/** @internal */ -export type BillingPreviewAttachProration$Outbound = { - on_increase: string; - on_decrease: string; -}; - -/** @internal */ -export const BillingPreviewAttachProration$outboundSchema: z.ZodMiniType< - BillingPreviewAttachProration$Outbound, - BillingPreviewAttachProration -> = z.pipe( - z.object({ - onIncrease: BillingPreviewAttachOnIncrease$outboundSchema, - onDecrease: BillingPreviewAttachOnDecrease$outboundSchema, - }), - z.transform((v) => { - return remap$(v, { - onIncrease: "on_increase", - onDecrease: "on_decrease", - }); - }), -); - -export function billingPreviewAttachProrationToJSON( - billingPreviewAttachProration: BillingPreviewAttachProration, -): string { - return JSON.stringify( - BillingPreviewAttachProration$outboundSchema.parse( - billingPreviewAttachProration, - ), - ); -} - -/** @internal */ -export const BillingPreviewAttachExpiryDurationType$outboundSchema: - z.ZodMiniEnum = z.enum( - BillingPreviewAttachExpiryDurationType, - ); - -/** @internal */ -export type BillingPreviewAttachRolloverRequest$Outbound = { - max?: number | undefined; - expiry_duration_type: string; - expiry_duration_length?: number | undefined; -}; - -/** @internal */ -export const BillingPreviewAttachRolloverRequest$outboundSchema: z.ZodMiniType< - BillingPreviewAttachRolloverRequest$Outbound, - BillingPreviewAttachRolloverRequest -> = z.pipe( - z.object({ - max: z.optional(z.number()), - expiryDurationType: BillingPreviewAttachExpiryDurationType$outboundSchema, - expiryDurationLength: z.optional(z.number()), - }), - z.transform((v) => { - return remap$(v, { - expiryDurationType: "expiry_duration_type", - expiryDurationLength: "expiry_duration_length", - }); - }), -); - -export function billingPreviewAttachRolloverRequestToJSON( - billingPreviewAttachRolloverRequest: BillingPreviewAttachRolloverRequest, -): string { - return JSON.stringify( - BillingPreviewAttachRolloverRequest$outboundSchema.parse( - billingPreviewAttachRolloverRequest, - ), - ); -} - -/** @internal */ -export type BillingPreviewAttachItem$Outbound = { - feature_id: string; - included?: number | undefined; - unlimited?: boolean | undefined; - reset?: BillingPreviewAttachCustomizeReset$Outbound | undefined; - price?: BillingPreviewAttachItemPrice$Outbound | undefined; - proration?: BillingPreviewAttachProration$Outbound | undefined; - rollover?: BillingPreviewAttachRolloverRequest$Outbound | undefined; -}; - -/** @internal */ -export const BillingPreviewAttachItem$outboundSchema: z.ZodMiniType< - BillingPreviewAttachItem$Outbound, - BillingPreviewAttachItem -> = z.pipe( - z.object({ - featureId: z.string(), - included: z.optional(z.number()), - unlimited: z.optional(z.boolean()), - reset: z.optional( - z.lazy(() => BillingPreviewAttachCustomizeReset$outboundSchema), - ), - price: z.optional( - z.lazy(() => BillingPreviewAttachItemPrice$outboundSchema), - ), - proration: z.optional( - z.lazy(() => BillingPreviewAttachProration$outboundSchema), - ), - rollover: z.optional( - z.lazy(() => BillingPreviewAttachRolloverRequest$outboundSchema), - ), - }), - z.transform((v) => { - return remap$(v, { - featureId: "feature_id", - }); - }), -); - -export function billingPreviewAttachItemToJSON( - billingPreviewAttachItem: BillingPreviewAttachItem, -): string { - return JSON.stringify( - BillingPreviewAttachItem$outboundSchema.parse(billingPreviewAttachItem), - ); -} - -/** @internal */ -export type BillingPreviewAttachCustomize$Outbound = { - price?: BillingPreviewAttachPriceRequest$Outbound | null | undefined; - items?: Array | undefined; -}; - -/** @internal */ -export const BillingPreviewAttachCustomize$outboundSchema: z.ZodMiniType< - BillingPreviewAttachCustomize$Outbound, - BillingPreviewAttachCustomize -> = z.object({ - price: z.optional( - z.nullable(z.lazy(() => BillingPreviewAttachPriceRequest$outboundSchema)), - ), - items: z.optional( - z.array(z.lazy(() => BillingPreviewAttachItem$outboundSchema)), - ), -}); - -export function billingPreviewAttachCustomizeToJSON( - billingPreviewAttachCustomize: BillingPreviewAttachCustomize, -): string { - return JSON.stringify( - BillingPreviewAttachCustomize$outboundSchema.parse( - billingPreviewAttachCustomize, - ), - ); -} - -/** @internal */ -export type BillingPreviewAttachInvoiceMode$Outbound = { - enabled: boolean; - enable_plan_immediately: boolean; - finalize: boolean; -}; - -/** @internal */ -export const BillingPreviewAttachInvoiceMode$outboundSchema: z.ZodMiniType< - BillingPreviewAttachInvoiceMode$Outbound, - BillingPreviewAttachInvoiceMode -> = z.pipe( - z.object({ - enabled: z.boolean(), - enablePlanImmediately: z._default(z.boolean(), false), - finalize: z._default(z.boolean(), true), - }), - z.transform((v) => { - return remap$(v, { - enablePlanImmediately: "enable_plan_immediately", - }); - }), -); - -export function billingPreviewAttachInvoiceModeToJSON( - billingPreviewAttachInvoiceMode: BillingPreviewAttachInvoiceMode, -): string { - return JSON.stringify( - BillingPreviewAttachInvoiceMode$outboundSchema.parse( - billingPreviewAttachInvoiceMode, - ), - ); -} - -/** @internal */ -export type BillingPreviewAttachDiscountRequest2$Outbound = { - promotion_code: string; -}; - -/** @internal */ -export const BillingPreviewAttachDiscountRequest2$outboundSchema: z.ZodMiniType< - BillingPreviewAttachDiscountRequest2$Outbound, - BillingPreviewAttachDiscountRequest2 -> = z.pipe( - z.object({ - promotionCode: z.string(), - }), - z.transform((v) => { - return remap$(v, { - promotionCode: "promotion_code", - }); - }), -); - -export function billingPreviewAttachDiscountRequest2ToJSON( - billingPreviewAttachDiscountRequest2: BillingPreviewAttachDiscountRequest2, -): string { - return JSON.stringify( - BillingPreviewAttachDiscountRequest2$outboundSchema.parse( - billingPreviewAttachDiscountRequest2, - ), - ); -} - -/** @internal */ -export type BillingPreviewAttachDiscountRequest1$Outbound = { - reward_id: string; -}; - -/** @internal */ -export const BillingPreviewAttachDiscountRequest1$outboundSchema: z.ZodMiniType< - BillingPreviewAttachDiscountRequest1$Outbound, - BillingPreviewAttachDiscountRequest1 -> = z.pipe( - z.object({ - rewardId: z.string(), - }), - z.transform((v) => { - return remap$(v, { - rewardId: "reward_id", - }); - }), -); - -export function billingPreviewAttachDiscountRequest1ToJSON( - billingPreviewAttachDiscountRequest1: BillingPreviewAttachDiscountRequest1, -): string { - return JSON.stringify( - BillingPreviewAttachDiscountRequest1$outboundSchema.parse( - billingPreviewAttachDiscountRequest1, - ), - ); -} - -/** @internal */ -export type BillingPreviewAttachDiscountUnion$Outbound = - | BillingPreviewAttachDiscountRequest1$Outbound - | BillingPreviewAttachDiscountRequest2$Outbound; - -/** @internal */ -export const BillingPreviewAttachDiscountUnion$outboundSchema: z.ZodMiniType< - BillingPreviewAttachDiscountUnion$Outbound, - BillingPreviewAttachDiscountUnion -> = smartUnion([ - z.lazy(() => BillingPreviewAttachDiscountRequest1$outboundSchema), - z.lazy(() => BillingPreviewAttachDiscountRequest2$outboundSchema), -]); - -export function billingPreviewAttachDiscountUnionToJSON( - billingPreviewAttachDiscountUnion: BillingPreviewAttachDiscountUnion, -): string { - return JSON.stringify( - BillingPreviewAttachDiscountUnion$outboundSchema.parse( - billingPreviewAttachDiscountUnion, - ), - ); -} - -/** @internal */ -export const BillingPreviewAttachRedirectMode$outboundSchema: z.ZodMiniEnum< - typeof BillingPreviewAttachRedirectMode -> = z.enum(BillingPreviewAttachRedirectMode); - -/** @internal */ -export const BillingPreviewAttachPlanSchedule$outboundSchema: z.ZodMiniEnum< - typeof BillingPreviewAttachPlanSchedule -> = z.enum(BillingPreviewAttachPlanSchedule); - -/** @internal */ -export const BillingPreviewAttachBillingBehavior$outboundSchema: z.ZodMiniEnum< - typeof BillingPreviewAttachBillingBehavior -> = z.enum(BillingPreviewAttachBillingBehavior); - -/** @internal */ -export type BillingPreviewAttachRequest$Outbound = { - customer_id: string; - entity_id?: string | null | undefined; - feature_quantities?: - | Array - | null - | undefined; - version?: number | undefined; - free_trial?: BillingPreviewAttachFreeTrial$Outbound | null | undefined; - customize?: BillingPreviewAttachCustomize$Outbound | undefined; - plan_id: string; - invoice_mode?: BillingPreviewAttachInvoiceMode$Outbound | undefined; - discounts?: - | Array< - | BillingPreviewAttachDiscountRequest1$Outbound - | BillingPreviewAttachDiscountRequest2$Outbound - > - | undefined; - redirect_mode: string; - success_url?: string | undefined; - new_billing_subscription?: boolean | undefined; - plan_schedule?: string | undefined; - billing_behavior?: string | undefined; -}; - -/** @internal */ -export const BillingPreviewAttachRequest$outboundSchema: z.ZodMiniType< - BillingPreviewAttachRequest$Outbound, - BillingPreviewAttachRequest -> = z.pipe( - z.object({ - customerId: z.string(), - entityId: z.optional(z.nullable(z.string())), - featureQuantities: z.optional(z.nullable(z.array(z.lazy(() => - BillingPreviewAttachFeatureQuantities$outboundSchema - )))), - version: z.optional(z.number()), - freeTrial: z.optional(z.nullable(z.lazy(() => - BillingPreviewAttachFreeTrial$outboundSchema - ))), - customize: z.optional(z.lazy(() => - BillingPreviewAttachCustomize$outboundSchema - )), - planId: z.string(), - invoiceMode: z.optional(z.lazy(() => - BillingPreviewAttachInvoiceMode$outboundSchema - )), - discounts: z.optional(z.array(smartUnion([ - z.lazy(() => BillingPreviewAttachDiscountRequest1$outboundSchema), - z.lazy(() => - BillingPreviewAttachDiscountRequest2$outboundSchema - ), - ]))), - redirectMode: z._default( - BillingPreviewAttachRedirectMode$outboundSchema, - "always", - ), - successUrl: z.optional(z.string()), - newBillingSubscription: z.optional(z.boolean()), - planSchedule: z.optional(BillingPreviewAttachPlanSchedule$outboundSchema), - billingBehavior: z.optional( - BillingPreviewAttachBillingBehavior$outboundSchema, - ), - }), - z.transform((v) => { - return remap$(v, { - customerId: "customer_id", - entityId: "entity_id", - featureQuantities: "feature_quantities", - freeTrial: "free_trial", - planId: "plan_id", - invoiceMode: "invoice_mode", - redirectMode: "redirect_mode", - successUrl: "success_url", - newBillingSubscription: "new_billing_subscription", - planSchedule: "plan_schedule", - billingBehavior: "billing_behavior", - }); - }), -); - -export function billingPreviewAttachRequestToJSON( - billingPreviewAttachRequest: BillingPreviewAttachRequest, -): string { - return JSON.stringify( - BillingPreviewAttachRequest$outboundSchema.parse( - billingPreviewAttachRequest, - ), - ); -} - -/** @internal */ -export const BillingPreviewAttachDiscountResponse$inboundSchema: z.ZodMiniType< - BillingPreviewAttachDiscountResponse, - unknown -> = z.object({ - amountOff: types.number(), - percentOff: types.optional(types.number()), - stripeCouponId: types.optional(types.string()), - couponName: types.optional(types.string()), -}); - -export function billingPreviewAttachDiscountResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => - BillingPreviewAttachDiscountResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingPreviewAttachDiscountResponse' from JSON`, - ); -} - -/** @internal */ -export const BillingPreviewAttachEffectivePeriod$inboundSchema: z.ZodMiniType< - BillingPreviewAttachEffectivePeriod, - unknown -> = z.object({ - start: types.number(), - end: types.number(), -}); - -export function billingPreviewAttachEffectivePeriodFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => - BillingPreviewAttachEffectivePeriod$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingPreviewAttachEffectivePeriod' from JSON`, - ); -} - -/** @internal */ -export const BillingPreviewAttachLineItem$inboundSchema: z.ZodMiniType< - BillingPreviewAttachLineItem, - unknown -> = z.pipe( - z.object({ - title: types.string(), - description: types.string(), - amount: types.number(), - discounts: types.optional( - z.array(z.lazy(() => BillingPreviewAttachDiscountResponse$inboundSchema)), - ), - plan_id: types.string(), - total_quantity: types.number(), - paid_quantity: types.number(), - deferred_for_trial: types.optional(types.boolean()), - effective_period: types.optional( - z.lazy(() => BillingPreviewAttachEffectivePeriod$inboundSchema), - ), - is_base: types.optional(types.boolean()), - }), - z.transform((v) => { - return remap$(v, { - "plan_id": "planId", - "total_quantity": "totalQuantity", - "paid_quantity": "paidQuantity", - "deferred_for_trial": "deferredForTrial", - "effective_period": "effectivePeriod", - "is_base": "isBase", - }); - }), -); - -export function billingPreviewAttachLineItemFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BillingPreviewAttachLineItem$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingPreviewAttachLineItem' from JSON`, - ); -} - -/** @internal */ -export const BillingPreviewAttachNextCycleDiscount$inboundSchema: z.ZodMiniType< - BillingPreviewAttachNextCycleDiscount, - unknown -> = z.object({ - amountOff: types.number(), - percentOff: types.optional(types.number()), - stripeCouponId: types.optional(types.string()), - couponName: types.optional(types.string()), -}); - -export function billingPreviewAttachNextCycleDiscountFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => - BillingPreviewAttachNextCycleDiscount$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingPreviewAttachNextCycleDiscount' from JSON`, - ); -} - -/** @internal */ -export const BillingPreviewAttachNextCycleEffectivePeriod$inboundSchema: - z.ZodMiniType = z - .object({ - start: types.number(), - end: types.number(), - }); - -export function billingPreviewAttachNextCycleEffectivePeriodFromJSON( - jsonString: string, -): SafeParseResult< - BillingPreviewAttachNextCycleEffectivePeriod, - SDKValidationError -> { - return safeParse( - jsonString, - (x) => - BillingPreviewAttachNextCycleEffectivePeriod$inboundSchema.parse( - JSON.parse(x), - ), - `Failed to parse 'BillingPreviewAttachNextCycleEffectivePeriod' from JSON`, - ); -} - -/** @internal */ -export const BillingPreviewAttachNextCycleLineItem$inboundSchema: z.ZodMiniType< - BillingPreviewAttachNextCycleLineItem, - unknown -> = z.pipe( - z.object({ - title: types.string(), - description: types.string(), - amount: types.number(), - discounts: types.optional( - z.array( - z.lazy(() => BillingPreviewAttachNextCycleDiscount$inboundSchema), - ), - ), - plan_id: types.string(), - total_quantity: types.number(), - paid_quantity: types.number(), - deferred_for_trial: types.optional(types.boolean()), - effective_period: types.optional( - z.lazy(() => BillingPreviewAttachNextCycleEffectivePeriod$inboundSchema), - ), - is_base: types.optional(types.boolean()), - }), - z.transform((v) => { - return remap$(v, { - "plan_id": "planId", - "total_quantity": "totalQuantity", - "paid_quantity": "paidQuantity", - "deferred_for_trial": "deferredForTrial", - "effective_period": "effectivePeriod", - "is_base": "isBase", - }); - }), -); - -export function billingPreviewAttachNextCycleLineItemFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => - BillingPreviewAttachNextCycleLineItem$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingPreviewAttachNextCycleLineItem' from JSON`, - ); -} - -/** @internal */ -export const BillingPreviewAttachNextCycle$inboundSchema: z.ZodMiniType< - BillingPreviewAttachNextCycle, - unknown -> = z.pipe( - z.object({ - starts_at: types.number(), - total: types.number(), - line_items: z.array( - z.lazy(() => BillingPreviewAttachNextCycleLineItem$inboundSchema), - ), - }), - z.transform((v) => { - return remap$(v, { - "starts_at": "startsAt", - "line_items": "lineItems", - }); - }), -); - -export function billingPreviewAttachNextCycleFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BillingPreviewAttachNextCycle$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingPreviewAttachNextCycle' from JSON`, - ); -} - -/** @internal */ -export const IncomingFeatureQuantity$inboundSchema: z.ZodMiniType< - IncomingFeatureQuantity, - unknown -> = z.pipe( - z.object({ - feature_id: types.string(), - quantity: types.number(), - }), - z.transform((v) => { - return remap$(v, { - "feature_id": "featureId", - }); - }), -); - -export function incomingFeatureQuantityFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => IncomingFeatureQuantity$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'IncomingFeatureQuantity' from JSON`, - ); -} - -/** @internal */ -export const IncomingType$inboundSchema: z.ZodMiniType = - openEnums.inboundSchema(IncomingType); - -/** @internal */ -export const IncomingCreditSchema$inboundSchema: z.ZodMiniType< - IncomingCreditSchema, - unknown -> = z.pipe( - z.object({ - metered_feature_id: types.string(), - credit_cost: types.number(), - }), - z.transform((v) => { - return remap$(v, { - "metered_feature_id": "meteredFeatureId", - "credit_cost": "creditCost", - }); - }), -); - -export function incomingCreditSchemaFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => IncomingCreditSchema$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'IncomingCreditSchema' from JSON`, - ); -} - -/** @internal */ -export const IncomingDisplay$inboundSchema: z.ZodMiniType< - IncomingDisplay, - unknown -> = z.object({ - singular: z.optional(z.nullable(types.string())), - plural: z.optional(z.nullable(types.string())), -}); - -export function incomingDisplayFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => IncomingDisplay$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'IncomingDisplay' from JSON`, - ); -} - -/** @internal */ -export const IncomingFeature$inboundSchema: z.ZodMiniType< - IncomingFeature, - unknown -> = z.pipe( - z.object({ - id: types.string(), - name: types.string(), - type: IncomingType$inboundSchema, - consumable: types.boolean(), - event_names: types.optional(z.array(types.string())), - credit_schema: types.optional( - z.array(z.lazy(() => IncomingCreditSchema$inboundSchema)), - ), - display: types.optional(z.lazy(() => IncomingDisplay$inboundSchema)), - archived: types.boolean(), - }), - z.transform((v) => { - return remap$(v, { - "event_names": "eventNames", - "credit_schema": "creditSchema", - }); - }), -); - -export function incomingFeatureFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => IncomingFeature$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'IncomingFeature' from JSON`, - ); -} - -/** @internal */ -export const IntervalIncomingEnum$inboundSchema: z.ZodMiniType< - IntervalIncomingEnum, - unknown -> = openEnums.inboundSchema(IntervalIncomingEnum); - -/** @internal */ -export const IncomingIntervalUnion$inboundSchema: z.ZodMiniType< - IncomingIntervalUnion, - unknown -> = smartUnion([IntervalIncomingEnum$inboundSchema, types.string()]); - -export function incomingIntervalUnionFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => IncomingIntervalUnion$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'IncomingIntervalUnion' from JSON`, - ); -} - -/** @internal */ -export const IncomingReset$inboundSchema: z.ZodMiniType< - IncomingReset, - unknown -> = z.pipe( - z.object({ - interval: smartUnion([IntervalIncomingEnum$inboundSchema, types.string()]), - interval_count: types.optional(types.number()), - resets_at: types.nullable(types.number()), - }), - z.transform((v) => { - return remap$(v, { - "interval_count": "intervalCount", - "resets_at": "resetsAt", - }); - }), -); - -export function incomingResetFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => IncomingReset$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'IncomingReset' from JSON`, - ); -} - -/** @internal */ -export const IncomingTier$inboundSchema: z.ZodMiniType = - z.object({ - to: types.optional(z.any()), - amount: types.number(), - }); - -export function incomingTierFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => IncomingTier$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'IncomingTier' from JSON`, - ); -} - -/** @internal */ -export const IncomingBillingMethod$inboundSchema: z.ZodMiniType< - IncomingBillingMethod, - unknown -> = openEnums.inboundSchema(IncomingBillingMethod); - -/** @internal */ -export const IncomingPrice$inboundSchema: z.ZodMiniType< - IncomingPrice, - unknown -> = z.pipe( - z.object({ - amount: types.optional(types.number()), - tiers: types.optional(z.array(z.lazy(() => IncomingTier$inboundSchema))), - billing_units: types.number(), - billing_method: IncomingBillingMethod$inboundSchema, - max_purchase: types.nullable(types.number()), - }), - z.transform((v) => { - return remap$(v, { - "billing_units": "billingUnits", - "billing_method": "billingMethod", - "max_purchase": "maxPurchase", - }); - }), -); - -export function incomingPriceFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => IncomingPrice$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'IncomingPrice' from JSON`, - ); -} - -/** @internal */ -export const IncomingBreakdown$inboundSchema: z.ZodMiniType< - IncomingBreakdown, - unknown -> = z.pipe( - z.object({ - id: z._default(types.string(), ""), - plan_id: types.nullable(types.string()), - included_grant: types.number(), - prepaid_grant: types.number(), - remaining: types.number(), - usage: types.number(), - unlimited: types.boolean(), - reset: types.nullable(z.lazy(() => IncomingReset$inboundSchema)), - price: types.nullable(z.lazy(() => IncomingPrice$inboundSchema)), - expires_at: types.nullable(types.number()), - }), - z.transform((v) => { - return remap$(v, { - "plan_id": "planId", - "included_grant": "includedGrant", - "prepaid_grant": "prepaidGrant", - "expires_at": "expiresAt", - }); - }), -); - -export function incomingBreakdownFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => IncomingBreakdown$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'IncomingBreakdown' from JSON`, - ); -} - -/** @internal */ -export const IncomingRollover$inboundSchema: z.ZodMiniType< - IncomingRollover, - unknown -> = z.pipe( - z.object({ - balance: types.number(), - expires_at: types.number(), - }), - z.transform((v) => { - return remap$(v, { - "expires_at": "expiresAt", - }); - }), -); - -export function incomingRolloverFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => IncomingRollover$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'IncomingRollover' from JSON`, - ); -} - -/** @internal */ -export const IncomingBalances$inboundSchema: z.ZodMiniType< - IncomingBalances, - unknown -> = z.pipe( - z.object({ - feature_id: types.string(), - feature: types.optional(z.lazy(() => IncomingFeature$inboundSchema)), - granted: types.number(), - remaining: types.number(), - usage: types.number(), - unlimited: types.boolean(), - overage_allowed: types.boolean(), - max_purchase: types.nullable(types.number()), - next_reset_at: types.nullable(types.number()), - breakdown: types.optional( - z.array(z.lazy(() => IncomingBreakdown$inboundSchema)), - ), - rollovers: types.optional( - z.array(z.lazy(() => IncomingRollover$inboundSchema)), - ), - }), - z.transform((v) => { - return remap$(v, { - "feature_id": "featureId", - "overage_allowed": "overageAllowed", - "max_purchase": "maxPurchase", - "next_reset_at": "nextResetAt", - }); - }), -); - -export function incomingBalancesFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => IncomingBalances$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'IncomingBalances' from JSON`, - ); -} - -/** @internal */ -export const Incoming$inboundSchema: z.ZodMiniType = z.pipe( - z.object({ - plan: Plan$inboundSchema, - feature_quantities: z.array(z.lazy(() => - IncomingFeatureQuantity$inboundSchema - )), - balances: z.record( - z.string(), - z.lazy(() => IncomingBalances$inboundSchema), - ), - period_start: types.optional(types.number()), - period_end: types.optional(types.number()), - }), - z.transform((v) => { - return remap$(v, { - "feature_quantities": "featureQuantities", - "period_start": "periodStart", - "period_end": "periodEnd", - }); - }), -); - -export function incomingFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => Incoming$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'Incoming' from JSON`, - ); -} - -/** @internal */ -export const OutgoingFeatureQuantity$inboundSchema: z.ZodMiniType< - OutgoingFeatureQuantity, - unknown -> = z.pipe( - z.object({ - feature_id: types.string(), - quantity: types.number(), - }), - z.transform((v) => { - return remap$(v, { - "feature_id": "featureId", - }); - }), -); - -export function outgoingFeatureQuantityFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => OutgoingFeatureQuantity$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'OutgoingFeatureQuantity' from JSON`, - ); -} - -/** @internal */ -export const OutgoingType$inboundSchema: z.ZodMiniType = - openEnums.inboundSchema(OutgoingType); - -/** @internal */ -export const OutgoingCreditSchema$inboundSchema: z.ZodMiniType< - OutgoingCreditSchema, - unknown -> = z.pipe( - z.object({ - metered_feature_id: types.string(), - credit_cost: types.number(), - }), - z.transform((v) => { - return remap$(v, { - "metered_feature_id": "meteredFeatureId", - "credit_cost": "creditCost", - }); - }), -); - -export function outgoingCreditSchemaFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => OutgoingCreditSchema$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'OutgoingCreditSchema' from JSON`, - ); -} - -/** @internal */ -export const OutgoingDisplay$inboundSchema: z.ZodMiniType< - OutgoingDisplay, - unknown -> = z.object({ - singular: z.optional(z.nullable(types.string())), - plural: z.optional(z.nullable(types.string())), -}); - -export function outgoingDisplayFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => OutgoingDisplay$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'OutgoingDisplay' from JSON`, - ); -} - -/** @internal */ -export const OutgoingFeature$inboundSchema: z.ZodMiniType< - OutgoingFeature, - unknown -> = z.pipe( - z.object({ - id: types.string(), - name: types.string(), - type: OutgoingType$inboundSchema, - consumable: types.boolean(), - event_names: types.optional(z.array(types.string())), - credit_schema: types.optional( - z.array(z.lazy(() => OutgoingCreditSchema$inboundSchema)), - ), - display: types.optional(z.lazy(() => OutgoingDisplay$inboundSchema)), - archived: types.boolean(), - }), - z.transform((v) => { - return remap$(v, { - "event_names": "eventNames", - "credit_schema": "creditSchema", - }); - }), -); - -export function outgoingFeatureFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => OutgoingFeature$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'OutgoingFeature' from JSON`, - ); -} - -/** @internal */ -export const IntervalOutgoingEnum$inboundSchema: z.ZodMiniType< - IntervalOutgoingEnum, - unknown -> = openEnums.inboundSchema(IntervalOutgoingEnum); - -/** @internal */ -export const OutgoingIntervalUnion$inboundSchema: z.ZodMiniType< - OutgoingIntervalUnion, - unknown -> = smartUnion([IntervalOutgoingEnum$inboundSchema, types.string()]); - -export function outgoingIntervalUnionFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => OutgoingIntervalUnion$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'OutgoingIntervalUnion' from JSON`, - ); -} - -/** @internal */ -export const OutgoingReset$inboundSchema: z.ZodMiniType< - OutgoingReset, - unknown -> = z.pipe( - z.object({ - interval: smartUnion([IntervalOutgoingEnum$inboundSchema, types.string()]), - interval_count: types.optional(types.number()), - resets_at: types.nullable(types.number()), - }), - z.transform((v) => { - return remap$(v, { - "interval_count": "intervalCount", - "resets_at": "resetsAt", - }); - }), -); - -export function outgoingResetFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => OutgoingReset$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'OutgoingReset' from JSON`, - ); -} - -/** @internal */ -export const OutgoingTier$inboundSchema: z.ZodMiniType = - z.object({ - to: types.optional(z.any()), - amount: types.number(), - }); - -export function outgoingTierFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => OutgoingTier$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'OutgoingTier' from JSON`, - ); -} - -/** @internal */ -export const OutgoingBillingMethod$inboundSchema: z.ZodMiniType< - OutgoingBillingMethod, - unknown -> = openEnums.inboundSchema(OutgoingBillingMethod); - -/** @internal */ -export const OutgoingPrice$inboundSchema: z.ZodMiniType< - OutgoingPrice, - unknown -> = z.pipe( - z.object({ - amount: types.optional(types.number()), - tiers: types.optional(z.array(z.lazy(() => OutgoingTier$inboundSchema))), - billing_units: types.number(), - billing_method: OutgoingBillingMethod$inboundSchema, - max_purchase: types.nullable(types.number()), - }), - z.transform((v) => { - return remap$(v, { - "billing_units": "billingUnits", - "billing_method": "billingMethod", - "max_purchase": "maxPurchase", - }); - }), -); - -export function outgoingPriceFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => OutgoingPrice$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'OutgoingPrice' from JSON`, - ); -} - -/** @internal */ -export const OutgoingBreakdown$inboundSchema: z.ZodMiniType< - OutgoingBreakdown, - unknown -> = z.pipe( - z.object({ - id: z._default(types.string(), ""), - plan_id: types.nullable(types.string()), - included_grant: types.number(), - prepaid_grant: types.number(), - remaining: types.number(), - usage: types.number(), - unlimited: types.boolean(), - reset: types.nullable(z.lazy(() => OutgoingReset$inboundSchema)), - price: types.nullable(z.lazy(() => OutgoingPrice$inboundSchema)), - expires_at: types.nullable(types.number()), - }), - z.transform((v) => { - return remap$(v, { - "plan_id": "planId", - "included_grant": "includedGrant", - "prepaid_grant": "prepaidGrant", - "expires_at": "expiresAt", - }); - }), -); - -export function outgoingBreakdownFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => OutgoingBreakdown$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'OutgoingBreakdown' from JSON`, - ); -} - -/** @internal */ -export const OutgoingRollover$inboundSchema: z.ZodMiniType< - OutgoingRollover, - unknown -> = z.pipe( - z.object({ - balance: types.number(), - expires_at: types.number(), - }), - z.transform((v) => { - return remap$(v, { - "expires_at": "expiresAt", - }); - }), -); - -export function outgoingRolloverFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => OutgoingRollover$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'OutgoingRollover' from JSON`, - ); -} - -/** @internal */ -export const OutgoingBalances$inboundSchema: z.ZodMiniType< - OutgoingBalances, - unknown -> = z.pipe( - z.object({ - feature_id: types.string(), - feature: types.optional(z.lazy(() => OutgoingFeature$inboundSchema)), - granted: types.number(), - remaining: types.number(), - usage: types.number(), - unlimited: types.boolean(), - overage_allowed: types.boolean(), - max_purchase: types.nullable(types.number()), - next_reset_at: types.nullable(types.number()), - breakdown: types.optional( - z.array(z.lazy(() => OutgoingBreakdown$inboundSchema)), - ), - rollovers: types.optional( - z.array(z.lazy(() => OutgoingRollover$inboundSchema)), - ), - }), - z.transform((v) => { - return remap$(v, { - "feature_id": "featureId", - "overage_allowed": "overageAllowed", - "max_purchase": "maxPurchase", - "next_reset_at": "nextResetAt", - }); - }), -); - -export function outgoingBalancesFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => OutgoingBalances$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'OutgoingBalances' from JSON`, - ); -} - -/** @internal */ -export const Outgoing$inboundSchema: z.ZodMiniType = z.pipe( - z.object({ - plan: Plan$inboundSchema, - feature_quantities: z.array(z.lazy(() => - OutgoingFeatureQuantity$inboundSchema - )), - balances: z.record( - z.string(), - z.lazy(() => OutgoingBalances$inboundSchema), - ), - period_start: types.optional(types.number()), - period_end: types.optional(types.number()), - }), - z.transform((v) => { - return remap$(v, { - "feature_quantities": "featureQuantities", - "period_start": "periodStart", - "period_end": "periodEnd", - }); - }), -); - -export function outgoingFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => Outgoing$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'Outgoing' from JSON`, - ); -} - -/** @internal */ -export const RedirectType$inboundSchema: z.ZodMiniType = - openEnums.inboundSchema(RedirectType); - -/** @internal */ -export const BillingPreviewAttachResponse$inboundSchema: z.ZodMiniType< - BillingPreviewAttachResponse, - unknown -> = z.pipe( - z.object({ - customer_id: types.string(), - line_items: z.array( - z.lazy(() => BillingPreviewAttachLineItem$inboundSchema), - ), - total: types.number(), - currency: types.string(), - period_start: types.optional(types.number()), - period_end: types.optional(types.number()), - next_cycle: types.optional( - z.lazy(() => BillingPreviewAttachNextCycle$inboundSchema), - ), - incoming: z.array(z.lazy(() => Incoming$inboundSchema)), - outgoing: z.array(z.lazy(() => Outgoing$inboundSchema)), - redirect_type: types.nullable(RedirectType$inboundSchema), - }), - z.transform((v) => { - return remap$(v, { - "customer_id": "customerId", - "line_items": "lineItems", - "period_start": "periodStart", - "period_end": "periodEnd", - "next_cycle": "nextCycle", - "redirect_type": "redirectType", - }); - }), -); - -export function billingPreviewAttachResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BillingPreviewAttachResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingPreviewAttachResponse' from JSON`, - ); -} diff --git a/packages/sdk/src/models/billing-preview-update-op.ts b/packages/sdk/src/models/billing-preview-update-op.ts deleted file mode 100644 index 6caf3a21e..000000000 --- a/packages/sdk/src/models/billing-preview-update-op.ts +++ /dev/null @@ -1,1058 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod/v4-mini"; -import { remap as remap$ } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { ClosedEnum } from "../types/enums.js"; -import { Result as SafeParseResult } from "../types/fp.js"; -import * as types from "../types/primitives.js"; -import { smartUnion } from "../types/smart-union.js"; -import { SDKValidationError } from "./sdk-validation-error.js"; - -export type BillingPreviewUpdateGlobals = { - xApiVersion?: string | undefined; -}; - -export type BillingPreviewUpdateFeatureQuantities = { - featureId: string; - quantity?: number | undefined; - adjustable?: boolean | undefined; -}; - -export const BillingPreviewUpdateDurationType = { - Day: "day", - Month: "month", - Year: "year", -} as const; -export type BillingPreviewUpdateDurationType = ClosedEnum< - typeof BillingPreviewUpdateDurationType ->; - -export type BillingPreviewUpdateFreeTrial = { - durationLength: number; - durationType?: BillingPreviewUpdateDurationType | undefined; - cardRequired?: boolean | undefined; -}; - -export const BillingPreviewUpdatePriceInterval = { - OneOff: "one_off", - Week: "week", - Month: "month", - Quarter: "quarter", - SemiAnnual: "semi_annual", - Year: "year", -} as const; -export type BillingPreviewUpdatePriceInterval = ClosedEnum< - typeof BillingPreviewUpdatePriceInterval ->; - -export type BillingPreviewUpdatePrice = { - amount: number; - interval: BillingPreviewUpdatePriceInterval; - intervalCount?: number | undefined; -}; - -export const BillingPreviewUpdateResetInterval = { - OneOff: "one_off", - Minute: "minute", - Hour: "hour", - Day: "day", - Week: "week", - Month: "month", - Quarter: "quarter", - SemiAnnual: "semi_annual", - Year: "year", -} as const; -export type BillingPreviewUpdateResetInterval = ClosedEnum< - typeof BillingPreviewUpdateResetInterval ->; - -export type BillingPreviewUpdateReset = { - interval: BillingPreviewUpdateResetInterval; - intervalCount?: number | undefined; -}; - -export type BillingPreviewUpdateTo = number | string; - -export type BillingPreviewUpdateTier = { - to: number | string; - amount: number; -}; - -export const BillingPreviewUpdateItemPriceInterval = { - OneOff: "one_off", - Week: "week", - Month: "month", - Quarter: "quarter", - SemiAnnual: "semi_annual", - Year: "year", -} as const; -export type BillingPreviewUpdateItemPriceInterval = ClosedEnum< - typeof BillingPreviewUpdateItemPriceInterval ->; - -export const BillingPreviewUpdateBillingMethod = { - Prepaid: "prepaid", - UsageBased: "usage_based", -} as const; -export type BillingPreviewUpdateBillingMethod = ClosedEnum< - typeof BillingPreviewUpdateBillingMethod ->; - -export type BillingPreviewUpdateItemPrice = { - amount?: number | undefined; - tiers?: Array | undefined; - interval: BillingPreviewUpdateItemPriceInterval; - intervalCount?: number | undefined; - billingUnits?: number | undefined; - billingMethod: BillingPreviewUpdateBillingMethod; - maxPurchase?: number | undefined; -}; - -export const BillingPreviewUpdateOnIncrease = { - BillImmediately: "bill_immediately", - ProrateImmediately: "prorate_immediately", - ProrateNextCycle: "prorate_next_cycle", - BillNextCycle: "bill_next_cycle", -} as const; -export type BillingPreviewUpdateOnIncrease = ClosedEnum< - typeof BillingPreviewUpdateOnIncrease ->; - -export const BillingPreviewUpdateOnDecrease = { - Prorate: "prorate", - ProrateImmediately: "prorate_immediately", - ProrateNextCycle: "prorate_next_cycle", - None: "none", - NoProrations: "no_prorations", -} as const; -export type BillingPreviewUpdateOnDecrease = ClosedEnum< - typeof BillingPreviewUpdateOnDecrease ->; - -export type BillingPreviewUpdateProration = { - onIncrease: BillingPreviewUpdateOnIncrease; - onDecrease: BillingPreviewUpdateOnDecrease; -}; - -export const BillingPreviewUpdateExpiryDurationType = { - Month: "month", - Forever: "forever", -} as const; -export type BillingPreviewUpdateExpiryDurationType = ClosedEnum< - typeof BillingPreviewUpdateExpiryDurationType ->; - -export type BillingPreviewUpdateRollover = { - max?: number | undefined; - expiryDurationType: BillingPreviewUpdateExpiryDurationType; - expiryDurationLength?: number | undefined; -}; - -export type BillingPreviewUpdateItem = { - featureId: string; - included?: number | undefined; - unlimited?: boolean | undefined; - reset?: BillingPreviewUpdateReset | undefined; - price?: BillingPreviewUpdateItemPrice | undefined; - proration?: BillingPreviewUpdateProration | undefined; - rollover?: BillingPreviewUpdateRollover | undefined; -}; - -/** - * Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - */ -export type BillingPreviewUpdateCustomize = { - price?: BillingPreviewUpdatePrice | null | undefined; - items?: Array | undefined; -}; - -export type BillingPreviewUpdateInvoiceMode = { - enabled: boolean; - enablePlanImmediately?: boolean | undefined; - finalize?: boolean | undefined; -}; - -export const BillingPreviewUpdateCancelAction = { - CancelImmediately: "cancel_immediately", - CancelEndOfCycle: "cancel_end_of_cycle", - Uncancel: "uncancel", -} as const; -export type BillingPreviewUpdateCancelAction = ClosedEnum< - typeof BillingPreviewUpdateCancelAction ->; - -export const BillingPreviewUpdateBillingBehavior = { - ProrateImmediately: "prorate_immediately", - NextCycleOnly: "next_cycle_only", -} as const; -export type BillingPreviewUpdateBillingBehavior = ClosedEnum< - typeof BillingPreviewUpdateBillingBehavior ->; - -export type BillingPreviewUpdateRequest = { - /** - * The ID of the customer to attach the plan to. - */ - customerId: string; - /** - * The ID of the entity to attach the plan to. - */ - entityId?: string | null | undefined; - /** - * If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. - */ - featureQuantities?: - | Array - | null - | undefined; - /** - * The version of the plan to attach. - */ - version?: number | undefined; - freeTrial?: BillingPreviewUpdateFreeTrial | null | undefined; - /** - * Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. - */ - customize?: BillingPreviewUpdateCustomize | undefined; - planId?: string | undefined; - invoiceMode?: BillingPreviewUpdateInvoiceMode | undefined; - cancelAction?: BillingPreviewUpdateCancelAction | undefined; - billingBehavior?: BillingPreviewUpdateBillingBehavior | undefined; -}; - -export type BillingPreviewUpdateDiscount = { - amountOff: number; - percentOff?: number | undefined; - stripeCouponId?: string | undefined; - couponName?: string | undefined; -}; - -export type BillingPreviewUpdateEffectivePeriod = { - start: number; - end: number; -}; - -export type BillingPreviewUpdateLineItem = { - title: string; - description: string; - amount: number; - discounts?: Array | undefined; - planId: string; - totalQuantity: number; - paidQuantity: number; - deferredForTrial?: boolean | undefined; - effectivePeriod?: BillingPreviewUpdateEffectivePeriod | undefined; - isBase?: boolean | undefined; -}; - -export type BillingPreviewUpdateNextCycleDiscount = { - amountOff: number; - percentOff?: number | undefined; - stripeCouponId?: string | undefined; - couponName?: string | undefined; -}; - -export type BillingPreviewUpdateNextCycleEffectivePeriod = { - start: number; - end: number; -}; - -export type BillingPreviewUpdateNextCycleLineItem = { - title: string; - description: string; - amount: number; - discounts?: Array | undefined; - planId: string; - totalQuantity: number; - paidQuantity: number; - deferredForTrial?: boolean | undefined; - effectivePeriod?: BillingPreviewUpdateNextCycleEffectivePeriod | undefined; - isBase?: boolean | undefined; -}; - -export type BillingPreviewUpdateNextCycle = { - startsAt: number; - total: number; - lineItems: Array; -}; - -/** - * OK - */ -export type BillingPreviewUpdateResponse = { - customerId: string; - lineItems: Array; - total: number; - currency: string; - periodStart?: number | undefined; - periodEnd?: number | undefined; - nextCycle?: BillingPreviewUpdateNextCycle | undefined; -}; - -/** @internal */ -export type BillingPreviewUpdateFeatureQuantities$Outbound = { - feature_id: string; - quantity?: number | undefined; - adjustable?: boolean | undefined; -}; - -/** @internal */ -export const BillingPreviewUpdateFeatureQuantities$outboundSchema: - z.ZodMiniType< - BillingPreviewUpdateFeatureQuantities$Outbound, - BillingPreviewUpdateFeatureQuantities - > = z.pipe( - z.object({ - featureId: z.string(), - quantity: z.optional(z.number()), - adjustable: z.optional(z.boolean()), - }), - z.transform((v) => { - return remap$(v, { - featureId: "feature_id", - }); - }), - ); - -export function billingPreviewUpdateFeatureQuantitiesToJSON( - billingPreviewUpdateFeatureQuantities: BillingPreviewUpdateFeatureQuantities, -): string { - return JSON.stringify( - BillingPreviewUpdateFeatureQuantities$outboundSchema.parse( - billingPreviewUpdateFeatureQuantities, - ), - ); -} - -/** @internal */ -export const BillingPreviewUpdateDurationType$outboundSchema: z.ZodMiniEnum< - typeof BillingPreviewUpdateDurationType -> = z.enum(BillingPreviewUpdateDurationType); - -/** @internal */ -export type BillingPreviewUpdateFreeTrial$Outbound = { - duration_length: number; - duration_type: string; - card_required: boolean; -}; - -/** @internal */ -export const BillingPreviewUpdateFreeTrial$outboundSchema: z.ZodMiniType< - BillingPreviewUpdateFreeTrial$Outbound, - BillingPreviewUpdateFreeTrial -> = z.pipe( - z.object({ - durationLength: z.number(), - durationType: z._default( - BillingPreviewUpdateDurationType$outboundSchema, - "month", - ), - cardRequired: z._default(z.boolean(), true), - }), - z.transform((v) => { - return remap$(v, { - durationLength: "duration_length", - durationType: "duration_type", - cardRequired: "card_required", - }); - }), -); - -export function billingPreviewUpdateFreeTrialToJSON( - billingPreviewUpdateFreeTrial: BillingPreviewUpdateFreeTrial, -): string { - return JSON.stringify( - BillingPreviewUpdateFreeTrial$outboundSchema.parse( - billingPreviewUpdateFreeTrial, - ), - ); -} - -/** @internal */ -export const BillingPreviewUpdatePriceInterval$outboundSchema: z.ZodMiniEnum< - typeof BillingPreviewUpdatePriceInterval -> = z.enum(BillingPreviewUpdatePriceInterval); - -/** @internal */ -export type BillingPreviewUpdatePrice$Outbound = { - amount: number; - interval: string; - interval_count?: number | undefined; -}; - -/** @internal */ -export const BillingPreviewUpdatePrice$outboundSchema: z.ZodMiniType< - BillingPreviewUpdatePrice$Outbound, - BillingPreviewUpdatePrice -> = z.pipe( - z.object({ - amount: z.number(), - interval: BillingPreviewUpdatePriceInterval$outboundSchema, - intervalCount: z.optional(z.number()), - }), - z.transform((v) => { - return remap$(v, { - intervalCount: "interval_count", - }); - }), -); - -export function billingPreviewUpdatePriceToJSON( - billingPreviewUpdatePrice: BillingPreviewUpdatePrice, -): string { - return JSON.stringify( - BillingPreviewUpdatePrice$outboundSchema.parse(billingPreviewUpdatePrice), - ); -} - -/** @internal */ -export const BillingPreviewUpdateResetInterval$outboundSchema: z.ZodMiniEnum< - typeof BillingPreviewUpdateResetInterval -> = z.enum(BillingPreviewUpdateResetInterval); - -/** @internal */ -export type BillingPreviewUpdateReset$Outbound = { - interval: string; - interval_count?: number | undefined; -}; - -/** @internal */ -export const BillingPreviewUpdateReset$outboundSchema: z.ZodMiniType< - BillingPreviewUpdateReset$Outbound, - BillingPreviewUpdateReset -> = z.pipe( - z.object({ - interval: BillingPreviewUpdateResetInterval$outboundSchema, - intervalCount: z.optional(z.number()), - }), - z.transform((v) => { - return remap$(v, { - intervalCount: "interval_count", - }); - }), -); - -export function billingPreviewUpdateResetToJSON( - billingPreviewUpdateReset: BillingPreviewUpdateReset, -): string { - return JSON.stringify( - BillingPreviewUpdateReset$outboundSchema.parse(billingPreviewUpdateReset), - ); -} - -/** @internal */ -export type BillingPreviewUpdateTo$Outbound = number | string; - -/** @internal */ -export const BillingPreviewUpdateTo$outboundSchema: z.ZodMiniType< - BillingPreviewUpdateTo$Outbound, - BillingPreviewUpdateTo -> = smartUnion([z.number(), z.string()]); - -export function billingPreviewUpdateToToJSON( - billingPreviewUpdateTo: BillingPreviewUpdateTo, -): string { - return JSON.stringify( - BillingPreviewUpdateTo$outboundSchema.parse(billingPreviewUpdateTo), - ); -} - -/** @internal */ -export type BillingPreviewUpdateTier$Outbound = { - to: number | string; - amount: number; -}; - -/** @internal */ -export const BillingPreviewUpdateTier$outboundSchema: z.ZodMiniType< - BillingPreviewUpdateTier$Outbound, - BillingPreviewUpdateTier -> = z.object({ - to: smartUnion([z.number(), z.string()]), - amount: z.number(), -}); - -export function billingPreviewUpdateTierToJSON( - billingPreviewUpdateTier: BillingPreviewUpdateTier, -): string { - return JSON.stringify( - BillingPreviewUpdateTier$outboundSchema.parse(billingPreviewUpdateTier), - ); -} - -/** @internal */ -export const BillingPreviewUpdateItemPriceInterval$outboundSchema: - z.ZodMiniEnum = z.enum( - BillingPreviewUpdateItemPriceInterval, - ); - -/** @internal */ -export const BillingPreviewUpdateBillingMethod$outboundSchema: z.ZodMiniEnum< - typeof BillingPreviewUpdateBillingMethod -> = z.enum(BillingPreviewUpdateBillingMethod); - -/** @internal */ -export type BillingPreviewUpdateItemPrice$Outbound = { - amount?: number | undefined; - tiers?: Array | undefined; - interval: string; - interval_count: number; - billing_units: number; - billing_method: string; - max_purchase?: number | undefined; -}; - -/** @internal */ -export const BillingPreviewUpdateItemPrice$outboundSchema: z.ZodMiniType< - BillingPreviewUpdateItemPrice$Outbound, - BillingPreviewUpdateItemPrice -> = z.pipe( - z.object({ - amount: z.optional(z.number()), - tiers: z.optional( - z.array(z.lazy(() => BillingPreviewUpdateTier$outboundSchema)), - ), - interval: BillingPreviewUpdateItemPriceInterval$outboundSchema, - intervalCount: z._default(z.number(), 1), - billingUnits: z._default(z.number(), 1), - billingMethod: BillingPreviewUpdateBillingMethod$outboundSchema, - maxPurchase: z.optional(z.number()), - }), - z.transform((v) => { - return remap$(v, { - intervalCount: "interval_count", - billingUnits: "billing_units", - billingMethod: "billing_method", - maxPurchase: "max_purchase", - }); - }), -); - -export function billingPreviewUpdateItemPriceToJSON( - billingPreviewUpdateItemPrice: BillingPreviewUpdateItemPrice, -): string { - return JSON.stringify( - BillingPreviewUpdateItemPrice$outboundSchema.parse( - billingPreviewUpdateItemPrice, - ), - ); -} - -/** @internal */ -export const BillingPreviewUpdateOnIncrease$outboundSchema: z.ZodMiniEnum< - typeof BillingPreviewUpdateOnIncrease -> = z.enum(BillingPreviewUpdateOnIncrease); - -/** @internal */ -export const BillingPreviewUpdateOnDecrease$outboundSchema: z.ZodMiniEnum< - typeof BillingPreviewUpdateOnDecrease -> = z.enum(BillingPreviewUpdateOnDecrease); - -/** @internal */ -export type BillingPreviewUpdateProration$Outbound = { - on_increase: string; - on_decrease: string; -}; - -/** @internal */ -export const BillingPreviewUpdateProration$outboundSchema: z.ZodMiniType< - BillingPreviewUpdateProration$Outbound, - BillingPreviewUpdateProration -> = z.pipe( - z.object({ - onIncrease: BillingPreviewUpdateOnIncrease$outboundSchema, - onDecrease: BillingPreviewUpdateOnDecrease$outboundSchema, - }), - z.transform((v) => { - return remap$(v, { - onIncrease: "on_increase", - onDecrease: "on_decrease", - }); - }), -); - -export function billingPreviewUpdateProrationToJSON( - billingPreviewUpdateProration: BillingPreviewUpdateProration, -): string { - return JSON.stringify( - BillingPreviewUpdateProration$outboundSchema.parse( - billingPreviewUpdateProration, - ), - ); -} - -/** @internal */ -export const BillingPreviewUpdateExpiryDurationType$outboundSchema: - z.ZodMiniEnum = z.enum( - BillingPreviewUpdateExpiryDurationType, - ); - -/** @internal */ -export type BillingPreviewUpdateRollover$Outbound = { - max?: number | undefined; - expiry_duration_type: string; - expiry_duration_length?: number | undefined; -}; - -/** @internal */ -export const BillingPreviewUpdateRollover$outboundSchema: z.ZodMiniType< - BillingPreviewUpdateRollover$Outbound, - BillingPreviewUpdateRollover -> = z.pipe( - z.object({ - max: z.optional(z.number()), - expiryDurationType: BillingPreviewUpdateExpiryDurationType$outboundSchema, - expiryDurationLength: z.optional(z.number()), - }), - z.transform((v) => { - return remap$(v, { - expiryDurationType: "expiry_duration_type", - expiryDurationLength: "expiry_duration_length", - }); - }), -); - -export function billingPreviewUpdateRolloverToJSON( - billingPreviewUpdateRollover: BillingPreviewUpdateRollover, -): string { - return JSON.stringify( - BillingPreviewUpdateRollover$outboundSchema.parse( - billingPreviewUpdateRollover, - ), - ); -} - -/** @internal */ -export type BillingPreviewUpdateItem$Outbound = { - feature_id: string; - included?: number | undefined; - unlimited?: boolean | undefined; - reset?: BillingPreviewUpdateReset$Outbound | undefined; - price?: BillingPreviewUpdateItemPrice$Outbound | undefined; - proration?: BillingPreviewUpdateProration$Outbound | undefined; - rollover?: BillingPreviewUpdateRollover$Outbound | undefined; -}; - -/** @internal */ -export const BillingPreviewUpdateItem$outboundSchema: z.ZodMiniType< - BillingPreviewUpdateItem$Outbound, - BillingPreviewUpdateItem -> = z.pipe( - z.object({ - featureId: z.string(), - included: z.optional(z.number()), - unlimited: z.optional(z.boolean()), - reset: z.optional(z.lazy(() => BillingPreviewUpdateReset$outboundSchema)), - price: z.optional( - z.lazy(() => BillingPreviewUpdateItemPrice$outboundSchema), - ), - proration: z.optional( - z.lazy(() => BillingPreviewUpdateProration$outboundSchema), - ), - rollover: z.optional( - z.lazy(() => BillingPreviewUpdateRollover$outboundSchema), - ), - }), - z.transform((v) => { - return remap$(v, { - featureId: "feature_id", - }); - }), -); - -export function billingPreviewUpdateItemToJSON( - billingPreviewUpdateItem: BillingPreviewUpdateItem, -): string { - return JSON.stringify( - BillingPreviewUpdateItem$outboundSchema.parse(billingPreviewUpdateItem), - ); -} - -/** @internal */ -export type BillingPreviewUpdateCustomize$Outbound = { - price?: BillingPreviewUpdatePrice$Outbound | null | undefined; - items?: Array | undefined; -}; - -/** @internal */ -export const BillingPreviewUpdateCustomize$outboundSchema: z.ZodMiniType< - BillingPreviewUpdateCustomize$Outbound, - BillingPreviewUpdateCustomize -> = z.object({ - price: z.optional( - z.nullable(z.lazy(() => BillingPreviewUpdatePrice$outboundSchema)), - ), - items: z.optional( - z.array(z.lazy(() => BillingPreviewUpdateItem$outboundSchema)), - ), -}); - -export function billingPreviewUpdateCustomizeToJSON( - billingPreviewUpdateCustomize: BillingPreviewUpdateCustomize, -): string { - return JSON.stringify( - BillingPreviewUpdateCustomize$outboundSchema.parse( - billingPreviewUpdateCustomize, - ), - ); -} - -/** @internal */ -export type BillingPreviewUpdateInvoiceMode$Outbound = { - enabled: boolean; - enable_plan_immediately: boolean; - finalize: boolean; -}; - -/** @internal */ -export const BillingPreviewUpdateInvoiceMode$outboundSchema: z.ZodMiniType< - BillingPreviewUpdateInvoiceMode$Outbound, - BillingPreviewUpdateInvoiceMode -> = z.pipe( - z.object({ - enabled: z.boolean(), - enablePlanImmediately: z._default(z.boolean(), false), - finalize: z._default(z.boolean(), true), - }), - z.transform((v) => { - return remap$(v, { - enablePlanImmediately: "enable_plan_immediately", - }); - }), -); - -export function billingPreviewUpdateInvoiceModeToJSON( - billingPreviewUpdateInvoiceMode: BillingPreviewUpdateInvoiceMode, -): string { - return JSON.stringify( - BillingPreviewUpdateInvoiceMode$outboundSchema.parse( - billingPreviewUpdateInvoiceMode, - ), - ); -} - -/** @internal */ -export const BillingPreviewUpdateCancelAction$outboundSchema: z.ZodMiniEnum< - typeof BillingPreviewUpdateCancelAction -> = z.enum(BillingPreviewUpdateCancelAction); - -/** @internal */ -export const BillingPreviewUpdateBillingBehavior$outboundSchema: z.ZodMiniEnum< - typeof BillingPreviewUpdateBillingBehavior -> = z.enum(BillingPreviewUpdateBillingBehavior); - -/** @internal */ -export type BillingPreviewUpdateRequest$Outbound = { - customer_id: string; - entity_id?: string | null | undefined; - feature_quantities?: - | Array - | null - | undefined; - version?: number | undefined; - free_trial?: BillingPreviewUpdateFreeTrial$Outbound | null | undefined; - customize?: BillingPreviewUpdateCustomize$Outbound | undefined; - plan_id?: string | undefined; - invoice_mode?: BillingPreviewUpdateInvoiceMode$Outbound | undefined; - cancel_action?: string | undefined; - billing_behavior?: string | undefined; -}; - -/** @internal */ -export const BillingPreviewUpdateRequest$outboundSchema: z.ZodMiniType< - BillingPreviewUpdateRequest$Outbound, - BillingPreviewUpdateRequest -> = z.pipe( - z.object({ - customerId: z.string(), - entityId: z.optional(z.nullable(z.string())), - featureQuantities: z.optional(z.nullable(z.array(z.lazy(() => - BillingPreviewUpdateFeatureQuantities$outboundSchema - )))), - version: z.optional(z.number()), - freeTrial: z.optional(z.nullable(z.lazy(() => - BillingPreviewUpdateFreeTrial$outboundSchema - ))), - customize: z.optional(z.lazy(() => - BillingPreviewUpdateCustomize$outboundSchema - )), - planId: z.optional(z.string()), - invoiceMode: z.optional(z.lazy(() => - BillingPreviewUpdateInvoiceMode$outboundSchema - )), - cancelAction: z.optional(BillingPreviewUpdateCancelAction$outboundSchema), - billingBehavior: z.optional( - BillingPreviewUpdateBillingBehavior$outboundSchema, - ), - }), - z.transform((v) => { - return remap$(v, { - customerId: "customer_id", - entityId: "entity_id", - featureQuantities: "feature_quantities", - freeTrial: "free_trial", - planId: "plan_id", - invoiceMode: "invoice_mode", - cancelAction: "cancel_action", - billingBehavior: "billing_behavior", - }); - }), -); - -export function billingPreviewUpdateRequestToJSON( - billingPreviewUpdateRequest: BillingPreviewUpdateRequest, -): string { - return JSON.stringify( - BillingPreviewUpdateRequest$outboundSchema.parse( - billingPreviewUpdateRequest, - ), - ); -} - -/** @internal */ -export const BillingPreviewUpdateDiscount$inboundSchema: z.ZodMiniType< - BillingPreviewUpdateDiscount, - unknown -> = z.object({ - amountOff: types.number(), - percentOff: types.optional(types.number()), - stripeCouponId: types.optional(types.string()), - couponName: types.optional(types.string()), -}); - -export function billingPreviewUpdateDiscountFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BillingPreviewUpdateDiscount$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingPreviewUpdateDiscount' from JSON`, - ); -} - -/** @internal */ -export const BillingPreviewUpdateEffectivePeriod$inboundSchema: z.ZodMiniType< - BillingPreviewUpdateEffectivePeriod, - unknown -> = z.object({ - start: types.number(), - end: types.number(), -}); - -export function billingPreviewUpdateEffectivePeriodFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => - BillingPreviewUpdateEffectivePeriod$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingPreviewUpdateEffectivePeriod' from JSON`, - ); -} - -/** @internal */ -export const BillingPreviewUpdateLineItem$inboundSchema: z.ZodMiniType< - BillingPreviewUpdateLineItem, - unknown -> = z.pipe( - z.object({ - title: types.string(), - description: types.string(), - amount: types.number(), - discounts: types.optional( - z.array(z.lazy(() => BillingPreviewUpdateDiscount$inboundSchema)), - ), - plan_id: types.string(), - total_quantity: types.number(), - paid_quantity: types.number(), - deferred_for_trial: types.optional(types.boolean()), - effective_period: types.optional( - z.lazy(() => BillingPreviewUpdateEffectivePeriod$inboundSchema), - ), - is_base: types.optional(types.boolean()), - }), - z.transform((v) => { - return remap$(v, { - "plan_id": "planId", - "total_quantity": "totalQuantity", - "paid_quantity": "paidQuantity", - "deferred_for_trial": "deferredForTrial", - "effective_period": "effectivePeriod", - "is_base": "isBase", - }); - }), -); - -export function billingPreviewUpdateLineItemFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BillingPreviewUpdateLineItem$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingPreviewUpdateLineItem' from JSON`, - ); -} - -/** @internal */ -export const BillingPreviewUpdateNextCycleDiscount$inboundSchema: z.ZodMiniType< - BillingPreviewUpdateNextCycleDiscount, - unknown -> = z.object({ - amountOff: types.number(), - percentOff: types.optional(types.number()), - stripeCouponId: types.optional(types.string()), - couponName: types.optional(types.string()), -}); - -export function billingPreviewUpdateNextCycleDiscountFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => - BillingPreviewUpdateNextCycleDiscount$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingPreviewUpdateNextCycleDiscount' from JSON`, - ); -} - -/** @internal */ -export const BillingPreviewUpdateNextCycleEffectivePeriod$inboundSchema: - z.ZodMiniType = z - .object({ - start: types.number(), - end: types.number(), - }); - -export function billingPreviewUpdateNextCycleEffectivePeriodFromJSON( - jsonString: string, -): SafeParseResult< - BillingPreviewUpdateNextCycleEffectivePeriod, - SDKValidationError -> { - return safeParse( - jsonString, - (x) => - BillingPreviewUpdateNextCycleEffectivePeriod$inboundSchema.parse( - JSON.parse(x), - ), - `Failed to parse 'BillingPreviewUpdateNextCycleEffectivePeriod' from JSON`, - ); -} - -/** @internal */ -export const BillingPreviewUpdateNextCycleLineItem$inboundSchema: z.ZodMiniType< - BillingPreviewUpdateNextCycleLineItem, - unknown -> = z.pipe( - z.object({ - title: types.string(), - description: types.string(), - amount: types.number(), - discounts: types.optional( - z.array( - z.lazy(() => BillingPreviewUpdateNextCycleDiscount$inboundSchema), - ), - ), - plan_id: types.string(), - total_quantity: types.number(), - paid_quantity: types.number(), - deferred_for_trial: types.optional(types.boolean()), - effective_period: types.optional( - z.lazy(() => BillingPreviewUpdateNextCycleEffectivePeriod$inboundSchema), - ), - is_base: types.optional(types.boolean()), - }), - z.transform((v) => { - return remap$(v, { - "plan_id": "planId", - "total_quantity": "totalQuantity", - "paid_quantity": "paidQuantity", - "deferred_for_trial": "deferredForTrial", - "effective_period": "effectivePeriod", - "is_base": "isBase", - }); - }), -); - -export function billingPreviewUpdateNextCycleLineItemFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => - BillingPreviewUpdateNextCycleLineItem$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingPreviewUpdateNextCycleLineItem' from JSON`, - ); -} - -/** @internal */ -export const BillingPreviewUpdateNextCycle$inboundSchema: z.ZodMiniType< - BillingPreviewUpdateNextCycle, - unknown -> = z.pipe( - z.object({ - starts_at: types.number(), - total: types.number(), - line_items: z.array( - z.lazy(() => BillingPreviewUpdateNextCycleLineItem$inboundSchema), - ), - }), - z.transform((v) => { - return remap$(v, { - "starts_at": "startsAt", - "line_items": "lineItems", - }); - }), -); - -export function billingPreviewUpdateNextCycleFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BillingPreviewUpdateNextCycle$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingPreviewUpdateNextCycle' from JSON`, - ); -} - -/** @internal */ -export const BillingPreviewUpdateResponse$inboundSchema: z.ZodMiniType< - BillingPreviewUpdateResponse, - unknown -> = z.pipe( - z.object({ - customer_id: types.string(), - line_items: z.array( - z.lazy(() => BillingPreviewUpdateLineItem$inboundSchema), - ), - total: types.number(), - currency: types.string(), - period_start: types.optional(types.number()), - period_end: types.optional(types.number()), - next_cycle: types.optional( - z.lazy(() => BillingPreviewUpdateNextCycle$inboundSchema), - ), - }), - z.transform((v) => { - return remap$(v, { - "customer_id": "customerId", - "line_items": "lineItems", - "period_start": "periodStart", - "period_end": "periodEnd", - "next_cycle": "nextCycle", - }); - }), -); - -export function billingPreviewUpdateResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BillingPreviewUpdateResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingPreviewUpdateResponse' from JSON`, - ); -} diff --git a/packages/sdk/src/models/billing-setup-payment-op.ts b/packages/sdk/src/models/billing-setup-payment-op.ts deleted file mode 100644 index c5ae80c85..000000000 --- a/packages/sdk/src/models/billing-setup-payment-op.ts +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod/v4-mini"; -import { remap as remap$ } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { Result as SafeParseResult } from "../types/fp.js"; -import * as types from "../types/primitives.js"; -import { - CustomerData, - CustomerData$Outbound, - CustomerData$outboundSchema, -} from "./customer-data.js"; -import { SDKValidationError } from "./sdk-validation-error.js"; - -export type BillingSetupPaymentGlobals = { - xApiVersion?: string | undefined; -}; - -export type BillingSetupPaymentRequest = { - /** - * The ID of the customer - */ - customerId: string; - /** - * URL to redirect to after successful payment setup. Must start with either http:// or https:// - */ - successUrl?: string | undefined; - /** - * Customer details to set when creating a customer - */ - customerData?: CustomerData | undefined; - /** - * Additional parameters for the checkout session - */ - checkoutSessionParams?: { [k: string]: any } | undefined; -}; - -/** - * OK - */ -export type BillingSetupPaymentResponse = { - /** - * The ID of the customer - */ - customerId: string; - /** - * URL to the payment setup page - */ - url: string; -}; - -/** @internal */ -export type BillingSetupPaymentRequest$Outbound = { - customer_id: string; - success_url?: string | undefined; - customer_data?: CustomerData$Outbound | undefined; - checkout_session_params?: { [k: string]: any } | undefined; -}; - -/** @internal */ -export const BillingSetupPaymentRequest$outboundSchema: z.ZodMiniType< - BillingSetupPaymentRequest$Outbound, - BillingSetupPaymentRequest -> = z.pipe( - z.object({ - customerId: z.string(), - successUrl: z.optional(z.string()), - customerData: z.optional(CustomerData$outboundSchema), - checkoutSessionParams: z.optional(z.record(z.string(), z.any())), - }), - z.transform((v) => { - return remap$(v, { - customerId: "customer_id", - successUrl: "success_url", - customerData: "customer_data", - checkoutSessionParams: "checkout_session_params", - }); - }), -); - -export function billingSetupPaymentRequestToJSON( - billingSetupPaymentRequest: BillingSetupPaymentRequest, -): string { - return JSON.stringify( - BillingSetupPaymentRequest$outboundSchema.parse(billingSetupPaymentRequest), - ); -} - -/** @internal */ -export const BillingSetupPaymentResponse$inboundSchema: z.ZodMiniType< - BillingSetupPaymentResponse, - unknown -> = z.pipe( - z.object({ - customer_id: types.string(), - url: types.string(), - }), - z.transform((v) => { - return remap$(v, { - "customer_id": "customerId", - }); - }), -); - -export function billingSetupPaymentResponseFromJSON( - jsonString: string, -): SafeParseResult { - return safeParse( - jsonString, - (x) => BillingSetupPaymentResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BillingSetupPaymentResponse' from JSON`, - ); -} diff --git a/packages/sdk/src/models/billing-update-op.ts b/packages/sdk/src/models/billing-update-op.ts index 28e62dae1..f8402e63d 100644 --- a/packages/sdk/src/models/billing-update-op.ts +++ b/packages/sdk/src/models/billing-update-op.ts @@ -16,7 +16,7 @@ export type BillingUpdateGlobals = { xApiVersion?: string | undefined; }; -export type BillingUpdateFeatureQuantities = { +export type BillingUpdateFeatureQuantity = { featureId: string; quantity?: number | undefined; adjustable?: boolean | undefined; @@ -170,30 +170,54 @@ export type BillingUpdateCustomize = { items?: Array | undefined; }; +/** + * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + */ export type BillingUpdateInvoiceMode = { + /** + * When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. + */ enabled: boolean; + /** + * If true, enables the plan immediately even though the invoice is not paid yet. + */ enablePlanImmediately?: boolean | undefined; + /** + * If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. + */ finalize?: boolean | undefined; }; +/** + * 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. + */ +export const BillingUpdateBillingBehavior = { + ProrateImmediately: "prorate_immediately", + NextCycleOnly: "next_cycle_only", +} as const; +/** + * 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. + */ +export type BillingUpdateBillingBehavior = ClosedEnum< + typeof BillingUpdateBillingBehavior +>; + +/** + * Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. + */ export const BillingUpdateCancelAction = { CancelImmediately: "cancel_immediately", CancelEndOfCycle: "cancel_end_of_cycle", Uncancel: "uncancel", } as const; +/** + * Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. + */ export type BillingUpdateCancelAction = ClosedEnum< typeof BillingUpdateCancelAction >; -export const BillingUpdateBillingBehavior = { - ProrateImmediately: "prorate_immediately", - NextCycleOnly: "next_cycle_only", -} as const; -export type BillingUpdateBillingBehavior = ClosedEnum< - typeof BillingUpdateBillingBehavior ->; - -export type BillingUpdateRequest = { +export type UpdateSubscriptionParams = { /** * The ID of the customer to attach the plan to. */ @@ -201,43 +225,91 @@ export type BillingUpdateRequest = { /** * The ID of the entity to attach the plan to. */ - entityId?: string | null | undefined; + entityId?: string | undefined; + /** + * The ID of the plan. + */ + planId: string; /** * If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. */ - featureQuantities?: Array | null | undefined; + featureQuantities?: Array | undefined; /** * The version of the plan to attach. */ version?: number | undefined; + /** + * Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. + */ freeTrial?: BillingUpdateFreeTrial | null | undefined; /** * Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. */ customize?: BillingUpdateCustomize | undefined; - planId?: string | undefined; + /** + * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + */ invoiceMode?: BillingUpdateInvoiceMode | undefined; - cancelAction?: BillingUpdateCancelAction | undefined; + /** + * 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. + */ billingBehavior?: BillingUpdateBillingBehavior | undefined; + /** + * Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. + */ + cancelAction?: BillingUpdateCancelAction | undefined; }; +/** + * Invoice details if an invoice was created. Only present when a charge was made. + */ export type BillingUpdateInvoice = { + /** + * The status of the invoice (e.g., 'paid', 'open', 'draft'). + */ status: string | null; + /** + * The Stripe invoice ID. + */ stripeId: string; + /** + * The total amount of the invoice in cents. + */ total: number; + /** + * The three-letter ISO currency code (e.g., 'usd'). + */ currency: string; + /** + * URL to the hosted invoice page where the customer can view and pay the invoice. + */ hostedInvoiceUrl: string | null; }; +/** + * The type of action required to complete the payment. + */ export const BillingUpdateCode = { ThreedsRequired: "3ds_required", PaymentMethodRequired: "payment_method_required", PaymentFailed: "payment_failed", } as const; +/** + * The type of action required to complete the payment. + */ export type BillingUpdateCode = OpenEnum; +/** + * Details about any action required to complete the payment. Present when the payment could not be processed automatically. + */ export type BillingUpdateRequiredAction = { + /** + * The type of action required to complete the payment. + */ code: BillingUpdateCode; + /** + * A human-readable explanation of why this action is required. + */ reason: string; }; @@ -245,24 +317,39 @@ export type BillingUpdateRequiredAction = { * OK */ export type BillingUpdateResponse = { + /** + * The ID of the customer. + */ customerId: string; + /** + * The ID of the entity, if the plan was attached to an entity. + */ entityId?: string | undefined; + /** + * Invoice details if an invoice was created. Only present when a charge was made. + */ invoice?: BillingUpdateInvoice | undefined; + /** + * URL to redirect the customer to complete payment. Null if no payment action is required. + */ paymentUrl: string | null; + /** + * Details about any action required to complete the payment. Present when the payment could not be processed automatically. + */ requiredAction?: BillingUpdateRequiredAction | undefined; }; /** @internal */ -export type BillingUpdateFeatureQuantities$Outbound = { +export type BillingUpdateFeatureQuantity$Outbound = { feature_id: string; quantity?: number | undefined; adjustable?: boolean | undefined; }; /** @internal */ -export const BillingUpdateFeatureQuantities$outboundSchema: z.ZodMiniType< - BillingUpdateFeatureQuantities$Outbound, - BillingUpdateFeatureQuantities +export const BillingUpdateFeatureQuantity$outboundSchema: z.ZodMiniType< + BillingUpdateFeatureQuantity$Outbound, + BillingUpdateFeatureQuantity > = z.pipe( z.object({ featureId: z.string(), @@ -276,12 +363,12 @@ export const BillingUpdateFeatureQuantities$outboundSchema: z.ZodMiniType< }), ); -export function billingUpdateFeatureQuantitiesToJSON( - billingUpdateFeatureQuantities: BillingUpdateFeatureQuantities, +export function billingUpdateFeatureQuantityToJSON( + billingUpdateFeatureQuantity: BillingUpdateFeatureQuantity, ): string { return JSON.stringify( - BillingUpdateFeatureQuantities$outboundSchema.parse( - billingUpdateFeatureQuantities, + BillingUpdateFeatureQuantity$outboundSchema.parse( + billingUpdateFeatureQuantity, ), ); } @@ -664,77 +751,72 @@ export function billingUpdateInvoiceModeToJSON( ); } -/** @internal */ -export const BillingUpdateCancelAction$outboundSchema: z.ZodMiniEnum< - typeof BillingUpdateCancelAction -> = z.enum(BillingUpdateCancelAction); - /** @internal */ export const BillingUpdateBillingBehavior$outboundSchema: z.ZodMiniEnum< typeof BillingUpdateBillingBehavior > = z.enum(BillingUpdateBillingBehavior); /** @internal */ -export type BillingUpdateRequest$Outbound = { +export const BillingUpdateCancelAction$outboundSchema: z.ZodMiniEnum< + typeof BillingUpdateCancelAction +> = z.enum(BillingUpdateCancelAction); + +/** @internal */ +export type UpdateSubscriptionParams$Outbound = { customer_id: string; - entity_id?: string | null | undefined; - feature_quantities?: - | Array - | null - | undefined; + entity_id?: string | undefined; + plan_id: string; + feature_quantities?: Array | undefined; version?: number | undefined; free_trial?: BillingUpdateFreeTrial$Outbound | null | undefined; customize?: BillingUpdateCustomize$Outbound | undefined; - plan_id?: string | undefined; invoice_mode?: BillingUpdateInvoiceMode$Outbound | undefined; - cancel_action?: string | undefined; billing_behavior?: string | undefined; + cancel_action?: string | undefined; }; /** @internal */ -export const BillingUpdateRequest$outboundSchema: z.ZodMiniType< - BillingUpdateRequest$Outbound, - BillingUpdateRequest +export const UpdateSubscriptionParams$outboundSchema: z.ZodMiniType< + UpdateSubscriptionParams$Outbound, + UpdateSubscriptionParams > = z.pipe( z.object({ customerId: z.string(), - entityId: z.optional(z.nullable(z.string())), - featureQuantities: z.optional(z.nullable(z.array(z.lazy(() => - BillingUpdateFeatureQuantities$outboundSchema - )))), + entityId: z.optional(z.string()), + planId: z.string(), + featureQuantities: z.optional( + z.array(z.lazy(() => BillingUpdateFeatureQuantity$outboundSchema)), + ), version: z.optional(z.number()), - freeTrial: z.optional(z.nullable(z.lazy(() => - BillingUpdateFreeTrial$outboundSchema - ))), - customize: z.optional(z.lazy(() => - BillingUpdateCustomize$outboundSchema - )), - planId: z.optional(z.string()), + freeTrial: z.optional( + z.nullable(z.lazy(() => BillingUpdateFreeTrial$outboundSchema)), + ), + customize: z.optional(z.lazy(() => BillingUpdateCustomize$outboundSchema)), invoiceMode: z.optional( z.lazy(() => BillingUpdateInvoiceMode$outboundSchema), ), - cancelAction: z.optional(BillingUpdateCancelAction$outboundSchema), billingBehavior: z.optional(BillingUpdateBillingBehavior$outboundSchema), + cancelAction: z.optional(BillingUpdateCancelAction$outboundSchema), }), z.transform((v) => { return remap$(v, { customerId: "customer_id", entityId: "entity_id", + planId: "plan_id", featureQuantities: "feature_quantities", freeTrial: "free_trial", - planId: "plan_id", invoiceMode: "invoice_mode", - cancelAction: "cancel_action", billingBehavior: "billing_behavior", + cancelAction: "cancel_action", }); }), ); -export function billingUpdateRequestToJSON( - billingUpdateRequest: BillingUpdateRequest, +export function updateSubscriptionParamsToJSON( + updateSubscriptionParams: UpdateSubscriptionParams, ): string { return JSON.stringify( - BillingUpdateRequest$outboundSchema.parse(billingUpdateRequest), + UpdateSubscriptionParams$outboundSchema.parse(updateSubscriptionParams), ); } diff --git a/packages/sdk/src/models/balances-check-op.ts b/packages/sdk/src/models/check-op.ts similarity index 54% rename from packages/sdk/src/models/balances-check-op.ts rename to packages/sdk/src/models/check-op.ts index 00b739d16..37ab007d8 100644 --- a/packages/sdk/src/models/balances-check-op.ts +++ b/packages/sdk/src/models/check-op.ts @@ -12,69 +12,73 @@ import * as types from "../types/primitives.js"; import { smartUnion } from "../types/smart-union.js"; import { SDKValidationError } from "./sdk-validation-error.js"; -export type BalancesCheckGlobals = { +export type CheckGlobals = { xApiVersion?: string | undefined; }; -export type BalancesCheckRequest = { +export type CheckParams = { /** - * ID which you provided when creating the customer + * The ID of the customer. */ customerId: string; /** - * ID of the feature to check access to. + * The ID of the feature. */ featureId: string; /** - * If using entity balances (eg, seats), the entity ID to check access for. + * The ID of the entity for entity-scoped balances (e.g., per-seat limits). */ entityId?: string | undefined; /** - * If you know the amount of the feature the end user is consuming in advance. If their balance is below this quantity, allowed will be false. + * Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1. */ requiredBalance?: number | undefined; + /** + * Additional properties to attach to the usage event if send_event is true. + */ properties?: { [k: string]: any } | undefined; /** - * If true, a usage event will be recorded together with checking access. The required_balance field will be used as the usage value. + * If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. */ sendEvent?: boolean | undefined; /** - * If true, the response will include a preview object, which can be used to display information such as a paywall or upgrade confirmation. + * If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. */ withPreview?: boolean | undefined; }; -export const BalancesCheckBalanceType = { +export const CheckBalanceType = { Boolean: "boolean", Metered: "metered", CreditSystem: "credit_system", } as const; -export type BalancesCheckBalanceType = OpenEnum< - typeof BalancesCheckBalanceType ->; +export type CheckBalanceType = OpenEnum; -export type BalancesCheckCreditSchema = { +export type CheckCreditSchema = { meteredFeatureId: string; creditCost: number; }; -export type BalancesCheckBalanceDisplay = { +export type CheckBalanceDisplay = { singular?: string | null | undefined; plural?: string | null | undefined; }; -export type BalancesCheckFeature = { +/** + * The full feature object if expanded. + */ +export type CheckFeature = { id: string; name: string; - type: BalancesCheckBalanceType; + type: CheckBalanceType; consumable: boolean; eventNames?: Array | undefined; - creditSchema?: Array | undefined; - display?: BalancesCheckBalanceDisplay | undefined; + creditSchema?: Array | undefined; + display?: CheckBalanceDisplay | undefined; archived: boolean; }; -export const BalancesCheckBalanceIntervalEnum = { +export const CheckBalanceIntervalEnum = { OneOff: "one_off", Minute: "minute", Hour: "hour", @@ -85,92 +89,196 @@ export const BalancesCheckBalanceIntervalEnum = { SemiAnnual: "semi_annual", Year: "year", } as const; -export type BalancesCheckBalanceIntervalEnum = OpenEnum< - typeof BalancesCheckBalanceIntervalEnum +export type CheckBalanceIntervalEnum = OpenEnum< + typeof CheckBalanceIntervalEnum >; -export type BalancesCheckIntervalUnion = - | BalancesCheckBalanceIntervalEnum - | string; +/** + * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + */ +export type CheckIntervalUnion = CheckBalanceIntervalEnum | string; -export type BalancesCheckReset = { - interval: BalancesCheckBalanceIntervalEnum | string; +export type CheckReset = { + /** + * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + */ + interval: CheckBalanceIntervalEnum | string; + /** + * Number of intervals between resets (eg. 2 for bi-monthly). + */ intervalCount?: number | undefined; + /** + * Timestamp when the balance will next reset. + */ resetsAt: number | null; }; -export type BalancesCheckBalanceTo = number | string; +export type CheckBalanceTo = number | string; -export type BalancesCheckTier = { +export type CheckTier = { to: number | string; amount: number; }; -export const BalancesCheckBillingMethod = { +/** + * Whether usage is prepaid or billed pay-per-use. + */ +export const CheckBillingMethod = { Prepaid: "prepaid", UsageBased: "usage_based", } as const; -export type BalancesCheckBillingMethod = OpenEnum< - typeof BalancesCheckBillingMethod ->; +/** + * Whether usage is prepaid or billed pay-per-use. + */ +export type CheckBillingMethod = OpenEnum; -export type BalancesCheckPrice = { +export type CheckPrice = { + /** + * The per-unit price amount. + */ amount?: number | undefined; - tiers?: Array | undefined; + /** + * Tiered pricing configuration if applicable. + */ + tiers?: Array | undefined; + /** + * The number of units per billing increment (eg. $9 / 250 units). + */ billingUnits: number; - billingMethod: BalancesCheckBillingMethod; + /** + * Whether usage is prepaid or billed pay-per-use. + */ + billingMethod: CheckBillingMethod; + /** + * Maximum quantity that can be purchased, or null for unlimited. + */ maxPurchase: number | null; }; -export type BalancesCheckBreakdown = { +export type CheckBreakdown = { + /** + * The unique identifier for this balance breakdown. + */ id: string; + /** + * The plan ID this balance originates from, or null for standalone balances. + */ planId: string | null; + /** + * Amount granted from the plan's included usage. + */ includedGrant: number; + /** + * Amount granted from prepaid purchases or top-ups. + */ prepaidGrant: number; + /** + * Remaining balance available for use. + */ remaining: number; + /** + * Amount consumed in the current period. + */ usage: number; + /** + * Whether this balance has unlimited usage. + */ unlimited: boolean; - reset: BalancesCheckReset | null; - price: BalancesCheckPrice | null; + /** + * Reset configuration for this balance, or null if no reset. + */ + reset: CheckReset | null; + /** + * Pricing configuration if this balance has usage-based pricing. + */ + price: CheckPrice | null; + /** + * Timestamp when this balance expires, or null for no expiration. + */ expiresAt: number | null; }; -export type BalancesCheckBalanceRollover = { +export type CheckBalanceRollover = { + /** + * Amount of balance rolled over from a previous period. + */ balance: number; + /** + * Timestamp when the rollover balance expires. + */ expiresAt: number; }; -export type BalancesCheckBalance = { +export type CheckBalance = { + /** + * The feature ID this balance is for. + */ featureId: string; - feature?: BalancesCheckFeature | undefined; + /** + * The full feature object if expanded. + */ + feature?: CheckFeature | undefined; + /** + * Total balance granted (included + prepaid). + */ granted: number; + /** + * Remaining balance available for use. + */ remaining: number; + /** + * Total usage consumed in the current period. + */ usage: number; + /** + * Whether this feature has unlimited usage. + */ unlimited: boolean; + /** + * Whether usage beyond the granted balance is allowed (with overage charges). + */ overageAllowed: boolean; + /** + * Maximum quantity that can be purchased as a top-up, or null for unlimited. + */ maxPurchase: number | null; + /** + * Timestamp when the balance will reset, or null for no reset. + */ nextResetAt: number | null; - breakdown?: Array | undefined; - rollovers?: Array | undefined; + /** + * Detailed breakdown of balance sources when stacking multiple plans or grants. + */ + breakdown?: Array | undefined; + /** + * Rollover balances carried over from previous periods. + */ + rollovers?: Array | undefined; }; -export const BalancesCheckScenario = { +/** + * The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. + */ +export const CheckScenario = { UsageLimit: "usage_limit", FeatureFlag: "feature_flag", } as const; -export type BalancesCheckScenario = OpenEnum; +/** + * The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. + */ +export type CheckScenario = OpenEnum; /** * The environment of the product */ -export const BalancesCheckEnv = { +export const CheckEnv = { Sandbox: "sandbox", Live: "live", } as const; /** * The environment of the product */ -export type BalancesCheckEnv = OpenEnum; +export type CheckEnv = OpenEnum; export const ProductType = { Feature: "feature", @@ -240,33 +348,33 @@ export type ConfigRollover = { length: number; }; -export const BalancesCheckOnIncrease = { +export const CheckOnIncrease = { BillImmediately: "bill_immediately", ProrateImmediately: "prorate_immediately", ProrateNextCycle: "prorate_next_cycle", BillNextCycle: "bill_next_cycle", } as const; -export type BalancesCheckOnIncrease = OpenEnum; +export type CheckOnIncrease = OpenEnum; -export const BalancesCheckOnDecrease = { +export const CheckOnDecrease = { Prorate: "prorate", ProrateImmediately: "prorate_immediately", ProrateNextCycle: "prorate_next_cycle", None: "none", NoProrations: "no_prorations", } as const; -export type BalancesCheckOnDecrease = OpenEnum; +export type CheckOnDecrease = OpenEnum; export type Config = { rollover?: ConfigRollover | null | undefined; - onIncrease?: BalancesCheckOnIncrease | null | undefined; - onDecrease?: BalancesCheckOnDecrease | null | undefined; + onIncrease?: CheckOnIncrease | null | undefined; + onDecrease?: CheckOnDecrease | null | undefined; }; /** * Product item defining features and pricing within a product */ -export type BalancesCheckItem = { +export type CheckItem = { /** * The type of the product item */ @@ -346,7 +454,7 @@ export const FreeTrialDuration = { */ export type FreeTrialDuration = OpenEnum; -export type BalancesCheckFreeTrial = { +export type CheckFreeTrial = { /** * The duration type of the free trial */ @@ -388,7 +496,7 @@ export const ProductScenario = { */ export type ProductScenario = OpenEnum; -export type Properties = { +export type CheckProperties = { /** * True if the product has no base price or usage prices */ @@ -427,7 +535,7 @@ export type Product = { /** * The environment of the product */ - env: BalancesCheckEnv; + env: CheckEnv; /** * Whether the product is an add-on and can be purchased alongside other products */ @@ -451,11 +559,11 @@ export type Product = { /** * Array of product items that define the product's features and pricing */ - items: Array; + items: Array; /** * Free trial configuration for this product, if available */ - freeTrial: BalancesCheckFreeTrial | null; + freeTrial: CheckFreeTrial | null; /** * ID of the base variant this product is derived from */ @@ -464,32 +572,71 @@ export type Product = { * Scenario for when this product is used in attach flows */ scenario?: ProductScenario | undefined; - properties?: Properties | undefined; + properties?: CheckProperties | undefined; }; +/** + * Upgrade/upsell information when access is denied. Only present if with_preview was true and allowed is false. + */ export type Preview = { - scenario: BalancesCheckScenario; + /** + * The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan. + */ + scenario: CheckScenario; + /** + * A title suitable for displaying in a paywall or upgrade modal. + */ title: string; + /** + * A message explaining why access was denied. + */ message: string; + /** + * The ID of the feature that was checked. + */ featureId: string; + /** + * The display name of the feature. + */ featureName: string; + /** + * Products that would grant access to this feature. Use to display upgrade options. + */ products: Array; }; /** * OK */ -export type BalancesCheckResponse = { +export type CheckResponse = { + /** + * Whether the customer is allowed to use the feature. True if they have sufficient balance or the feature is unlimited/boolean. + */ allowed: boolean; + /** + * The ID of the customer that was checked. + */ customerId: string; + /** + * The ID of the entity, if an entity-scoped check was performed. + */ entityId?: string | null | undefined; + /** + * The required balance that was checked against. + */ requiredBalance?: number | undefined; - balance: BalancesCheckBalance | null; + /** + * The customer's balance for this feature. Null if the customer has no balance for this feature. + */ + balance: CheckBalance | null; + /** + * Upgrade/upsell information when access is denied. Only present if with_preview was true and allowed is false. + */ preview?: Preview | undefined; }; /** @internal */ -export type BalancesCheckRequest$Outbound = { +export type CheckParams$Outbound = { customer_id: string; feature_id: string; entity_id?: string | undefined; @@ -500,9 +647,9 @@ export type BalancesCheckRequest$Outbound = { }; /** @internal */ -export const BalancesCheckRequest$outboundSchema: z.ZodMiniType< - BalancesCheckRequest$Outbound, - BalancesCheckRequest +export const CheckParams$outboundSchema: z.ZodMiniType< + CheckParams$Outbound, + CheckParams > = z.pipe( z.object({ customerId: z.string(), @@ -525,23 +672,19 @@ export const BalancesCheckRequest$outboundSchema: z.ZodMiniType< }), ); -export function balancesCheckRequestToJSON( - balancesCheckRequest: BalancesCheckRequest, -): string { - return JSON.stringify( - BalancesCheckRequest$outboundSchema.parse(balancesCheckRequest), - ); +export function checkParamsToJSON(checkParams: CheckParams): string { + return JSON.stringify(CheckParams$outboundSchema.parse(checkParams)); } /** @internal */ -export const BalancesCheckBalanceType$inboundSchema: z.ZodMiniType< - BalancesCheckBalanceType, +export const CheckBalanceType$inboundSchema: z.ZodMiniType< + CheckBalanceType, unknown -> = openEnums.inboundSchema(BalancesCheckBalanceType); +> = openEnums.inboundSchema(CheckBalanceType); /** @internal */ -export const BalancesCheckCreditSchema$inboundSchema: z.ZodMiniType< - BalancesCheckCreditSchema, +export const CheckCreditSchema$inboundSchema: z.ZodMiniType< + CheckCreditSchema, unknown > = z.pipe( z.object({ @@ -556,205 +699,190 @@ export const BalancesCheckCreditSchema$inboundSchema: z.ZodMiniType< }), ); -export function balancesCheckCreditSchemaFromJSON( +export function checkCreditSchemaFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BalancesCheckCreditSchema$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesCheckCreditSchema' from JSON`, + (x) => CheckCreditSchema$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CheckCreditSchema' from JSON`, ); } /** @internal */ -export const BalancesCheckBalanceDisplay$inboundSchema: z.ZodMiniType< - BalancesCheckBalanceDisplay, +export const CheckBalanceDisplay$inboundSchema: z.ZodMiniType< + CheckBalanceDisplay, unknown > = z.object({ singular: z.optional(z.nullable(types.string())), plural: z.optional(z.nullable(types.string())), }); -export function balancesCheckBalanceDisplayFromJSON( +export function checkBalanceDisplayFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BalancesCheckBalanceDisplay$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesCheckBalanceDisplay' from JSON`, + (x) => CheckBalanceDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CheckBalanceDisplay' from JSON`, ); } /** @internal */ -export const BalancesCheckFeature$inboundSchema: z.ZodMiniType< - BalancesCheckFeature, - unknown -> = z.pipe( - z.object({ - id: types.string(), - name: types.string(), - type: BalancesCheckBalanceType$inboundSchema, - consumable: types.boolean(), - event_names: types.optional(z.array(types.string())), - credit_schema: types.optional( - z.array(z.lazy(() => BalancesCheckCreditSchema$inboundSchema)), - ), - display: types.optional( - z.lazy(() => BalancesCheckBalanceDisplay$inboundSchema), - ), - archived: types.boolean(), - }), - z.transform((v) => { - return remap$(v, { - "event_names": "eventNames", - "credit_schema": "creditSchema", - }); - }), -); +export const CheckFeature$inboundSchema: z.ZodMiniType = + z.pipe( + z.object({ + id: types.string(), + name: types.string(), + type: CheckBalanceType$inboundSchema, + consumable: types.boolean(), + event_names: types.optional(z.array(types.string())), + credit_schema: types.optional( + z.array(z.lazy(() => CheckCreditSchema$inboundSchema)), + ), + display: types.optional(z.lazy(() => CheckBalanceDisplay$inboundSchema)), + archived: types.boolean(), + }), + z.transform((v) => { + return remap$(v, { + "event_names": "eventNames", + "credit_schema": "creditSchema", + }); + }), + ); -export function balancesCheckFeatureFromJSON( +export function checkFeatureFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BalancesCheckFeature$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesCheckFeature' from JSON`, + (x) => CheckFeature$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CheckFeature' from JSON`, ); } /** @internal */ -export const BalancesCheckBalanceIntervalEnum$inboundSchema: z.ZodMiniType< - BalancesCheckBalanceIntervalEnum, +export const CheckBalanceIntervalEnum$inboundSchema: z.ZodMiniType< + CheckBalanceIntervalEnum, unknown -> = openEnums.inboundSchema(BalancesCheckBalanceIntervalEnum); +> = openEnums.inboundSchema(CheckBalanceIntervalEnum); /** @internal */ -export const BalancesCheckIntervalUnion$inboundSchema: z.ZodMiniType< - BalancesCheckIntervalUnion, +export const CheckIntervalUnion$inboundSchema: z.ZodMiniType< + CheckIntervalUnion, unknown -> = smartUnion([ - BalancesCheckBalanceIntervalEnum$inboundSchema, - types.string(), -]); +> = smartUnion([CheckBalanceIntervalEnum$inboundSchema, types.string()]); -export function balancesCheckIntervalUnionFromJSON( +export function checkIntervalUnionFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BalancesCheckIntervalUnion$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesCheckIntervalUnion' from JSON`, + (x) => CheckIntervalUnion$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CheckIntervalUnion' from JSON`, ); } /** @internal */ -export const BalancesCheckReset$inboundSchema: z.ZodMiniType< - BalancesCheckReset, - unknown -> = z.pipe( - z.object({ - interval: smartUnion([ - BalancesCheckBalanceIntervalEnum$inboundSchema, - types.string(), - ]), - interval_count: types.optional(types.number()), - resets_at: types.nullable(types.number()), - }), - z.transform((v) => { - return remap$(v, { - "interval_count": "intervalCount", - "resets_at": "resetsAt", - }); - }), -); +export const CheckReset$inboundSchema: z.ZodMiniType = z + .pipe( + z.object({ + interval: smartUnion([ + CheckBalanceIntervalEnum$inboundSchema, + types.string(), + ]), + interval_count: types.optional(types.number()), + resets_at: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + "resets_at": "resetsAt", + }); + }), + ); -export function balancesCheckResetFromJSON( +export function checkResetFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BalancesCheckReset$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesCheckReset' from JSON`, + (x) => CheckReset$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CheckReset' from JSON`, ); } /** @internal */ -export const BalancesCheckBalanceTo$inboundSchema: z.ZodMiniType< - BalancesCheckBalanceTo, +export const CheckBalanceTo$inboundSchema: z.ZodMiniType< + CheckBalanceTo, unknown > = smartUnion([types.number(), types.string()]); -export function balancesCheckBalanceToFromJSON( +export function checkBalanceToFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BalancesCheckBalanceTo$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesCheckBalanceTo' from JSON`, + (x) => CheckBalanceTo$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CheckBalanceTo' from JSON`, ); } /** @internal */ -export const BalancesCheckTier$inboundSchema: z.ZodMiniType< - BalancesCheckTier, - unknown -> = z.object({ - to: smartUnion([types.number(), types.string()]), - amount: types.number(), -}); +export const CheckTier$inboundSchema: z.ZodMiniType = z + .object({ + to: smartUnion([types.number(), types.string()]), + amount: types.number(), + }); -export function balancesCheckTierFromJSON( +export function checkTierFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BalancesCheckTier$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesCheckTier' from JSON`, + (x) => CheckTier$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CheckTier' from JSON`, ); } /** @internal */ -export const BalancesCheckBillingMethod$inboundSchema: z.ZodMiniType< - BalancesCheckBillingMethod, +export const CheckBillingMethod$inboundSchema: z.ZodMiniType< + CheckBillingMethod, unknown -> = openEnums.inboundSchema(BalancesCheckBillingMethod); +> = openEnums.inboundSchema(CheckBillingMethod); /** @internal */ -export const BalancesCheckPrice$inboundSchema: z.ZodMiniType< - BalancesCheckPrice, - unknown -> = z.pipe( - z.object({ - amount: types.optional(types.number()), - tiers: types.optional( - z.array(z.lazy(() => BalancesCheckTier$inboundSchema)), - ), - billing_units: types.number(), - billing_method: BalancesCheckBillingMethod$inboundSchema, - max_purchase: types.nullable(types.number()), - }), - z.transform((v) => { - return remap$(v, { - "billing_units": "billingUnits", - "billing_method": "billingMethod", - "max_purchase": "maxPurchase", - }); - }), -); +export const CheckPrice$inboundSchema: z.ZodMiniType = z + .pipe( + z.object({ + amount: types.optional(types.number()), + tiers: types.optional(z.array(z.lazy(() => CheckTier$inboundSchema))), + billing_units: types.number(), + billing_method: CheckBillingMethod$inboundSchema, + max_purchase: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "billing_units": "billingUnits", + "billing_method": "billingMethod", + "max_purchase": "maxPurchase", + }); + }), + ); -export function balancesCheckPriceFromJSON( +export function checkPriceFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BalancesCheckPrice$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesCheckPrice' from JSON`, + (x) => CheckPrice$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CheckPrice' from JSON`, ); } /** @internal */ -export const BalancesCheckBreakdown$inboundSchema: z.ZodMiniType< - BalancesCheckBreakdown, +export const CheckBreakdown$inboundSchema: z.ZodMiniType< + CheckBreakdown, unknown > = z.pipe( z.object({ @@ -765,8 +893,8 @@ export const BalancesCheckBreakdown$inboundSchema: z.ZodMiniType< remaining: types.number(), usage: types.number(), unlimited: types.boolean(), - reset: types.nullable(z.lazy(() => BalancesCheckReset$inboundSchema)), - price: types.nullable(z.lazy(() => BalancesCheckPrice$inboundSchema)), + reset: types.nullable(z.lazy(() => CheckReset$inboundSchema)), + price: types.nullable(z.lazy(() => CheckPrice$inboundSchema)), expires_at: types.nullable(types.number()), }), z.transform((v) => { @@ -779,19 +907,19 @@ export const BalancesCheckBreakdown$inboundSchema: z.ZodMiniType< }), ); -export function balancesCheckBreakdownFromJSON( +export function checkBreakdownFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BalancesCheckBreakdown$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesCheckBreakdown' from JSON`, + (x) => CheckBreakdown$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CheckBreakdown' from JSON`, ); } /** @internal */ -export const BalancesCheckBalanceRollover$inboundSchema: z.ZodMiniType< - BalancesCheckBalanceRollover, +export const CheckBalanceRollover$inboundSchema: z.ZodMiniType< + CheckBalanceRollover, unknown > = z.pipe( z.object({ @@ -805,69 +933,65 @@ export const BalancesCheckBalanceRollover$inboundSchema: z.ZodMiniType< }), ); -export function balancesCheckBalanceRolloverFromJSON( +export function checkBalanceRolloverFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BalancesCheckBalanceRollover$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesCheckBalanceRollover' from JSON`, + (x) => CheckBalanceRollover$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CheckBalanceRollover' from JSON`, ); } /** @internal */ -export const BalancesCheckBalance$inboundSchema: z.ZodMiniType< - BalancesCheckBalance, - unknown -> = z.pipe( - z.object({ - feature_id: types.string(), - feature: types.optional(z.lazy(() => BalancesCheckFeature$inboundSchema)), - granted: types.number(), - remaining: types.number(), - usage: types.number(), - unlimited: types.boolean(), - overage_allowed: types.boolean(), - max_purchase: types.nullable(types.number()), - next_reset_at: types.nullable(types.number()), - breakdown: types.optional( - z.array(z.lazy(() => BalancesCheckBreakdown$inboundSchema)), - ), - rollovers: types.optional( - z.array(z.lazy(() => BalancesCheckBalanceRollover$inboundSchema)), - ), - }), - z.transform((v) => { - return remap$(v, { - "feature_id": "featureId", - "overage_allowed": "overageAllowed", - "max_purchase": "maxPurchase", - "next_reset_at": "nextResetAt", - }); - }), -); +export const CheckBalance$inboundSchema: z.ZodMiniType = + z.pipe( + z.object({ + feature_id: types.string(), + feature: types.optional(z.lazy(() => CheckFeature$inboundSchema)), + granted: types.number(), + remaining: types.number(), + usage: types.number(), + unlimited: types.boolean(), + overage_allowed: types.boolean(), + max_purchase: types.nullable(types.number()), + next_reset_at: types.nullable(types.number()), + breakdown: types.optional( + z.array(z.lazy(() => CheckBreakdown$inboundSchema)), + ), + rollovers: types.optional( + z.array(z.lazy(() => CheckBalanceRollover$inboundSchema)), + ), + }), + z.transform((v) => { + return remap$(v, { + "feature_id": "featureId", + "overage_allowed": "overageAllowed", + "max_purchase": "maxPurchase", + "next_reset_at": "nextResetAt", + }); + }), + ); -export function balancesCheckBalanceFromJSON( +export function checkBalanceFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BalancesCheckBalance$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesCheckBalance' from JSON`, + (x) => CheckBalance$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CheckBalance' from JSON`, ); } /** @internal */ -export const BalancesCheckScenario$inboundSchema: z.ZodMiniType< - BalancesCheckScenario, +export const CheckScenario$inboundSchema: z.ZodMiniType< + CheckScenario, unknown -> = openEnums.inboundSchema(BalancesCheckScenario); +> = openEnums.inboundSchema(CheckScenario); /** @internal */ -export const BalancesCheckEnv$inboundSchema: z.ZodMiniType< - BalancesCheckEnv, - unknown -> = openEnums.inboundSchema(BalancesCheckEnv); +export const CheckEnv$inboundSchema: z.ZodMiniType = + openEnums.inboundSchema(CheckEnv); /** @internal */ export const ProductType$inboundSchema: z.ZodMiniType = @@ -987,16 +1111,16 @@ export function configRolloverFromJSON( } /** @internal */ -export const BalancesCheckOnIncrease$inboundSchema: z.ZodMiniType< - BalancesCheckOnIncrease, +export const CheckOnIncrease$inboundSchema: z.ZodMiniType< + CheckOnIncrease, unknown -> = openEnums.inboundSchema(BalancesCheckOnIncrease); +> = openEnums.inboundSchema(CheckOnIncrease); /** @internal */ -export const BalancesCheckOnDecrease$inboundSchema: z.ZodMiniType< - BalancesCheckOnDecrease, +export const CheckOnDecrease$inboundSchema: z.ZodMiniType< + CheckOnDecrease, unknown -> = openEnums.inboundSchema(BalancesCheckOnDecrease); +> = openEnums.inboundSchema(CheckOnDecrease); /** @internal */ export const Config$inboundSchema: z.ZodMiniType = z.pipe( @@ -1004,8 +1128,8 @@ export const Config$inboundSchema: z.ZodMiniType = z.pipe( rollover: z.optional( z.nullable(z.lazy(() => ConfigRollover$inboundSchema)), ), - on_increase: z.optional(z.nullable(BalancesCheckOnIncrease$inboundSchema)), - on_decrease: z.optional(z.nullable(BalancesCheckOnDecrease$inboundSchema)), + on_increase: z.optional(z.nullable(CheckOnIncrease$inboundSchema)), + on_decrease: z.optional(z.nullable(CheckOnDecrease$inboundSchema)), }), z.transform((v) => { return remap$(v, { @@ -1026,52 +1150,52 @@ export function configFromJSON( } /** @internal */ -export const BalancesCheckItem$inboundSchema: z.ZodMiniType< - BalancesCheckItem, - unknown -> = z.pipe( - z.object({ - type: z.optional(z.nullable(ProductType$inboundSchema)), - feature_id: z.optional(z.nullable(types.string())), - feature_type: z.optional(z.nullable(FeatureType$inboundSchema)), - included_usage: z.optional( - z.nullable(smartUnion([types.number(), types.string()])), - ), - interval: z.optional(z.nullable(ProductInterval$inboundSchema)), - interval_count: z.optional(z.nullable(types.number())), - price: z.optional(z.nullable(types.number())), - tiers: z.optional(z.nullable(z.array(z.lazy(() => Tiers$inboundSchema)))), - usage_model: z.optional(z.nullable(UsageModel$inboundSchema)), - billing_units: z.optional(z.nullable(types.number())), - reset_usage_when_enabled: z.optional(z.nullable(types.boolean())), - entity_feature_id: z.optional(z.nullable(types.string())), - display: z.optional(z.nullable(z.lazy(() => ProductDisplay$inboundSchema))), - quantity: z.optional(z.nullable(types.number())), - next_cycle_quantity: z.optional(z.nullable(types.number())), - config: z.optional(z.nullable(z.lazy(() => Config$inboundSchema))), - }), - z.transform((v) => { - return remap$(v, { - "feature_id": "featureId", - "feature_type": "featureType", - "included_usage": "includedUsage", - "interval_count": "intervalCount", - "usage_model": "usageModel", - "billing_units": "billingUnits", - "reset_usage_when_enabled": "resetUsageWhenEnabled", - "entity_feature_id": "entityFeatureId", - "next_cycle_quantity": "nextCycleQuantity", - }); - }), -); +export const CheckItem$inboundSchema: z.ZodMiniType = z + .pipe( + z.object({ + type: z.optional(z.nullable(ProductType$inboundSchema)), + feature_id: z.optional(z.nullable(types.string())), + feature_type: z.optional(z.nullable(FeatureType$inboundSchema)), + included_usage: z.optional( + z.nullable(smartUnion([types.number(), types.string()])), + ), + interval: z.optional(z.nullable(ProductInterval$inboundSchema)), + interval_count: z.optional(z.nullable(types.number())), + price: z.optional(z.nullable(types.number())), + tiers: z.optional(z.nullable(z.array(z.lazy(() => Tiers$inboundSchema)))), + usage_model: z.optional(z.nullable(UsageModel$inboundSchema)), + billing_units: z.optional(z.nullable(types.number())), + reset_usage_when_enabled: z.optional(z.nullable(types.boolean())), + entity_feature_id: z.optional(z.nullable(types.string())), + display: z.optional( + z.nullable(z.lazy(() => ProductDisplay$inboundSchema)), + ), + quantity: z.optional(z.nullable(types.number())), + next_cycle_quantity: z.optional(z.nullable(types.number())), + config: z.optional(z.nullable(z.lazy(() => Config$inboundSchema))), + }), + z.transform((v) => { + return remap$(v, { + "feature_id": "featureId", + "feature_type": "featureType", + "included_usage": "includedUsage", + "interval_count": "intervalCount", + "usage_model": "usageModel", + "billing_units": "billingUnits", + "reset_usage_when_enabled": "resetUsageWhenEnabled", + "entity_feature_id": "entityFeatureId", + "next_cycle_quantity": "nextCycleQuantity", + }); + }), + ); -export function balancesCheckItemFromJSON( +export function checkItemFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BalancesCheckItem$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesCheckItem' from JSON`, + (x) => CheckItem$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CheckItem' from JSON`, ); } @@ -1082,8 +1206,8 @@ export const FreeTrialDuration$inboundSchema: z.ZodMiniType< > = openEnums.inboundSchema(FreeTrialDuration); /** @internal */ -export const BalancesCheckFreeTrial$inboundSchema: z.ZodMiniType< - BalancesCheckFreeTrial, +export const CheckFreeTrial$inboundSchema: z.ZodMiniType< + CheckFreeTrial, unknown > = z.pipe( z.object({ @@ -1102,13 +1226,13 @@ export const BalancesCheckFreeTrial$inboundSchema: z.ZodMiniType< }), ); -export function balancesCheckFreeTrialFromJSON( +export function checkFreeTrialFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BalancesCheckFreeTrial$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesCheckFreeTrial' from JSON`, + (x) => CheckFreeTrial$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CheckFreeTrial' from JSON`, ); } @@ -1119,32 +1243,34 @@ export const ProductScenario$inboundSchema: z.ZodMiniType< > = openEnums.inboundSchema(ProductScenario); /** @internal */ -export const Properties$inboundSchema: z.ZodMiniType = z - .pipe( - z.object({ - is_free: types.boolean(), - is_one_off: types.boolean(), - interval_group: z.optional(z.nullable(types.string())), - has_trial: z.optional(z.nullable(types.boolean())), - updateable: z.optional(z.nullable(types.boolean())), - }), - z.transform((v) => { - return remap$(v, { - "is_free": "isFree", - "is_one_off": "isOneOff", - "interval_group": "intervalGroup", - "has_trial": "hasTrial", - }); - }), - ); +export const CheckProperties$inboundSchema: z.ZodMiniType< + CheckProperties, + unknown +> = z.pipe( + z.object({ + is_free: types.boolean(), + is_one_off: types.boolean(), + interval_group: z.optional(z.nullable(types.string())), + has_trial: z.optional(z.nullable(types.boolean())), + updateable: z.optional(z.nullable(types.boolean())), + }), + z.transform((v) => { + return remap$(v, { + "is_free": "isFree", + "is_one_off": "isOneOff", + "interval_group": "intervalGroup", + "has_trial": "hasTrial", + }); + }), +); -export function propertiesFromJSON( +export function checkPropertiesFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => Properties$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'Properties' from JSON`, + (x) => CheckProperties$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CheckProperties' from JSON`, ); } @@ -1154,19 +1280,17 @@ export const Product$inboundSchema: z.ZodMiniType = z.pipe( id: types.string(), name: types.string(), group: types.nullable(types.string()), - env: BalancesCheckEnv$inboundSchema, + env: CheckEnv$inboundSchema, is_add_on: types.boolean(), is_default: types.boolean(), archived: types.boolean(), version: types.number(), created_at: types.number(), - items: z.array(z.lazy(() => BalancesCheckItem$inboundSchema)), - free_trial: types.nullable(z.lazy(() => - BalancesCheckFreeTrial$inboundSchema - )), + items: z.array(z.lazy(() => CheckItem$inboundSchema)), + free_trial: types.nullable(z.lazy(() => CheckFreeTrial$inboundSchema)), base_variant_id: types.nullable(types.string()), scenario: types.optional(ProductScenario$inboundSchema), - properties: types.optional(z.lazy(() => Properties$inboundSchema)), + properties: types.optional(z.lazy(() => CheckProperties$inboundSchema)), }), z.transform((v) => { return remap$(v, { @@ -1192,7 +1316,7 @@ export function productFromJSON( /** @internal */ export const Preview$inboundSchema: z.ZodMiniType = z.pipe( z.object({ - scenario: BalancesCheckScenario$inboundSchema, + scenario: CheckScenario$inboundSchema, title: types.string(), message: types.string(), feature_id: types.string(), @@ -1218,8 +1342,8 @@ export function previewFromJSON( } /** @internal */ -export const BalancesCheckResponse$inboundSchema: z.ZodMiniType< - BalancesCheckResponse, +export const CheckResponse$inboundSchema: z.ZodMiniType< + CheckResponse, unknown > = z.pipe( z.object({ @@ -1227,7 +1351,7 @@ export const BalancesCheckResponse$inboundSchema: z.ZodMiniType< customer_id: types.string(), entity_id: z.optional(z.nullable(types.string())), required_balance: types.optional(types.number()), - balance: types.nullable(z.lazy(() => BalancesCheckBalance$inboundSchema)), + balance: types.nullable(z.lazy(() => CheckBalance$inboundSchema)), preview: types.optional(z.lazy(() => Preview$inboundSchema)), }), z.transform((v) => { @@ -1239,12 +1363,12 @@ export const BalancesCheckResponse$inboundSchema: z.ZodMiniType< }), ); -export function balancesCheckResponseFromJSON( +export function checkResponseFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => BalancesCheckResponse$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'BalancesCheckResponse' from JSON`, + (x) => CheckResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CheckResponse' from JSON`, ); } diff --git a/packages/sdk/src/models/create-balance-op.ts b/packages/sdk/src/models/create-balance-op.ts new file mode 100644 index 000000000..640e2c811 --- /dev/null +++ b/packages/sdk/src/models/create-balance-op.ts @@ -0,0 +1,186 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { ClosedEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type CreateBalanceGlobals = { + xApiVersion?: string | undefined; +}; + +/** + * The interval at which the balance resets (e.g., 'month', 'day', 'year'). + */ +export const CreateBalanceInterval = { + OneOff: "one_off", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * The interval at which the balance resets (e.g., 'month', 'day', 'year'). + */ +export type CreateBalanceInterval = ClosedEnum; + +/** + * Reset configuration for the balance. If not provided, the balance is a one-time grant that never resets. + */ +export type CreateBalanceReset = { + /** + * The interval at which the balance resets (e.g., 'month', 'day', 'year'). + */ + interval: CreateBalanceInterval; + /** + * Number of intervals between resets. Defaults to 1 (e.g., interval_count: 2 with interval: 'month' resets every 2 months). + */ + intervalCount?: number | undefined; +}; + +export type CreateBalanceParams = { + /** + * The ID of the customer. + */ + customerId: string; + /** + * The ID of the feature. + */ + featureId: string; + /** + * The ID of the entity for entity-scoped balances (e.g., per-seat limits). + */ + entityId?: string | undefined; + /** + * The initial balance amount to grant. For metered features, this is the number of units the customer can use. + */ + included?: number | undefined; + /** + * If true, the balance has unlimited usage. Cannot be combined with 'included'. + */ + unlimited?: boolean | undefined; + /** + * Reset configuration for the balance. If not provided, the balance is a one-time grant that never resets. + */ + reset?: CreateBalanceReset | undefined; + /** + * Unix timestamp (milliseconds) when the balance expires. Mutually exclusive with reset. + */ + expiresAt?: number | undefined; + grantedBalance?: number | undefined; +}; + +/** + * OK + */ +export type CreateBalanceResponse = { + success: boolean; +}; + +/** @internal */ +export const CreateBalanceInterval$outboundSchema: z.ZodMiniEnum< + typeof CreateBalanceInterval +> = z.enum(CreateBalanceInterval); + +/** @internal */ +export type CreateBalanceReset$Outbound = { + interval: string; + interval_count?: number | undefined; +}; + +/** @internal */ +export const CreateBalanceReset$outboundSchema: z.ZodMiniType< + CreateBalanceReset$Outbound, + CreateBalanceReset +> = z.pipe( + z.object({ + interval: CreateBalanceInterval$outboundSchema, + intervalCount: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + }); + }), +); + +export function createBalanceResetToJSON( + createBalanceReset: CreateBalanceReset, +): string { + return JSON.stringify( + CreateBalanceReset$outboundSchema.parse(createBalanceReset), + ); +} + +/** @internal */ +export type CreateBalanceParams$Outbound = { + customer_id: string; + feature_id: string; + entity_id?: string | undefined; + included?: number | undefined; + unlimited?: boolean | undefined; + reset?: CreateBalanceReset$Outbound | undefined; + expires_at?: number | undefined; + granted_balance?: number | undefined; +}; + +/** @internal */ +export const CreateBalanceParams$outboundSchema: z.ZodMiniType< + CreateBalanceParams$Outbound, + CreateBalanceParams +> = z.pipe( + z.object({ + customerId: z.string(), + featureId: z.string(), + entityId: z.optional(z.string()), + included: z.optional(z.number()), + unlimited: z.optional(z.boolean()), + reset: z.optional(z.lazy(() => CreateBalanceReset$outboundSchema)), + expiresAt: z.optional(z.number()), + grantedBalance: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + featureId: "feature_id", + entityId: "entity_id", + expiresAt: "expires_at", + grantedBalance: "granted_balance", + }); + }), +); + +export function createBalanceParamsToJSON( + createBalanceParams: CreateBalanceParams, +): string { + return JSON.stringify( + CreateBalanceParams$outboundSchema.parse(createBalanceParams), + ); +} + +/** @internal */ +export const CreateBalanceResponse$inboundSchema: z.ZodMiniType< + CreateBalanceResponse, + unknown +> = z.object({ + success: types.boolean(), +}); + +export function createBalanceResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateBalanceResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateBalanceResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/create-entity-op.ts b/packages/sdk/src/models/create-entity-op.ts new file mode 100644 index 000000000..b31d8b2ec --- /dev/null +++ b/packages/sdk/src/models/create-entity-op.ts @@ -0,0 +1,948 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { smartUnion } from "../types/smart-union.js"; +import { + CustomerData, + CustomerData$Outbound, + CustomerData$outboundSchema, +} from "./customer-data.js"; +import { Plan, Plan$inboundSchema } from "./plan.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type CreateEntityGlobals = { + xApiVersion?: string | undefined; +}; + +export type CreateEntityParams = { + /** + * The name of the entity + */ + name?: string | null | undefined; + /** + * The ID of the feature this entity is associated with + */ + featureId: string; + /** + * Customer details to set when creating a customer + */ + customerData?: CustomerData | undefined; + /** + * The ID of the customer to create the entity for. + */ + customerId: string; + /** + * The ID of the entity. + */ + entityId: string; +}; + +/** + * The environment (sandbox/live) + */ +export const CreateEntityEnv = { + Sandbox: "sandbox", + Live: "live", +} as const; +/** + * The environment (sandbox/live) + */ +export type CreateEntityEnv = OpenEnum; + +/** + * Current status of the subscription. + */ +export const CreateEntityStatus = { + Active: "active", + Scheduled: "scheduled", +} as const; +/** + * Current status of the subscription. + */ +export type CreateEntityStatus = OpenEnum; + +export type CreateEntitySubscription = { + plan?: Plan | undefined; + /** + * The unique identifier of the subscribed plan. + */ + planId: string; + /** + * Whether the plan was automatically enabled for the customer. + */ + autoEnable: boolean; + /** + * Whether this is an add-on plan rather than a base subscription. + */ + addOn: boolean; + /** + * Current status of the subscription. + */ + status: CreateEntityStatus; + /** + * Whether the subscription has overdue payments. + */ + pastDue: boolean; + /** + * Timestamp when the subscription was canceled, or null if not canceled. + */ + canceledAt: number | null; + /** + * Timestamp when the subscription will expire, or null if no expiry set. + */ + expiresAt: number | null; + /** + * Timestamp when the trial period ends, or null if not on trial. + */ + trialEndsAt: number | null; + /** + * Timestamp when the subscription started. + */ + startedAt: number; + /** + * Start timestamp of the current billing period. + */ + currentPeriodStart: number | null; + /** + * End timestamp of the current billing period. + */ + currentPeriodEnd: number | null; + /** + * Number of units of this subscription (for per-seat plans). + */ + quantity: number; +}; + +export type CreateEntityPurchase = { + plan?: Plan | undefined; + /** + * The unique identifier of the purchased plan. + */ + planId: string; + /** + * Timestamp when the purchase expires, or null for lifetime access. + */ + expiresAt: number | null; + /** + * Timestamp when the purchase was made. + */ + startedAt: number; + /** + * Number of units purchased. + */ + quantity: number; +}; + +export const CreateEntityType = { + Boolean: "boolean", + Metered: "metered", + CreditSystem: "credit_system", +} as const; +export type CreateEntityType = OpenEnum; + +export type CreateEntityCreditSchema = { + meteredFeatureId: string; + creditCost: number; +}; + +export type CreateEntityDisplay = { + singular?: string | null | undefined; + plural?: string | null | undefined; +}; + +/** + * The full feature object if expanded. + */ +export type CreateEntityFeature = { + id: string; + name: string; + type: CreateEntityType; + consumable: boolean; + eventNames?: Array | undefined; + creditSchema?: Array | undefined; + display?: CreateEntityDisplay | undefined; + archived: boolean; +}; + +export const CreateEntityIntervalEnum = { + OneOff: "one_off", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +export type CreateEntityIntervalEnum = OpenEnum< + typeof CreateEntityIntervalEnum +>; + +/** + * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + */ +export type CreateEntityIntervalUnion = CreateEntityIntervalEnum | string; + +export type CreateEntityReset = { + /** + * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + */ + interval: CreateEntityIntervalEnum | string; + /** + * Number of intervals between resets (eg. 2 for bi-monthly). + */ + intervalCount?: number | undefined; + /** + * Timestamp when the balance will next reset. + */ + resetsAt: number | null; +}; + +export type CreateEntityTo = number | string; + +export type CreateEntityTier = { + to: number | string; + amount: number; +}; + +/** + * Whether usage is prepaid or billed pay-per-use. + */ +export const CreateEntityBillingMethod = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +/** + * Whether usage is prepaid or billed pay-per-use. + */ +export type CreateEntityBillingMethod = OpenEnum< + typeof CreateEntityBillingMethod +>; + +export type CreateEntityPrice = { + /** + * The per-unit price amount. + */ + amount?: number | undefined; + /** + * Tiered pricing configuration if applicable. + */ + tiers?: Array | undefined; + /** + * The number of units per billing increment (eg. $9 / 250 units). + */ + billingUnits: number; + /** + * Whether usage is prepaid or billed pay-per-use. + */ + billingMethod: CreateEntityBillingMethod; + /** + * Maximum quantity that can be purchased, or null for unlimited. + */ + maxPurchase: number | null; +}; + +export type CreateEntityBreakdown = { + /** + * The unique identifier for this balance breakdown. + */ + id: string; + /** + * The plan ID this balance originates from, or null for standalone balances. + */ + planId: string | null; + /** + * Amount granted from the plan's included usage. + */ + includedGrant: number; + /** + * Amount granted from prepaid purchases or top-ups. + */ + prepaidGrant: number; + /** + * Remaining balance available for use. + */ + remaining: number; + /** + * Amount consumed in the current period. + */ + usage: number; + /** + * Whether this balance has unlimited usage. + */ + unlimited: boolean; + /** + * Reset configuration for this balance, or null if no reset. + */ + reset: CreateEntityReset | null; + /** + * Pricing configuration if this balance has usage-based pricing. + */ + price: CreateEntityPrice | null; + /** + * Timestamp when this balance expires, or null for no expiration. + */ + expiresAt: number | null; +}; + +export type CreateEntityRollover = { + /** + * Amount of balance rolled over from a previous period. + */ + balance: number; + /** + * Timestamp when the rollover balance expires. + */ + expiresAt: number; +}; + +export type CreateEntityBalances = { + /** + * The feature ID this balance is for. + */ + featureId: string; + /** + * The full feature object if expanded. + */ + feature?: CreateEntityFeature | undefined; + /** + * Total balance granted (included + prepaid). + */ + granted: number; + /** + * Remaining balance available for use. + */ + remaining: number; + /** + * Total usage consumed in the current period. + */ + usage: number; + /** + * Whether this feature has unlimited usage. + */ + unlimited: boolean; + /** + * Whether usage beyond the granted balance is allowed (with overage charges). + */ + overageAllowed: boolean; + /** + * Maximum quantity that can be purchased as a top-up, or null for unlimited. + */ + maxPurchase: number | null; + /** + * Timestamp when the balance will reset, or null for no reset. + */ + nextResetAt: number | null; + /** + * Detailed breakdown of balance sources when stacking multiple plans or grants. + */ + breakdown?: Array | undefined; + /** + * Rollover balances carried over from previous periods. + */ + rollovers?: Array | undefined; +}; + +export type CreateEntityInvoice = { + /** + * Array of plan IDs included in this invoice + */ + planIds: Array; + /** + * The Stripe invoice ID + */ + stripeId: string; + /** + * The status of the invoice + */ + status: string; + /** + * The total amount of the invoice + */ + total: number; + /** + * The currency code for the invoice + */ + currency: string; + /** + * Timestamp when the invoice was created + */ + createdAt: number; + /** + * URL to the Stripe-hosted invoice page + */ + hostedInvoiceUrl?: string | null | undefined; +}; + +/** + * OK + */ +export type CreateEntityResponse = { + autumnId?: string | undefined; + /** + * The unique identifier of the entity + */ + id: string | null; + /** + * The name of the entity + */ + name: string | null; + /** + * The customer ID this entity belongs to + */ + customerId?: string | null | undefined; + /** + * The feature ID this entity belongs to + */ + featureId?: string | null | undefined; + /** + * Unix timestamp when the entity was created + */ + createdAt: number; + /** + * The environment (sandbox/live) + */ + env: CreateEntityEnv; + subscriptions: Array; + purchases: Array; + balances: { [k: string]: CreateEntityBalances }; + /** + * Invoices for this entity (only included when expand=invoices) + */ + invoices?: Array | undefined; +}; + +/** @internal */ +export type CreateEntityParams$Outbound = { + name?: string | null | undefined; + feature_id: string; + customer_data?: CustomerData$Outbound | undefined; + customer_id: string; + entity_id: string; +}; + +/** @internal */ +export const CreateEntityParams$outboundSchema: z.ZodMiniType< + CreateEntityParams$Outbound, + CreateEntityParams +> = z.pipe( + z.object({ + name: z.optional(z.nullable(z.string())), + featureId: z.string(), + customerData: z.optional(CustomerData$outboundSchema), + customerId: z.string(), + entityId: z.string(), + }), + z.transform((v) => { + return remap$(v, { + featureId: "feature_id", + customerData: "customer_data", + customerId: "customer_id", + entityId: "entity_id", + }); + }), +); + +export function createEntityParamsToJSON( + createEntityParams: CreateEntityParams, +): string { + return JSON.stringify( + CreateEntityParams$outboundSchema.parse(createEntityParams), + ); +} + +/** @internal */ +export const CreateEntityEnv$inboundSchema: z.ZodMiniType< + CreateEntityEnv, + unknown +> = openEnums.inboundSchema(CreateEntityEnv); + +/** @internal */ +export const CreateEntityStatus$inboundSchema: z.ZodMiniType< + CreateEntityStatus, + unknown +> = openEnums.inboundSchema(CreateEntityStatus); + +/** @internal */ +export const CreateEntitySubscription$inboundSchema: z.ZodMiniType< + CreateEntitySubscription, + unknown +> = z.pipe( + z.object({ + plan: types.optional(Plan$inboundSchema), + plan_id: types.string(), + auto_enable: types.boolean(), + add_on: types.boolean(), + status: CreateEntityStatus$inboundSchema, + past_due: types.boolean(), + canceled_at: types.nullable(types.number()), + expires_at: types.nullable(types.number()), + trial_ends_at: types.nullable(types.number()), + started_at: types.number(), + current_period_start: types.nullable(types.number()), + current_period_end: types.nullable(types.number()), + quantity: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "plan_id": "planId", + "auto_enable": "autoEnable", + "add_on": "addOn", + "past_due": "pastDue", + "canceled_at": "canceledAt", + "expires_at": "expiresAt", + "trial_ends_at": "trialEndsAt", + "started_at": "startedAt", + "current_period_start": "currentPeriodStart", + "current_period_end": "currentPeriodEnd", + }); + }), +); + +export function createEntitySubscriptionFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateEntitySubscription$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateEntitySubscription' from JSON`, + ); +} + +/** @internal */ +export const CreateEntityPurchase$inboundSchema: z.ZodMiniType< + CreateEntityPurchase, + unknown +> = z.pipe( + z.object({ + plan: types.optional(Plan$inboundSchema), + plan_id: types.string(), + expires_at: types.nullable(types.number()), + started_at: types.number(), + quantity: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "plan_id": "planId", + "expires_at": "expiresAt", + "started_at": "startedAt", + }); + }), +); + +export function createEntityPurchaseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateEntityPurchase$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateEntityPurchase' from JSON`, + ); +} + +/** @internal */ +export const CreateEntityType$inboundSchema: z.ZodMiniType< + CreateEntityType, + unknown +> = openEnums.inboundSchema(CreateEntityType); + +/** @internal */ +export const CreateEntityCreditSchema$inboundSchema: z.ZodMiniType< + CreateEntityCreditSchema, + unknown +> = z.pipe( + z.object({ + metered_feature_id: types.string(), + credit_cost: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "metered_feature_id": "meteredFeatureId", + "credit_cost": "creditCost", + }); + }), +); + +export function createEntityCreditSchemaFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateEntityCreditSchema$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateEntityCreditSchema' from JSON`, + ); +} + +/** @internal */ +export const CreateEntityDisplay$inboundSchema: z.ZodMiniType< + CreateEntityDisplay, + unknown +> = z.object({ + singular: z.optional(z.nullable(types.string())), + plural: z.optional(z.nullable(types.string())), +}); + +export function createEntityDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateEntityDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateEntityDisplay' from JSON`, + ); +} + +/** @internal */ +export const CreateEntityFeature$inboundSchema: z.ZodMiniType< + CreateEntityFeature, + unknown +> = z.pipe( + z.object({ + id: types.string(), + name: types.string(), + type: CreateEntityType$inboundSchema, + consumable: types.boolean(), + event_names: types.optional(z.array(types.string())), + credit_schema: types.optional( + z.array(z.lazy(() => CreateEntityCreditSchema$inboundSchema)), + ), + display: types.optional(z.lazy(() => CreateEntityDisplay$inboundSchema)), + archived: types.boolean(), + }), + z.transform((v) => { + return remap$(v, { + "event_names": "eventNames", + "credit_schema": "creditSchema", + }); + }), +); + +export function createEntityFeatureFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateEntityFeature$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateEntityFeature' from JSON`, + ); +} + +/** @internal */ +export const CreateEntityIntervalEnum$inboundSchema: z.ZodMiniType< + CreateEntityIntervalEnum, + unknown +> = openEnums.inboundSchema(CreateEntityIntervalEnum); + +/** @internal */ +export const CreateEntityIntervalUnion$inboundSchema: z.ZodMiniType< + CreateEntityIntervalUnion, + unknown +> = smartUnion([CreateEntityIntervalEnum$inboundSchema, types.string()]); + +export function createEntityIntervalUnionFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateEntityIntervalUnion$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateEntityIntervalUnion' from JSON`, + ); +} + +/** @internal */ +export const CreateEntityReset$inboundSchema: z.ZodMiniType< + CreateEntityReset, + unknown +> = z.pipe( + z.object({ + interval: smartUnion([ + CreateEntityIntervalEnum$inboundSchema, + types.string(), + ]), + interval_count: types.optional(types.number()), + resets_at: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + "resets_at": "resetsAt", + }); + }), +); + +export function createEntityResetFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateEntityReset$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateEntityReset' from JSON`, + ); +} + +/** @internal */ +export const CreateEntityTo$inboundSchema: z.ZodMiniType< + CreateEntityTo, + unknown +> = smartUnion([types.number(), types.string()]); + +export function createEntityToFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateEntityTo$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateEntityTo' from JSON`, + ); +} + +/** @internal */ +export const CreateEntityTier$inboundSchema: z.ZodMiniType< + CreateEntityTier, + unknown +> = z.object({ + to: smartUnion([types.number(), types.string()]), + amount: types.number(), +}); + +export function createEntityTierFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateEntityTier$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateEntityTier' from JSON`, + ); +} + +/** @internal */ +export const CreateEntityBillingMethod$inboundSchema: z.ZodMiniType< + CreateEntityBillingMethod, + unknown +> = openEnums.inboundSchema(CreateEntityBillingMethod); + +/** @internal */ +export const CreateEntityPrice$inboundSchema: z.ZodMiniType< + CreateEntityPrice, + unknown +> = z.pipe( + z.object({ + amount: types.optional(types.number()), + tiers: types.optional( + z.array(z.lazy(() => CreateEntityTier$inboundSchema)), + ), + billing_units: types.number(), + billing_method: CreateEntityBillingMethod$inboundSchema, + max_purchase: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "billing_units": "billingUnits", + "billing_method": "billingMethod", + "max_purchase": "maxPurchase", + }); + }), +); + +export function createEntityPriceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateEntityPrice$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateEntityPrice' from JSON`, + ); +} + +/** @internal */ +export const CreateEntityBreakdown$inboundSchema: z.ZodMiniType< + CreateEntityBreakdown, + unknown +> = z.pipe( + z.object({ + id: z._default(types.string(), ""), + plan_id: types.nullable(types.string()), + included_grant: types.number(), + prepaid_grant: types.number(), + remaining: types.number(), + usage: types.number(), + unlimited: types.boolean(), + reset: types.nullable(z.lazy(() => CreateEntityReset$inboundSchema)), + price: types.nullable(z.lazy(() => CreateEntityPrice$inboundSchema)), + expires_at: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "plan_id": "planId", + "included_grant": "includedGrant", + "prepaid_grant": "prepaidGrant", + "expires_at": "expiresAt", + }); + }), +); + +export function createEntityBreakdownFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateEntityBreakdown$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateEntityBreakdown' from JSON`, + ); +} + +/** @internal */ +export const CreateEntityRollover$inboundSchema: z.ZodMiniType< + CreateEntityRollover, + unknown +> = z.pipe( + z.object({ + balance: types.number(), + expires_at: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "expires_at": "expiresAt", + }); + }), +); + +export function createEntityRolloverFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateEntityRollover$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateEntityRollover' from JSON`, + ); +} + +/** @internal */ +export const CreateEntityBalances$inboundSchema: z.ZodMiniType< + CreateEntityBalances, + unknown +> = z.pipe( + z.object({ + feature_id: types.string(), + feature: types.optional(z.lazy(() => CreateEntityFeature$inboundSchema)), + granted: types.number(), + remaining: types.number(), + usage: types.number(), + unlimited: types.boolean(), + overage_allowed: types.boolean(), + max_purchase: types.nullable(types.number()), + next_reset_at: types.nullable(types.number()), + breakdown: types.optional( + z.array(z.lazy(() => CreateEntityBreakdown$inboundSchema)), + ), + rollovers: types.optional( + z.array(z.lazy(() => CreateEntityRollover$inboundSchema)), + ), + }), + z.transform((v) => { + return remap$(v, { + "feature_id": "featureId", + "overage_allowed": "overageAllowed", + "max_purchase": "maxPurchase", + "next_reset_at": "nextResetAt", + }); + }), +); + +export function createEntityBalancesFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateEntityBalances$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateEntityBalances' from JSON`, + ); +} + +/** @internal */ +export const CreateEntityInvoice$inboundSchema: z.ZodMiniType< + CreateEntityInvoice, + unknown +> = z.pipe( + z.object({ + plan_ids: z.array(types.string()), + stripe_id: types.string(), + status: types.string(), + total: types.number(), + currency: types.string(), + created_at: types.number(), + hosted_invoice_url: z.optional(z.nullable(types.string())), + }), + z.transform((v) => { + return remap$(v, { + "plan_ids": "planIds", + "stripe_id": "stripeId", + "created_at": "createdAt", + "hosted_invoice_url": "hostedInvoiceUrl", + }); + }), +); + +export function createEntityInvoiceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateEntityInvoice$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateEntityInvoice' from JSON`, + ); +} + +/** @internal */ +export const CreateEntityResponse$inboundSchema: z.ZodMiniType< + CreateEntityResponse, + unknown +> = z.pipe( + z.object({ + autumn_id: types.optional(types.string()), + id: types.nullable(types.string()), + name: types.nullable(types.string()), + customer_id: z.optional(z.nullable(types.string())), + feature_id: z.optional(z.nullable(types.string())), + created_at: types.number(), + env: CreateEntityEnv$inboundSchema, + subscriptions: z.array( + z.lazy(() => CreateEntitySubscription$inboundSchema), + ), + purchases: z.array(z.lazy(() => CreateEntityPurchase$inboundSchema)), + balances: z.record( + z.string(), + z.lazy(() => CreateEntityBalances$inboundSchema), + ), + invoices: types.optional( + z.array(z.lazy(() => CreateEntityInvoice$inboundSchema)), + ), + }), + z.transform((v) => { + return remap$(v, { + "autumn_id": "autumnId", + "customer_id": "customerId", + "feature_id": "featureId", + "created_at": "createdAt", + }); + }), +); + +export function createEntityResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateEntityResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateEntityResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/create-referral-code-op.ts b/packages/sdk/src/models/create-referral-code-op.ts new file mode 100644 index 000000000..d979198ac --- /dev/null +++ b/packages/sdk/src/models/create-referral-code-op.ts @@ -0,0 +1,102 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type CreateReferralCodeGlobals = { + xApiVersion?: string | undefined; +}; + +export type CreateReferralCodeParams = { + /** + * The unique identifier of the customer + */ + customerId: string; + /** + * ID of your referral program + */ + programId: string; +}; + +/** + * OK + */ +export type CreateReferralCodeResponse = { + /** + * The referral code that can be shared with customers + */ + code: string; + /** + * Your unique identifier for the customer + */ + customerId: string; + /** + * The timestamp of when the referral code was created + */ + createdAt: number; +}; + +/** @internal */ +export type CreateReferralCodeParams$Outbound = { + customer_id: string; + program_id: string; +}; + +/** @internal */ +export const CreateReferralCodeParams$outboundSchema: z.ZodMiniType< + CreateReferralCodeParams$Outbound, + CreateReferralCodeParams +> = z.pipe( + z.object({ + customerId: z.string(), + programId: z.string(), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + programId: "program_id", + }); + }), +); + +export function createReferralCodeParamsToJSON( + createReferralCodeParams: CreateReferralCodeParams, +): string { + return JSON.stringify( + CreateReferralCodeParams$outboundSchema.parse(createReferralCodeParams), + ); +} + +/** @internal */ +export const CreateReferralCodeResponse$inboundSchema: z.ZodMiniType< + CreateReferralCodeResponse, + unknown +> = z.pipe( + z.object({ + code: types.string(), + customer_id: types.string(), + created_at: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "customer_id": "customerId", + "created_at": "createdAt", + }); + }), +); + +export function createReferralCodeResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateReferralCodeResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateReferralCodeResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/customer.ts b/packages/sdk/src/models/customer.ts index 85200c462..3caab66e2 100644 --- a/packages/sdk/src/models/customer.ts +++ b/packages/sdk/src/models/customer.ts @@ -25,34 +25,87 @@ export const CustomerEnv = { */ export type CustomerEnv = OpenEnum; +/** + * Current status of the subscription. + */ export const Status = { Active: "active", Scheduled: "scheduled", - Expired: "expired", } as const; +/** + * Current status of the subscription. + */ export type Status = OpenEnum; export type Subscription = { plan?: Plan | undefined; + /** + * The unique identifier of the subscribed plan. + */ planId: string; + /** + * Whether the plan was automatically enabled for the customer. + */ autoEnable: boolean; + /** + * Whether this is an add-on plan rather than a base subscription. + */ addOn: boolean; + /** + * Current status of the subscription. + */ status: Status; + /** + * Whether the subscription has overdue payments. + */ pastDue: boolean; + /** + * Timestamp when the subscription was canceled, or null if not canceled. + */ canceledAt: number | null; + /** + * Timestamp when the subscription will expire, or null if no expiry set. + */ expiresAt: number | null; + /** + * Timestamp when the trial period ends, or null if not on trial. + */ trialEndsAt: number | null; + /** + * Timestamp when the subscription started. + */ startedAt: number; + /** + * Start timestamp of the current billing period. + */ currentPeriodStart: number | null; + /** + * End timestamp of the current billing period. + */ currentPeriodEnd: number | null; + /** + * Number of units of this subscription (for per-seat plans). + */ quantity: number; }; export type Purchase = { plan?: Plan | undefined; + /** + * The unique identifier of the purchased plan. + */ planId: string; + /** + * Timestamp when the purchase expires, or null for lifetime access. + */ expiresAt: number | null; + /** + * Timestamp when the purchase was made. + */ startedAt: number; + /** + * Number of units purchased. + */ quantity: number; }; @@ -73,6 +126,9 @@ export type CustomerDisplay = { plural?: string | null | undefined; }; +/** + * The full feature object if expanded. + */ export type CustomerFeature = { id: string; name: string; @@ -97,11 +153,23 @@ export const CustomerIntervalEnum = { } as const; export type CustomerIntervalEnum = OpenEnum; +/** + * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + */ export type CustomerIntervalUnion = CustomerIntervalEnum | string; export type CustomerReset = { + /** + * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + */ interval: CustomerIntervalEnum | string; + /** + * Number of intervals between resets (eg. 2 for bi-monthly). + */ intervalCount?: number | undefined; + /** + * Timestamp when the balance will next reset. + */ resetsAt: number | null; }; @@ -112,49 +180,139 @@ export type CustomerTier = { amount: number; }; +/** + * Whether usage is prepaid or billed pay-per-use. + */ export const CustomerBillingMethod = { Prepaid: "prepaid", UsageBased: "usage_based", } as const; +/** + * Whether usage is prepaid or billed pay-per-use. + */ export type CustomerBillingMethod = OpenEnum; export type CustomerPrice = { + /** + * The per-unit price amount. + */ amount?: number | undefined; + /** + * Tiered pricing configuration if applicable. + */ tiers?: Array | undefined; + /** + * The number of units per billing increment (eg. $9 / 250 units). + */ billingUnits: number; + /** + * Whether usage is prepaid or billed pay-per-use. + */ billingMethod: CustomerBillingMethod; + /** + * Maximum quantity that can be purchased, or null for unlimited. + */ maxPurchase: number | null; }; export type Breakdown = { + /** + * The unique identifier for this balance breakdown. + */ id: string; + /** + * The plan ID this balance originates from, or null for standalone balances. + */ planId: string | null; + /** + * Amount granted from the plan's included usage. + */ includedGrant: number; + /** + * Amount granted from prepaid purchases or top-ups. + */ prepaidGrant: number; + /** + * Remaining balance available for use. + */ remaining: number; + /** + * Amount consumed in the current period. + */ usage: number; + /** + * Whether this balance has unlimited usage. + */ unlimited: boolean; + /** + * Reset configuration for this balance, or null if no reset. + */ reset: CustomerReset | null; + /** + * Pricing configuration if this balance has usage-based pricing. + */ price: CustomerPrice | null; + /** + * Timestamp when this balance expires, or null for no expiration. + */ expiresAt: number | null; }; export type CustomerRollover = { + /** + * Amount of balance rolled over from a previous period. + */ balance: number; + /** + * Timestamp when the rollover balance expires. + */ expiresAt: number; }; export type Balances = { + /** + * The feature ID this balance is for. + */ featureId: string; + /** + * The full feature object if expanded. + */ feature?: CustomerFeature | undefined; + /** + * Total balance granted (included + prepaid). + */ granted: number; + /** + * Remaining balance available for use. + */ remaining: number; + /** + * Total usage consumed in the current period. + */ usage: number; + /** + * Whether this feature has unlimited usage. + */ unlimited: boolean; + /** + * Whether usage beyond the granted balance is allowed (with overage charges). + */ overageAllowed: boolean; + /** + * Maximum quantity that can be purchased as a top-up, or null for unlimited. + */ maxPurchase: number | null; + /** + * Timestamp when the balance will reset, or null for no reset. + */ nextResetAt: number | null; + /** + * Detailed breakdown of balance sources when stacking multiple plans or grants. + */ breakdown?: Array | undefined; + /** + * Rollover balances carried over from previous periods. + */ rollovers?: Array | undefined; }; @@ -366,8 +524,17 @@ export type Customer = { * Whether to send email receipts to the customer. */ sendEmailReceipts: boolean; + /** + * Active and scheduled recurring plans that this customer has attached. + */ subscriptions: Array; + /** + * One-time purchases made by the customer. + */ purchases: Array; + /** + * Feature balances keyed by feature ID, showing usage limits and remaining amounts. + */ balances: { [k: string]: Balances }; invoices?: Array | undefined; entities?: Array | undefined; diff --git a/packages/sdk/src/models/delete-entity-op.ts b/packages/sdk/src/models/delete-entity-op.ts new file mode 100644 index 000000000..09d6e2c7e --- /dev/null +++ b/packages/sdk/src/models/delete-entity-op.ts @@ -0,0 +1,81 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type DeleteEntityGlobals = { + xApiVersion?: string | undefined; +}; + +export type DeleteEntityParams = { + /** + * The ID of the customer. + */ + customerId?: string | undefined; + /** + * The ID of the entity. + */ + entityId: string; +}; + +/** + * OK + */ +export type DeleteEntityResponse = { + success: boolean; +}; + +/** @internal */ +export type DeleteEntityParams$Outbound = { + customer_id?: string | undefined; + entity_id: string; +}; + +/** @internal */ +export const DeleteEntityParams$outboundSchema: z.ZodMiniType< + DeleteEntityParams$Outbound, + DeleteEntityParams +> = z.pipe( + z.object({ + customerId: z.optional(z.string()), + entityId: z.string(), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + entityId: "entity_id", + }); + }), +); + +export function deleteEntityParamsToJSON( + deleteEntityParams: DeleteEntityParams, +): string { + return JSON.stringify( + DeleteEntityParams$outboundSchema.parse(deleteEntityParams), + ); +} + +/** @internal */ +export const DeleteEntityResponse$inboundSchema: z.ZodMiniType< + DeleteEntityResponse, + unknown +> = z.object({ + success: types.boolean(), +}); + +export function deleteEntityResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DeleteEntityResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DeleteEntityResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/get-entity-op.ts b/packages/sdk/src/models/get-entity-op.ts new file mode 100644 index 000000000..4557f8592 --- /dev/null +++ b/packages/sdk/src/models/get-entity-op.ts @@ -0,0 +1,906 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { smartUnion } from "../types/smart-union.js"; +import { Plan, Plan$inboundSchema } from "./plan.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type GetEntityGlobals = { + xApiVersion?: string | undefined; +}; + +export type GetEntityParams = { + /** + * The ID of the customer to create the entity for. + */ + customerId?: string | undefined; + /** + * The ID of the entity. + */ + entityId: string; +}; + +/** + * The environment (sandbox/live) + */ +export const GetEntityEnv = { + Sandbox: "sandbox", + Live: "live", +} as const; +/** + * The environment (sandbox/live) + */ +export type GetEntityEnv = OpenEnum; + +/** + * Current status of the subscription. + */ +export const GetEntityStatus = { + Active: "active", + Scheduled: "scheduled", +} as const; +/** + * Current status of the subscription. + */ +export type GetEntityStatus = OpenEnum; + +export type GetEntitySubscription = { + plan?: Plan | undefined; + /** + * The unique identifier of the subscribed plan. + */ + planId: string; + /** + * Whether the plan was automatically enabled for the customer. + */ + autoEnable: boolean; + /** + * Whether this is an add-on plan rather than a base subscription. + */ + addOn: boolean; + /** + * Current status of the subscription. + */ + status: GetEntityStatus; + /** + * Whether the subscription has overdue payments. + */ + pastDue: boolean; + /** + * Timestamp when the subscription was canceled, or null if not canceled. + */ + canceledAt: number | null; + /** + * Timestamp when the subscription will expire, or null if no expiry set. + */ + expiresAt: number | null; + /** + * Timestamp when the trial period ends, or null if not on trial. + */ + trialEndsAt: number | null; + /** + * Timestamp when the subscription started. + */ + startedAt: number; + /** + * Start timestamp of the current billing period. + */ + currentPeriodStart: number | null; + /** + * End timestamp of the current billing period. + */ + currentPeriodEnd: number | null; + /** + * Number of units of this subscription (for per-seat plans). + */ + quantity: number; +}; + +export type GetEntityPurchase = { + plan?: Plan | undefined; + /** + * The unique identifier of the purchased plan. + */ + planId: string; + /** + * Timestamp when the purchase expires, or null for lifetime access. + */ + expiresAt: number | null; + /** + * Timestamp when the purchase was made. + */ + startedAt: number; + /** + * Number of units purchased. + */ + quantity: number; +}; + +export const GetEntityType = { + Boolean: "boolean", + Metered: "metered", + CreditSystem: "credit_system", +} as const; +export type GetEntityType = OpenEnum; + +export type GetEntityCreditSchema = { + meteredFeatureId: string; + creditCost: number; +}; + +export type GetEntityDisplay = { + singular?: string | null | undefined; + plural?: string | null | undefined; +}; + +/** + * The full feature object if expanded. + */ +export type GetEntityFeature = { + id: string; + name: string; + type: GetEntityType; + consumable: boolean; + eventNames?: Array | undefined; + creditSchema?: Array | undefined; + display?: GetEntityDisplay | undefined; + archived: boolean; +}; + +export const GetEntityIntervalEnum = { + OneOff: "one_off", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +export type GetEntityIntervalEnum = OpenEnum; + +/** + * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + */ +export type GetEntityIntervalUnion = GetEntityIntervalEnum | string; + +export type GetEntityReset = { + /** + * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + */ + interval: GetEntityIntervalEnum | string; + /** + * Number of intervals between resets (eg. 2 for bi-monthly). + */ + intervalCount?: number | undefined; + /** + * Timestamp when the balance will next reset. + */ + resetsAt: number | null; +}; + +export type GetEntityTo = number | string; + +export type GetEntityTier = { + to: number | string; + amount: number; +}; + +/** + * Whether usage is prepaid or billed pay-per-use. + */ +export const GetEntityBillingMethod = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +/** + * Whether usage is prepaid or billed pay-per-use. + */ +export type GetEntityBillingMethod = OpenEnum; + +export type GetEntityPrice = { + /** + * The per-unit price amount. + */ + amount?: number | undefined; + /** + * Tiered pricing configuration if applicable. + */ + tiers?: Array | undefined; + /** + * The number of units per billing increment (eg. $9 / 250 units). + */ + billingUnits: number; + /** + * Whether usage is prepaid or billed pay-per-use. + */ + billingMethod: GetEntityBillingMethod; + /** + * Maximum quantity that can be purchased, or null for unlimited. + */ + maxPurchase: number | null; +}; + +export type GetEntityBreakdown = { + /** + * The unique identifier for this balance breakdown. + */ + id: string; + /** + * The plan ID this balance originates from, or null for standalone balances. + */ + planId: string | null; + /** + * Amount granted from the plan's included usage. + */ + includedGrant: number; + /** + * Amount granted from prepaid purchases or top-ups. + */ + prepaidGrant: number; + /** + * Remaining balance available for use. + */ + remaining: number; + /** + * Amount consumed in the current period. + */ + usage: number; + /** + * Whether this balance has unlimited usage. + */ + unlimited: boolean; + /** + * Reset configuration for this balance, or null if no reset. + */ + reset: GetEntityReset | null; + /** + * Pricing configuration if this balance has usage-based pricing. + */ + price: GetEntityPrice | null; + /** + * Timestamp when this balance expires, or null for no expiration. + */ + expiresAt: number | null; +}; + +export type GetEntityRollover = { + /** + * Amount of balance rolled over from a previous period. + */ + balance: number; + /** + * Timestamp when the rollover balance expires. + */ + expiresAt: number; +}; + +export type GetEntityBalances = { + /** + * The feature ID this balance is for. + */ + featureId: string; + /** + * The full feature object if expanded. + */ + feature?: GetEntityFeature | undefined; + /** + * Total balance granted (included + prepaid). + */ + granted: number; + /** + * Remaining balance available for use. + */ + remaining: number; + /** + * Total usage consumed in the current period. + */ + usage: number; + /** + * Whether this feature has unlimited usage. + */ + unlimited: boolean; + /** + * Whether usage beyond the granted balance is allowed (with overage charges). + */ + overageAllowed: boolean; + /** + * Maximum quantity that can be purchased as a top-up, or null for unlimited. + */ + maxPurchase: number | null; + /** + * Timestamp when the balance will reset, or null for no reset. + */ + nextResetAt: number | null; + /** + * Detailed breakdown of balance sources when stacking multiple plans or grants. + */ + breakdown?: Array | undefined; + /** + * Rollover balances carried over from previous periods. + */ + rollovers?: Array | undefined; +}; + +export type GetEntityInvoice = { + /** + * Array of plan IDs included in this invoice + */ + planIds: Array; + /** + * The Stripe invoice ID + */ + stripeId: string; + /** + * The status of the invoice + */ + status: string; + /** + * The total amount of the invoice + */ + total: number; + /** + * The currency code for the invoice + */ + currency: string; + /** + * Timestamp when the invoice was created + */ + createdAt: number; + /** + * URL to the Stripe-hosted invoice page + */ + hostedInvoiceUrl?: string | null | undefined; +}; + +/** + * OK + */ +export type GetEntityResponse = { + autumnId?: string | undefined; + /** + * The unique identifier of the entity + */ + id: string | null; + /** + * The name of the entity + */ + name: string | null; + /** + * The customer ID this entity belongs to + */ + customerId?: string | null | undefined; + /** + * The feature ID this entity belongs to + */ + featureId?: string | null | undefined; + /** + * Unix timestamp when the entity was created + */ + createdAt: number; + /** + * The environment (sandbox/live) + */ + env: GetEntityEnv; + subscriptions: Array; + purchases: Array; + balances: { [k: string]: GetEntityBalances }; + /** + * Invoices for this entity (only included when expand=invoices) + */ + invoices?: Array | undefined; +}; + +/** @internal */ +export type GetEntityParams$Outbound = { + customer_id?: string | undefined; + entity_id: string; +}; + +/** @internal */ +export const GetEntityParams$outboundSchema: z.ZodMiniType< + GetEntityParams$Outbound, + GetEntityParams +> = z.pipe( + z.object({ + customerId: z.optional(z.string()), + entityId: z.string(), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + entityId: "entity_id", + }); + }), +); + +export function getEntityParamsToJSON( + getEntityParams: GetEntityParams, +): string { + return JSON.stringify(GetEntityParams$outboundSchema.parse(getEntityParams)); +} + +/** @internal */ +export const GetEntityEnv$inboundSchema: z.ZodMiniType = + openEnums.inboundSchema(GetEntityEnv); + +/** @internal */ +export const GetEntityStatus$inboundSchema: z.ZodMiniType< + GetEntityStatus, + unknown +> = openEnums.inboundSchema(GetEntityStatus); + +/** @internal */ +export const GetEntitySubscription$inboundSchema: z.ZodMiniType< + GetEntitySubscription, + unknown +> = z.pipe( + z.object({ + plan: types.optional(Plan$inboundSchema), + plan_id: types.string(), + auto_enable: types.boolean(), + add_on: types.boolean(), + status: GetEntityStatus$inboundSchema, + past_due: types.boolean(), + canceled_at: types.nullable(types.number()), + expires_at: types.nullable(types.number()), + trial_ends_at: types.nullable(types.number()), + started_at: types.number(), + current_period_start: types.nullable(types.number()), + current_period_end: types.nullable(types.number()), + quantity: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "plan_id": "planId", + "auto_enable": "autoEnable", + "add_on": "addOn", + "past_due": "pastDue", + "canceled_at": "canceledAt", + "expires_at": "expiresAt", + "trial_ends_at": "trialEndsAt", + "started_at": "startedAt", + "current_period_start": "currentPeriodStart", + "current_period_end": "currentPeriodEnd", + }); + }), +); + +export function getEntitySubscriptionFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetEntitySubscription$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetEntitySubscription' from JSON`, + ); +} + +/** @internal */ +export const GetEntityPurchase$inboundSchema: z.ZodMiniType< + GetEntityPurchase, + unknown +> = z.pipe( + z.object({ + plan: types.optional(Plan$inboundSchema), + plan_id: types.string(), + expires_at: types.nullable(types.number()), + started_at: types.number(), + quantity: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "plan_id": "planId", + "expires_at": "expiresAt", + "started_at": "startedAt", + }); + }), +); + +export function getEntityPurchaseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetEntityPurchase$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetEntityPurchase' from JSON`, + ); +} + +/** @internal */ +export const GetEntityType$inboundSchema: z.ZodMiniType< + GetEntityType, + unknown +> = openEnums.inboundSchema(GetEntityType); + +/** @internal */ +export const GetEntityCreditSchema$inboundSchema: z.ZodMiniType< + GetEntityCreditSchema, + unknown +> = z.pipe( + z.object({ + metered_feature_id: types.string(), + credit_cost: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "metered_feature_id": "meteredFeatureId", + "credit_cost": "creditCost", + }); + }), +); + +export function getEntityCreditSchemaFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetEntityCreditSchema$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetEntityCreditSchema' from JSON`, + ); +} + +/** @internal */ +export const GetEntityDisplay$inboundSchema: z.ZodMiniType< + GetEntityDisplay, + unknown +> = z.object({ + singular: z.optional(z.nullable(types.string())), + plural: z.optional(z.nullable(types.string())), +}); + +export function getEntityDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetEntityDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetEntityDisplay' from JSON`, + ); +} + +/** @internal */ +export const GetEntityFeature$inboundSchema: z.ZodMiniType< + GetEntityFeature, + unknown +> = z.pipe( + z.object({ + id: types.string(), + name: types.string(), + type: GetEntityType$inboundSchema, + consumable: types.boolean(), + event_names: types.optional(z.array(types.string())), + credit_schema: types.optional( + z.array(z.lazy(() => GetEntityCreditSchema$inboundSchema)), + ), + display: types.optional(z.lazy(() => GetEntityDisplay$inboundSchema)), + archived: types.boolean(), + }), + z.transform((v) => { + return remap$(v, { + "event_names": "eventNames", + "credit_schema": "creditSchema", + }); + }), +); + +export function getEntityFeatureFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetEntityFeature$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetEntityFeature' from JSON`, + ); +} + +/** @internal */ +export const GetEntityIntervalEnum$inboundSchema: z.ZodMiniType< + GetEntityIntervalEnum, + unknown +> = openEnums.inboundSchema(GetEntityIntervalEnum); + +/** @internal */ +export const GetEntityIntervalUnion$inboundSchema: z.ZodMiniType< + GetEntityIntervalUnion, + unknown +> = smartUnion([GetEntityIntervalEnum$inboundSchema, types.string()]); + +export function getEntityIntervalUnionFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetEntityIntervalUnion$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetEntityIntervalUnion' from JSON`, + ); +} + +/** @internal */ +export const GetEntityReset$inboundSchema: z.ZodMiniType< + GetEntityReset, + unknown +> = z.pipe( + z.object({ + interval: smartUnion([GetEntityIntervalEnum$inboundSchema, types.string()]), + interval_count: types.optional(types.number()), + resets_at: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + "resets_at": "resetsAt", + }); + }), +); + +export function getEntityResetFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetEntityReset$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetEntityReset' from JSON`, + ); +} + +/** @internal */ +export const GetEntityTo$inboundSchema: z.ZodMiniType = + smartUnion([types.number(), types.string()]); + +export function getEntityToFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetEntityTo$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetEntityTo' from JSON`, + ); +} + +/** @internal */ +export const GetEntityTier$inboundSchema: z.ZodMiniType< + GetEntityTier, + unknown +> = z.object({ + to: smartUnion([types.number(), types.string()]), + amount: types.number(), +}); + +export function getEntityTierFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetEntityTier$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetEntityTier' from JSON`, + ); +} + +/** @internal */ +export const GetEntityBillingMethod$inboundSchema: z.ZodMiniType< + GetEntityBillingMethod, + unknown +> = openEnums.inboundSchema(GetEntityBillingMethod); + +/** @internal */ +export const GetEntityPrice$inboundSchema: z.ZodMiniType< + GetEntityPrice, + unknown +> = z.pipe( + z.object({ + amount: types.optional(types.number()), + tiers: types.optional(z.array(z.lazy(() => GetEntityTier$inboundSchema))), + billing_units: types.number(), + billing_method: GetEntityBillingMethod$inboundSchema, + max_purchase: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "billing_units": "billingUnits", + "billing_method": "billingMethod", + "max_purchase": "maxPurchase", + }); + }), +); + +export function getEntityPriceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetEntityPrice$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetEntityPrice' from JSON`, + ); +} + +/** @internal */ +export const GetEntityBreakdown$inboundSchema: z.ZodMiniType< + GetEntityBreakdown, + unknown +> = z.pipe( + z.object({ + id: z._default(types.string(), ""), + plan_id: types.nullable(types.string()), + included_grant: types.number(), + prepaid_grant: types.number(), + remaining: types.number(), + usage: types.number(), + unlimited: types.boolean(), + reset: types.nullable(z.lazy(() => GetEntityReset$inboundSchema)), + price: types.nullable(z.lazy(() => GetEntityPrice$inboundSchema)), + expires_at: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "plan_id": "planId", + "included_grant": "includedGrant", + "prepaid_grant": "prepaidGrant", + "expires_at": "expiresAt", + }); + }), +); + +export function getEntityBreakdownFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetEntityBreakdown$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetEntityBreakdown' from JSON`, + ); +} + +/** @internal */ +export const GetEntityRollover$inboundSchema: z.ZodMiniType< + GetEntityRollover, + unknown +> = z.pipe( + z.object({ + balance: types.number(), + expires_at: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "expires_at": "expiresAt", + }); + }), +); + +export function getEntityRolloverFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetEntityRollover$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetEntityRollover' from JSON`, + ); +} + +/** @internal */ +export const GetEntityBalances$inboundSchema: z.ZodMiniType< + GetEntityBalances, + unknown +> = z.pipe( + z.object({ + feature_id: types.string(), + feature: types.optional(z.lazy(() => GetEntityFeature$inboundSchema)), + granted: types.number(), + remaining: types.number(), + usage: types.number(), + unlimited: types.boolean(), + overage_allowed: types.boolean(), + max_purchase: types.nullable(types.number()), + next_reset_at: types.nullable(types.number()), + breakdown: types.optional( + z.array(z.lazy(() => GetEntityBreakdown$inboundSchema)), + ), + rollovers: types.optional( + z.array(z.lazy(() => GetEntityRollover$inboundSchema)), + ), + }), + z.transform((v) => { + return remap$(v, { + "feature_id": "featureId", + "overage_allowed": "overageAllowed", + "max_purchase": "maxPurchase", + "next_reset_at": "nextResetAt", + }); + }), +); + +export function getEntityBalancesFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetEntityBalances$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetEntityBalances' from JSON`, + ); +} + +/** @internal */ +export const GetEntityInvoice$inboundSchema: z.ZodMiniType< + GetEntityInvoice, + unknown +> = z.pipe( + z.object({ + plan_ids: z.array(types.string()), + stripe_id: types.string(), + status: types.string(), + total: types.number(), + currency: types.string(), + created_at: types.number(), + hosted_invoice_url: z.optional(z.nullable(types.string())), + }), + z.transform((v) => { + return remap$(v, { + "plan_ids": "planIds", + "stripe_id": "stripeId", + "created_at": "createdAt", + "hosted_invoice_url": "hostedInvoiceUrl", + }); + }), +); + +export function getEntityInvoiceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetEntityInvoice$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetEntityInvoice' from JSON`, + ); +} + +/** @internal */ +export const GetEntityResponse$inboundSchema: z.ZodMiniType< + GetEntityResponse, + unknown +> = z.pipe( + z.object({ + autumn_id: types.optional(types.string()), + id: types.nullable(types.string()), + name: types.nullable(types.string()), + customer_id: z.optional(z.nullable(types.string())), + feature_id: z.optional(z.nullable(types.string())), + created_at: types.number(), + env: GetEntityEnv$inboundSchema, + subscriptions: z.array(z.lazy(() => GetEntitySubscription$inboundSchema)), + purchases: z.array(z.lazy(() => GetEntityPurchase$inboundSchema)), + balances: z.record( + z.string(), + z.lazy(() => GetEntityBalances$inboundSchema), + ), + invoices: types.optional( + z.array(z.lazy(() => GetEntityInvoice$inboundSchema)), + ), + }), + z.transform((v) => { + return remap$(v, { + "autumn_id": "autumnId", + "customer_id": "customerId", + "feature_id": "featureId", + "created_at": "createdAt", + }); + }), +); + +export function getEntityResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetEntityResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetEntityResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/index.ts b/packages/sdk/src/models/index.ts index 049aff41b..401b79055 100644 --- a/packages/sdk/src/models/index.ts +++ b/packages/sdk/src/models/index.ts @@ -2,27 +2,34 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ +export * from "./aggregate-events-op.js"; export * from "./autumn-default-error.js"; export * from "./autumn-error.js"; -export * from "./balances-check-op.js"; -export * from "./balances-create-op.js"; -export * from "./balances-track-op.js"; -export * from "./balances-update-op.js"; export * from "./billing-attach-op.js"; -export * from "./billing-preview-attach-op.js"; -export * from "./billing-preview-update-op.js"; -export * from "./billing-setup-payment-op.js"; export * from "./billing-update-op.js"; +export * from "./check-op.js"; +export * from "./create-balance-op.js"; +export * from "./create-entity-op.js"; +export * from "./create-referral-code-op.js"; export * from "./customer-data.js"; export * from "./customer-expand.js"; export * from "./customer.js"; export * from "./delete-customer-op.js"; +export * from "./delete-entity-op.js"; +export * from "./get-entity-op.js"; export * from "./get-or-create-customer-op.js"; export * from "./http-client-errors.js"; export * from "./list-customers-op.js"; +export * from "./list-events-op.js"; export * from "./list-plans-op.js"; +export * from "./open-customer-portal-op.js"; export * from "./plan.js"; +export * from "./preview-attach-op.js"; +export * from "./preview-update-op.js"; +export * from "./redeem-referral-code-op.js"; export * from "./response-validation-error.js"; export * from "./sdk-validation-error.js"; export * from "./security.js"; +export * from "./track-op.js"; +export * from "./update-balance-op.js"; export * from "./update-customer-op.js"; diff --git a/packages/sdk/src/models/list-customers-op.ts b/packages/sdk/src/models/list-customers-op.ts index dae93235f..789c0d082 100644 --- a/packages/sdk/src/models/list-customers-op.ts +++ b/packages/sdk/src/models/list-customers-op.ts @@ -69,34 +69,87 @@ export const ListCustomersEnv = { */ export type ListCustomersEnv = OpenEnum; +/** + * Current status of the subscription. + */ export const ListCustomersStatus = { Active: "active", Scheduled: "scheduled", - Expired: "expired", } as const; +/** + * Current status of the subscription. + */ export type ListCustomersStatus = OpenEnum; export type ListCustomersSubscription = { plan?: Plan | undefined; + /** + * The unique identifier of the subscribed plan. + */ planId: string; + /** + * Whether the plan was automatically enabled for the customer. + */ autoEnable: boolean; + /** + * Whether this is an add-on plan rather than a base subscription. + */ addOn: boolean; + /** + * Current status of the subscription. + */ status: ListCustomersStatus; + /** + * Whether the subscription has overdue payments. + */ pastDue: boolean; + /** + * Timestamp when the subscription was canceled, or null if not canceled. + */ canceledAt: number | null; + /** + * Timestamp when the subscription will expire, or null if no expiry set. + */ expiresAt: number | null; + /** + * Timestamp when the trial period ends, or null if not on trial. + */ trialEndsAt: number | null; + /** + * Timestamp when the subscription started. + */ startedAt: number; + /** + * Start timestamp of the current billing period. + */ currentPeriodStart: number | null; + /** + * End timestamp of the current billing period. + */ currentPeriodEnd: number | null; + /** + * Number of units of this subscription (for per-seat plans). + */ quantity: number; }; export type ListCustomersPurchase = { plan?: Plan | undefined; + /** + * The unique identifier of the purchased plan. + */ planId: string; + /** + * Timestamp when the purchase expires, or null for lifetime access. + */ expiresAt: number | null; + /** + * Timestamp when the purchase was made. + */ startedAt: number; + /** + * Number of units purchased. + */ quantity: number; }; @@ -117,6 +170,9 @@ export type ListCustomersDisplay = { plural?: string | null | undefined; }; +/** + * The full feature object if expanded. + */ export type ListCustomersFeature = { id: string; name: string; @@ -143,11 +199,23 @@ export type ListCustomersIntervalEnum = OpenEnum< typeof ListCustomersIntervalEnum >; +/** + * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + */ export type ListCustomersIntervalUnion = ListCustomersIntervalEnum | string; export type ListCustomersReset = { + /** + * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + */ interval: ListCustomersIntervalEnum | string; + /** + * Number of intervals between resets (eg. 2 for bi-monthly). + */ intervalCount?: number | undefined; + /** + * Timestamp when the balance will next reset. + */ resetsAt: number | null; }; @@ -156,55 +224,145 @@ export type ListCustomersTier = { amount: number; }; +/** + * Whether usage is prepaid or billed pay-per-use. + */ export const ListCustomersBillingMethod = { Prepaid: "prepaid", UsageBased: "usage_based", } as const; +/** + * Whether usage is prepaid or billed pay-per-use. + */ export type ListCustomersBillingMethod = OpenEnum< typeof ListCustomersBillingMethod >; export type ListCustomersPrice = { + /** + * The per-unit price amount. + */ amount?: number | undefined; + /** + * Tiered pricing configuration if applicable. + */ tiers?: Array | undefined; + /** + * The number of units per billing increment (eg. $9 / 250 units). + */ billingUnits: number; + /** + * Whether usage is prepaid or billed pay-per-use. + */ billingMethod: ListCustomersBillingMethod; + /** + * Maximum quantity that can be purchased, or null for unlimited. + */ maxPurchase: number | null; }; export type ListCustomersBreakdown = { + /** + * The unique identifier for this balance breakdown. + */ id: string; + /** + * The plan ID this balance originates from, or null for standalone balances. + */ planId: string | null; + /** + * Amount granted from the plan's included usage. + */ includedGrant: number; + /** + * Amount granted from prepaid purchases or top-ups. + */ prepaidGrant: number; + /** + * Remaining balance available for use. + */ remaining: number; + /** + * Amount consumed in the current period. + */ usage: number; + /** + * Whether this balance has unlimited usage. + */ unlimited: boolean; + /** + * Reset configuration for this balance, or null if no reset. + */ reset: ListCustomersReset | null; + /** + * Pricing configuration if this balance has usage-based pricing. + */ price: ListCustomersPrice | null; + /** + * Timestamp when this balance expires, or null for no expiration. + */ expiresAt: number | null; }; export type ListCustomersRollover = { + /** + * Amount of balance rolled over from a previous period. + */ balance: number; + /** + * Timestamp when the rollover balance expires. + */ expiresAt: number; }; export type ListCustomersBalances = { + /** + * The feature ID this balance is for. + */ featureId: string; + /** + * The full feature object if expanded. + */ feature?: ListCustomersFeature | undefined; + /** + * Total balance granted (included + prepaid). + */ granted: number; + /** + * Remaining balance available for use. + */ remaining: number; + /** + * Total usage consumed in the current period. + */ usage: number; + /** + * Whether this feature has unlimited usage. + */ unlimited: boolean; + /** + * Whether usage beyond the granted balance is allowed (with overage charges). + */ overageAllowed: boolean; + /** + * Maximum quantity that can be purchased as a top-up, or null for unlimited. + */ maxPurchase: number | null; + /** + * Timestamp when the balance will reset, or null for no reset. + */ nextResetAt: number | null; + /** + * Detailed breakdown of balance sources when stacking multiple plans or grants. + */ breakdown?: Array | undefined; + /** + * Rollover balances carried over from previous periods. + */ rollovers?: Array | undefined; }; -export type List = { +export type ListCustomersList = { /** * Your unique identifier for the customer. */ @@ -241,8 +399,17 @@ export type List = { * Whether to send email receipts to the customer. */ sendEmailReceipts: boolean; + /** + * Active and scheduled recurring plans that this customer has attached. + */ subscriptions: Array; + /** + * One-time purchases made by the customer. + */ purchases: Array; + /** + * Feature balances keyed by feature ID, showing usage limits and remaining amounts. + */ balances: { [k: string]: ListCustomersBalances }; }; @@ -253,7 +420,7 @@ export type ListCustomersResponse = { /** * Array of items for current page */ - list: Array; + list: Array; /** * Whether more results exist after this page */ @@ -729,7 +896,10 @@ export function listCustomersBalancesFromJSON( } /** @internal */ -export const List$inboundSchema: z.ZodMiniType = z.pipe( +export const ListCustomersList$inboundSchema: z.ZodMiniType< + ListCustomersList, + unknown +> = z.pipe( z.object({ id: types.nullable(types.string()), name: types.nullable(types.string()), @@ -758,13 +928,13 @@ export const List$inboundSchema: z.ZodMiniType = z.pipe( }), ); -export function listFromJSON( +export function listCustomersListFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => List$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'List' from JSON`, + (x) => ListCustomersList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomersList' from JSON`, ); } @@ -774,7 +944,7 @@ export const ListCustomersResponse$inboundSchema: z.ZodMiniType< unknown > = z.pipe( z.object({ - list: z.array(z.lazy(() => List$inboundSchema)), + list: z.array(z.lazy(() => ListCustomersList$inboundSchema)), has_more: types.boolean(), offset: types.number(), limit: types.number(), diff --git a/packages/sdk/src/models/list-events-op.ts b/packages/sdk/src/models/list-events-op.ts new file mode 100644 index 000000000..e0896884a --- /dev/null +++ b/packages/sdk/src/models/list-events-op.ts @@ -0,0 +1,269 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { smartUnion } from "../types/smart-union.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type ListEventsGlobals = { + xApiVersion?: string | undefined; +}; + +/** + * Filter by specific feature ID(s) + */ +export type ListEventsFeatureId = string | Array; + +/** + * Filter events by time range + */ +export type ListEventsCustomRange = { + /** + * Filter events after this timestamp (epoch milliseconds) + */ + start?: number | undefined; + /** + * Filter events before this timestamp (epoch milliseconds) + */ + end?: number | undefined; +}; + +export type EventsListParams = { + /** + * Number of items to skip + */ + offset?: number | undefined; + /** + * Number of items to return. Default 100, max 1000. + */ + limit?: number | undefined; + /** + * Filter events by customer ID + */ + customerId?: string | undefined; + /** + * Filter by specific feature ID(s) + */ + featureId?: string | Array | undefined; + /** + * Filter events by time range + */ + customRange?: ListEventsCustomRange | undefined; +}; + +/** + * Event properties (JSONB) + */ +export type ListEventsProperties = {}; + +export type ListEventsList = { + /** + * Event ID (KSUID) + */ + id: string; + /** + * Event timestamp (epoch milliseconds) + */ + timestamp: number; + /** + * ID of the feature that the event belongs to + */ + featureId: string; + /** + * Customer identifier + */ + customerId: string; + /** + * Event value/count + */ + value: number; + /** + * Event properties (JSONB) + */ + properties: ListEventsProperties; +}; + +/** + * OK + */ +export type ListEventsResponse = { + /** + * Array of items for current page + */ + list: Array; + /** + * Whether more results exist after this page + */ + hasMore: boolean; + /** + * Current offset position + */ + offset: number; + /** + * Limit passed in the request + */ + limit: number; + /** + * Total number of items returned in the current page + */ + total: number; +}; + +/** @internal */ +export type ListEventsFeatureId$Outbound = string | Array; + +/** @internal */ +export const ListEventsFeatureId$outboundSchema: z.ZodMiniType< + ListEventsFeatureId$Outbound, + ListEventsFeatureId +> = smartUnion([z.string(), z.array(z.string())]); + +export function listEventsFeatureIdToJSON( + listEventsFeatureId: ListEventsFeatureId, +): string { + return JSON.stringify( + ListEventsFeatureId$outboundSchema.parse(listEventsFeatureId), + ); +} + +/** @internal */ +export type ListEventsCustomRange$Outbound = { + start?: number | undefined; + end?: number | undefined; +}; + +/** @internal */ +export const ListEventsCustomRange$outboundSchema: z.ZodMiniType< + ListEventsCustomRange$Outbound, + ListEventsCustomRange +> = z.object({ + start: z.optional(z.number()), + end: z.optional(z.number()), +}); + +export function listEventsCustomRangeToJSON( + listEventsCustomRange: ListEventsCustomRange, +): string { + return JSON.stringify( + ListEventsCustomRange$outboundSchema.parse(listEventsCustomRange), + ); +} + +/** @internal */ +export type EventsListParams$Outbound = { + offset: number; + limit: number; + customer_id?: string | undefined; + feature_id?: string | Array | undefined; + custom_range?: ListEventsCustomRange$Outbound | undefined; +}; + +/** @internal */ +export const EventsListParams$outboundSchema: z.ZodMiniType< + EventsListParams$Outbound, + EventsListParams +> = z.pipe( + z.object({ + offset: z._default(z.int(), 0), + limit: z._default(z.int(), 100), + customerId: z.optional(z.string()), + featureId: z.optional(smartUnion([z.string(), z.array(z.string())])), + customRange: z.optional(z.lazy(() => ListEventsCustomRange$outboundSchema)), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + featureId: "feature_id", + customRange: "custom_range", + }); + }), +); + +export function eventsListParamsToJSON( + eventsListParams: EventsListParams, +): string { + return JSON.stringify( + EventsListParams$outboundSchema.parse(eventsListParams), + ); +} + +/** @internal */ +export const ListEventsProperties$inboundSchema: z.ZodMiniType< + ListEventsProperties, + unknown +> = z.object({}); + +export function listEventsPropertiesFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListEventsProperties$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListEventsProperties' from JSON`, + ); +} + +/** @internal */ +export const ListEventsList$inboundSchema: z.ZodMiniType< + ListEventsList, + unknown +> = z.pipe( + z.object({ + id: types.string(), + timestamp: types.number(), + feature_id: types.string(), + customer_id: types.string(), + value: types.number(), + properties: z.lazy(() => ListEventsProperties$inboundSchema), + }), + z.transform((v) => { + return remap$(v, { + "feature_id": "featureId", + "customer_id": "customerId", + }); + }), +); + +export function listEventsListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListEventsList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListEventsList' from JSON`, + ); +} + +/** @internal */ +export const ListEventsResponse$inboundSchema: z.ZodMiniType< + ListEventsResponse, + unknown +> = z.pipe( + z.object({ + list: z.array(z.lazy(() => ListEventsList$inboundSchema)), + has_more: types.boolean(), + offset: types.number(), + limit: types.number(), + total: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "has_more": "hasMore", + }); + }), +); + +export function listEventsResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListEventsResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListEventsResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/open-customer-portal-op.ts b/packages/sdk/src/models/open-customer-portal-op.ts new file mode 100644 index 000000000..4a9318890 --- /dev/null +++ b/packages/sdk/src/models/open-customer-portal-op.ts @@ -0,0 +1,103 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type OpenCustomerPortalGlobals = { + xApiVersion?: string | undefined; +}; + +export type OpenCustomerPortalParams = { + /** + * The ID of the customer to open the billing portal for. + */ + customerId: string; + /** + * Stripe billing portal configuration ID. Create configurations in your Stripe dashboard. + */ + configurationId?: string | undefined; + /** + * URL to redirect to when back button is clicked in the billing portal + */ + returnUrl?: string | undefined; +}; + +/** + * OK + */ +export type OpenCustomerPortalResponse = { + /** + * The ID of the billing portal session + */ + customerId: string; + /** + * URL to the billing portal + */ + url: string; +}; + +/** @internal */ +export type OpenCustomerPortalParams$Outbound = { + customer_id: string; + configuration_id?: string | undefined; + return_url?: string | undefined; +}; + +/** @internal */ +export const OpenCustomerPortalParams$outboundSchema: z.ZodMiniType< + OpenCustomerPortalParams$Outbound, + OpenCustomerPortalParams +> = z.pipe( + z.object({ + customerId: z.string(), + configurationId: z.optional(z.string()), + returnUrl: z.optional(z.string()), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + configurationId: "configuration_id", + returnUrl: "return_url", + }); + }), +); + +export function openCustomerPortalParamsToJSON( + openCustomerPortalParams: OpenCustomerPortalParams, +): string { + return JSON.stringify( + OpenCustomerPortalParams$outboundSchema.parse(openCustomerPortalParams), + ); +} + +/** @internal */ +export const OpenCustomerPortalResponse$inboundSchema: z.ZodMiniType< + OpenCustomerPortalResponse, + unknown +> = z.pipe( + z.object({ + customer_id: types.string(), + url: types.string(), + }), + z.transform((v) => { + return remap$(v, { + "customer_id": "customerId", + }); + }), +); + +export function openCustomerPortalResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => OpenCustomerPortalResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'OpenCustomerPortalResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/preview-attach-op.ts b/packages/sdk/src/models/preview-attach-op.ts new file mode 100644 index 000000000..a6e20f4ca --- /dev/null +++ b/packages/sdk/src/models/preview-attach-op.ts @@ -0,0 +1,1044 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { ClosedEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { smartUnion } from "../types/smart-union.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type PreviewAttachGlobals = { + xApiVersion?: string | undefined; +}; + +export type PreviewAttachFeatureQuantity = { + featureId: string; + quantity?: number | undefined; + adjustable?: boolean | undefined; +}; + +export const PreviewAttachDurationType = { + Day: "day", + Month: "month", + Year: "year", +} as const; +export type PreviewAttachDurationType = ClosedEnum< + typeof PreviewAttachDurationType +>; + +export type PreviewAttachFreeTrial = { + durationLength: number; + durationType?: PreviewAttachDurationType | undefined; + cardRequired?: boolean | undefined; +}; + +export const PreviewAttachPriceInterval = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +export type PreviewAttachPriceInterval = ClosedEnum< + typeof PreviewAttachPriceInterval +>; + +export type PreviewAttachPrice = { + amount: number; + interval: PreviewAttachPriceInterval; + intervalCount?: number | undefined; +}; + +export const PreviewAttachResetInterval = { + OneOff: "one_off", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +export type PreviewAttachResetInterval = ClosedEnum< + typeof PreviewAttachResetInterval +>; + +export type PreviewAttachReset = { + interval: PreviewAttachResetInterval; + intervalCount?: number | undefined; +}; + +export type PreviewAttachTo = number | string; + +export type PreviewAttachTier = { + to: number | string; + amount: number; +}; + +export const PreviewAttachItemPriceInterval = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +export type PreviewAttachItemPriceInterval = ClosedEnum< + typeof PreviewAttachItemPriceInterval +>; + +export const PreviewAttachBillingMethod = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +export type PreviewAttachBillingMethod = ClosedEnum< + typeof PreviewAttachBillingMethod +>; + +export type PreviewAttachItemPrice = { + amount?: number | undefined; + tiers?: Array | undefined; + interval: PreviewAttachItemPriceInterval; + intervalCount?: number | undefined; + billingUnits?: number | undefined; + billingMethod: PreviewAttachBillingMethod; + maxPurchase?: number | undefined; +}; + +export const PreviewAttachOnIncrease = { + BillImmediately: "bill_immediately", + ProrateImmediately: "prorate_immediately", + ProrateNextCycle: "prorate_next_cycle", + BillNextCycle: "bill_next_cycle", +} as const; +export type PreviewAttachOnIncrease = ClosedEnum< + typeof PreviewAttachOnIncrease +>; + +export const PreviewAttachOnDecrease = { + Prorate: "prorate", + ProrateImmediately: "prorate_immediately", + ProrateNextCycle: "prorate_next_cycle", + None: "none", + NoProrations: "no_prorations", +} as const; +export type PreviewAttachOnDecrease = ClosedEnum< + typeof PreviewAttachOnDecrease +>; + +export type PreviewAttachProration = { + onIncrease: PreviewAttachOnIncrease; + onDecrease: PreviewAttachOnDecrease; +}; + +export const PreviewAttachExpiryDurationType = { + Month: "month", + Forever: "forever", +} as const; +export type PreviewAttachExpiryDurationType = ClosedEnum< + typeof PreviewAttachExpiryDurationType +>; + +export type PreviewAttachRollover = { + max?: number | undefined; + expiryDurationType: PreviewAttachExpiryDurationType; + expiryDurationLength?: number | undefined; +}; + +export type PreviewAttachItem = { + featureId: string; + included?: number | undefined; + unlimited?: boolean | undefined; + reset?: PreviewAttachReset | undefined; + price?: PreviewAttachItemPrice | undefined; + proration?: PreviewAttachProration | undefined; + rollover?: PreviewAttachRollover | undefined; +}; + +/** + * Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. + */ +export type PreviewAttachCustomize = { + price?: PreviewAttachPrice | null | undefined; + items?: Array | undefined; +}; + +/** + * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + */ +export type PreviewAttachInvoiceMode = { + /** + * When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. + */ + enabled: boolean; + /** + * If true, enables the plan immediately even though the invoice is not paid yet. + */ + enablePlanImmediately?: boolean | undefined; + /** + * If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. + */ + finalize?: boolean | undefined; +}; + +/** + * 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. + */ +export const PreviewAttachBillingBehavior = { + ProrateImmediately: "prorate_immediately", + NextCycleOnly: "next_cycle_only", +} as const; +/** + * 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. + */ +export type PreviewAttachBillingBehavior = ClosedEnum< + typeof PreviewAttachBillingBehavior +>; + +export type PreviewAttachDiscountRequest2 = { + /** + * The promotion code to apply as a discount. + */ + promotionCode: string; +}; + +export type PreviewAttachDiscountRequest1 = { + /** + * The ID of the reward to apply as a discount. + */ + rewardId: string; +}; + +/** + * A discount to apply. Can be either a reward ID or a promotion code. + */ +export type PreviewAttachDiscountUnion = + | PreviewAttachDiscountRequest1 + | PreviewAttachDiscountRequest2; + +/** + * When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + */ +export const PreviewAttachPlanSchedule = { + Immediate: "immediate", + EndOfCycle: "end_of_cycle", +} as const; +/** + * When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + */ +export type PreviewAttachPlanSchedule = ClosedEnum< + typeof PreviewAttachPlanSchedule +>; + +export type PreviewAttachParams = { + /** + * The ID of the customer to attach the plan to. + */ + customerId: string; + /** + * The ID of the entity to attach the plan to. + */ + entityId?: string | undefined; + /** + * The ID of the plan. + */ + planId: string; + /** + * If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. + */ + featureQuantities?: Array | undefined; + /** + * The version of the plan to attach. + */ + version?: number | undefined; + /** + * Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. + */ + freeTrial?: PreviewAttachFreeTrial | null | undefined; + /** + * Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. + */ + customize?: PreviewAttachCustomize | undefined; + /** + * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + */ + invoiceMode?: PreviewAttachInvoiceMode | undefined; + /** + * 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. + */ + billingBehavior?: PreviewAttachBillingBehavior | undefined; + /** + * List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. + */ + discounts?: + | Array + | undefined; + /** + * URL to redirect to after successful checkout. + */ + successUrl?: string | undefined; + /** + * Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. + */ + newBillingSubscription?: boolean | undefined; + /** + * When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. + */ + planSchedule?: PreviewAttachPlanSchedule | undefined; +}; + +export type PreviewAttachDiscountResponse = { + amountOff: number; + percentOff?: number | undefined; + stripeCouponId?: string | undefined; + couponName?: string | undefined; +}; + +export type PreviewAttachLineItem = { + /** + * The title of the line item. + */ + title: string; + /** + * A detailed description of the line item. + */ + description: string; + /** + * The amount in cents for this line item. + */ + amount: number; + /** + * List of discounts applied to this line item. + */ + discounts?: Array | undefined; +}; + +/** + * Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. + */ +export type PreviewAttachNextCycle = { + /** + * Unix timestamp (milliseconds) when the next billing cycle starts. + */ + startsAt: number; + /** + * The total amount in cents for the next cycle. + */ + total: number; +}; + +/** + * OK + */ +export type PreviewAttachResponse = { + /** + * The ID of the customer. + */ + customerId: string; + /** + * List of line items for the current billing period. + */ + lineItems: Array; + /** + * The total amount in cents for the current billing period. + */ + total: number; + /** + * The three-letter ISO currency code (e.g., 'usd'). + */ + currency: string; + /** + * Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. + */ + nextCycle?: PreviewAttachNextCycle | undefined; +}; + +/** @internal */ +export type PreviewAttachFeatureQuantity$Outbound = { + feature_id: string; + quantity?: number | undefined; + adjustable?: boolean | undefined; +}; + +/** @internal */ +export const PreviewAttachFeatureQuantity$outboundSchema: z.ZodMiniType< + PreviewAttachFeatureQuantity$Outbound, + PreviewAttachFeatureQuantity +> = z.pipe( + z.object({ + featureId: z.string(), + quantity: z.optional(z.number()), + adjustable: z.optional(z.boolean()), + }), + z.transform((v) => { + return remap$(v, { + featureId: "feature_id", + }); + }), +); + +export function previewAttachFeatureQuantityToJSON( + previewAttachFeatureQuantity: PreviewAttachFeatureQuantity, +): string { + return JSON.stringify( + PreviewAttachFeatureQuantity$outboundSchema.parse( + previewAttachFeatureQuantity, + ), + ); +} + +/** @internal */ +export const PreviewAttachDurationType$outboundSchema: z.ZodMiniEnum< + typeof PreviewAttachDurationType +> = z.enum(PreviewAttachDurationType); + +/** @internal */ +export type PreviewAttachFreeTrial$Outbound = { + duration_length: number; + duration_type: string; + card_required: boolean; +}; + +/** @internal */ +export const PreviewAttachFreeTrial$outboundSchema: z.ZodMiniType< + PreviewAttachFreeTrial$Outbound, + PreviewAttachFreeTrial +> = z.pipe( + z.object({ + durationLength: z.number(), + durationType: z._default(PreviewAttachDurationType$outboundSchema, "month"), + cardRequired: z._default(z.boolean(), true), + }), + z.transform((v) => { + return remap$(v, { + durationLength: "duration_length", + durationType: "duration_type", + cardRequired: "card_required", + }); + }), +); + +export function previewAttachFreeTrialToJSON( + previewAttachFreeTrial: PreviewAttachFreeTrial, +): string { + return JSON.stringify( + PreviewAttachFreeTrial$outboundSchema.parse(previewAttachFreeTrial), + ); +} + +/** @internal */ +export const PreviewAttachPriceInterval$outboundSchema: z.ZodMiniEnum< + typeof PreviewAttachPriceInterval +> = z.enum(PreviewAttachPriceInterval); + +/** @internal */ +export type PreviewAttachPrice$Outbound = { + amount: number; + interval: string; + interval_count?: number | undefined; +}; + +/** @internal */ +export const PreviewAttachPrice$outboundSchema: z.ZodMiniType< + PreviewAttachPrice$Outbound, + PreviewAttachPrice +> = z.pipe( + z.object({ + amount: z.number(), + interval: PreviewAttachPriceInterval$outboundSchema, + intervalCount: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + }); + }), +); + +export function previewAttachPriceToJSON( + previewAttachPrice: PreviewAttachPrice, +): string { + return JSON.stringify( + PreviewAttachPrice$outboundSchema.parse(previewAttachPrice), + ); +} + +/** @internal */ +export const PreviewAttachResetInterval$outboundSchema: z.ZodMiniEnum< + typeof PreviewAttachResetInterval +> = z.enum(PreviewAttachResetInterval); + +/** @internal */ +export type PreviewAttachReset$Outbound = { + interval: string; + interval_count?: number | undefined; +}; + +/** @internal */ +export const PreviewAttachReset$outboundSchema: z.ZodMiniType< + PreviewAttachReset$Outbound, + PreviewAttachReset +> = z.pipe( + z.object({ + interval: PreviewAttachResetInterval$outboundSchema, + intervalCount: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + }); + }), +); + +export function previewAttachResetToJSON( + previewAttachReset: PreviewAttachReset, +): string { + return JSON.stringify( + PreviewAttachReset$outboundSchema.parse(previewAttachReset), + ); +} + +/** @internal */ +export type PreviewAttachTo$Outbound = number | string; + +/** @internal */ +export const PreviewAttachTo$outboundSchema: z.ZodMiniType< + PreviewAttachTo$Outbound, + PreviewAttachTo +> = smartUnion([z.number(), z.string()]); + +export function previewAttachToToJSON( + previewAttachTo: PreviewAttachTo, +): string { + return JSON.stringify(PreviewAttachTo$outboundSchema.parse(previewAttachTo)); +} + +/** @internal */ +export type PreviewAttachTier$Outbound = { + to: number | string; + amount: number; +}; + +/** @internal */ +export const PreviewAttachTier$outboundSchema: z.ZodMiniType< + PreviewAttachTier$Outbound, + PreviewAttachTier +> = z.object({ + to: smartUnion([z.number(), z.string()]), + amount: z.number(), +}); + +export function previewAttachTierToJSON( + previewAttachTier: PreviewAttachTier, +): string { + return JSON.stringify( + PreviewAttachTier$outboundSchema.parse(previewAttachTier), + ); +} + +/** @internal */ +export const PreviewAttachItemPriceInterval$outboundSchema: z.ZodMiniEnum< + typeof PreviewAttachItemPriceInterval +> = z.enum(PreviewAttachItemPriceInterval); + +/** @internal */ +export const PreviewAttachBillingMethod$outboundSchema: z.ZodMiniEnum< + typeof PreviewAttachBillingMethod +> = z.enum(PreviewAttachBillingMethod); + +/** @internal */ +export type PreviewAttachItemPrice$Outbound = { + amount?: number | undefined; + tiers?: Array | undefined; + interval: string; + interval_count: number; + billing_units: number; + billing_method: string; + max_purchase?: number | undefined; +}; + +/** @internal */ +export const PreviewAttachItemPrice$outboundSchema: z.ZodMiniType< + PreviewAttachItemPrice$Outbound, + PreviewAttachItemPrice +> = z.pipe( + z.object({ + amount: z.optional(z.number()), + tiers: z.optional(z.array(z.lazy(() => PreviewAttachTier$outboundSchema))), + interval: PreviewAttachItemPriceInterval$outboundSchema, + intervalCount: z._default(z.number(), 1), + billingUnits: z._default(z.number(), 1), + billingMethod: PreviewAttachBillingMethod$outboundSchema, + maxPurchase: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + billingUnits: "billing_units", + billingMethod: "billing_method", + maxPurchase: "max_purchase", + }); + }), +); + +export function previewAttachItemPriceToJSON( + previewAttachItemPrice: PreviewAttachItemPrice, +): string { + return JSON.stringify( + PreviewAttachItemPrice$outboundSchema.parse(previewAttachItemPrice), + ); +} + +/** @internal */ +export const PreviewAttachOnIncrease$outboundSchema: z.ZodMiniEnum< + typeof PreviewAttachOnIncrease +> = z.enum(PreviewAttachOnIncrease); + +/** @internal */ +export const PreviewAttachOnDecrease$outboundSchema: z.ZodMiniEnum< + typeof PreviewAttachOnDecrease +> = z.enum(PreviewAttachOnDecrease); + +/** @internal */ +export type PreviewAttachProration$Outbound = { + on_increase: string; + on_decrease: string; +}; + +/** @internal */ +export const PreviewAttachProration$outboundSchema: z.ZodMiniType< + PreviewAttachProration$Outbound, + PreviewAttachProration +> = z.pipe( + z.object({ + onIncrease: PreviewAttachOnIncrease$outboundSchema, + onDecrease: PreviewAttachOnDecrease$outboundSchema, + }), + z.transform((v) => { + return remap$(v, { + onIncrease: "on_increase", + onDecrease: "on_decrease", + }); + }), +); + +export function previewAttachProrationToJSON( + previewAttachProration: PreviewAttachProration, +): string { + return JSON.stringify( + PreviewAttachProration$outboundSchema.parse(previewAttachProration), + ); +} + +/** @internal */ +export const PreviewAttachExpiryDurationType$outboundSchema: z.ZodMiniEnum< + typeof PreviewAttachExpiryDurationType +> = z.enum(PreviewAttachExpiryDurationType); + +/** @internal */ +export type PreviewAttachRollover$Outbound = { + max?: number | undefined; + expiry_duration_type: string; + expiry_duration_length?: number | undefined; +}; + +/** @internal */ +export const PreviewAttachRollover$outboundSchema: z.ZodMiniType< + PreviewAttachRollover$Outbound, + PreviewAttachRollover +> = z.pipe( + z.object({ + max: z.optional(z.number()), + expiryDurationType: PreviewAttachExpiryDurationType$outboundSchema, + expiryDurationLength: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + expiryDurationType: "expiry_duration_type", + expiryDurationLength: "expiry_duration_length", + }); + }), +); + +export function previewAttachRolloverToJSON( + previewAttachRollover: PreviewAttachRollover, +): string { + return JSON.stringify( + PreviewAttachRollover$outboundSchema.parse(previewAttachRollover), + ); +} + +/** @internal */ +export type PreviewAttachItem$Outbound = { + feature_id: string; + included?: number | undefined; + unlimited?: boolean | undefined; + reset?: PreviewAttachReset$Outbound | undefined; + price?: PreviewAttachItemPrice$Outbound | undefined; + proration?: PreviewAttachProration$Outbound | undefined; + rollover?: PreviewAttachRollover$Outbound | undefined; +}; + +/** @internal */ +export const PreviewAttachItem$outboundSchema: z.ZodMiniType< + PreviewAttachItem$Outbound, + PreviewAttachItem +> = z.pipe( + z.object({ + featureId: z.string(), + included: z.optional(z.number()), + unlimited: z.optional(z.boolean()), + reset: z.optional(z.lazy(() => PreviewAttachReset$outboundSchema)), + price: z.optional(z.lazy(() => PreviewAttachItemPrice$outboundSchema)), + proration: z.optional(z.lazy(() => PreviewAttachProration$outboundSchema)), + rollover: z.optional(z.lazy(() => PreviewAttachRollover$outboundSchema)), + }), + z.transform((v) => { + return remap$(v, { + featureId: "feature_id", + }); + }), +); + +export function previewAttachItemToJSON( + previewAttachItem: PreviewAttachItem, +): string { + return JSON.stringify( + PreviewAttachItem$outboundSchema.parse(previewAttachItem), + ); +} + +/** @internal */ +export type PreviewAttachCustomize$Outbound = { + price?: PreviewAttachPrice$Outbound | null | undefined; + items?: Array | undefined; +}; + +/** @internal */ +export const PreviewAttachCustomize$outboundSchema: z.ZodMiniType< + PreviewAttachCustomize$Outbound, + PreviewAttachCustomize +> = z.object({ + price: z.optional( + z.nullable(z.lazy(() => PreviewAttachPrice$outboundSchema)), + ), + items: z.optional(z.array(z.lazy(() => PreviewAttachItem$outboundSchema))), +}); + +export function previewAttachCustomizeToJSON( + previewAttachCustomize: PreviewAttachCustomize, +): string { + return JSON.stringify( + PreviewAttachCustomize$outboundSchema.parse(previewAttachCustomize), + ); +} + +/** @internal */ +export type PreviewAttachInvoiceMode$Outbound = { + enabled: boolean; + enable_plan_immediately: boolean; + finalize: boolean; +}; + +/** @internal */ +export const PreviewAttachInvoiceMode$outboundSchema: z.ZodMiniType< + PreviewAttachInvoiceMode$Outbound, + PreviewAttachInvoiceMode +> = z.pipe( + z.object({ + enabled: z.boolean(), + enablePlanImmediately: z._default(z.boolean(), false), + finalize: z._default(z.boolean(), true), + }), + z.transform((v) => { + return remap$(v, { + enablePlanImmediately: "enable_plan_immediately", + }); + }), +); + +export function previewAttachInvoiceModeToJSON( + previewAttachInvoiceMode: PreviewAttachInvoiceMode, +): string { + return JSON.stringify( + PreviewAttachInvoiceMode$outboundSchema.parse(previewAttachInvoiceMode), + ); +} + +/** @internal */ +export const PreviewAttachBillingBehavior$outboundSchema: z.ZodMiniEnum< + typeof PreviewAttachBillingBehavior +> = z.enum(PreviewAttachBillingBehavior); + +/** @internal */ +export type PreviewAttachDiscountRequest2$Outbound = { + promotion_code: string; +}; + +/** @internal */ +export const PreviewAttachDiscountRequest2$outboundSchema: z.ZodMiniType< + PreviewAttachDiscountRequest2$Outbound, + PreviewAttachDiscountRequest2 +> = z.pipe( + z.object({ + promotionCode: z.string(), + }), + z.transform((v) => { + return remap$(v, { + promotionCode: "promotion_code", + }); + }), +); + +export function previewAttachDiscountRequest2ToJSON( + previewAttachDiscountRequest2: PreviewAttachDiscountRequest2, +): string { + return JSON.stringify( + PreviewAttachDiscountRequest2$outboundSchema.parse( + previewAttachDiscountRequest2, + ), + ); +} + +/** @internal */ +export type PreviewAttachDiscountRequest1$Outbound = { + reward_id: string; +}; + +/** @internal */ +export const PreviewAttachDiscountRequest1$outboundSchema: z.ZodMiniType< + PreviewAttachDiscountRequest1$Outbound, + PreviewAttachDiscountRequest1 +> = z.pipe( + z.object({ + rewardId: z.string(), + }), + z.transform((v) => { + return remap$(v, { + rewardId: "reward_id", + }); + }), +); + +export function previewAttachDiscountRequest1ToJSON( + previewAttachDiscountRequest1: PreviewAttachDiscountRequest1, +): string { + return JSON.stringify( + PreviewAttachDiscountRequest1$outboundSchema.parse( + previewAttachDiscountRequest1, + ), + ); +} + +/** @internal */ +export type PreviewAttachDiscountUnion$Outbound = + | PreviewAttachDiscountRequest1$Outbound + | PreviewAttachDiscountRequest2$Outbound; + +/** @internal */ +export const PreviewAttachDiscountUnion$outboundSchema: z.ZodMiniType< + PreviewAttachDiscountUnion$Outbound, + PreviewAttachDiscountUnion +> = smartUnion([ + z.lazy(() => PreviewAttachDiscountRequest1$outboundSchema), + z.lazy(() => PreviewAttachDiscountRequest2$outboundSchema), +]); + +export function previewAttachDiscountUnionToJSON( + previewAttachDiscountUnion: PreviewAttachDiscountUnion, +): string { + return JSON.stringify( + PreviewAttachDiscountUnion$outboundSchema.parse(previewAttachDiscountUnion), + ); +} + +/** @internal */ +export const PreviewAttachPlanSchedule$outboundSchema: z.ZodMiniEnum< + typeof PreviewAttachPlanSchedule +> = z.enum(PreviewAttachPlanSchedule); + +/** @internal */ +export type PreviewAttachParams$Outbound = { + customer_id: string; + entity_id?: string | undefined; + plan_id: string; + feature_quantities?: Array | undefined; + version?: number | undefined; + free_trial?: PreviewAttachFreeTrial$Outbound | null | undefined; + customize?: PreviewAttachCustomize$Outbound | undefined; + invoice_mode?: PreviewAttachInvoiceMode$Outbound | undefined; + billing_behavior?: string | undefined; + discounts?: + | Array< + | PreviewAttachDiscountRequest1$Outbound + | PreviewAttachDiscountRequest2$Outbound + > + | undefined; + success_url?: string | undefined; + new_billing_subscription?: boolean | undefined; + plan_schedule?: string | undefined; +}; + +/** @internal */ +export const PreviewAttachParams$outboundSchema: z.ZodMiniType< + PreviewAttachParams$Outbound, + PreviewAttachParams +> = z.pipe( + z.object({ + customerId: z.string(), + entityId: z.optional(z.string()), + planId: z.string(), + featureQuantities: z.optional( + z.array(z.lazy(() => PreviewAttachFeatureQuantity$outboundSchema)), + ), + version: z.optional(z.number()), + freeTrial: z.optional( + z.nullable(z.lazy(() => PreviewAttachFreeTrial$outboundSchema)), + ), + customize: z.optional(z.lazy(() => PreviewAttachCustomize$outboundSchema)), + invoiceMode: z.optional( + z.lazy(() => PreviewAttachInvoiceMode$outboundSchema), + ), + billingBehavior: z.optional(PreviewAttachBillingBehavior$outboundSchema), + discounts: z.optional(z.array(smartUnion([ + z.lazy(() => PreviewAttachDiscountRequest1$outboundSchema), + z.lazy(() => + PreviewAttachDiscountRequest2$outboundSchema + ), + ]))), + successUrl: z.optional(z.string()), + newBillingSubscription: z.optional(z.boolean()), + planSchedule: z.optional(PreviewAttachPlanSchedule$outboundSchema), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + entityId: "entity_id", + planId: "plan_id", + featureQuantities: "feature_quantities", + freeTrial: "free_trial", + invoiceMode: "invoice_mode", + billingBehavior: "billing_behavior", + successUrl: "success_url", + newBillingSubscription: "new_billing_subscription", + planSchedule: "plan_schedule", + }); + }), +); + +export function previewAttachParamsToJSON( + previewAttachParams: PreviewAttachParams, +): string { + return JSON.stringify( + PreviewAttachParams$outboundSchema.parse(previewAttachParams), + ); +} + +/** @internal */ +export const PreviewAttachDiscountResponse$inboundSchema: z.ZodMiniType< + PreviewAttachDiscountResponse, + unknown +> = z.object({ + amountOff: types.number(), + percentOff: types.optional(types.number()), + stripeCouponId: types.optional(types.string()), + couponName: types.optional(types.string()), +}); + +export function previewAttachDiscountResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PreviewAttachDiscountResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PreviewAttachDiscountResponse' from JSON`, + ); +} + +/** @internal */ +export const PreviewAttachLineItem$inboundSchema: z.ZodMiniType< + PreviewAttachLineItem, + unknown +> = z.object({ + title: types.string(), + description: types.string(), + amount: types.number(), + discounts: types.optional( + z.array(z.lazy(() => PreviewAttachDiscountResponse$inboundSchema)), + ), +}); + +export function previewAttachLineItemFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PreviewAttachLineItem$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PreviewAttachLineItem' from JSON`, + ); +} + +/** @internal */ +export const PreviewAttachNextCycle$inboundSchema: z.ZodMiniType< + PreviewAttachNextCycle, + unknown +> = z.pipe( + z.object({ + starts_at: types.number(), + total: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "starts_at": "startsAt", + }); + }), +); + +export function previewAttachNextCycleFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PreviewAttachNextCycle$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PreviewAttachNextCycle' from JSON`, + ); +} + +/** @internal */ +export const PreviewAttachResponse$inboundSchema: z.ZodMiniType< + PreviewAttachResponse, + unknown +> = z.pipe( + z.object({ + customer_id: types.string(), + line_items: z.array(z.lazy(() => PreviewAttachLineItem$inboundSchema)), + total: types.number(), + currency: types.string(), + next_cycle: types.optional( + z.lazy(() => PreviewAttachNextCycle$inboundSchema), + ), + }), + z.transform((v) => { + return remap$(v, { + "customer_id": "customerId", + "line_items": "lineItems", + "next_cycle": "nextCycle", + }); + }), +); + +export function previewAttachResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PreviewAttachResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PreviewAttachResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/preview-update-op.ts b/packages/sdk/src/models/preview-update-op.ts new file mode 100644 index 000000000..af9a1c0d1 --- /dev/null +++ b/packages/sdk/src/models/preview-update-op.ts @@ -0,0 +1,910 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { ClosedEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { smartUnion } from "../types/smart-union.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type PreviewUpdateGlobals = { + xApiVersion?: string | undefined; +}; + +export type PreviewUpdateFeatureQuantity = { + featureId: string; + quantity?: number | undefined; + adjustable?: boolean | undefined; +}; + +export const PreviewUpdateDurationType = { + Day: "day", + Month: "month", + Year: "year", +} as const; +export type PreviewUpdateDurationType = ClosedEnum< + typeof PreviewUpdateDurationType +>; + +export type PreviewUpdateFreeTrial = { + durationLength: number; + durationType?: PreviewUpdateDurationType | undefined; + cardRequired?: boolean | undefined; +}; + +export const PreviewUpdatePriceInterval = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +export type PreviewUpdatePriceInterval = ClosedEnum< + typeof PreviewUpdatePriceInterval +>; + +export type PreviewUpdatePrice = { + amount: number; + interval: PreviewUpdatePriceInterval; + intervalCount?: number | undefined; +}; + +export const PreviewUpdateResetInterval = { + OneOff: "one_off", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +export type PreviewUpdateResetInterval = ClosedEnum< + typeof PreviewUpdateResetInterval +>; + +export type PreviewUpdateReset = { + interval: PreviewUpdateResetInterval; + intervalCount?: number | undefined; +}; + +export type PreviewUpdateTo = number | string; + +export type PreviewUpdateTier = { + to: number | string; + amount: number; +}; + +export const PreviewUpdateItemPriceInterval = { + OneOff: "one_off", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +export type PreviewUpdateItemPriceInterval = ClosedEnum< + typeof PreviewUpdateItemPriceInterval +>; + +export const PreviewUpdateBillingMethod = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +export type PreviewUpdateBillingMethod = ClosedEnum< + typeof PreviewUpdateBillingMethod +>; + +export type PreviewUpdateItemPrice = { + amount?: number | undefined; + tiers?: Array | undefined; + interval: PreviewUpdateItemPriceInterval; + intervalCount?: number | undefined; + billingUnits?: number | undefined; + billingMethod: PreviewUpdateBillingMethod; + maxPurchase?: number | undefined; +}; + +export const PreviewUpdateOnIncrease = { + BillImmediately: "bill_immediately", + ProrateImmediately: "prorate_immediately", + ProrateNextCycle: "prorate_next_cycle", + BillNextCycle: "bill_next_cycle", +} as const; +export type PreviewUpdateOnIncrease = ClosedEnum< + typeof PreviewUpdateOnIncrease +>; + +export const PreviewUpdateOnDecrease = { + Prorate: "prorate", + ProrateImmediately: "prorate_immediately", + ProrateNextCycle: "prorate_next_cycle", + None: "none", + NoProrations: "no_prorations", +} as const; +export type PreviewUpdateOnDecrease = ClosedEnum< + typeof PreviewUpdateOnDecrease +>; + +export type PreviewUpdateProration = { + onIncrease: PreviewUpdateOnIncrease; + onDecrease: PreviewUpdateOnDecrease; +}; + +export const PreviewUpdateExpiryDurationType = { + Month: "month", + Forever: "forever", +} as const; +export type PreviewUpdateExpiryDurationType = ClosedEnum< + typeof PreviewUpdateExpiryDurationType +>; + +export type PreviewUpdateRollover = { + max?: number | undefined; + expiryDurationType: PreviewUpdateExpiryDurationType; + expiryDurationLength?: number | undefined; +}; + +export type PreviewUpdateItem = { + featureId: string; + included?: number | undefined; + unlimited?: boolean | undefined; + reset?: PreviewUpdateReset | undefined; + price?: PreviewUpdateItemPrice | undefined; + proration?: PreviewUpdateProration | undefined; + rollover?: PreviewUpdateRollover | undefined; +}; + +/** + * Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. + */ +export type PreviewUpdateCustomize = { + price?: PreviewUpdatePrice | null | undefined; + items?: Array | undefined; +}; + +/** + * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + */ +export type PreviewUpdateInvoiceMode = { + /** + * When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. + */ + enabled: boolean; + /** + * If true, enables the plan immediately even though the invoice is not paid yet. + */ + enablePlanImmediately?: boolean | undefined; + /** + * If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. + */ + finalize?: boolean | undefined; +}; + +/** + * 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. + */ +export const PreviewUpdateBillingBehavior = { + ProrateImmediately: "prorate_immediately", + NextCycleOnly: "next_cycle_only", +} as const; +/** + * 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. + */ +export type PreviewUpdateBillingBehavior = ClosedEnum< + typeof PreviewUpdateBillingBehavior +>; + +/** + * Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. + */ +export const PreviewUpdateCancelAction = { + CancelImmediately: "cancel_immediately", + CancelEndOfCycle: "cancel_end_of_cycle", + Uncancel: "uncancel", +} as const; +/** + * Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. + */ +export type PreviewUpdateCancelAction = ClosedEnum< + typeof PreviewUpdateCancelAction +>; + +export type PreviewUpdateParams = { + /** + * The ID of the customer to attach the plan to. + */ + customerId: string; + /** + * The ID of the entity to attach the plan to. + */ + entityId?: string | undefined; + /** + * The ID of the plan. + */ + planId: string; + /** + * If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. + */ + featureQuantities?: Array | undefined; + /** + * The version of the plan to attach. + */ + version?: number | undefined; + /** + * Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. + */ + freeTrial?: PreviewUpdateFreeTrial | null | undefined; + /** + * Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. + */ + customize?: PreviewUpdateCustomize | undefined; + /** + * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. + */ + invoiceMode?: PreviewUpdateInvoiceMode | undefined; + /** + * 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. + */ + billingBehavior?: PreviewUpdateBillingBehavior | undefined; + /** + * Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. + */ + cancelAction?: PreviewUpdateCancelAction | undefined; +}; + +export type PreviewUpdateDiscount = { + amountOff: number; + percentOff?: number | undefined; + stripeCouponId?: string | undefined; + couponName?: string | undefined; +}; + +export type PreviewUpdateLineItem = { + /** + * The title of the line item. + */ + title: string; + /** + * A detailed description of the line item. + */ + description: string; + /** + * The amount in cents for this line item. + */ + amount: number; + /** + * List of discounts applied to this line item. + */ + discounts?: Array | undefined; +}; + +/** + * Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. + */ +export type PreviewUpdateNextCycle = { + /** + * Unix timestamp (milliseconds) when the next billing cycle starts. + */ + startsAt: number; + /** + * The total amount in cents for the next cycle. + */ + total: number; +}; + +/** + * OK + */ +export type PreviewUpdateResponse = { + /** + * The ID of the customer. + */ + customerId: string; + /** + * List of line items for the current billing period. + */ + lineItems: Array; + /** + * The total amount in cents for the current billing period. + */ + total: number; + /** + * The three-letter ISO currency code (e.g., 'usd'). + */ + currency: string; + /** + * Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles. + */ + nextCycle?: PreviewUpdateNextCycle | undefined; +}; + +/** @internal */ +export type PreviewUpdateFeatureQuantity$Outbound = { + feature_id: string; + quantity?: number | undefined; + adjustable?: boolean | undefined; +}; + +/** @internal */ +export const PreviewUpdateFeatureQuantity$outboundSchema: z.ZodMiniType< + PreviewUpdateFeatureQuantity$Outbound, + PreviewUpdateFeatureQuantity +> = z.pipe( + z.object({ + featureId: z.string(), + quantity: z.optional(z.number()), + adjustable: z.optional(z.boolean()), + }), + z.transform((v) => { + return remap$(v, { + featureId: "feature_id", + }); + }), +); + +export function previewUpdateFeatureQuantityToJSON( + previewUpdateFeatureQuantity: PreviewUpdateFeatureQuantity, +): string { + return JSON.stringify( + PreviewUpdateFeatureQuantity$outboundSchema.parse( + previewUpdateFeatureQuantity, + ), + ); +} + +/** @internal */ +export const PreviewUpdateDurationType$outboundSchema: z.ZodMiniEnum< + typeof PreviewUpdateDurationType +> = z.enum(PreviewUpdateDurationType); + +/** @internal */ +export type PreviewUpdateFreeTrial$Outbound = { + duration_length: number; + duration_type: string; + card_required: boolean; +}; + +/** @internal */ +export const PreviewUpdateFreeTrial$outboundSchema: z.ZodMiniType< + PreviewUpdateFreeTrial$Outbound, + PreviewUpdateFreeTrial +> = z.pipe( + z.object({ + durationLength: z.number(), + durationType: z._default(PreviewUpdateDurationType$outboundSchema, "month"), + cardRequired: z._default(z.boolean(), true), + }), + z.transform((v) => { + return remap$(v, { + durationLength: "duration_length", + durationType: "duration_type", + cardRequired: "card_required", + }); + }), +); + +export function previewUpdateFreeTrialToJSON( + previewUpdateFreeTrial: PreviewUpdateFreeTrial, +): string { + return JSON.stringify( + PreviewUpdateFreeTrial$outboundSchema.parse(previewUpdateFreeTrial), + ); +} + +/** @internal */ +export const PreviewUpdatePriceInterval$outboundSchema: z.ZodMiniEnum< + typeof PreviewUpdatePriceInterval +> = z.enum(PreviewUpdatePriceInterval); + +/** @internal */ +export type PreviewUpdatePrice$Outbound = { + amount: number; + interval: string; + interval_count?: number | undefined; +}; + +/** @internal */ +export const PreviewUpdatePrice$outboundSchema: z.ZodMiniType< + PreviewUpdatePrice$Outbound, + PreviewUpdatePrice +> = z.pipe( + z.object({ + amount: z.number(), + interval: PreviewUpdatePriceInterval$outboundSchema, + intervalCount: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + }); + }), +); + +export function previewUpdatePriceToJSON( + previewUpdatePrice: PreviewUpdatePrice, +): string { + return JSON.stringify( + PreviewUpdatePrice$outboundSchema.parse(previewUpdatePrice), + ); +} + +/** @internal */ +export const PreviewUpdateResetInterval$outboundSchema: z.ZodMiniEnum< + typeof PreviewUpdateResetInterval +> = z.enum(PreviewUpdateResetInterval); + +/** @internal */ +export type PreviewUpdateReset$Outbound = { + interval: string; + interval_count?: number | undefined; +}; + +/** @internal */ +export const PreviewUpdateReset$outboundSchema: z.ZodMiniType< + PreviewUpdateReset$Outbound, + PreviewUpdateReset +> = z.pipe( + z.object({ + interval: PreviewUpdateResetInterval$outboundSchema, + intervalCount: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + }); + }), +); + +export function previewUpdateResetToJSON( + previewUpdateReset: PreviewUpdateReset, +): string { + return JSON.stringify( + PreviewUpdateReset$outboundSchema.parse(previewUpdateReset), + ); +} + +/** @internal */ +export type PreviewUpdateTo$Outbound = number | string; + +/** @internal */ +export const PreviewUpdateTo$outboundSchema: z.ZodMiniType< + PreviewUpdateTo$Outbound, + PreviewUpdateTo +> = smartUnion([z.number(), z.string()]); + +export function previewUpdateToToJSON( + previewUpdateTo: PreviewUpdateTo, +): string { + return JSON.stringify(PreviewUpdateTo$outboundSchema.parse(previewUpdateTo)); +} + +/** @internal */ +export type PreviewUpdateTier$Outbound = { + to: number | string; + amount: number; +}; + +/** @internal */ +export const PreviewUpdateTier$outboundSchema: z.ZodMiniType< + PreviewUpdateTier$Outbound, + PreviewUpdateTier +> = z.object({ + to: smartUnion([z.number(), z.string()]), + amount: z.number(), +}); + +export function previewUpdateTierToJSON( + previewUpdateTier: PreviewUpdateTier, +): string { + return JSON.stringify( + PreviewUpdateTier$outboundSchema.parse(previewUpdateTier), + ); +} + +/** @internal */ +export const PreviewUpdateItemPriceInterval$outboundSchema: z.ZodMiniEnum< + typeof PreviewUpdateItemPriceInterval +> = z.enum(PreviewUpdateItemPriceInterval); + +/** @internal */ +export const PreviewUpdateBillingMethod$outboundSchema: z.ZodMiniEnum< + typeof PreviewUpdateBillingMethod +> = z.enum(PreviewUpdateBillingMethod); + +/** @internal */ +export type PreviewUpdateItemPrice$Outbound = { + amount?: number | undefined; + tiers?: Array | undefined; + interval: string; + interval_count: number; + billing_units: number; + billing_method: string; + max_purchase?: number | undefined; +}; + +/** @internal */ +export const PreviewUpdateItemPrice$outboundSchema: z.ZodMiniType< + PreviewUpdateItemPrice$Outbound, + PreviewUpdateItemPrice +> = z.pipe( + z.object({ + amount: z.optional(z.number()), + tiers: z.optional(z.array(z.lazy(() => PreviewUpdateTier$outboundSchema))), + interval: PreviewUpdateItemPriceInterval$outboundSchema, + intervalCount: z._default(z.number(), 1), + billingUnits: z._default(z.number(), 1), + billingMethod: PreviewUpdateBillingMethod$outboundSchema, + maxPurchase: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + intervalCount: "interval_count", + billingUnits: "billing_units", + billingMethod: "billing_method", + maxPurchase: "max_purchase", + }); + }), +); + +export function previewUpdateItemPriceToJSON( + previewUpdateItemPrice: PreviewUpdateItemPrice, +): string { + return JSON.stringify( + PreviewUpdateItemPrice$outboundSchema.parse(previewUpdateItemPrice), + ); +} + +/** @internal */ +export const PreviewUpdateOnIncrease$outboundSchema: z.ZodMiniEnum< + typeof PreviewUpdateOnIncrease +> = z.enum(PreviewUpdateOnIncrease); + +/** @internal */ +export const PreviewUpdateOnDecrease$outboundSchema: z.ZodMiniEnum< + typeof PreviewUpdateOnDecrease +> = z.enum(PreviewUpdateOnDecrease); + +/** @internal */ +export type PreviewUpdateProration$Outbound = { + on_increase: string; + on_decrease: string; +}; + +/** @internal */ +export const PreviewUpdateProration$outboundSchema: z.ZodMiniType< + PreviewUpdateProration$Outbound, + PreviewUpdateProration +> = z.pipe( + z.object({ + onIncrease: PreviewUpdateOnIncrease$outboundSchema, + onDecrease: PreviewUpdateOnDecrease$outboundSchema, + }), + z.transform((v) => { + return remap$(v, { + onIncrease: "on_increase", + onDecrease: "on_decrease", + }); + }), +); + +export function previewUpdateProrationToJSON( + previewUpdateProration: PreviewUpdateProration, +): string { + return JSON.stringify( + PreviewUpdateProration$outboundSchema.parse(previewUpdateProration), + ); +} + +/** @internal */ +export const PreviewUpdateExpiryDurationType$outboundSchema: z.ZodMiniEnum< + typeof PreviewUpdateExpiryDurationType +> = z.enum(PreviewUpdateExpiryDurationType); + +/** @internal */ +export type PreviewUpdateRollover$Outbound = { + max?: number | undefined; + expiry_duration_type: string; + expiry_duration_length?: number | undefined; +}; + +/** @internal */ +export const PreviewUpdateRollover$outboundSchema: z.ZodMiniType< + PreviewUpdateRollover$Outbound, + PreviewUpdateRollover +> = z.pipe( + z.object({ + max: z.optional(z.number()), + expiryDurationType: PreviewUpdateExpiryDurationType$outboundSchema, + expiryDurationLength: z.optional(z.number()), + }), + z.transform((v) => { + return remap$(v, { + expiryDurationType: "expiry_duration_type", + expiryDurationLength: "expiry_duration_length", + }); + }), +); + +export function previewUpdateRolloverToJSON( + previewUpdateRollover: PreviewUpdateRollover, +): string { + return JSON.stringify( + PreviewUpdateRollover$outboundSchema.parse(previewUpdateRollover), + ); +} + +/** @internal */ +export type PreviewUpdateItem$Outbound = { + feature_id: string; + included?: number | undefined; + unlimited?: boolean | undefined; + reset?: PreviewUpdateReset$Outbound | undefined; + price?: PreviewUpdateItemPrice$Outbound | undefined; + proration?: PreviewUpdateProration$Outbound | undefined; + rollover?: PreviewUpdateRollover$Outbound | undefined; +}; + +/** @internal */ +export const PreviewUpdateItem$outboundSchema: z.ZodMiniType< + PreviewUpdateItem$Outbound, + PreviewUpdateItem +> = z.pipe( + z.object({ + featureId: z.string(), + included: z.optional(z.number()), + unlimited: z.optional(z.boolean()), + reset: z.optional(z.lazy(() => PreviewUpdateReset$outboundSchema)), + price: z.optional(z.lazy(() => PreviewUpdateItemPrice$outboundSchema)), + proration: z.optional(z.lazy(() => PreviewUpdateProration$outboundSchema)), + rollover: z.optional(z.lazy(() => PreviewUpdateRollover$outboundSchema)), + }), + z.transform((v) => { + return remap$(v, { + featureId: "feature_id", + }); + }), +); + +export function previewUpdateItemToJSON( + previewUpdateItem: PreviewUpdateItem, +): string { + return JSON.stringify( + PreviewUpdateItem$outboundSchema.parse(previewUpdateItem), + ); +} + +/** @internal */ +export type PreviewUpdateCustomize$Outbound = { + price?: PreviewUpdatePrice$Outbound | null | undefined; + items?: Array | undefined; +}; + +/** @internal */ +export const PreviewUpdateCustomize$outboundSchema: z.ZodMiniType< + PreviewUpdateCustomize$Outbound, + PreviewUpdateCustomize +> = z.object({ + price: z.optional( + z.nullable(z.lazy(() => PreviewUpdatePrice$outboundSchema)), + ), + items: z.optional(z.array(z.lazy(() => PreviewUpdateItem$outboundSchema))), +}); + +export function previewUpdateCustomizeToJSON( + previewUpdateCustomize: PreviewUpdateCustomize, +): string { + return JSON.stringify( + PreviewUpdateCustomize$outboundSchema.parse(previewUpdateCustomize), + ); +} + +/** @internal */ +export type PreviewUpdateInvoiceMode$Outbound = { + enabled: boolean; + enable_plan_immediately: boolean; + finalize: boolean; +}; + +/** @internal */ +export const PreviewUpdateInvoiceMode$outboundSchema: z.ZodMiniType< + PreviewUpdateInvoiceMode$Outbound, + PreviewUpdateInvoiceMode +> = z.pipe( + z.object({ + enabled: z.boolean(), + enablePlanImmediately: z._default(z.boolean(), false), + finalize: z._default(z.boolean(), true), + }), + z.transform((v) => { + return remap$(v, { + enablePlanImmediately: "enable_plan_immediately", + }); + }), +); + +export function previewUpdateInvoiceModeToJSON( + previewUpdateInvoiceMode: PreviewUpdateInvoiceMode, +): string { + return JSON.stringify( + PreviewUpdateInvoiceMode$outboundSchema.parse(previewUpdateInvoiceMode), + ); +} + +/** @internal */ +export const PreviewUpdateBillingBehavior$outboundSchema: z.ZodMiniEnum< + typeof PreviewUpdateBillingBehavior +> = z.enum(PreviewUpdateBillingBehavior); + +/** @internal */ +export const PreviewUpdateCancelAction$outboundSchema: z.ZodMiniEnum< + typeof PreviewUpdateCancelAction +> = z.enum(PreviewUpdateCancelAction); + +/** @internal */ +export type PreviewUpdateParams$Outbound = { + customer_id: string; + entity_id?: string | undefined; + plan_id: string; + feature_quantities?: Array | undefined; + version?: number | undefined; + free_trial?: PreviewUpdateFreeTrial$Outbound | null | undefined; + customize?: PreviewUpdateCustomize$Outbound | undefined; + invoice_mode?: PreviewUpdateInvoiceMode$Outbound | undefined; + billing_behavior?: string | undefined; + cancel_action?: string | undefined; +}; + +/** @internal */ +export const PreviewUpdateParams$outboundSchema: z.ZodMiniType< + PreviewUpdateParams$Outbound, + PreviewUpdateParams +> = z.pipe( + z.object({ + customerId: z.string(), + entityId: z.optional(z.string()), + planId: z.string(), + featureQuantities: z.optional( + z.array(z.lazy(() => PreviewUpdateFeatureQuantity$outboundSchema)), + ), + version: z.optional(z.number()), + freeTrial: z.optional( + z.nullable(z.lazy(() => PreviewUpdateFreeTrial$outboundSchema)), + ), + customize: z.optional(z.lazy(() => PreviewUpdateCustomize$outboundSchema)), + invoiceMode: z.optional( + z.lazy(() => PreviewUpdateInvoiceMode$outboundSchema), + ), + billingBehavior: z.optional(PreviewUpdateBillingBehavior$outboundSchema), + cancelAction: z.optional(PreviewUpdateCancelAction$outboundSchema), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + entityId: "entity_id", + planId: "plan_id", + featureQuantities: "feature_quantities", + freeTrial: "free_trial", + invoiceMode: "invoice_mode", + billingBehavior: "billing_behavior", + cancelAction: "cancel_action", + }); + }), +); + +export function previewUpdateParamsToJSON( + previewUpdateParams: PreviewUpdateParams, +): string { + return JSON.stringify( + PreviewUpdateParams$outboundSchema.parse(previewUpdateParams), + ); +} + +/** @internal */ +export const PreviewUpdateDiscount$inboundSchema: z.ZodMiniType< + PreviewUpdateDiscount, + unknown +> = z.object({ + amountOff: types.number(), + percentOff: types.optional(types.number()), + stripeCouponId: types.optional(types.string()), + couponName: types.optional(types.string()), +}); + +export function previewUpdateDiscountFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PreviewUpdateDiscount$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PreviewUpdateDiscount' from JSON`, + ); +} + +/** @internal */ +export const PreviewUpdateLineItem$inboundSchema: z.ZodMiniType< + PreviewUpdateLineItem, + unknown +> = z.object({ + title: types.string(), + description: types.string(), + amount: types.number(), + discounts: types.optional( + z.array(z.lazy(() => PreviewUpdateDiscount$inboundSchema)), + ), +}); + +export function previewUpdateLineItemFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PreviewUpdateLineItem$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PreviewUpdateLineItem' from JSON`, + ); +} + +/** @internal */ +export const PreviewUpdateNextCycle$inboundSchema: z.ZodMiniType< + PreviewUpdateNextCycle, + unknown +> = z.pipe( + z.object({ + starts_at: types.number(), + total: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "starts_at": "startsAt", + }); + }), +); + +export function previewUpdateNextCycleFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PreviewUpdateNextCycle$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PreviewUpdateNextCycle' from JSON`, + ); +} + +/** @internal */ +export const PreviewUpdateResponse$inboundSchema: z.ZodMiniType< + PreviewUpdateResponse, + unknown +> = z.pipe( + z.object({ + customer_id: types.string(), + line_items: z.array(z.lazy(() => PreviewUpdateLineItem$inboundSchema)), + total: types.number(), + currency: types.string(), + next_cycle: types.optional( + z.lazy(() => PreviewUpdateNextCycle$inboundSchema), + ), + }), + z.transform((v) => { + return remap$(v, { + "customer_id": "customerId", + "line_items": "lineItems", + "next_cycle": "nextCycle", + }); + }), +); + +export function previewUpdateResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PreviewUpdateResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PreviewUpdateResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/redeem-referral-code-op.ts b/packages/sdk/src/models/redeem-referral-code-op.ts new file mode 100644 index 000000000..ef030006b --- /dev/null +++ b/packages/sdk/src/models/redeem-referral-code-op.ts @@ -0,0 +1,101 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type RedeemReferralCodeGlobals = { + xApiVersion?: string | undefined; +}; + +export type RedeemReferralCodeParams = { + /** + * The referral code to redeem + */ + code: string; + /** + * The unique identifier of the customer redeeming the code + */ + customerId: string; +}; + +/** + * OK + */ +export type RedeemReferralCodeResponse = { + /** + * The ID of the redemption event + */ + id: string; + /** + * Your unique identifier for the customer + */ + customerId: string; + /** + * The ID of the reward that will be granted + */ + rewardId: string; +}; + +/** @internal */ +export type RedeemReferralCodeParams$Outbound = { + code: string; + customer_id: string; +}; + +/** @internal */ +export const RedeemReferralCodeParams$outboundSchema: z.ZodMiniType< + RedeemReferralCodeParams$Outbound, + RedeemReferralCodeParams +> = z.pipe( + z.object({ + code: z.string(), + customerId: z.string(), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + }); + }), +); + +export function redeemReferralCodeParamsToJSON( + redeemReferralCodeParams: RedeemReferralCodeParams, +): string { + return JSON.stringify( + RedeemReferralCodeParams$outboundSchema.parse(redeemReferralCodeParams), + ); +} + +/** @internal */ +export const RedeemReferralCodeResponse$inboundSchema: z.ZodMiniType< + RedeemReferralCodeResponse, + unknown +> = z.pipe( + z.object({ + id: types.string(), + customer_id: types.string(), + reward_id: types.string(), + }), + z.transform((v) => { + return remap$(v, { + "customer_id": "customerId", + "reward_id": "rewardId", + }); + }), +); + +export function redeemReferralCodeResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => RedeemReferralCodeResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'RedeemReferralCodeResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/track-op.ts b/packages/sdk/src/models/track-op.ts new file mode 100644 index 000000000..3f311e7ef --- /dev/null +++ b/packages/sdk/src/models/track-op.ts @@ -0,0 +1,1203 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { smartUnion } from "../types/smart-union.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type TrackGlobals = { + xApiVersion?: string | undefined; +}; + +export type TrackParams = { + /** + * The ID of the customer. + */ + customerId: string; + /** + * The ID of the feature to track usage for. Required if event_name is not provided. + */ + featureId?: string | undefined; + /** + * The ID of the entity for entity-scoped balances (e.g., per-seat limits). + */ + entityId?: string | undefined; + /** + * Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. + */ + eventName?: string | undefined; + /** + * The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). + */ + value?: number | undefined; + /** + * Additional properties to attach to this usage event. + */ + properties?: { [k: string]: any } | undefined; +}; + +export const TrackBalanceType = { + Boolean: "boolean", + Metered: "metered", + CreditSystem: "credit_system", +} as const; +export type TrackBalanceType = OpenEnum; + +export type TrackBalanceCreditSchema = { + meteredFeatureId: string; + creditCost: number; +}; + +export type TrackBalanceDisplay = { + singular?: string | null | undefined; + plural?: string | null | undefined; +}; + +/** + * The full feature object if expanded. + */ +export type TrackBalanceFeature = { + id: string; + name: string; + type: TrackBalanceType; + consumable: boolean; + eventNames?: Array | undefined; + creditSchema?: Array | undefined; + display?: TrackBalanceDisplay | undefined; + archived: boolean; +}; + +export const TrackBalanceIntervalEnum = { + OneOff: "one_off", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +export type TrackBalanceIntervalEnum = OpenEnum< + typeof TrackBalanceIntervalEnum +>; + +/** + * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + */ +export type TrackBalanceIntervalUnion = TrackBalanceIntervalEnum | string; + +export type TrackBalanceReset = { + /** + * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + */ + interval: TrackBalanceIntervalEnum | string; + /** + * Number of intervals between resets (eg. 2 for bi-monthly). + */ + intervalCount?: number | undefined; + /** + * Timestamp when the balance will next reset. + */ + resetsAt: number | null; +}; + +export type TrackBalanceTo = number | string; + +export type TrackBalanceTier = { + to: number | string; + amount: number; +}; + +/** + * Whether usage is prepaid or billed pay-per-use. + */ +export const TrackBalanceBillingMethod = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +/** + * Whether usage is prepaid or billed pay-per-use. + */ +export type TrackBalanceBillingMethod = OpenEnum< + typeof TrackBalanceBillingMethod +>; + +export type TrackBalancePrice = { + /** + * The per-unit price amount. + */ + amount?: number | undefined; + /** + * Tiered pricing configuration if applicable. + */ + tiers?: Array | undefined; + /** + * The number of units per billing increment (eg. $9 / 250 units). + */ + billingUnits: number; + /** + * Whether usage is prepaid or billed pay-per-use. + */ + billingMethod: TrackBalanceBillingMethod; + /** + * Maximum quantity that can be purchased, or null for unlimited. + */ + maxPurchase: number | null; +}; + +export type TrackBalanceBreakdown = { + /** + * The unique identifier for this balance breakdown. + */ + id: string; + /** + * The plan ID this balance originates from, or null for standalone balances. + */ + planId: string | null; + /** + * Amount granted from the plan's included usage. + */ + includedGrant: number; + /** + * Amount granted from prepaid purchases or top-ups. + */ + prepaidGrant: number; + /** + * Remaining balance available for use. + */ + remaining: number; + /** + * Amount consumed in the current period. + */ + usage: number; + /** + * Whether this balance has unlimited usage. + */ + unlimited: boolean; + /** + * Reset configuration for this balance, or null if no reset. + */ + reset: TrackBalanceReset | null; + /** + * Pricing configuration if this balance has usage-based pricing. + */ + price: TrackBalancePrice | null; + /** + * Timestamp when this balance expires, or null for no expiration. + */ + expiresAt: number | null; +}; + +export type TrackBalanceRollover = { + /** + * Amount of balance rolled over from a previous period. + */ + balance: number; + /** + * Timestamp when the rollover balance expires. + */ + expiresAt: number; +}; + +export type TrackBalance = { + /** + * The feature ID this balance is for. + */ + featureId: string; + /** + * The full feature object if expanded. + */ + feature?: TrackBalanceFeature | undefined; + /** + * Total balance granted (included + prepaid). + */ + granted: number; + /** + * Remaining balance available for use. + */ + remaining: number; + /** + * Total usage consumed in the current period. + */ + usage: number; + /** + * Whether this feature has unlimited usage. + */ + unlimited: boolean; + /** + * Whether usage beyond the granted balance is allowed (with overage charges). + */ + overageAllowed: boolean; + /** + * Maximum quantity that can be purchased as a top-up, or null for unlimited. + */ + maxPurchase: number | null; + /** + * Timestamp when the balance will reset, or null for no reset. + */ + nextResetAt: number | null; + /** + * Detailed breakdown of balance sources when stacking multiple plans or grants. + */ + breakdown?: Array | undefined; + /** + * Rollover balances carried over from previous periods. + */ + rollovers?: Array | undefined; +}; + +export const TrackBalancesType = { + Boolean: "boolean", + Metered: "metered", + CreditSystem: "credit_system", +} as const; +export type TrackBalancesType = OpenEnum; + +export type TrackBalancesCreditSchema = { + meteredFeatureId: string; + creditCost: number; +}; + +export type TrackBalancesDisplay = { + singular?: string | null | undefined; + plural?: string | null | undefined; +}; + +/** + * The full feature object if expanded. + */ +export type TrackBalancesFeature = { + id: string; + name: string; + type: TrackBalancesType; + consumable: boolean; + eventNames?: Array | undefined; + creditSchema?: Array | undefined; + display?: TrackBalancesDisplay | undefined; + archived: boolean; +}; + +export const TrackIntervalBalancesEnum = { + OneOff: "one_off", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +export type TrackIntervalBalancesEnum = OpenEnum< + typeof TrackIntervalBalancesEnum +>; + +/** + * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + */ +export type TrackBalancesIntervalUnion = TrackIntervalBalancesEnum | string; + +export type TrackBalancesReset = { + /** + * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + */ + interval: TrackIntervalBalancesEnum | string; + /** + * Number of intervals between resets (eg. 2 for bi-monthly). + */ + intervalCount?: number | undefined; + /** + * Timestamp when the balance will next reset. + */ + resetsAt: number | null; +}; + +export type TrackBalancesTo = number | string; + +export type TrackBalancesTier = { + to: number | string; + amount: number; +}; + +/** + * Whether usage is prepaid or billed pay-per-use. + */ +export const TrackBalancesBillingMethod = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +/** + * Whether usage is prepaid or billed pay-per-use. + */ +export type TrackBalancesBillingMethod = OpenEnum< + typeof TrackBalancesBillingMethod +>; + +export type TrackBalancesPrice = { + /** + * The per-unit price amount. + */ + amount?: number | undefined; + /** + * Tiered pricing configuration if applicable. + */ + tiers?: Array | undefined; + /** + * The number of units per billing increment (eg. $9 / 250 units). + */ + billingUnits: number; + /** + * Whether usage is prepaid or billed pay-per-use. + */ + billingMethod: TrackBalancesBillingMethod; + /** + * Maximum quantity that can be purchased, or null for unlimited. + */ + maxPurchase: number | null; +}; + +export type TrackBalancesBreakdown = { + /** + * The unique identifier for this balance breakdown. + */ + id: string; + /** + * The plan ID this balance originates from, or null for standalone balances. + */ + planId: string | null; + /** + * Amount granted from the plan's included usage. + */ + includedGrant: number; + /** + * Amount granted from prepaid purchases or top-ups. + */ + prepaidGrant: number; + /** + * Remaining balance available for use. + */ + remaining: number; + /** + * Amount consumed in the current period. + */ + usage: number; + /** + * Whether this balance has unlimited usage. + */ + unlimited: boolean; + /** + * Reset configuration for this balance, or null if no reset. + */ + reset: TrackBalancesReset | null; + /** + * Pricing configuration if this balance has usage-based pricing. + */ + price: TrackBalancesPrice | null; + /** + * Timestamp when this balance expires, or null for no expiration. + */ + expiresAt: number | null; +}; + +export type TrackBalancesRollover = { + /** + * Amount of balance rolled over from a previous period. + */ + balance: number; + /** + * Timestamp when the rollover balance expires. + */ + expiresAt: number; +}; + +export type TrackBalances = { + /** + * The feature ID this balance is for. + */ + featureId: string; + /** + * The full feature object if expanded. + */ + feature?: TrackBalancesFeature | undefined; + /** + * Total balance granted (included + prepaid). + */ + granted: number; + /** + * Remaining balance available for use. + */ + remaining: number; + /** + * Total usage consumed in the current period. + */ + usage: number; + /** + * Whether this feature has unlimited usage. + */ + unlimited: boolean; + /** + * Whether usage beyond the granted balance is allowed (with overage charges). + */ + overageAllowed: boolean; + /** + * Maximum quantity that can be purchased as a top-up, or null for unlimited. + */ + maxPurchase: number | null; + /** + * Timestamp when the balance will reset, or null for no reset. + */ + nextResetAt: number | null; + /** + * Detailed breakdown of balance sources when stacking multiple plans or grants. + */ + breakdown?: Array | undefined; + /** + * Rollover balances carried over from previous periods. + */ + rollovers?: Array | undefined; +}; + +/** + * OK + */ +export type TrackResponse = { + /** + * The ID of the customer whose usage was tracked. + */ + customerId: string; + /** + * The ID of the entity, if entity-scoped tracking was performed. + */ + entityId?: string | undefined; + /** + * The event name that was tracked, if event_name was used instead of feature_id. + */ + eventName?: string | undefined; + /** + * The amount of usage that was recorded. + */ + value: number; + /** + * The updated balance for the tracked feature. Null if tracking by event_name that affects multiple features. + */ + balance: TrackBalance | null; + /** + * Map of feature_id to updated balance when tracking by event_name affects multiple features. + */ + balances?: { [k: string]: TrackBalances } | undefined; +}; + +/** @internal */ +export type TrackParams$Outbound = { + customer_id: string; + feature_id?: string | undefined; + entity_id?: string | undefined; + event_name?: string | undefined; + value?: number | undefined; + properties?: { [k: string]: any } | undefined; +}; + +/** @internal */ +export const TrackParams$outboundSchema: z.ZodMiniType< + TrackParams$Outbound, + TrackParams +> = z.pipe( + z.object({ + customerId: z.string(), + featureId: z.optional(z.string()), + entityId: z.optional(z.string()), + eventName: z.optional(z.string()), + value: z.optional(z.number()), + properties: z.optional(z.record(z.string(), z.any())), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + featureId: "feature_id", + entityId: "entity_id", + eventName: "event_name", + }); + }), +); + +export function trackParamsToJSON(trackParams: TrackParams): string { + return JSON.stringify(TrackParams$outboundSchema.parse(trackParams)); +} + +/** @internal */ +export const TrackBalanceType$inboundSchema: z.ZodMiniType< + TrackBalanceType, + unknown +> = openEnums.inboundSchema(TrackBalanceType); + +/** @internal */ +export const TrackBalanceCreditSchema$inboundSchema: z.ZodMiniType< + TrackBalanceCreditSchema, + unknown +> = z.pipe( + z.object({ + metered_feature_id: types.string(), + credit_cost: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "metered_feature_id": "meteredFeatureId", + "credit_cost": "creditCost", + }); + }), +); + +export function trackBalanceCreditSchemaFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalanceCreditSchema$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalanceCreditSchema' from JSON`, + ); +} + +/** @internal */ +export const TrackBalanceDisplay$inboundSchema: z.ZodMiniType< + TrackBalanceDisplay, + unknown +> = z.object({ + singular: z.optional(z.nullable(types.string())), + plural: z.optional(z.nullable(types.string())), +}); + +export function trackBalanceDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalanceDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalanceDisplay' from JSON`, + ); +} + +/** @internal */ +export const TrackBalanceFeature$inboundSchema: z.ZodMiniType< + TrackBalanceFeature, + unknown +> = z.pipe( + z.object({ + id: types.string(), + name: types.string(), + type: TrackBalanceType$inboundSchema, + consumable: types.boolean(), + event_names: types.optional(z.array(types.string())), + credit_schema: types.optional( + z.array(z.lazy(() => TrackBalanceCreditSchema$inboundSchema)), + ), + display: types.optional(z.lazy(() => TrackBalanceDisplay$inboundSchema)), + archived: types.boolean(), + }), + z.transform((v) => { + return remap$(v, { + "event_names": "eventNames", + "credit_schema": "creditSchema", + }); + }), +); + +export function trackBalanceFeatureFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalanceFeature$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalanceFeature' from JSON`, + ); +} + +/** @internal */ +export const TrackBalanceIntervalEnum$inboundSchema: z.ZodMiniType< + TrackBalanceIntervalEnum, + unknown +> = openEnums.inboundSchema(TrackBalanceIntervalEnum); + +/** @internal */ +export const TrackBalanceIntervalUnion$inboundSchema: z.ZodMiniType< + TrackBalanceIntervalUnion, + unknown +> = smartUnion([TrackBalanceIntervalEnum$inboundSchema, types.string()]); + +export function trackBalanceIntervalUnionFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalanceIntervalUnion$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalanceIntervalUnion' from JSON`, + ); +} + +/** @internal */ +export const TrackBalanceReset$inboundSchema: z.ZodMiniType< + TrackBalanceReset, + unknown +> = z.pipe( + z.object({ + interval: smartUnion([ + TrackBalanceIntervalEnum$inboundSchema, + types.string(), + ]), + interval_count: types.optional(types.number()), + resets_at: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + "resets_at": "resetsAt", + }); + }), +); + +export function trackBalanceResetFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalanceReset$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalanceReset' from JSON`, + ); +} + +/** @internal */ +export const TrackBalanceTo$inboundSchema: z.ZodMiniType< + TrackBalanceTo, + unknown +> = smartUnion([types.number(), types.string()]); + +export function trackBalanceToFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalanceTo$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalanceTo' from JSON`, + ); +} + +/** @internal */ +export const TrackBalanceTier$inboundSchema: z.ZodMiniType< + TrackBalanceTier, + unknown +> = z.object({ + to: smartUnion([types.number(), types.string()]), + amount: types.number(), +}); + +export function trackBalanceTierFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalanceTier$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalanceTier' from JSON`, + ); +} + +/** @internal */ +export const TrackBalanceBillingMethod$inboundSchema: z.ZodMiniType< + TrackBalanceBillingMethod, + unknown +> = openEnums.inboundSchema(TrackBalanceBillingMethod); + +/** @internal */ +export const TrackBalancePrice$inboundSchema: z.ZodMiniType< + TrackBalancePrice, + unknown +> = z.pipe( + z.object({ + amount: types.optional(types.number()), + tiers: types.optional( + z.array(z.lazy(() => TrackBalanceTier$inboundSchema)), + ), + billing_units: types.number(), + billing_method: TrackBalanceBillingMethod$inboundSchema, + max_purchase: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "billing_units": "billingUnits", + "billing_method": "billingMethod", + "max_purchase": "maxPurchase", + }); + }), +); + +export function trackBalancePriceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalancePrice$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalancePrice' from JSON`, + ); +} + +/** @internal */ +export const TrackBalanceBreakdown$inboundSchema: z.ZodMiniType< + TrackBalanceBreakdown, + unknown +> = z.pipe( + z.object({ + id: z._default(types.string(), ""), + plan_id: types.nullable(types.string()), + included_grant: types.number(), + prepaid_grant: types.number(), + remaining: types.number(), + usage: types.number(), + unlimited: types.boolean(), + reset: types.nullable(z.lazy(() => TrackBalanceReset$inboundSchema)), + price: types.nullable(z.lazy(() => TrackBalancePrice$inboundSchema)), + expires_at: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "plan_id": "planId", + "included_grant": "includedGrant", + "prepaid_grant": "prepaidGrant", + "expires_at": "expiresAt", + }); + }), +); + +export function trackBalanceBreakdownFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalanceBreakdown$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalanceBreakdown' from JSON`, + ); +} + +/** @internal */ +export const TrackBalanceRollover$inboundSchema: z.ZodMiniType< + TrackBalanceRollover, + unknown +> = z.pipe( + z.object({ + balance: types.number(), + expires_at: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "expires_at": "expiresAt", + }); + }), +); + +export function trackBalanceRolloverFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalanceRollover$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalanceRollover' from JSON`, + ); +} + +/** @internal */ +export const TrackBalance$inboundSchema: z.ZodMiniType = + z.pipe( + z.object({ + feature_id: types.string(), + feature: types.optional(z.lazy(() => TrackBalanceFeature$inboundSchema)), + granted: types.number(), + remaining: types.number(), + usage: types.number(), + unlimited: types.boolean(), + overage_allowed: types.boolean(), + max_purchase: types.nullable(types.number()), + next_reset_at: types.nullable(types.number()), + breakdown: types.optional( + z.array(z.lazy(() => TrackBalanceBreakdown$inboundSchema)), + ), + rollovers: types.optional( + z.array(z.lazy(() => TrackBalanceRollover$inboundSchema)), + ), + }), + z.transform((v) => { + return remap$(v, { + "feature_id": "featureId", + "overage_allowed": "overageAllowed", + "max_purchase": "maxPurchase", + "next_reset_at": "nextResetAt", + }); + }), + ); + +export function trackBalanceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalance$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalance' from JSON`, + ); +} + +/** @internal */ +export const TrackBalancesType$inboundSchema: z.ZodMiniType< + TrackBalancesType, + unknown +> = openEnums.inboundSchema(TrackBalancesType); + +/** @internal */ +export const TrackBalancesCreditSchema$inboundSchema: z.ZodMiniType< + TrackBalancesCreditSchema, + unknown +> = z.pipe( + z.object({ + metered_feature_id: types.string(), + credit_cost: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "metered_feature_id": "meteredFeatureId", + "credit_cost": "creditCost", + }); + }), +); + +export function trackBalancesCreditSchemaFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalancesCreditSchema$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalancesCreditSchema' from JSON`, + ); +} + +/** @internal */ +export const TrackBalancesDisplay$inboundSchema: z.ZodMiniType< + TrackBalancesDisplay, + unknown +> = z.object({ + singular: z.optional(z.nullable(types.string())), + plural: z.optional(z.nullable(types.string())), +}); + +export function trackBalancesDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalancesDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalancesDisplay' from JSON`, + ); +} + +/** @internal */ +export const TrackBalancesFeature$inboundSchema: z.ZodMiniType< + TrackBalancesFeature, + unknown +> = z.pipe( + z.object({ + id: types.string(), + name: types.string(), + type: TrackBalancesType$inboundSchema, + consumable: types.boolean(), + event_names: types.optional(z.array(types.string())), + credit_schema: types.optional( + z.array(z.lazy(() => TrackBalancesCreditSchema$inboundSchema)), + ), + display: types.optional(z.lazy(() => TrackBalancesDisplay$inboundSchema)), + archived: types.boolean(), + }), + z.transform((v) => { + return remap$(v, { + "event_names": "eventNames", + "credit_schema": "creditSchema", + }); + }), +); + +export function trackBalancesFeatureFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalancesFeature$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalancesFeature' from JSON`, + ); +} + +/** @internal */ +export const TrackIntervalBalancesEnum$inboundSchema: z.ZodMiniType< + TrackIntervalBalancesEnum, + unknown +> = openEnums.inboundSchema(TrackIntervalBalancesEnum); + +/** @internal */ +export const TrackBalancesIntervalUnion$inboundSchema: z.ZodMiniType< + TrackBalancesIntervalUnion, + unknown +> = smartUnion([TrackIntervalBalancesEnum$inboundSchema, types.string()]); + +export function trackBalancesIntervalUnionFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalancesIntervalUnion$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalancesIntervalUnion' from JSON`, + ); +} + +/** @internal */ +export const TrackBalancesReset$inboundSchema: z.ZodMiniType< + TrackBalancesReset, + unknown +> = z.pipe( + z.object({ + interval: smartUnion([ + TrackIntervalBalancesEnum$inboundSchema, + types.string(), + ]), + interval_count: types.optional(types.number()), + resets_at: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + "resets_at": "resetsAt", + }); + }), +); + +export function trackBalancesResetFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalancesReset$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalancesReset' from JSON`, + ); +} + +/** @internal */ +export const TrackBalancesTo$inboundSchema: z.ZodMiniType< + TrackBalancesTo, + unknown +> = smartUnion([types.number(), types.string()]); + +export function trackBalancesToFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalancesTo$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalancesTo' from JSON`, + ); +} + +/** @internal */ +export const TrackBalancesTier$inboundSchema: z.ZodMiniType< + TrackBalancesTier, + unknown +> = z.object({ + to: smartUnion([types.number(), types.string()]), + amount: types.number(), +}); + +export function trackBalancesTierFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalancesTier$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalancesTier' from JSON`, + ); +} + +/** @internal */ +export const TrackBalancesBillingMethod$inboundSchema: z.ZodMiniType< + TrackBalancesBillingMethod, + unknown +> = openEnums.inboundSchema(TrackBalancesBillingMethod); + +/** @internal */ +export const TrackBalancesPrice$inboundSchema: z.ZodMiniType< + TrackBalancesPrice, + unknown +> = z.pipe( + z.object({ + amount: types.optional(types.number()), + tiers: types.optional( + z.array(z.lazy(() => TrackBalancesTier$inboundSchema)), + ), + billing_units: types.number(), + billing_method: TrackBalancesBillingMethod$inboundSchema, + max_purchase: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "billing_units": "billingUnits", + "billing_method": "billingMethod", + "max_purchase": "maxPurchase", + }); + }), +); + +export function trackBalancesPriceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalancesPrice$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalancesPrice' from JSON`, + ); +} + +/** @internal */ +export const TrackBalancesBreakdown$inboundSchema: z.ZodMiniType< + TrackBalancesBreakdown, + unknown +> = z.pipe( + z.object({ + id: z._default(types.string(), ""), + plan_id: types.nullable(types.string()), + included_grant: types.number(), + prepaid_grant: types.number(), + remaining: types.number(), + usage: types.number(), + unlimited: types.boolean(), + reset: types.nullable(z.lazy(() => TrackBalancesReset$inboundSchema)), + price: types.nullable(z.lazy(() => TrackBalancesPrice$inboundSchema)), + expires_at: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "plan_id": "planId", + "included_grant": "includedGrant", + "prepaid_grant": "prepaidGrant", + "expires_at": "expiresAt", + }); + }), +); + +export function trackBalancesBreakdownFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalancesBreakdown$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalancesBreakdown' from JSON`, + ); +} + +/** @internal */ +export const TrackBalancesRollover$inboundSchema: z.ZodMiniType< + TrackBalancesRollover, + unknown +> = z.pipe( + z.object({ + balance: types.number(), + expires_at: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "expires_at": "expiresAt", + }); + }), +); + +export function trackBalancesRolloverFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalancesRollover$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalancesRollover' from JSON`, + ); +} + +/** @internal */ +export const TrackBalances$inboundSchema: z.ZodMiniType< + TrackBalances, + unknown +> = z.pipe( + z.object({ + feature_id: types.string(), + feature: types.optional(z.lazy(() => TrackBalancesFeature$inboundSchema)), + granted: types.number(), + remaining: types.number(), + usage: types.number(), + unlimited: types.boolean(), + overage_allowed: types.boolean(), + max_purchase: types.nullable(types.number()), + next_reset_at: types.nullable(types.number()), + breakdown: types.optional( + z.array(z.lazy(() => TrackBalancesBreakdown$inboundSchema)), + ), + rollovers: types.optional( + z.array(z.lazy(() => TrackBalancesRollover$inboundSchema)), + ), + }), + z.transform((v) => { + return remap$(v, { + "feature_id": "featureId", + "overage_allowed": "overageAllowed", + "max_purchase": "maxPurchase", + "next_reset_at": "nextResetAt", + }); + }), +); + +export function trackBalancesFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackBalances$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackBalances' from JSON`, + ); +} + +/** @internal */ +export const TrackResponse$inboundSchema: z.ZodMiniType< + TrackResponse, + unknown +> = z.pipe( + z.object({ + customer_id: types.string(), + entity_id: types.optional(types.string()), + event_name: types.optional(types.string()), + value: types.number(), + balance: types.nullable(z.lazy(() => TrackBalance$inboundSchema)), + balances: types.optional( + z.record(z.string(), z.lazy(() => TrackBalances$inboundSchema)), + ), + }), + z.transform((v) => { + return remap$(v, { + "customer_id": "customerId", + "entity_id": "entityId", + "event_name": "eventName", + }); + }), +); + +export function trackResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/update-balance-op.ts b/packages/sdk/src/models/update-balance-op.ts new file mode 100644 index 000000000..038d8ec36 --- /dev/null +++ b/packages/sdk/src/models/update-balance-op.ts @@ -0,0 +1,132 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { ClosedEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type UpdateBalanceGlobals = { + xApiVersion?: string | undefined; +}; + +/** + * Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals. + */ +export const UpdateBalanceInterval = { + OneOff: "one_off", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +/** + * Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals. + */ +export type UpdateBalanceInterval = ClosedEnum; + +export type UpdateBalanceParams = { + /** + * The ID of the customer. + */ + customerId: string; + /** + * The ID of the feature. + */ + featureId: string; + /** + * The ID of the entity for entity-scoped balances (e.g., per-seat limits). + */ + entityId?: string | undefined; + /** + * Set the remaining balance to this exact value. Cannot be combined with add_to_balance. + */ + remaining?: number | undefined; + /** + * Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance. + */ + addToBalance?: number | undefined; + /** + * Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals. + */ + interval?: UpdateBalanceInterval | undefined; +}; + +/** + * OK + */ +export type UpdateBalanceResponse = { + success: boolean; +}; + +/** @internal */ +export const UpdateBalanceInterval$outboundSchema: z.ZodMiniEnum< + typeof UpdateBalanceInterval +> = z.enum(UpdateBalanceInterval); + +/** @internal */ +export type UpdateBalanceParams$Outbound = { + customer_id: string; + feature_id: string; + entity_id?: string | undefined; + remaining?: number | undefined; + add_to_balance?: number | undefined; + interval?: string | undefined; +}; + +/** @internal */ +export const UpdateBalanceParams$outboundSchema: z.ZodMiniType< + UpdateBalanceParams$Outbound, + UpdateBalanceParams +> = z.pipe( + z.object({ + customerId: z.string(), + featureId: z.string(), + entityId: z.optional(z.string()), + remaining: z.optional(z.number()), + addToBalance: z.optional(z.number()), + interval: z.optional(UpdateBalanceInterval$outboundSchema), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + featureId: "feature_id", + entityId: "entity_id", + addToBalance: "add_to_balance", + }); + }), +); + +export function updateBalanceParamsToJSON( + updateBalanceParams: UpdateBalanceParams, +): string { + return JSON.stringify( + UpdateBalanceParams$outboundSchema.parse(updateBalanceParams), + ); +} + +/** @internal */ +export const UpdateBalanceResponse$inboundSchema: z.ZodMiniType< + UpdateBalanceResponse, + unknown +> = z.object({ + success: types.boolean(), +}); + +export function updateBalanceResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateBalanceResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateBalanceResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/update-customer-op.ts b/packages/sdk/src/models/update-customer-op.ts index 249d7b1e7..47dd8fc01 100644 --- a/packages/sdk/src/models/update-customer-op.ts +++ b/packages/sdk/src/models/update-customer-op.ts @@ -64,34 +64,87 @@ export const UpdateCustomerEnv = { */ export type UpdateCustomerEnv = OpenEnum; +/** + * Current status of the subscription. + */ export const UpdateCustomerStatus = { Active: "active", Scheduled: "scheduled", - Expired: "expired", } as const; +/** + * Current status of the subscription. + */ export type UpdateCustomerStatus = OpenEnum; export type UpdateCustomerSubscription = { plan?: Plan | undefined; + /** + * The unique identifier of the subscribed plan. + */ planId: string; + /** + * Whether the plan was automatically enabled for the customer. + */ autoEnable: boolean; + /** + * Whether this is an add-on plan rather than a base subscription. + */ addOn: boolean; + /** + * Current status of the subscription. + */ status: UpdateCustomerStatus; + /** + * Whether the subscription has overdue payments. + */ pastDue: boolean; + /** + * Timestamp when the subscription was canceled, or null if not canceled. + */ canceledAt: number | null; + /** + * Timestamp when the subscription will expire, or null if no expiry set. + */ expiresAt: number | null; + /** + * Timestamp when the trial period ends, or null if not on trial. + */ trialEndsAt: number | null; + /** + * Timestamp when the subscription started. + */ startedAt: number; + /** + * Start timestamp of the current billing period. + */ currentPeriodStart: number | null; + /** + * End timestamp of the current billing period. + */ currentPeriodEnd: number | null; + /** + * Number of units of this subscription (for per-seat plans). + */ quantity: number; }; export type UpdateCustomerPurchase = { plan?: Plan | undefined; + /** + * The unique identifier of the purchased plan. + */ planId: string; + /** + * Timestamp when the purchase expires, or null for lifetime access. + */ expiresAt: number | null; + /** + * Timestamp when the purchase was made. + */ startedAt: number; + /** + * Number of units purchased. + */ quantity: number; }; @@ -112,6 +165,9 @@ export type UpdateCustomerDisplay = { plural?: string | null | undefined; }; +/** + * The full feature object if expanded. + */ export type UpdateCustomerFeature = { id: string; name: string; @@ -138,11 +194,23 @@ export type UpdateCustomerIntervalEnum = OpenEnum< typeof UpdateCustomerIntervalEnum >; +/** + * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + */ export type UpdateCustomerIntervalUnion = UpdateCustomerIntervalEnum | string; export type UpdateCustomerReset = { + /** + * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals. + */ interval: UpdateCustomerIntervalEnum | string; + /** + * Number of intervals between resets (eg. 2 for bi-monthly). + */ intervalCount?: number | undefined; + /** + * Timestamp when the balance will next reset. + */ resetsAt: number | null; }; @@ -153,51 +221,141 @@ export type UpdateCustomerTier = { amount: number; }; +/** + * Whether usage is prepaid or billed pay-per-use. + */ export const UpdateCustomerBillingMethod = { Prepaid: "prepaid", UsageBased: "usage_based", } as const; +/** + * Whether usage is prepaid or billed pay-per-use. + */ export type UpdateCustomerBillingMethod = OpenEnum< typeof UpdateCustomerBillingMethod >; export type UpdateCustomerPrice = { + /** + * The per-unit price amount. + */ amount?: number | undefined; + /** + * Tiered pricing configuration if applicable. + */ tiers?: Array | undefined; + /** + * The number of units per billing increment (eg. $9 / 250 units). + */ billingUnits: number; + /** + * Whether usage is prepaid or billed pay-per-use. + */ billingMethod: UpdateCustomerBillingMethod; + /** + * Maximum quantity that can be purchased, or null for unlimited. + */ maxPurchase: number | null; }; export type UpdateCustomerBreakdown = { + /** + * The unique identifier for this balance breakdown. + */ id: string; + /** + * The plan ID this balance originates from, or null for standalone balances. + */ planId: string | null; + /** + * Amount granted from the plan's included usage. + */ includedGrant: number; + /** + * Amount granted from prepaid purchases or top-ups. + */ prepaidGrant: number; + /** + * Remaining balance available for use. + */ remaining: number; + /** + * Amount consumed in the current period. + */ usage: number; + /** + * Whether this balance has unlimited usage. + */ unlimited: boolean; + /** + * Reset configuration for this balance, or null if no reset. + */ reset: UpdateCustomerReset | null; + /** + * Pricing configuration if this balance has usage-based pricing. + */ price: UpdateCustomerPrice | null; + /** + * Timestamp when this balance expires, or null for no expiration. + */ expiresAt: number | null; }; export type UpdateCustomerRollover = { + /** + * Amount of balance rolled over from a previous period. + */ balance: number; + /** + * Timestamp when the rollover balance expires. + */ expiresAt: number; }; export type UpdateCustomerBalances = { + /** + * The feature ID this balance is for. + */ featureId: string; + /** + * The full feature object if expanded. + */ feature?: UpdateCustomerFeature | undefined; + /** + * Total balance granted (included + prepaid). + */ granted: number; + /** + * Remaining balance available for use. + */ remaining: number; + /** + * Total usage consumed in the current period. + */ usage: number; + /** + * Whether this feature has unlimited usage. + */ unlimited: boolean; + /** + * Whether usage beyond the granted balance is allowed (with overage charges). + */ overageAllowed: boolean; + /** + * Maximum quantity that can be purchased as a top-up, or null for unlimited. + */ maxPurchase: number | null; + /** + * Timestamp when the balance will reset, or null for no reset. + */ nextResetAt: number | null; + /** + * Detailed breakdown of balance sources when stacking multiple plans or grants. + */ breakdown?: Array | undefined; + /** + * Rollover balances carried over from previous periods. + */ rollovers?: Array | undefined; }; @@ -241,8 +399,17 @@ export type UpdateCustomerResponse = { * Whether to send email receipts to the customer. */ sendEmailReceipts: boolean; + /** + * Active and scheduled recurring plans that this customer has attached. + */ subscriptions: Array; + /** + * One-time purchases made by the customer. + */ purchases: Array; + /** + * Feature balances keyed by feature ID, showing usage limits and remaining amounts. + */ balances: { [k: string]: UpdateCustomerBalances }; }; diff --git a/packages/sdk/src/sdk/balances.ts b/packages/sdk/src/sdk/balances.ts index a339128fd..a03539efd 100644 --- a/packages/sdk/src/sdk/balances.ts +++ b/packages/sdk/src/sdk/balances.ts @@ -2,9 +2,7 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { balancesCheck } from "../funcs/balances-check.js"; import { balancesCreate } from "../funcs/balances-create.js"; -import { balancesTrack } from "../funcs/balances-track.js"; import { balancesUpdate } from "../funcs/balances-update.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; @@ -15,9 +13,9 @@ export class Balances extends ClientSDK { * Create a balance for a customer feature. */ async create( - request: models.BalancesCreateRequest, + request: models.CreateBalanceParams, options?: RequestOptions, - ): Promise { + ): Promise { return unwrapAsync(balancesCreate( this, request, @@ -29,41 +27,13 @@ export class Balances extends ClientSDK { * Update a customer balance. */ async update( - request: models.BalancesUpdateRequest, + request: models.UpdateBalanceParams, options?: RequestOptions, - ): Promise { + ): Promise { return unwrapAsync(balancesUpdate( this, request, options, )); } - - /** - * Check whether usage is allowed for a customer feature. - */ - async check( - request: models.BalancesCheckRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(balancesCheck( - this, - request, - options, - )); - } - - /** - * Track usage for a customer feature. - */ - async track( - request: models.BalancesTrackRequest, - options?: RequestOptions, - ): Promise { - return unwrapAsync(balancesTrack( - this, - request, - options, - )); - } } diff --git a/packages/sdk/src/sdk/billing.ts b/packages/sdk/src/sdk/billing.ts index 5e3899481..f1210dada 100644 --- a/packages/sdk/src/sdk/billing.ts +++ b/packages/sdk/src/sdk/billing.ts @@ -3,9 +3,9 @@ */ import { billingAttach } from "../funcs/billing-attach.js"; +import { billingOpenCustomerPortal } from "../funcs/billing-open-customer-portal.js"; import { billingPreviewAttach } from "../funcs/billing-preview-attach.js"; import { billingPreviewUpdate } from "../funcs/billing-preview-update.js"; -import { billingSetupPayment } from "../funcs/billing-setup-payment.js"; import { billingUpdate } from "../funcs/billing-update.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; @@ -15,20 +15,44 @@ export class Billing extends ClientSDK { /** * Attaches a plan to a customer. Handles new subscriptions, upgrades and downgrades. * + * Use this endpoint to subscribe a customer to a plan, upgrade/downgrade between plans, or add an add-on product. + * * @example * ```typescript * // Attach a plan to a customer - * const response = await client.attach({ customerId: "cus_123", planId: "pro_plan" }); + * const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan" }); + * ``` + * + * @example + * ```typescript + * // Attach with a free trial + * const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan", freeTrial: {"durationLength":14,"durationType":"day"} }); + * ``` + * + * @example + * ```typescript + * // Attach with custom pricing + * const response = await client.billing.attach({ customerId: "cus_123", planId: "pro_plan", customize: {"price":{"amount":4900,"interval":"month"}} }); * ``` * * @param customerId - The ID of the customer to attach the plan to. * @param entityId - The ID of the entity to attach the plan to. (optional) + * @param planId - The ID of the plan. * @param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) * @param version - The version of the plan to attach. (optional) + * @param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) * @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) + * @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) + * @param billingBehavior - 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. (optional) + * @param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) + * @param successUrl - URL to redirect to after successful checkout. (optional) + * @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) + * @param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + * + * @returns A billing response with customer ID, invoice details, and payment URL (if checkout required). */ async attach( - request: models.BillingAttachRequest, + request: models.AttachParams, options?: RequestOptions, ): Promise { return unwrapAsync(billingAttach( @@ -39,12 +63,36 @@ export class Billing extends ClientSDK { } /** - * Preview billing changes before attaching a plan. + * Previews the billing changes that would occur when attaching a plan, without actually making any changes. + * + * Use this endpoint to show customers what they will be charged before confirming a subscription change. + * + * @example + * ```typescript + * // Preview attaching a plan + * const response = await client.billing.previewAttach({ customerId: "cus_123", planId: "pro_plan" }); + * ``` + * + * @param customerId - The ID of the customer to attach the plan to. + * @param entityId - The ID of the entity to attach the plan to. (optional) + * @param planId - The ID of the plan. + * @param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) + * @param version - The version of the plan to attach. (optional) + * @param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) + * @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) + * @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) + * @param billingBehavior - 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. (optional) + * @param discounts - List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code. (optional) + * @param successUrl - URL to redirect to after successful checkout. (optional) + * @param newBillingSubscription - Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one. (optional) + * @param planSchedule - When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled. (optional) + * + * @returns A preview response with line items, totals, and effective dates for the proposed changes. */ async previewAttach( - request: models.BillingPreviewAttachRequest, + request: models.PreviewAttachParams, options?: RequestOptions, - ): Promise { + ): Promise { return unwrapAsync(billingPreviewAttach( this, request, @@ -53,10 +101,42 @@ export class Billing extends ClientSDK { } /** - * Update an existing subscription. + * Updates an existing subscription. Use to modify feature quantities, cancel, or change plan configuration. + * + * Use this endpoint to update prepaid quantities, cancel a subscription (immediately or at end of cycle), or modify subscription settings. + * + * @example + * ```typescript + * // Update prepaid feature quantity + * const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", featureQuantities: [{"featureId":"seats","quantity":10}] }); + * ``` + * + * @example + * ```typescript + * // Cancel a subscription at end of billing cycle + * const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", cancelAction: "cancel_end_of_cycle" }); + * ``` + * + * @example + * ```typescript + * // Uncancel a subscription at the end of the billing cycle + * const response = await client.billing.update({ customerId: "cus_123", planId: "pro_plan", cancelAction: "uncancel" }); + * ``` + * + * @param customerId - The ID of the customer to attach the plan to. + * @param entityId - The ID of the entity to attach the plan to. (optional) + * @param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) + * @param version - The version of the plan to attach. (optional) + * @param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) + * @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) + * @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) + * @param billingBehavior - 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. (optional) + * @param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional) + * + * @returns A billing response with customer ID, invoice details, and payment URL (if next action is required). */ async update( - request: models.BillingUpdateRequest, + request: models.UpdateSubscriptionParams, options?: RequestOptions, ): Promise { return unwrapAsync(billingUpdate( @@ -67,12 +147,32 @@ export class Billing extends ClientSDK { } /** - * Preview billing changes before updating a subscription. + * Previews the billing changes that would occur when updating a subscription, without actually making any changes. + * + * Use this endpoint to show customers prorated charges or refunds before confirming subscription modifications. + * + * @example + * ```typescript + * // Preview updating seat quantity + * const response = await client.billing.previewUpdate({ customerId: "cus_123", planId: "pro_plan", featureQuantities: [{"featureId":"seats","quantity":15}] }); + * ``` + * + * @param customerId - The ID of the customer to attach the plan to. + * @param entityId - The ID of the entity to attach the plan to. (optional) + * @param featureQuantities - If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan. (optional) + * @param version - The version of the plan to attach. (optional) + * @param freeTrial - Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. (optional) + * @param customize - Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. (optional) + * @param invoiceMode - Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method. (optional) + * @param billingBehavior - 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. (optional) + * @param cancelAction - Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation. (optional) + * + * @returns A preview response with line items showing prorated charges or credits for the proposed changes. */ async previewUpdate( - request: models.BillingPreviewUpdateRequest, + request: models.PreviewUpdateParams, options?: RequestOptions, - ): Promise { + ): Promise { return unwrapAsync(billingPreviewUpdate( this, request, @@ -81,13 +181,13 @@ export class Billing extends ClientSDK { } /** - * Create a setup payment session for a customer. + * Create a billing portal session for a customer to manage their subscription. */ - async setupPayment( - request: models.BillingSetupPaymentRequest, + async openCustomerPortal( + request: models.OpenCustomerPortalParams, options?: RequestOptions, - ): Promise { - return unwrapAsync(billingSetupPayment( + ): Promise { + return unwrapAsync(billingOpenCustomerPortal( this, request, options, diff --git a/packages/sdk/src/sdk/entities.ts b/packages/sdk/src/sdk/entities.ts new file mode 100644 index 000000000..334ef7086 --- /dev/null +++ b/packages/sdk/src/sdk/entities.ts @@ -0,0 +1,108 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { entitiesCreate } from "../funcs/entities-create.js"; +import { entitiesDelete } from "../funcs/entities-delete.js"; +import { entitiesGet } from "../funcs/entities-get.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class Entities extends ClientSDK { + /** + * 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. + * + * @example + * ```typescript + * // Create a seat entity + * const response = await client.entities.create({ + * + * customerId: "cus_123", + * entityId: "seat_42", + * featureId: "seats", + * name: "Seat 42", + * }); + * ``` + * + * @param name - The name of the entity (optional) + * @param featureId - The ID of the feature this entity is associated with + * @param customerData - Customer attributes used to resolve the customer when customer_id is not provided. (optional) + * @param customerId - The ID of the customer to create the entity for. + * @param entityId - The ID of the entity. + * + * @returns The created entity object including its current subscriptions, purchases, and balances. + */ + async create( + request: models.CreateEntityParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(entitiesCreate( + this, + request, + options, + )); + } + + /** + * Fetches a single entity by entity ID. + * + * Use this to read one entity's current state. Pass customerId when you want to scope the lookup to a specific customer. + * + * @example + * ```typescript + * // Fetch a seat entity + * const response = await client.entities.get({ entityId: "seat_42" }); + * ``` + * + * @example + * ```typescript + * // Fetch a seat entity for a specific customer + * const response = await client.entities.get({ customerId: "cus_123", entityId: "seat_42" }); + * ``` + * + * @param customerId - The ID of the customer to create the entity for. (optional) + * @param entityId - The ID of the entity. + * + * @returns The entity object including its current subscriptions, purchases, and balances. + */ + async get( + request: models.GetEntityParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(entitiesGet( + this, + request, + options, + )); + } + + /** + * Deletes an entity by entity ID. + * + * Use this when the underlying resource is removed and you no longer want entity-scoped balances or subscriptions tracked for it. + * + * @example + * ```typescript + * // Delete a seat entity + * const response = await client.entities.delete({ entityId: "seat_42" }); + * ``` + * + * @param customerId - The ID of the customer. (optional) + * @param entityId - The ID of the entity. + * + * @returns A success flag indicating the entity was deleted. + */ + async delete( + request: models.DeleteEntityParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(entitiesDelete( + this, + request, + options, + )); + } +} diff --git a/packages/sdk/src/sdk/events.ts b/packages/sdk/src/sdk/events.ts new file mode 100644 index 000000000..a7453990f --- /dev/null +++ b/packages/sdk/src/sdk/events.ts @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { eventsAggregate } from "../funcs/events-aggregate.js"; +import { eventsList } from "../funcs/events-list.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class Events extends ClientSDK { + /** + * List usage events for your organization. Filter by customer, feature, or time range. + */ + async list( + request: models.EventsListParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(eventsList( + this, + request, + options, + )); + } + + /** + * Aggregate usage events by time period. Returns usage totals grouped by feature and optionally by a custom property. + */ + async aggregate( + request: models.EventsAggregateParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(eventsAggregate( + this, + request, + options, + )); + } +} diff --git a/packages/sdk/src/sdk/referrals.ts b/packages/sdk/src/sdk/referrals.ts new file mode 100644 index 000000000..01839523f --- /dev/null +++ b/packages/sdk/src/sdk/referrals.ts @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { referralsCreateCode } from "../funcs/referrals-create-code.js"; +import { referralsRedeemCode } from "../funcs/referrals-redeem-code.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class Referrals extends ClientSDK { + /** + * Create or fetch a referral code for a customer in a referral program. + */ + async createCode( + request: models.CreateReferralCodeParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(referralsCreateCode( + this, + request, + options, + )); + } + + /** + * Redeem a referral code for a customer. + */ + async redeemCode( + request: models.RedeemReferralCodeParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(referralsRedeemCode( + this, + request, + options, + )); + } +} diff --git a/packages/sdk/src/sdk/sdk.ts b/packages/sdk/src/sdk/sdk.ts index d99bd76cd..fcfc869c6 100644 --- a/packages/sdk/src/sdk/sdk.ts +++ b/packages/sdk/src/sdk/sdk.ts @@ -2,11 +2,18 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { ClientSDK } from "../lib/sdks.js"; +import { check } from "../funcs/check.js"; +import { track } from "../funcs/track.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as models from "../models/index.js"; +import { unwrapAsync } from "../types/fp.js"; import { Balances } from "./balances.js"; import { Billing } from "./billing.js"; import { Customers } from "./customers.js"; +import { Entities } from "./entities.js"; +import { Events } from "./events.js"; import { Plans } from "./plans.js"; +import { Referrals } from "./referrals.js"; export class Autumn extends ClientSDK { private _customers?: Customers; @@ -28,4 +35,100 @@ export class Autumn extends ClientSDK { get balances(): Balances { return (this._balances ??= new Balances(this._options)); } + + private _events?: Events; + get events(): Events { + return (this._events ??= new Events(this._options)); + } + + private _entities?: Entities; + get entities(): Entities { + return (this._entities ??= new Entities(this._options)); + } + + private _referrals?: Referrals; + get referrals(): Referrals { + return (this._referrals ??= new Referrals(this._options)); + } + + /** + * Checks whether a customer currently has enough balance to use a feature. + * + * Use this to gate access before a feature action. Enable sendEvent when you want to check and consume balance atomically in one request. + * + * @example + * ```typescript + * // Check access for a feature + * const response = await client.check({ customerId: "cus_123", featureId: "messages" }); + * ``` + * + * @example + * ```typescript + * // Check and consume 3 units in one call + * const response = await client.check({ + * + * customerId: "cus_123", + * featureId: "messages", + * requiredBalance: 3, + * sendEvent: true, + * }); + * ``` + * + * @param customerId - The ID of the customer. + * @param featureId - The ID of the feature. + * @param entityId - The ID of the entity for entity-scoped balances (e.g., per-seat limits). (optional) + * @param requiredBalance - Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1. (optional) + * @param properties - Additional properties to attach to the usage event if send_event is true. (optional) + * @param sendEvent - If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call. (optional) + * @param withPreview - If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls. (optional) + * + * @returns Whether access is allowed, plus the current balance for that feature. + */ + async check( + request: models.CheckParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(check( + this, + request, + options, + )); + } + + /** + * Records usage for a customer feature and returns updated balances. + * + * Use this after an action happens to decrement usage, or send a negative value to credit balance back. + * + * @example + * ```typescript + * // Track one message event + * const response = await client.track({ customerId: "cus_123", featureId: "messages", value: 1 }); + * ``` + * + * @example + * ```typescript + * // Track an event mapped to multiple features + * const response = await client.track({ customerId: "cus_123", eventName: "ai_chat_request", value: 1 }); + * ``` + * + * @param customerId - The ID of the customer. + * @param featureId - The ID of the feature to track usage for. Required if event_name is not provided. (optional) + * @param entityId - The ID of the entity for entity-scoped balances (e.g., per-seat limits). (optional) + * @param eventName - Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. (optional) + * @param value - The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). (optional) + * @param properties - Additional properties to attach to this usage event. (optional) + * + * @returns The usage value recorded, with either a single updated balance or a map of updated balances. + */ + async track( + request: models.TrackParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(track( + this, + request, + options, + )); + } } diff --git a/server/src/honoMiddlewares/responseFilter/responseFilterConfig.ts b/server/src/honoMiddlewares/responseFilter/responseFilterConfig.ts index 73edcc277..7ea270386 100644 --- a/server/src/honoMiddlewares/responseFilter/responseFilterConfig.ts +++ b/server/src/honoMiddlewares/responseFilter/responseFilterConfig.ts @@ -48,7 +48,7 @@ function createFilterConfig({ const filterConfigs = [ createFilterConfig({ schema: ApiBalanceBreakdownV1Schema, - omitFields: ["overage", "expires_at", "object"], + omitFields: ["overage", "object"], }), createFilterConfig({ schema: ApiBalanceV1Schema, diff --git a/server/src/internal/api/entities/EntityService.ts b/server/src/internal/api/entities/EntityService.ts index ecd62e2ee..8c961ecf4 100644 --- a/server/src/internal/api/entities/EntityService.ts +++ b/server/src/internal/api/entities/EntityService.ts @@ -1,9 +1,31 @@ import { type Entity, ErrCode, entities } from "@autumn/shared"; import { and, eq, inArray, sql } from "drizzle-orm"; import type { DrizzleCli } from "@/db/initDrizzle.js"; +import type { AutumnContext } from "@/honoUtils/HonoEnv"; import RecaseError from "@/utils/errorUtils.js"; export class EntityService { + static async listById({ + ctx, + id, + withCustomer, + }: { + ctx: AutumnContext; + id: string; + withCustomer?: boolean; + }) { + return await ctx.db.query.entities.findMany({ + where: (entities, { eq }) => + and( + eq(entities.id, id), + eq(entities.org_id, ctx.org.id), + eq(entities.env, ctx.env), + ), + with: { + customer: withCustomer ? true : undefined, + }, + }); + } static async get({ db, id, diff --git a/server/src/internal/api/rewards/handlers/referrals/handleGetReferralCode.ts b/server/src/internal/api/rewards/handlers/referrals/handleGetReferralCode.ts index 949623edc..0bc88d588 100644 --- a/server/src/internal/api/rewards/handlers/referrals/handleGetReferralCode.ts +++ b/server/src/internal/api/rewards/handlers/referrals/handleGetReferralCode.ts @@ -1,5 +1,9 @@ -import { CustomerNotFoundError, ErrCode, RecaseError } from "@autumn/shared"; -import { z } from "zod/v4"; +import { + CreateReferralCodeParamsSchema, + CustomerNotFoundError, + ErrCode, + RecaseError, +} from "@autumn/shared"; import { CusService } from "@/internal/customers/CusService.js"; import { RewardProgramService } from "@/internal/rewards/RewardProgramService.js"; import { generateReferralCode } from "@/internal/rewards/referralUtils.js"; @@ -7,10 +11,7 @@ import { generateId } from "@/utils/genUtils.js"; import { createRoute } from "../../../../../honoMiddlewares/routeHandler"; export const handleGetReferralCode = createRoute({ - body: z.object({ - program_id: z.string(), - customer_id: z.string(), - }), + body: CreateReferralCodeParamsSchema, handler: async (c) => { const ctx = c.get("ctx"); const { db, org, env } = ctx; diff --git a/server/src/internal/api/rewards/handlers/referrals/handleRedeemReferral.ts b/server/src/internal/api/rewards/handlers/referrals/handleRedeemReferral.ts index 3afab20c1..cb8807e00 100644 --- a/server/src/internal/api/rewards/handlers/referrals/handleRedeemReferral.ts +++ b/server/src/internal/api/rewards/handlers/referrals/handleRedeemReferral.ts @@ -3,11 +3,11 @@ import { ErrCode, InternalError, RecaseError, + RedeemReferralCodeParamsSchema, RewardCategory, type RewardRedemption, RewardTriggerEvent, } from "@autumn/shared"; -import { z } from "zod/v4"; import { CusService } from "@/internal/customers/CusService.js"; import { RewardProgramService } from "@/internal/rewards/RewardProgramService.js"; import { RewardRedemptionService } from "@/internal/rewards/RewardRedemptionService.js"; @@ -19,10 +19,7 @@ import { generateId, notNullish } from "@/utils/genUtils.js"; import { createRoute } from "../../../../../honoMiddlewares/routeHandler"; export const handleRedeemReferral = createRoute({ - body: z.object({ - code: z.string(), - customer_id: z.string(), - }), + body: RedeemReferralCodeParamsSchema, handler: async (c) => { const ctx = c.get("ctx"); const { db, org, env } = ctx; diff --git a/server/src/internal/api/rewards/referralRouter.ts b/server/src/internal/api/rewards/referralRouter.ts index 49e863e5f..a989d8934 100644 --- a/server/src/internal/api/rewards/referralRouter.ts +++ b/server/src/internal/api/rewards/referralRouter.ts @@ -11,3 +11,7 @@ redemptionRouter.get("/:redemption_id", ...handleGetRedemption); export const referralRouter = new Hono(); referralRouter.post("/code", ...handleGetReferralCode); referralRouter.post("/redeem", ...handleRedeemReferral); + +export const referralRpcRouter = new Hono(); +referralRpcRouter.post("referrals.create_code", ...handleGetReferralCode); +referralRpcRouter.post("referrals.redeem_code", ...handleRedeemReferral); diff --git a/server/src/internal/balances/handlers/handleUpdateBalance.ts b/server/src/internal/balances/handlers/handleUpdateBalance.ts index 74b24b2b1..309c5681e 100644 --- a/server/src/internal/balances/handlers/handleUpdateBalance.ts +++ b/server/src/internal/balances/handlers/handleUpdateBalance.ts @@ -3,7 +3,7 @@ import { notNullish, nullish, RecaseError, - UpdateBalanceParamsSchema, + UpdateBalanceParamsV0Schema, } from "@autumn/shared"; import { StatusCodes } from "http-status-codes"; import { createRoute } from "@/honoMiddlewares/routeHandler"; @@ -15,16 +15,14 @@ import { CusEntService } from "@/internal/customers/cusProducts/cusEnts/CusEntit import { deleteCachedApiCustomer } from "@/internal/customers/cusUtils/apiCusCacheUtils/deleteCachedApiCustomer"; export const handleUpdateBalance = createRoute({ - body: UpdateBalanceParamsSchema.extend({}), + body: UpdateBalanceParamsV0Schema.extend({}), handler: async (c) => { const params = c.req.valid("json"); const ctx = c.get("ctx"); - if ( - notNullish(params.add_to_balance) || - notNullish(params.current_balance) - ) { + const targetBalance = params.remaining ?? params.current_balance; + if (notNullish(params.add_to_balance) || notNullish(targetBalance)) { await runUpdateBalanceV2({ ctx, params }); } diff --git a/server/src/internal/balances/updateBalance/runUpdateBalanceV2.ts b/server/src/internal/balances/updateBalance/runUpdateBalanceV2.ts index 4f540e42a..25f4fa108 100644 --- a/server/src/internal/balances/updateBalance/runUpdateBalanceV2.ts +++ b/server/src/internal/balances/updateBalance/runUpdateBalanceV2.ts @@ -1,7 +1,7 @@ import { FeatureNotFoundError, notNullish, - type UpdateBalanceParams, + type UpdateBalanceParamsV0, } from "@autumn/shared"; import type { AutumnContext } from "@/honoUtils/HonoEnv.js"; import { getOrCreateCachedFullCustomer } from "@/internal/customers/cusUtils/fullCustomerCacheUtils/getOrCreateCachedFullCustomer.js"; @@ -23,14 +23,12 @@ export const runUpdateBalanceV2 = async ({ params, }: { ctx: AutumnContext; - params: UpdateBalanceParams; + params: UpdateBalanceParamsV0; }) => { const { features } = ctx; - const { - feature_id: featureId, - current_balance: targetBalance, - add_to_balance: addToBalance, - } = params; + const { feature_id: featureId, add_to_balance: addToBalance } = params; + + const targetBalance = params.remaining ?? params.current_balance; // Look up feature const feature = features.find((f) => f.id === featureId); diff --git a/server/src/internal/balances/utils/buildCustomerEntitlementFilters.ts b/server/src/internal/balances/utils/buildCustomerEntitlementFilters.ts index 720b67f79..56104be26 100644 --- a/server/src/internal/balances/utils/buildCustomerEntitlementFilters.ts +++ b/server/src/internal/balances/utils/buildCustomerEntitlementFilters.ts @@ -1,13 +1,13 @@ import { type CustomerEntitlementFilters, resetIntvToEntIntv, - type UpdateBalanceParams, + type UpdateBalanceParamsV0, } from "@autumn/shared"; export const buildCustomerEntitlementFilters = ({ params, }: { - params: UpdateBalanceParams; + params: UpdateBalanceParamsV0; }): CustomerEntitlementFilters | undefined => { const { customer_entitlement_id: cusEntId, interval } = params; diff --git a/server/src/internal/billing/billingRouter.ts b/server/src/internal/billing/billingRouter.ts index 00875b4ce..bc6e83bb4 100644 --- a/server/src/internal/billing/billingRouter.ts +++ b/server/src/internal/billing/billingRouter.ts @@ -2,6 +2,7 @@ import { Hono } from "hono"; import { handlePreviewAttach } from "@/internal/billing/v2/handlers/handlePreviewAttach.js"; import { handleAttachPreview } from "@/internal/customers/attach/handleAttachPreview/handleAttachPreview.js"; import { handleCancelV2 } from "@/internal/customers/cancel/handleCancelV2.js"; +import { handleOpenCustomerPortalV2 } from "@/internal/customers/handlers/handleBillingPortal/handleOpenCustomerPortalV2.js"; import type { HonoEnv } from "../../honoUtils/HonoEnv.js"; import { handleAttach } from "./attach/handleAttach.js"; import { handleCheckoutV2 } from "./checkout/handleCheckoutV2.js"; @@ -37,3 +38,7 @@ billingRpcRouter.post( ); billingRpcRouter.post("/billing.attach", ...handleAttachV2); billingRpcRouter.post("/billing.preview_attach", ...handlePreviewAttach); +billingRpcRouter.post( + "/billing.open_customer_portal", + ...handleOpenCustomerPortalV2, +); diff --git a/server/src/internal/customers/cusUtils/getOrCreateCustomer.ts b/server/src/internal/customers/cusUtils/getOrCreateCustomer.ts index 35ea44ac9..eb4a5edf1 100644 --- a/server/src/internal/customers/cusUtils/getOrCreateCustomer.ts +++ b/server/src/internal/customers/cusUtils/getOrCreateCustomer.ts @@ -2,6 +2,7 @@ import { CusProductStatus, type CustomerData, CustomerExpand, + CustomerNotFoundError, type Entity, type EntityData, type FullCustomer, @@ -29,6 +30,7 @@ export const getOrCreateCustomer = async ({ entityId, entityData, skipUpdate = false, + skipCreate = false, }: { ctx: AutumnContext; customerId: string | null; @@ -40,6 +42,7 @@ export const getOrCreateCustomer = async ({ entityId?: string; entityData?: EntityData; skipUpdate?: boolean; + skipCreate?: boolean; }): Promise => { let customer: FullCustomer | undefined; @@ -65,6 +68,10 @@ export const getOrCreateCustomer = async ({ } if (!customer) { + if (skipCreate) { + throw new CustomerNotFoundError({ customerId: customerId || "" }); + } + customer = await customerActions.createWithDefaults({ ctx, customerId, diff --git a/server/src/internal/customers/handlers/handleBillingPortal/handleOpenCustomerPortalV2.ts b/server/src/internal/customers/handlers/handleBillingPortal/handleOpenCustomerPortalV2.ts new file mode 100644 index 000000000..dffee2285 --- /dev/null +++ b/server/src/internal/customers/handlers/handleBillingPortal/handleOpenCustomerPortalV2.ts @@ -0,0 +1,44 @@ +import { + CustomerNotFoundError, + OpenCustomerPortalParamsV1Schema, +} from "@autumn/shared"; +import { createRoute } from "../../../../honoMiddlewares/routeHandler"; +import { CusService } from "../../CusService"; +import { createBillingPortalSession } from "./createBillingPortalSession"; + +export const handleOpenCustomerPortalV2 = createRoute({ + body: OpenCustomerPortalParamsV1Schema, + handler: async (c) => { + const ctx = c.get("ctx"); + const { db, org, env } = ctx; + + const { + customer_id: customerId, + configuration_id: configurationId, + return_url: returnUrl, + } = c.req.valid("json"); + + const customer = await CusService.get({ + db, + idOrInternalId: customerId, + orgId: org.id, + env, + }); + + if (!customer) { + throw new CustomerNotFoundError({ customerId }); + } + + const session = await createBillingPortalSession({ + ctx, + customer, + returnUrl, + configurationId, + }); + + return c.json({ + customer_id: customer.id || null, + url: session.url, + }); + }, +}); diff --git a/server/src/internal/entities/handlers/handleCreateEntity/handleCreateEntity2.ts b/server/src/internal/entities/actions/batchCreateEntities.ts similarity index 52% rename from server/src/internal/entities/handlers/handleCreateEntity/handleCreateEntity2.ts rename to server/src/internal/entities/actions/batchCreateEntities.ts index c4313436e..82de9acf2 100644 --- a/server/src/internal/entities/handlers/handleCreateEntity/handleCreateEntity2.ts +++ b/server/src/internal/entities/actions/batchCreateEntities.ts @@ -1,25 +1,18 @@ import { - ApiVersion, type CreateEntityParams, - CreateEntityParamsSchema, - CreateEntityQuerySchema, type CustomerData, type Entity, findFeatureById, - notNullish, } from "@autumn/shared"; -import { z } from "zod/v4"; -import { createRoute } from "../../../../honoMiddlewares/routeHandler.js"; -import type { AutumnContext } from "../../../../honoUtils/HonoEnv.js"; -import { EntityService } from "../../../api/entities/EntityService.js"; -import { getApiEntity } from "../../entityUtils/apiEntityUtils/getApiEntity.js"; -import { constructEntity } from "../../entityUtils/entityUtils.js"; -import { createEntityForCusProduct } from "./createEntityForCusProduct.js"; -import { validateAndGetInputEntities } from "./getInputEntities.js"; +import type { AutumnContext } from "@/honoUtils/HonoEnv"; +import { EntityService } from "@/internal/api/entities/EntityService"; +import { getApiEntity } from "../entityUtils/apiEntityUtils/getApiEntity"; +import { constructEntity } from "../entityUtils/entityUtils"; +import { createEntityForCusProduct } from "../handlers/handleCreateEntity/createEntityForCusProduct"; +import { validateAndGetInputEntities } from "../handlers/handleCreateEntity/getInputEntities"; -const createEntities = async ({ +export const batchCreateEntities = async ({ ctx, - logger, customerId, customerData, createEntityData, @@ -27,7 +20,6 @@ const createEntities = async ({ }: { ctx: AutumnContext; customerData?: CustomerData; - logger: any; customerId: string; createEntityData: CreateEntityParams[] | CreateEntityParams; withAutumnId?: boolean; @@ -114,45 +106,3 @@ const createEntities = async ({ return apiEntities; }; - -export const handleCreateEntity = createRoute({ - query: CreateEntityQuerySchema, - body: CreateEntityParamsSchema.or(z.array(CreateEntityParamsSchema)), - handler: async (c) => { - const ctx = c.get("ctx"); - const body = c.req.valid("json"); - - // Skip cache for entity creation - ctx.skipCache = true; - - const { customer_id } = c.req.param(); - const { with_autumn_id } = c.req.valid("query"); - - let customerData: CustomerData | undefined; - if (Array.isArray(body)) { - customerData = body.filter((b) => notNullish(b.customer_data))?.[0] - ?.customer_data; - } else { - customerData = body.customer_data; - } - - const apiEntities = await createEntities({ - ctx, - customerId: customer_id, - createEntityData: body, - logger: ctx.logger, - customerData, - withAutumnId: with_autumn_id, - }); - - if (ctx.apiVersion.gte(ApiVersion.V1_2)) { - if (Array.isArray(body) && body.length > 1) { - return c.json({ list: apiEntities }); - } else { - return c.json(apiEntities[0]); - } - } else { - return c.json({ success: true }); - } - }, -}); diff --git a/server/src/internal/entities/actions/deleteEntity.ts b/server/src/internal/entities/actions/deleteEntity.ts new file mode 100644 index 000000000..d4d4b7c9e --- /dev/null +++ b/server/src/internal/entities/actions/deleteEntity.ts @@ -0,0 +1,150 @@ +import { + type EntityBalance, + EntityNotFoundError, + findCustomerEntitlementByFeature, + findFeatureById, +} from "@autumn/shared"; +import type { AutumnContext } from "@/honoUtils/HonoEnv"; +import { EntityService } from "@/internal/api/entities/EntityService"; +import { adjustAllowance } from "@/internal/balances/utils/paidAllocatedFeature/adjustAllowance"; +import { CusService } from "@/internal/customers/CusService"; +import { CusEntService } from "@/internal/customers/cusProducts/cusEnts/CusEntitlementService"; +import { findLinkedCusEnts } from "@/internal/customers/cusProducts/cusEnts/cusEntUtils/findCusEntUtils"; +import { + deleteEntityFromCusEnt, + replaceEntityInCusEnt, +} from "@/internal/customers/cusProducts/cusEnts/cusEntUtils/linkedCusEntUtils"; +import { RepService } from "@/internal/customers/cusProducts/cusEnts/RepService"; +import { cancelSubsForEntity } from "../handlers/handleDeleteEntity/cancelSubsForEntity"; + +export const deleteEntity = async ({ + ctx, + params, +}: { + ctx: AutumnContext; + params: { + customer_id: string; + entity_id: string; + }; +}) => { + const { customer_id: customerId, entity_id: entityId } = params; + + const { db, org, env, features, logger } = ctx; + + const fullCus = await CusService.getFull({ + db, + idOrInternalId: customerId, + orgId: org.id, + env, + withEntities: true, + }); + + const existingEntities = fullCus.entities; + const cusProducts = fullCus.customer_products; + const entity = existingEntities.find((e) => e.id === entityId); + + if (!entity) { + throw new EntityNotFoundError({ entityId: entityId }); + } + + const feature = findFeatureById({ + features, + featureId: entity.feature_id, + errorOnNotFound: true, + }); + + for (const cusProduct of cusProducts) { + const cusEnts = cusProduct.customer_entitlements; + + const mainCusEnt = findCustomerEntitlementByFeature({ + cusEnts, + feature: feature!, + }); + + if (!mainCusEnt) continue; + + const { newReplaceables } = await adjustAllowance({ + db, + env, + org, + cusPrices: cusProduct.customer_prices, + customer: fullCus, + affectedFeature: mainCusEnt.entitlement.feature, + cusEnt: { ...mainCusEnt, customer_product: cusProduct }, + originalBalance: mainCusEnt.balance!, + newBalance: mainCusEnt.balance! + 1, + logger, + }); + + const linkedCusEnts = findLinkedCusEnts({ + cusEnts: cusProduct.customer_entitlements, + feature: mainCusEnt.entitlement.feature, + }); + + const replaceable = + newReplaceables && newReplaceables.length > 0 ? newReplaceables[0] : null; + + if (replaceable) { + await RepService.update({ + db, + id: replaceable.id, + data: { + from_entity_id: entity.id, + }, + }); + } + + // Update linked cus ents with replaceables... + for (const linkedCusEnt of linkedCusEnts) { + let newEntities: { + [key: string]: EntityBalance; + }; + if (replaceable) { + const { newEntities: newEntities_ } = replaceEntityInCusEnt({ + cusEnt: linkedCusEnt, + entityId: entity.id, + replaceable, + }); + newEntities = newEntities_; + } else { + const { newEntities: newEntities_ } = deleteEntityFromCusEnt({ + cusEnt: linkedCusEnt, + entityId: entity.id, + }); + newEntities = newEntities_; + } + + await CusEntService.update({ + db, + id: linkedCusEnt.id, + updates: { + entities: newEntities, + }, + }); + } + + if (!replaceable) { + await CusEntService.increment({ + db, + id: mainCusEnt.id, + amount: 1, + }); + } + } + + // Cancel any subs + await cancelSubsForEntity({ + ctx, + cusProducts, + entity, + }); + + await EntityService.deleteInInternalIds({ + db, + internalIds: [entity.internal_id], + orgId: org.id, + env, + }); + + logger.info(` ✅ Finished deleting entity ${entityId}`); +}; diff --git a/server/src/internal/entities/actions/findCustomer.ts b/server/src/internal/entities/actions/findCustomer.ts new file mode 100644 index 000000000..77d438b59 --- /dev/null +++ b/server/src/internal/entities/actions/findCustomer.ts @@ -0,0 +1,33 @@ +import { ErrCode, InternalError, RecaseError } from "@autumn/shared"; +import type { AutumnContext } from "@/honoUtils/HonoEnv"; +import { EntityService } from "@/internal/api/entities/EntityService"; + +export const findCustomerForEntity = async ({ + ctx, + entityId, +}: { + ctx: AutumnContext; + entityId: string; +}) => { + const entities = await EntityService.listById({ + ctx, + id: entityId, + withCustomer: true, + }); + + if (entities.length > 1) { + throw new RecaseError({ + message: `Two entities with the ID ${entityId} found`, + code: ErrCode.EntityIdRequired, + statusCode: 400, + }); + } + + if (!entities[0].customer) { + throw new InternalError({ + message: `[findCustomerForEntity] entities[0].customer doesn't exist`, + }); + } + + return entities[0].customer; +}; diff --git a/server/src/internal/entities/actions/index.ts b/server/src/internal/entities/actions/index.ts new file mode 100644 index 000000000..b746e4502 --- /dev/null +++ b/server/src/internal/entities/actions/index.ts @@ -0,0 +1,7 @@ +import { batchCreateEntities } from "./batchCreateEntities"; +import { deleteEntity } from "./deleteEntity"; + +export const entityActions = { + batchCreate: batchCreateEntities, + delete: deleteEntity, +} as const; diff --git a/server/src/internal/entities/entityRouter.ts b/server/src/internal/entities/entityRouter.ts index eae21cdca..b4aca4757 100644 --- a/server/src/internal/entities/entityRouter.ts +++ b/server/src/internal/entities/entityRouter.ts @@ -1,8 +1,11 @@ import { Hono } from "hono"; import type { HonoEnv } from "../../honoUtils/HonoEnv.js"; -import { handleCreateEntity } from "./handlers/handleCreateEntity/handleCreateEntity2.js"; +import { handleCreateEntity } from "./handlers/handleCreateEntity/handleCreateEntity.js"; +import { handleCreateEntityV2 } from "./handlers/handleCreateEntity/handleCreateEntityV2.js"; import { handleDeleteEntity } from "./handlers/handleDeleteEntity/handleDeleteEntity.js"; -import { handleGetEntity } from "./handlers/handleGetEntity.js"; +import { handleDeleteEntityV2 } from "./handlers/handleDeleteEntity/handleDeleteEntityV2.js"; +import { handleGetEntity } from "./handlers/handleGetEntity/handleGetEntity.js"; +import { handleGetEntityV2 } from "./handlers/handleGetEntity/handleGetEntityV2.js"; import { handleListEntities } from "./handlers/handleListEntities.js"; export const entityRouter = new Hono(); @@ -22,3 +25,8 @@ entityRouter.delete( entityRouter.get("/customers/:customer_id/entities", ...handleListEntities); // entityRouter.post("", ...handlePostEntityRequest); // entityRouter.delete("/:entity_id", ...handleDeleteEntity); + +export const entityRpcRouter = new Hono(); +entityRpcRouter.post("/entities.create", ...handleCreateEntityV2); +entityRpcRouter.post("/entities.get", ...handleGetEntityV2); +entityRpcRouter.post("/entities.delete", ...handleDeleteEntityV2); diff --git a/server/src/internal/entities/handlers/handleCreateEntity/handleCreateEntity.ts b/server/src/internal/entities/handlers/handleCreateEntity/handleCreateEntity.ts new file mode 100644 index 000000000..62198326b --- /dev/null +++ b/server/src/internal/entities/handlers/handleCreateEntity/handleCreateEntity.ts @@ -0,0 +1,51 @@ +import { + ApiVersion, + CreateEntityParamsV0Schema, + CreateEntityQuerySchema, + type CustomerData, + notNullish, +} from "@autumn/shared"; +import { z } from "zod/v4"; +import { createRoute } from "../../../../honoMiddlewares/routeHandler.js"; +import { entityActions } from "../../actions/index.js"; + +export const handleCreateEntity = createRoute({ + query: CreateEntityQuerySchema, + body: CreateEntityParamsV0Schema.or(z.array(CreateEntityParamsV0Schema)), + handler: async (c) => { + const ctx = c.get("ctx"); + const body = c.req.valid("json"); + + // Skip cache for entity creation + ctx.skipCache = true; + + const { customer_id } = c.req.param(); + const { with_autumn_id } = c.req.valid("query"); + + let customerData: CustomerData | undefined; + if (Array.isArray(body)) { + customerData = body.filter((b) => notNullish(b.customer_data))?.[0] + ?.customer_data; + } else { + customerData = body.customer_data; + } + + const apiEntities = await entityActions.batchCreate({ + ctx, + customerId: customer_id, + createEntityData: body, + customerData, + withAutumnId: with_autumn_id, + }); + + if (ctx.apiVersion.gte(ApiVersion.V1_2)) { + if (Array.isArray(body) && body.length > 1) { + return c.json({ list: apiEntities }); + } else { + return c.json(apiEntities[0]); + } + } else { + return c.json({ success: true }); + } + }, +}); diff --git a/server/src/internal/entities/handlers/handleCreateEntity/handleCreateEntityV2.ts b/server/src/internal/entities/handlers/handleCreateEntity/handleCreateEntityV2.ts new file mode 100644 index 000000000..db118b386 --- /dev/null +++ b/server/src/internal/entities/handlers/handleCreateEntity/handleCreateEntityV2.ts @@ -0,0 +1,31 @@ +import { CreateEntityParamsV1Schema } from "@autumn/shared"; +import { createRoute } from "../../../../honoMiddlewares/routeHandler.js"; +import { entityActions } from "../../actions/index.js"; + +export const handleCreateEntityV2 = createRoute({ + body: CreateEntityParamsV1Schema, + handler: async (c) => { + const ctx = c.get("ctx"); + const body = c.req.valid("json"); + + // Skip cache for entity creation + ctx.skipCache = true; + + const { customer_id, customer_data } = body; + + const apiEntities = await entityActions.batchCreate({ + ctx, + customerId: customer_id, + createEntityData: [ + { + id: body.entity_id, + name: body.name, + feature_id: body.feature_id, + }, + ], + customerData: customer_data, + }); + + return c.json(apiEntities[0]); + }, +}); diff --git a/server/src/internal/entities/handlers/handleDeleteEntity/handleDeleteEntityV2.ts b/server/src/internal/entities/handlers/handleDeleteEntity/handleDeleteEntityV2.ts new file mode 100644 index 000000000..ca411fbe9 --- /dev/null +++ b/server/src/internal/entities/handlers/handleDeleteEntity/handleDeleteEntityV2.ts @@ -0,0 +1,39 @@ +import { + CustomerNotFoundError, + DeleteEntityParamsV0Schema, +} from "@autumn/shared"; +import { createRoute } from "../../../../honoMiddlewares/routeHandler.js"; +import { findCustomerForEntity } from "../../actions/findCustomer.js"; +import { entityActions } from "../../actions/index.js"; + +export const handleDeleteEntityV2 = createRoute({ + body: DeleteEntityParamsV0Schema, + handler: async (c) => { + const ctx = c.get("ctx"); + const body = c.req.valid("json"); + + let customerId = body.customer_id; + if (!customerId) { + const customer = await findCustomerForEntity({ + ctx, + entityId: body.entity_id, + }); + + customerId = customer?.id ?? undefined; + } + + if (!customerId) { + throw new CustomerNotFoundError({ customerId: customerId ?? "" }); + } + + await entityActions.delete({ + ctx, + params: { + customer_id: customerId, + entity_id: body.entity_id, + }, + }); + + return c.json({ success: true }); + }, +}); diff --git a/server/src/internal/entities/handlers/handleGetEntity.ts b/server/src/internal/entities/handlers/handleGetEntity/handleGetEntity.ts similarity index 80% rename from server/src/internal/entities/handlers/handleGetEntity.ts rename to server/src/internal/entities/handlers/handleGetEntity/handleGetEntity.ts index fe5a95fd5..2149144e5 100644 --- a/server/src/internal/entities/handlers/handleGetEntity.ts +++ b/server/src/internal/entities/handlers/handleGetEntity/handleGetEntity.ts @@ -3,8 +3,8 @@ import { ApiVersion, GetEntityQuerySchema, } from "@autumn/shared"; -import { createRoute } from "../../../honoMiddlewares/routeHandler.js"; -import { getApiEntity } from "../entityUtils/apiEntityUtils/getApiEntity.js"; +import { createRoute } from "@/honoMiddlewares/routeHandler.js"; +import { getApiEntity } from "../../entityUtils/apiEntityUtils/getApiEntity.js"; export const handleGetEntity = createRoute({ versionedQuery: { diff --git a/server/src/internal/entities/handlers/handleGetEntity/handleGetEntityV2.ts b/server/src/internal/entities/handlers/handleGetEntity/handleGetEntityV2.ts new file mode 100644 index 000000000..291d37eff --- /dev/null +++ b/server/src/internal/entities/handlers/handleGetEntity/handleGetEntityV2.ts @@ -0,0 +1,42 @@ +import { + AffectedResource, + GetEntityParamsV0Schema, + InternalError, +} from "@autumn/shared"; +import { createRoute } from "@/honoMiddlewares/routeHandler.js"; +import { findCustomerForEntity } from "../../actions/findCustomer.js"; +import { getApiEntity } from "../../entityUtils/apiEntityUtils/getApiEntity.js"; + +export const handleGetEntityV2 = createRoute({ + body: GetEntityParamsV0Schema, + resource: AffectedResource.Entity, + handler: async (c) => { + const ctx = c.get("ctx"); + const body = c.req.valid("json"); + let { customer_id: customerId, entity_id: entityId } = body; + + // 1. Entity -> Customer ID + if (!customerId) { + const customer = await findCustomerForEntity({ + ctx, + entityId: entityId, + }); + + if (!customer?.id) { + throw new InternalError({ + message: `Customer not found for entity ${entityId}`, + }); + } + + customerId = customer.id; + } + + const apiEntity = await getApiEntity({ + ctx, + customerId: customerId, + entityId: entityId, + }); + + return c.json(apiEntity); + }, +}); diff --git a/server/src/internal/events/eventsRouter.ts b/server/src/internal/events/eventsRouter.ts index 2c60d964a..a103b3fcc 100644 --- a/server/src/internal/events/eventsRouter.ts +++ b/server/src/internal/events/eventsRouter.ts @@ -7,3 +7,7 @@ export const eventsRouter = new Hono(); eventsRouter.post("aggregate", ...handleExternalAggregateEvents); eventsRouter.post("list", ...handleExternalListEvents); + +export const eventsRpcRouter = new Hono(); +eventsRpcRouter.post("events.aggregate", ...handleExternalAggregateEvents); +eventsRpcRouter.post("events.list", ...handleExternalListEvents); diff --git a/server/src/internal/events/handlers/handleExternalAggregateEvents.ts b/server/src/internal/events/handlers/handleExternalAggregateEvents.ts index 8462c25a3..534e080fa 100644 --- a/server/src/internal/events/handlers/handleExternalAggregateEvents.ts +++ b/server/src/internal/events/handlers/handleExternalAggregateEvents.ts @@ -1,5 +1,7 @@ import type { AggregatedEventRow, ProcessedEventRow } from "@autumn/shared"; import { + AffectedResource, + applyResponseVersionChanges, CustomerNotFoundError, ErrCode, EventsAggregateParamsSchema, @@ -106,9 +108,49 @@ export const handleExternalAggregateEvents = createRoute({ usageList = Array.from(grouped.values()) as AggregatedEventRow[]; } - return c.json({ - list: usageList, + let v1List: { + period: number; + values: Record; + grouped_values?: Record>; + }[]; + + if (group_by) { + v1List = usageList.map(({ period, ...groupedValues }) => { + const values: Record = {}; + const grouped_values: Record> = {}; + + for (const [featureName, featureData] of Object.entries( + groupedValues, + )) { + if (typeof featureData === "object" && featureData !== null) { + grouped_values[featureName] = featureData as Record; + values[featureName] = Object.values( + featureData as Record, + ).reduce((sum, v) => sum + v, 0); + } + } + + return { period, values, grouped_values }; + }); + } else { + v1List = usageList.map(({ period, ...values }) => ({ + period, + values: values as Record, + })); + } + + const v1Response = { + list: v1List, total, + }; + + const versionedResponse = applyResponseVersionChanges({ + input: v1Response, + targetVersion: ctx.apiVersion, + resource: AffectedResource.EventsAggregate, + ctx, }); + + return c.json(versionedResponse); }, }); diff --git a/server/src/routers/rpcRouter.ts b/server/src/routers/rpcRouter.ts index 9a649c59f..3ab2228b4 100644 --- a/server/src/routers/rpcRouter.ts +++ b/server/src/routers/rpcRouter.ts @@ -1,7 +1,10 @@ import { Hono } from "hono"; import { responseFilterMiddleware } from "@/honoMiddlewares/responseFilter/responseFilterMiddleware.js"; +import { referralRpcRouter } from "@/internal/api/rewards/referralRouter.js"; import { balancesRpcRouter } from "@/internal/balances/balancesRouter.js"; import { billingRpcRouter } from "@/internal/billing/billingRouter.js"; +import { entityRpcRouter } from "@/internal/entities/entityRouter.js"; +import { eventsRpcRouter } from "@/internal/events/eventsRouter.js"; import { plansRpcRouter } from "@/internal/products/productRouter.js"; import { analyticsMiddleware } from "../honoMiddlewares/analyticsMiddleware.js"; import { apiVersionMiddleware } from "../honoMiddlewares/apiVersionMiddleware.js"; @@ -32,3 +35,6 @@ rpcRouter.route("", customerRpcRouter); rpcRouter.route("", plansRpcRouter); rpcRouter.route("", billingRpcRouter); rpcRouter.route("", balancesRpcRouter); +rpcRouter.route("", eventsRpcRouter); +rpcRouter.route("", referralRpcRouter); +rpcRouter.route("", entityRpcRouter); diff --git a/shared/api/balances/balancesUpdateModels.ts b/shared/api/balances/balancesUpdateModels.ts deleted file mode 100644 index ba60c97d9..000000000 --- a/shared/api/balances/balancesUpdateModels.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { ResetInterval } from "@autumn/shared"; -import { z } from "zod/v4"; - -export const ExtBalancesUpdateParamsSchema = z.object({ - customer_id: z.string().meta({ - description: "The ID of the customer.", - }), - entity_id: z.string().optional().meta({ - description: - "The ID of the entity to update balance for (if using entity balances).", - }), - feature_id: z.string().meta({ - description: "The ID of the feature to update balance for.", - }), - current_balance: z.number().optional().meta({ - description: "The new balance value to set.", - }), - interval: z.enum(ResetInterval).optional().meta({ - description: "The interval to update balance for.", - }), -}); - -export const UpdateBalanceParamsSchema = ExtBalancesUpdateParamsSchema.extend({ - granted_balance: z.number().optional(), - usage: z.number().optional(), - customer_entitlement_id: z.string().optional(), - next_reset_at: z.number().optional(), - add_to_balance: z.number().optional(), -}).refine( - (data) => - !(data.add_to_balance !== undefined && data.current_balance !== undefined), - { message: "Cannot specify both add_to_balance and current_balance" }, -); - -export type UpdateBalanceParams = z.infer; - -// Legacy export for backwards compatibility -export const BalancesUpdateParamsSchema = UpdateBalanceParamsSchema; -export type BalancesUpdateParams = UpdateBalanceParams; diff --git a/shared/api/balances/check/checkFeaturePreview.ts b/shared/api/balances/check/checkFeaturePreview.ts index 5420e75e7..87fd00e86 100644 --- a/shared/api/balances/check/checkFeaturePreview.ts +++ b/shared/api/balances/check/checkFeaturePreview.ts @@ -3,10 +3,24 @@ import { z } from "zod/v4"; // Check Feature Preview Schemas export const CheckFeaturePreviewSchema = z.object({ - scenario: z.enum(["usage_limit", "feature_flag"]), - title: z.string(), - message: z.string(), - feature_id: z.string(), - feature_name: z.string(), - products: z.array(ApiProductSchema), + scenario: z.enum(["usage_limit", "feature_flag"]).meta({ + description: + "The reason access was denied. 'usage_limit' means the customer exceeded their balance, 'feature_flag' means the feature is not included in their plan.", + }), + title: z.string().meta({ + description: "A title suitable for displaying in a paywall or upgrade modal.", + }), + message: z.string().meta({ + description: "A message explaining why access was denied.", + }), + feature_id: z.string().meta({ + description: "The ID of the feature that was checked.", + }), + feature_name: z.string().meta({ + description: "The display name of the feature.", + }), + products: z.array(ApiProductSchema).meta({ + description: + "Products that would grant access to this feature. Use to display upgrade options.", + }), }); diff --git a/shared/api/balances/check/checkParams.ts b/shared/api/balances/check/checkParams.ts index 75d8b69b2..494622828 100644 --- a/shared/api/balances/check/checkParams.ts +++ b/shared/api/balances/check/checkParams.ts @@ -1,56 +1,35 @@ import { z } from "zod/v4"; +import { BalanceParamsBaseSchema } from "../common/balanceParamsBase"; import { CustomerDataSchema } from "../../common/customerData"; import { EntityDataSchema } from "../../common/entityData"; import { queryStringArray } from "../../common/queryHelpers"; import { CheckExpand } from "./enums/CheckExpand"; -const checkDescriptions = { - customer_id: "ID which you provided when creating the customer", - product_id: - "ID of the product to check access to. Required if feature_id is not provided.", - feature_id: "ID of the feature to check access to.", - required_balance: - "If you know the amount of the feature the end user is consuming in advance. If their balance is below this quantity, allowed will be false.", - send_event: - "If true, a usage event will be recorded together with checking access. The required_balance field will be used as the usage value.", - with_preview: - "If true, the response will include a preview object, which can be used to display information such as a paywall or upgrade confirmation.", - entity_id: - "If using entity balances (eg, seats), the entity ID to check access for.", - customer_data: - "Properties used if customer is automatically created. Will also update if the name or email is not already set.", -}; - export const CheckQuerySchema = z.object({ skip_cache: z.boolean().optional(), expand: queryStringArray(z.enum([CheckExpand.BalanceFeature])).optional(), }); // Check Feature Schemas -export const ExtCheckParamsSchema = z.object({ - customer_id: z.string().meta({ - description: checkDescriptions.customer_id, - }), - - feature_id: z.string().meta({ - description: checkDescriptions.feature_id, - }), - entity_id: z.string().optional().meta({ - description: checkDescriptions.entity_id, - }), - +export const ExtCheckParamsSchema = BalanceParamsBaseSchema.extend({ required_balance: z.number().optional().meta({ - description: checkDescriptions.required_balance, + description: + "Minimum balance required for access. Returns allowed: false if the customer's balance is below this value. Defaults to 1.", }), - properties: z.record(z.string(), z.any()).optional(), + properties: z.record(z.string(), z.any()).optional().meta({ + description: + "Additional properties to attach to the usage event if send_event is true.", + }), send_event: z.boolean().optional().meta({ - description: checkDescriptions.send_event, + description: + "If true, atomically records a usage event while checking access. The required_balance value is used as the usage amount. Combines check + track in one call.", }), with_preview: z.boolean().optional().meta({ - description: checkDescriptions.with_preview, + description: + "If true, includes upgrade/upsell information in the response when access is denied. Useful for displaying paywalls.", }), customer_data: CustomerDataSchema.optional().meta({ diff --git a/shared/api/balances/check/checkResponseV3.ts b/shared/api/balances/check/checkResponseV3.ts index 58f07bebc..3b43bff6b 100644 --- a/shared/api/balances/check/checkResponseV3.ts +++ b/shared/api/balances/check/checkResponseV3.ts @@ -7,14 +7,29 @@ import { CheckFeaturePreviewSchema } from "./checkFeaturePreview.js"; * This is the server's internal response format */ export const CheckResponseV3Schema = z.object({ - allowed: z.boolean(), - customer_id: z.string(), - entity_id: z.string().nullish(), - required_balance: z.number().optional(), + allowed: z.boolean().meta({ + description: + "Whether the customer is allowed to use the feature. True if they have sufficient balance or the feature is unlimited/boolean.", + }), + customer_id: z.string().meta({ + description: "The ID of the customer that was checked.", + }), + entity_id: z.string().nullish().meta({ + description: "The ID of the entity, if an entity-scoped check was performed.", + }), + required_balance: z.number().optional().meta({ + description: "The required balance that was checked against.", + }), - balance: ApiBalanceV1Schema.nullable(), + balance: ApiBalanceV1Schema.nullable().meta({ + description: + "The customer's balance for this feature. Null if the customer has no balance for this feature.", + }), - preview: CheckFeaturePreviewSchema.optional(), + preview: CheckFeaturePreviewSchema.optional().meta({ + description: + "Upgrade/upsell information when access is denied. Only present if with_preview was true and allowed is false.", + }), }); export type CheckResponseV3 = z.infer; diff --git a/shared/api/balances/common/balanceParamsBase.ts b/shared/api/balances/common/balanceParamsBase.ts new file mode 100644 index 000000000..f73d1b34f --- /dev/null +++ b/shared/api/balances/common/balanceParamsBase.ts @@ -0,0 +1,14 @@ +import { z } from "zod/v4"; + +export const BalanceParamsBaseSchema = z.object({ + customer_id: z.string().meta({ + description: "The ID of the customer.", + }), + feature_id: z.string().meta({ + description: "The ID of the feature.", + }), + entity_id: z.string().optional().meta({ + description: + "The ID of the entity for entity-scoped balances (e.g., per-seat limits).", + }), +}); diff --git a/shared/api/balances/create/createBalanceParams.ts b/shared/api/balances/create/createBalanceParams.ts index ecd9fdfb7..a8e21e4b3 100644 --- a/shared/api/balances/create/createBalanceParams.ts +++ b/shared/api/balances/create/createBalanceParams.ts @@ -1,42 +1,47 @@ import { FeatureSchema, FeatureType, ResetInterval } from "@autumn/shared"; import { z } from "zod/v4"; +import { BalanceParamsBaseSchema } from "../common/balanceParamsBase"; -const descriptions = { - feature_id: "The feature ID to create the balance for", - customer_id: "The customer ID to assign the balance to", - entity_id: "Entity ID for entity-scoped balances", - included: "The initial balance amount to grant", - unlimited: "Whether the balance is unlimited", - reset: "Reset configuration for the balance", - expires_at: "Unix timestamp (milliseconds) when the balance expires", -}; +export const ExtCreateBalanceParamsSchema = BalanceParamsBaseSchema.extend({ + included: z.number().optional().meta({ + description: + "The initial balance amount to grant. For metered features, this is the number of units the customer can use.", + }), -export const ExtCreateBalanceParamsSchema = z - .object({ - feature_id: z.string().describe(descriptions.feature_id), - customer_id: z.string().describe(descriptions.customer_id), - entity_id: z.string().optional().describe(descriptions.entity_id), - - included: z.number().optional().describe(descriptions.included), - - unlimited: z.boolean().optional().describe(descriptions.unlimited), - reset: z - .object({ - interval: z.enum(ResetInterval), - interval_count: z.number().optional(), - }) - .optional() - .describe(descriptions.reset), - expires_at: z.number().optional().describe(descriptions.expires_at), // Unix timestamp in milliseconds - }) - .refine((data) => { - if (data.entity_id && !data.customer_id) { - return false; - } else return true; - }); + unlimited: z.boolean().optional().meta({ + description: + "If true, the balance has unlimited usage. Cannot be combined with 'included'.", + }), + reset: z + .object({ + interval: z.enum(ResetInterval).meta({ + description: + "The interval at which the balance resets (e.g., 'month', 'day', 'year').", + }), + interval_count: z.number().optional().meta({ + description: + "Number of intervals between resets. Defaults to 1 (e.g., interval_count: 2 with interval: 'month' resets every 2 months).", + }), + }) + .optional() + .meta({ + description: + "Reset configuration for the balance. If not provided, the balance is a one-time grant that never resets.", + }), + expires_at: z.number().optional().meta({ + description: + "Unix timestamp (milliseconds) when the balance expires. Mutually exclusive with reset.", + }), +}).refine((data) => { + if (data.entity_id && !data.customer_id) { + return false; + } else return true; +}); export const CreateBalanceParamsV0Schema = ExtCreateBalanceParamsSchema.extend({ - granted_balance: z.number().optional(), + granted_balance: z.number().optional().meta({ + internal: true, + }), }); export const ValidateCreateBalanceParamsSchema = diff --git a/shared/api/balances/index.ts b/shared/api/balances/index.ts index e3f75584e..3f26a9c51 100644 --- a/shared/api/balances/index.ts +++ b/shared/api/balances/index.ts @@ -1 +1,2 @@ -export * from "./create/index.js"; +export * from "./create/index"; +export * from "./update/index"; diff --git a/shared/api/balances/track/trackParams.ts b/shared/api/balances/track/trackParams.ts index ac452208a..545a4648c 100644 --- a/shared/api/balances/track/trackParams.ts +++ b/shared/api/balances/track/trackParams.ts @@ -3,31 +3,7 @@ import { CustomerDataSchema } from "../../common/customerData"; import { EntityDataSchema } from "../../common/entityData"; import { queryStringArray } from "../../common/queryHelpers"; import { CheckExpand } from "../check/enums/CheckExpand"; - -const trackDescriptions = { - customer_id: "ID which you provided when creating the customer", - feature_id: - "ID of the feature to track usage for. Required if event_name is not provided. Use this for direct feature tracking.", - event_name: - "An [event name](/features/tracking-usage#using-event-names) can be used in place of feature_id. This can be used if multiple features are tracked in the same event.", - value: - "The amount of usage to record. Defaults to 1. Can be negative to increase the balance (e.g., when removing a seat).", - customer_data: - "Additional customer properties. These will be used to create or update the customer if they don't exist or their properties are not already set.", - properties: "Additional properties to attach to this usage event.", - timestamp: - "Unix timestamp in milliseconds when the event occurred. Defaults to current time if not provided.", - idempotency_key: - "Unique key to prevent duplicate event recording. Use this to safely retry requests without creating duplicate usage records.", - entity_id: - "If using [entity balances](/features/feature-entities) (eg, seats), the entity ID to track usage for.", - entity_data: - "Additional entity properties. These will be used to create the entity if it doesn't exist.", - overage_behavior: - "How to handle usage when balance is insufficient. 'cap' limits usage to available balance, 'reject' prevents the usage entirely.", - skip_event: - "If true, balance is deducted but the event is not persisted to the database. Used for performance testing only.", -}; +import { BalanceParamsBaseSchema } from "../common/balanceParamsBase"; export const TrackQuerySchema = z.object({ expand: queryStringArray(z.enum([CheckExpand.BalanceFeature])).optional(), @@ -35,68 +11,61 @@ export const TrackQuerySchema = z.object({ }); // Track Schemas -export const TrackParamsSchema = z - .object({ - customer_id: z.string().nonempty().meta({ - description: trackDescriptions.customer_id, - }), - feature_id: z.string().optional().meta({ - description: trackDescriptions.feature_id, - }), - event_name: z.string().nonempty().optional().meta({ - description: trackDescriptions.event_name, - }), - value: z.number().optional().meta({ - description: trackDescriptions.value, - }), - properties: z.record(z.string(), z.any()).optional().meta({ - description: trackDescriptions.properties, - }), +export const TrackParamsSchema = BalanceParamsBaseSchema.extend({ + feature_id: z.string().optional().meta({ + description: + "The ID of the feature to track usage for. Required if event_name is not provided.", + }), + event_name: z.string().nonempty().optional().meta({ + description: + "Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event.", + }), + value: z.number().optional().meta({ + description: + "The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat).", + }), + properties: z.record(z.string(), z.any()).optional().meta({ + description: "Additional properties to attach to this usage event.", + }), - idempotency_key: z.string().optional().meta({ - description: trackDescriptions.idempotency_key, - }), + idempotency_key: z.string().optional().meta({ + internal: true, + }), - entity_id: z.string().optional().meta({ - description: trackDescriptions.entity_id, - }), + timestamp: z.number().optional().meta({ + internal: true, + }), - timestamp: z.number().optional().meta({ - internal: true, - }), + overage_behavior: z.enum(["cap", "reject"]).optional().meta({ + internal: true, + }), - overage_behavior: z.enum(["cap", "reject"]).optional().meta({ - internal: true, - }), + customer_data: CustomerDataSchema.optional().meta({ + internal: true, + }), + entity_data: EntityDataSchema.optional().meta({ + internal: true, + }), - customer_data: CustomerDataSchema.optional().meta({ - description: trackDescriptions.customer_data, - internal: true, - }), - entity_data: EntityDataSchema.optional().meta({ - internal: true, - }), + skip_event: z.boolean().optional().meta({ + internal: true, + }), +}).refine( + (data) => { + if (data.feature_id && data.event_name) { + return false; + } - skip_event: z.boolean().optional().meta({ - internal: true, - }), - }) - .refine( - (data) => { - if (data.feature_id && data.event_name) { - return false; - } + if (!data.feature_id && !data.event_name) { + return false; + } - if (!data.feature_id && !data.event_name) { - return false; - } - - return true; - }, - { - message: "Either feature_id or event_name must be provided", - }, - ); + return true; + }, + { + message: "Either feature_id or event_name must be provided", + }, +); export type TrackParams = z.infer; export type TrackQuery = z.infer; diff --git a/shared/api/balances/track/trackResponseV3.ts b/shared/api/balances/track/trackResponseV3.ts index aff112cbc..2ff4161ff 100644 --- a/shared/api/balances/track/trackResponseV3.ts +++ b/shared/api/balances/track/trackResponseV3.ts @@ -7,18 +7,26 @@ import { ApiBalanceV1Schema } from "../../customers/cusFeatures/apiBalanceV1.js" */ export const TrackResponseV3Schema = z.object({ customer_id: z.string().meta({ - description: "The ID of the customer", + description: "The ID of the customer whose usage was tracked.", }), entity_id: z.string().optional().meta({ - description: "The ID of the entity (if provided)", + description: "The ID of the entity, if entity-scoped tracking was performed.", }), event_name: z.string().optional().meta({ - description: "The name of the event", + description: "The event name that was tracked, if event_name was used instead of feature_id.", }), - value: z.number(), - balance: ApiBalanceV1Schema.nullable(), - balances: z.record(z.string(), ApiBalanceV1Schema).optional(), + value: z.number().meta({ + description: "The amount of usage that was recorded.", + }), + balance: ApiBalanceV1Schema.nullable().meta({ + description: + "The updated balance for the tracked feature. Null if tracking by event_name that affects multiple features.", + }), + balances: z.record(z.string(), ApiBalanceV1Schema).optional().meta({ + description: + "Map of feature_id to updated balance when tracking by event_name affects multiple features.", + }), }); export type TrackResponseV3 = z.infer; diff --git a/shared/api/balances/update/index.ts b/shared/api/balances/update/index.ts new file mode 100644 index 000000000..00aebc7e8 --- /dev/null +++ b/shared/api/balances/update/index.ts @@ -0,0 +1 @@ +export * from "./updateBalanceParams"; diff --git a/shared/api/balances/update/updateBalanceParams.ts b/shared/api/balances/update/updateBalanceParams.ts new file mode 100644 index 000000000..bc7e994f5 --- /dev/null +++ b/shared/api/balances/update/updateBalanceParams.ts @@ -0,0 +1,41 @@ +import { ResetInterval } from "@autumn/shared"; +import { z } from "zod/v4"; +import { BalanceParamsBaseSchema } from "../common/balanceParamsBase"; + +export const ExtUpdateBalanceParamsV0Schema = BalanceParamsBaseSchema.extend({ + remaining: z.number().optional().meta({ + description: + "Set the remaining balance to this exact value. Cannot be combined with add_to_balance.", + }), + add_to_balance: z.number().optional().meta({ + description: + "Add this amount to the current balance. Use negative values to subtract. Cannot be combined with current_balance.", + }), + interval: z.enum(ResetInterval).optional().meta({ + description: + "Target a specific balance by its reset interval. Use when the customer has multiple balances for the same feature with different reset intervals.", + }), +}); + +export const UpdateBalanceParamsV0Schema = + ExtUpdateBalanceParamsV0Schema.extend({ + current_balance: z.number().optional().meta({ + internal: true, + }), + + granted_balance: z.number().optional().meta({ internal: true }), + usage: z.number().optional().meta({ internal: true }), + customer_entitlement_id: z.string().optional().meta({ internal: true }), + next_reset_at: z.number().optional().meta({ internal: true }), + }).refine( + (data) => { + const targetBalance = data.remaining ?? data.current_balance; + + return !( + data.add_to_balance !== undefined && targetBalance !== undefined + ); + }, + { message: "Cannot specify both add_to_balance and remaining" }, + ); + +export type UpdateBalanceParamsV0 = z.infer; diff --git a/shared/api/billing/attachV2/attachDiscount.ts b/shared/api/billing/attachV2/attachDiscount.ts index 6b604f584..e888cc112 100644 --- a/shared/api/billing/attachV2/attachDiscount.ts +++ b/shared/api/billing/attachV2/attachDiscount.ts @@ -1,8 +1,21 @@ import { z } from "zod/v4"; -export const AttachDiscountSchema = z.union([ - z.object({ reward_id: z.string() }), - z.object({ promotion_code: z.string() }), -]); +export const AttachDiscountSchema = z + .union([ + z.object({ + reward_id: z.string().meta({ + description: "The ID of the reward to apply as a discount.", + }), + }), + z.object({ + promotion_code: z.string().meta({ + description: "The promotion code to apply as a discount.", + }), + }), + ]) + .meta({ + description: + "A discount to apply. Can be either a reward ID or a promotion code.", + }); export type AttachDiscount = z.infer; diff --git a/shared/api/billing/attachV2/attachParamsV1.ts b/shared/api/billing/attachV2/attachParamsV1.ts index 9ee6be65a..f57927fa3 100644 --- a/shared/api/billing/attachV2/attachParamsV1.ts +++ b/shared/api/billing/attachV2/attachParamsV1.ts @@ -1,28 +1,33 @@ import { BillingParamsBaseV1Schema } from "@api/billing/common/billingParamsBase/billingParamsBaseV1"; import { z } from "zod/v4"; import { PlanTimingSchema } from "../../../models/billingModels/context/attachBillingContext"; -import { BillingBehaviorSchema } from "../common/billingBehavior"; -import { InvoiceModeParamsSchema } from "../common/invoiceModeParams"; import { RedirectModeSchema } from "../common/redirectMode"; import { AttachDiscountSchema } from "./attachDiscount"; export const AttachParamsV1Schema = BillingParamsBaseV1Schema.extend({ - // Product identification - plan_id: z.string(), + discounts: z.array(AttachDiscountSchema).optional().meta({ + description: + "List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.", + }), - // Invoice mode - // invoice: z.boolean().optional(), - // enable_product_immediately: z.boolean().optional(), - // finalize_invoice: z.boolean().optional(), - invoice_mode: InvoiceModeParamsSchema.optional(), + success_url: z.string().optional().meta({ + description: "URL to redirect to after successful checkout.", + }), - // Checkout behavior - discounts: z.array(AttachDiscountSchema).optional(), - redirect_mode: RedirectModeSchema.default("always"), - success_url: z.string().optional(), - new_billing_subscription: z.boolean().optional(), - plan_schedule: PlanTimingSchema.optional(), - billing_behavior: BillingBehaviorSchema.optional(), + redirect_mode: RedirectModeSchema.default("always").meta({ + internal: true, + description: + "Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects.", + }), + + new_billing_subscription: z.boolean().optional().meta({ + description: + "Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.", + }), + plan_schedule: PlanTimingSchema.optional().meta({ + description: + "When the plan change should take effect. 'immediate' applies now, 'end_of_cycle' schedules for the end of the current billing cycle. By default, upgrades are immediate and downgrades are scheduled.", + }), }); export type AttachParamsV1 = z.infer; diff --git a/shared/api/billing/common/attachPreviewResponse.ts b/shared/api/billing/common/attachPreviewResponse.ts index acb1c64f5..c5acf09fb 100644 --- a/shared/api/billing/common/attachPreviewResponse.ts +++ b/shared/api/billing/common/attachPreviewResponse.ts @@ -1,15 +1,20 @@ import { z } from "zod/v4"; import { CheckoutChangeSchema } from "../../../internal/checkout/checkoutResponses.js"; import { CheckoutModeSchema } from "../../../models/billingModels/context/attachBillingContext.js"; -import { BillingPreviewResponseSchema } from "./billingPreviewResponse.js"; +import { + BillingPreviewResponseSchema, + ExtBillingPreviewResponseSchema, +} from "./billingPreviewResponse.js"; + +export const ExtAttachPreviewResponseSchema = ExtBillingPreviewResponseSchema; -/** - * Attach preview response - extends BillingPreviewResponse with incoming/outgoing changes - */ export const AttachPreviewResponseSchema = BillingPreviewResponseSchema.extend({ incoming: z.array(CheckoutChangeSchema), outgoing: z.array(CheckoutChangeSchema), redirect_type: CheckoutModeSchema, }); +export type ExtAttachPreviewResponse = z.infer< + typeof ExtAttachPreviewResponseSchema +>; export type AttachPreviewResponse = z.infer; diff --git a/shared/api/billing/common/billingBehavior.ts b/shared/api/billing/common/billingBehavior.ts index 239e0579b..490229aad 100644 --- a/shared/api/billing/common/billingBehavior.ts +++ b/shared/api/billing/common/billingBehavior.ts @@ -1,8 +1,10 @@ import { z } from "zod/v4"; -export const BillingBehaviorSchema = z.enum([ - "prorate_immediately", - "next_cycle_only", -]); +export const BillingBehaviorSchema = z + .enum(["prorate_immediately", "next_cycle_only"]) + .meta({ + description: + "How to handle billing. 'prorate_immediately' charges/credits prorated amounts now, 'next_cycle_only' waits until the next billing cycle.", + }); export type BillingBehavior = z.infer; diff --git a/shared/api/billing/common/billingParamsBase/billingParamsBaseV1.ts b/shared/api/billing/common/billingParamsBase/billingParamsBaseV1.ts index 4a7191bfd..b87bb93f7 100644 --- a/shared/api/billing/common/billingParamsBase/billingParamsBaseV1.ts +++ b/shared/api/billing/common/billingParamsBase/billingParamsBaseV1.ts @@ -3,30 +3,47 @@ import { FreeTrialParamsV1Schema } from "@api/common/freeTrial/freeTrialParamsV1 import { z } from "zod/v4"; import { CustomerDataSchema } from "../../../common/customerData"; import { EntityDataSchema } from "../../../common/entityData"; +import { BillingBehaviorSchema } from "../billingBehavior"; import { CustomizePlanV1Schema } from "../customizePlan/customizePlanV1"; +import { InvoiceModeParamsSchema } from "../invoiceModeParams"; import { TransitionRulesSchema } from "../transitionRules"; export const BillingParamsBaseV1Schema = z.object({ customer_id: z.string().meta({ description: "The ID of the customer to attach the plan to.", }), - entity_id: z.string().nullish().meta({ + entity_id: z.string().optional().meta({ description: "The ID of the entity to attach the plan to.", }), + plan_id: z.string().meta({ + description: "The ID of the plan.", + }), - feature_quantities: z.array(FeatureQuantityParamsV0Schema).nullish().meta({ + feature_quantities: z.array(FeatureQuantityParamsV0Schema).optional().meta({ description: "If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan.", }), version: z.number().optional().meta({ description: "The version of the plan to attach.", }), - free_trial: FreeTrialParamsV1Schema.nullable().optional(), + free_trial: FreeTrialParamsV1Schema.nullable().optional().meta({ + description: + "Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.", + }), customize: CustomizePlanV1Schema.optional().meta({ description: "Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both.", }), + invoice_mode: InvoiceModeParamsSchema.optional().meta({ + description: + "Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.", + }), + billing_behavior: BillingBehaviorSchema.optional().meta({ + description: + "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.", + }), + transition_rules: TransitionRulesSchema.optional().meta({ internal: true, }), diff --git a/shared/api/billing/common/billingPreviewResponse.ts b/shared/api/billing/common/billingPreviewResponse.ts index a8f0129cb..2a7082c6a 100644 --- a/shared/api/billing/common/billingPreviewResponse.ts +++ b/shared/api/billing/common/billingPreviewResponse.ts @@ -1,54 +1,92 @@ import { LineItemDiscountSchema } from "@models/billingModels/lineItem/lineItem"; import { z } from "zod/v4"; -export const PreviewLineItemSchema = z.object({ - title: z.string(), - description: z.string(), - amount: z.number(), - discounts: z.array(LineItemDiscountSchema).default([]), - plan_id: z.string(), - total_quantity: z.number(), - paid_quantity: z.number(), - deferred_for_trial: z.boolean().optional(), +export const BILLING_PREVIEW_RESPONSE_EXAMPLE = { + customerId: "charles", + lineItems: [ + { + title: "Pro seed", + description: "Pro seed - Base Price (from 18 Feb 2026 to 18 Mar 2026)", + amount: 20, + discounts: [], + }, + ], + total: 20, + currency: "usd", +}; + +export const ExtPreviewLineItemSchema = z.object({ + title: z.string().meta({ description: "The title of the line item." }), + description: z + .string() + .meta({ description: "A detailed description of the line item." }), + amount: z + .number() + .meta({ description: "The amount in cents for this line item." }), + discounts: z.array(LineItemDiscountSchema).default([]).meta({ + description: "List of discounts applied to this line item.", + }), +}); + +const PreviewLineItemSchema = ExtPreviewLineItemSchema.extend({ + plan_id: z.string().meta({ internal: true }), + total_quantity: z.number().meta({ internal: true }), + paid_quantity: z.number().meta({ internal: true }), + deferred_for_trial: z.boolean().optional().meta({ internal: true }), effective_period: z .object({ start: z.number(), end: z.number(), }) - .optional(), + .optional() + .meta({ internal: true }), - is_base: z.boolean().optional(), + is_base: z.boolean().optional().meta({ internal: true }), }); -export type PreviewLineItem = z.infer; +export const ExtBillingPreviewResponseSchema = z.object({ + customer_id: z.string().meta({ description: "The ID of the customer." }), + line_items: z.array(ExtPreviewLineItemSchema).meta({ + description: "List of line items for the current billing period.", + }), -export const BillingPreviewResponseSchema = z.object({ - customer_id: z.string(), - line_items: z.array(PreviewLineItemSchema), - - total: z.number(), - currency: z.string(), - - period_start: z.number().optional(), - period_end: z.number().optional(), - - // /** Credit from excess refund (e.g. unused time on previous plan exceeds new charge). Applied to next invoice(s) by Stripe. */ - // credit: z - // .object({ - // amount: z.number(), - // description: z.string(), - // }) - // .optional(), + total: z.number().meta({ + description: "The total amount in cents for the current billing period.", + }), + currency: z.string().meta({ + description: "The three-letter ISO currency code (e.g., 'usd').", + }), next_cycle: z .object({ - starts_at: z.number(), - total: z.number(), - line_items: z.array(PreviewLineItemSchema), + starts_at: z.number().meta({ + description: + "Unix timestamp (milliseconds) when the next billing cycle starts.", + }), + total: z + .number() + .meta({ description: "The total amount in cents for the next cycle." }), + line_items: z.array(PreviewLineItemSchema).meta({ internal: true }), }) - .optional(), + .optional() + .meta({ + description: + "Preview of the next billing cycle, if applicable. This shows what the customer will be charged in subsequent cycles.", + }), }); +export const BillingPreviewResponseSchema = + ExtBillingPreviewResponseSchema.extend({ + line_items: z.array(PreviewLineItemSchema), + period_start: z.number().optional().meta({ internal: true }), + period_end: z.number().optional().meta({ internal: true }), + }); + +export type ExtBillingPreviewResponse = z.infer< + typeof ExtBillingPreviewResponseSchema +>; + +export type PreviewLineItem = z.infer; export type BillingPreviewResponse = z.infer< typeof BillingPreviewResponseSchema >; diff --git a/shared/api/billing/common/billingResponse.ts b/shared/api/billing/common/billingResponse.ts index 92ff11586..05925bbaf 100644 --- a/shared/api/billing/common/billingResponse.ts +++ b/shared/api/billing/common/billingResponse.ts @@ -1,34 +1,63 @@ import { z } from "zod/v4"; -export const PaymentFailureCodeEnum = z.enum([ - "3ds_required", - "payment_method_required", - "payment_failed", -]); +export const PaymentFailureCodeEnum = z + .enum(["3ds_required", "payment_method_required", "payment_failed"]) + .meta({ + description: + "The type of payment failure. '3ds_required' means 3D Secure authentication is needed, 'payment_method_required' means the customer needs to add a payment method, 'payment_failed' means the payment was declined.", + }); export type PaymentFailureCode = z.infer; export const BillingResponseRequiredActionSchema = z.object({ - code: PaymentFailureCodeEnum, - reason: z.string(), + code: PaymentFailureCodeEnum.meta({ + description: "The type of action required to complete the payment.", + }), + reason: z.string().meta({ + description: "A human-readable explanation of why this action is required.", + }), }); export const BillingResponseSchema = z.object({ - customer_id: z.string(), - entity_id: z.string().optional(), + customer_id: z.string().meta({ description: "The ID of the customer." }), + entity_id: z.string().optional().meta({ + description: "The ID of the entity, if the plan was attached to an entity.", + }), invoice: z .object({ - status: z.string().nullable(), - stripe_id: z.string(), - total: z.number(), - currency: z.string(), - hosted_invoice_url: z.string().nullable(), + status: z.string().nullable().meta({ + description: + "The status of the invoice (e.g., 'paid', 'open', 'draft').", + }), + stripe_id: z.string().meta({ + description: "The Stripe invoice ID.", + }), + total: z.number().meta({ + description: "The total amount of the invoice in cents.", + }), + currency: z.string().meta({ + description: "The three-letter ISO currency code (e.g., 'usd').", + }), + hosted_invoice_url: z.string().nullable().meta({ + description: + "URL to the hosted invoice page where the customer can view and pay the invoice.", + }), }) - .optional(), + .optional() + .meta({ + description: + "Invoice details if an invoice was created. Only present when a charge was made.", + }), - payment_url: z.string().nullable(), - required_action: BillingResponseRequiredActionSchema.optional(), + payment_url: z.string().nullable().meta({ + description: + "URL to redirect the customer to complete payment. Null if no payment action is required.", + }), + required_action: BillingResponseRequiredActionSchema.optional().meta({ + description: + "Details about any action required to complete the payment. Present when the payment could not be processed automatically.", + }), }); export type BillingResponse = z.infer; diff --git a/shared/api/billing/common/cancelAction.ts b/shared/api/billing/common/cancelAction.ts index 2d518a176..cd238546f 100644 --- a/shared/api/billing/common/cancelAction.ts +++ b/shared/api/billing/common/cancelAction.ts @@ -1,12 +1,10 @@ import { z } from "zod/v4"; -/** - * Action for canceling a subscription via update subscription API - */ -export const CancelActionSchema = z.enum([ - "cancel_immediately", - "cancel_end_of_cycle", - "uncancel", -]); +export const CancelActionSchema = z + .enum(["cancel_immediately", "cancel_end_of_cycle", "uncancel"]) + .meta({ + description: + "Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation.", + }); export type CancelAction = z.infer; diff --git a/shared/api/billing/common/invoiceModeParams.ts b/shared/api/billing/common/invoiceModeParams.ts index 46ba58945..44dcf160c 100644 --- a/shared/api/billing/common/invoiceModeParams.ts +++ b/shared/api/billing/common/invoiceModeParams.ts @@ -1,8 +1,17 @@ import { z } from "zod/v4"; export const InvoiceModeParamsSchema = z.object({ - enabled: z.boolean(), - enable_plan_immediately: z.boolean().default(false), - finalize: z.boolean().default(true), + enabled: z.boolean().meta({ + description: + "When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method.", + }), + enable_plan_immediately: z.boolean().default(false).meta({ + description: + "If true, enables the plan immediately even though the invoice is not paid yet.", + }), + finalize: z.boolean().default(true).meta({ + description: + "If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.", + }), }); export type InvoiceModeParams = z.infer; diff --git a/shared/api/billing/common/redirectMode.ts b/shared/api/billing/common/redirectMode.ts index 68ebd57c6..252df19a9 100644 --- a/shared/api/billing/common/redirectMode.ts +++ b/shared/api/billing/common/redirectMode.ts @@ -1,4 +1,9 @@ import { z } from "zod/v4"; -export const RedirectModeSchema = z.enum(["always", "if_required", "never"]); +export const RedirectModeSchema = z + .enum(["always", "if_required", "never"]) + .meta({ + description: + "Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects.", + }); export type RedirectMode = z.infer; diff --git a/shared/api/billing/index.ts b/shared/api/billing/index.ts index 4ff3505e8..00e9724ac 100644 --- a/shared/api/billing/index.ts +++ b/shared/api/billing/index.ts @@ -13,7 +13,8 @@ export * from "./checkout/prevVersions/checkoutResponseV0"; // Common export * from "./common/index"; - +export * from "./openBillingPortal/openBillingPortalParamsV1"; +export * from "./openBillingPortal/openBillingPortalResponse"; // Update Subscription export * from "./updateSubscription/previewUpdateSubscriptionResponse"; export * from "./updateSubscription/updateSubscriptionV0Params"; diff --git a/shared/api/billing/openBillingPortal/openBillingPortalParamsV1.ts b/shared/api/billing/openBillingPortal/openBillingPortalParamsV1.ts new file mode 100644 index 000000000..2d6c17da3 --- /dev/null +++ b/shared/api/billing/openBillingPortal/openBillingPortalParamsV1.ts @@ -0,0 +1,14 @@ +import z from "zod/v4"; +export const OpenCustomerPortalParamsV1Schema = z.object({ + customer_id: z.string().meta({ + description: "The ID of the customer to open the billing portal for.", + }), + configuration_id: z.string().optional().meta({ + description: + "Stripe billing portal configuration ID. Create configurations in your Stripe dashboard.", + }), + return_url: z.string().optional().meta({ + description: + "URL to redirect to when back button is clicked in the billing portal", + }), +}); diff --git a/shared/api/billing/openBillingPortal/openBillingPortalResponse.ts b/shared/api/billing/openBillingPortal/openBillingPortalResponse.ts new file mode 100644 index 000000000..4e87eace7 --- /dev/null +++ b/shared/api/billing/openBillingPortal/openBillingPortalResponse.ts @@ -0,0 +1,10 @@ +import z from "zod/v4"; + +export const OpenCustomerPortalResponseSchema = z.object({ + customer_id: z.string().meta({ + description: "The ID of the billing portal session", + }), + url: z.string().meta({ + description: "URL to the billing portal", + }), +}); diff --git a/shared/api/billing/openCustomerPortalParams.ts b/shared/api/billing/openCustomerPortalParams.ts new file mode 100644 index 000000000..e69de29bb diff --git a/shared/api/billing/updateSubscription/previewUpdateSubscriptionResponse.ts b/shared/api/billing/updateSubscription/previewUpdateSubscriptionResponse.ts index 08702520f..e60ca3c68 100644 --- a/shared/api/billing/updateSubscription/previewUpdateSubscriptionResponse.ts +++ b/shared/api/billing/updateSubscription/previewUpdateSubscriptionResponse.ts @@ -1,9 +1,18 @@ import type { z } from "zod/v4"; -import { BillingPreviewResponseSchema } from "../common/billingPreviewResponse"; +import { + BillingPreviewResponseSchema, + ExtBillingPreviewResponseSchema, +} from "../common/billingPreviewResponse"; + +export const ExtPreviewUpdateSubscriptionResponseSchema = + ExtBillingPreviewResponseSchema; export const PreviewUpdateSubscriptionResponseSchema = BillingPreviewResponseSchema; +export type ExtPreviewUpdateSubscriptionResponse = z.infer< + typeof ExtPreviewUpdateSubscriptionResponseSchema +>; export type PreviewUpdateSubscriptionResponse = z.infer< typeof PreviewUpdateSubscriptionResponseSchema >; diff --git a/shared/api/billing/updateSubscription/updateSubscriptionV1Params.ts b/shared/api/billing/updateSubscription/updateSubscriptionV1Params.ts index b07d79e41..248836a5d 100644 --- a/shared/api/billing/updateSubscription/updateSubscriptionV1Params.ts +++ b/shared/api/billing/updateSubscription/updateSubscriptionV1Params.ts @@ -1,51 +1,21 @@ import { z } from "zod/v4"; -import { BillingBehaviorSchema } from "../common/billingBehavior"; import { BillingParamsBaseV1Schema } from "../common/billingParamsBase/billingParamsBaseV1"; import { CancelActionSchema } from "../common/cancelAction"; -import { InvoiceModeParamsSchema } from "../common/invoiceModeParams"; -export const UpdateSubscriptionV1ParamsSchema = +export const ExtUpdateSubscriptionV1ParamsSchema = BillingParamsBaseV1Schema.extend({ + cancel_action: CancelActionSchema.optional().meta({ + description: + "Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation.", + }), + }); +export const UpdateSubscriptionV1ParamsSchema = + ExtUpdateSubscriptionV1ParamsSchema.extend({ plan_id: z.string().optional(), - - invoice_mode: InvoiceModeParamsSchema.optional(), - - cancel_action: CancelActionSchema.optional(), - billing_behavior: BillingBehaviorSchema.optional(), - customer_product_id: z.string().optional().meta({ internal: true, }), - }) - .refine( - (data) => { - if (data.cancel_action !== "cancel_immediately") return true; - - const forbiddenFields = [ - "feature_quantities", - "version", - "free_trial", - "customize", - ] as const; - return !forbiddenFields.some((field) => data[field] !== undefined); - }, - { - message: - "Cannot pass feature_quantities, customize, version, or free_trial when cancel_action is 'cancel_immediately'. Immediate cancellation only processes a prorated refund.", - }, - ) - .refine( - (data) => { - if (data.cancel_action !== "cancel_end_of_cycle") return true; - - // Cannot pass free_trial when cancel_action is 'cancel_end_of_cycle' - return data.free_trial === undefined; - }, - { - message: - "Cannot pass free_trial when cancel_action is 'cancel_end_of_cycle'.", - }, - ); + }); export type UpdateSubscriptionV1Params = z.infer< typeof UpdateSubscriptionV1ParamsSchema diff --git a/shared/api/common/index.ts b/shared/api/common/index.ts index 32f0917ad..307751a45 100644 --- a/shared/api/common/index.ts +++ b/shared/api/common/index.ts @@ -1 +1,2 @@ +export * from "./commonResponses"; export * from "./customerId"; diff --git a/shared/api/customers/apiCustomerV5.ts b/shared/api/customers/apiCustomerV5.ts index f966d8cec..5b16aae7b 100644 --- a/shared/api/customers/apiCustomerV5.ts +++ b/shared/api/customers/apiCustomerV5.ts @@ -8,42 +8,78 @@ import { } from "./cusPlans/apiSubscriptionV1"; export const API_CUSTOMER_V5_EXAMPLE = { - id: "cus_123", - created_at: 1717000000, - name: "John Doe", - email: "john@example.com", - fingerprint: "1234567890", - stripe_id: "cus_123", + id: "2ee25a41-0d81-4ad2-8451-ec1aadaefe58", // Example UUID + name: "Patrick", // Example random name + email: "patrick@useautumn.com", + createdAt: 1771409161016, + fingerprint: null, + stripeId: "cus_U0BKxpq1mFhuJO", env: "sandbox", metadata: {}, + sendEmailReceipts: false, subscriptions: [ { - id: "sub_123", - created_at: 1717000000, - plan_id: "plan_123", + planId: "pro_plan", + autoEnable: true, + addOn: false, status: "active", + pastDue: false, + canceledAt: null, + expiresAt: null, + trialEndsAt: null, + startedAt: 1771431921437, + currentPeriodStart: 1771431921437, + currentPeriodEnd: 1771999921437, quantity: 1, - interval: "month", - interval_count: 1, }, ], purchases: [], balances: { - balance_1: { - id: "balance_1", - amount: 100, - currency: "USD", - created_at: 1717000000, - updated_at: 1717000000, + messages: { + featureId: "messages", + granted: 100, + remaining: 0, + usage: 100, + unlimited: false, + overageAllowed: false, + maxPurchase: null, + nextResetAt: 1773851121437, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + planId: "pro_plan", + includedGrant: 100, + prepaidGrant: 0, + remaining: 0, + usage: 100, + unlimited: false, + reset: { + interval: "month", + resetsAt: 1773851121437, + }, + price: null, + expiresAt: null, + }, + ], }, }, }; // V5 base customer - uses V1 subscriptions (single array with status field) and V1 balances export const BaseApiCustomerV5Schema = BaseApiCustomerSchema.extend({ - subscriptions: z.array(ApiSubscriptionV1Schema), - purchases: z.array(ApiPurchaseV0Schema), - balances: z.record(z.string(), ApiBalanceV1Schema), + subscriptions: z.array(ApiSubscriptionV1Schema).meta({ + description: + "Active and scheduled recurring plans that this customer has attached.", + }), + purchases: z.array(ApiPurchaseV0Schema).meta({ + description: "One-time purchases made by the customer.", + }), + balances: z.record(z.string(), ApiBalanceV1Schema).meta({ + description: + "Feature balances keyed by feature ID, showing usage limits and remaining amounts.", + }), +}).meta({ + examples: [API_CUSTOMER_V5_EXAMPLE], }); export const ApiCustomerV5Schema = BaseApiCustomerV5Schema.extend( diff --git a/shared/api/customers/cusFeatures/apiBalance.ts b/shared/api/customers/cusFeatures/apiBalance.ts index 9ee4fd389..f62d56014 100644 --- a/shared/api/customers/cusFeatures/apiBalance.ts +++ b/shared/api/customers/cusFeatures/apiBalance.ts @@ -3,51 +3,117 @@ import { z } from "zod/v4"; import { ApiFeatureV1Schema } from "../../features/apiFeatureV1"; export const ApiBalanceResetSchema = z.object({ - interval: z.enum(ResetInterval).or(z.literal("multiple")), - interval_count: z.number().optional(), - resets_at: z.number().nullable(), + interval: z.enum(ResetInterval).or(z.literal("multiple")).meta({ + description: + "The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.", + }), + interval_count: z.number().optional().meta({ + description: "Number of intervals between resets (eg. 2 for bi-monthly).", + }), + resets_at: z.number().nullable().meta({ + description: "Timestamp when the balance will next reset.", + }), }); export const ApiBalanceRolloverSchema = z.object({ - balance: z.number(), - expires_at: z.number(), + balance: z.number().meta({ + description: "Amount of balance rolled over from a previous period.", + }), + expires_at: z.number().meta({ + description: "Timestamp when the rollover balance expires.", + }), }); export const ApiBalanceBreakdownSchema = z.object({ - id: z.string().default(""), - plan_id: z.string().nullable(), + id: z.string().default("").meta({ + description: "The unique identifier for this balance breakdown.", + }), + plan_id: z.string().nullable().meta({ + description: + "The plan ID this balance originates from, or null for standalone balances.", + }), - granted_balance: z.number(), - purchased_balance: z.number(), - current_balance: z.number(), - usage: z.number(), + granted_balance: z.number().meta({ + description: "Amount granted from the plan's included usage.", + }), + purchased_balance: z.number().meta({ + description: "Amount granted from prepaid purchases or top-ups.", + }), + current_balance: z.number().meta({ + description: "Current remaining balance available for use.", + }), + usage: z.number().meta({ + description: "Amount consumed in the current period.", + }), - overage_allowed: z.boolean(), - max_purchase: z.number().nullable(), - reset: ApiBalanceResetSchema.nullable(), + overage_allowed: z.boolean().meta({ + description: + "Whether usage beyond the granted balance is allowed (with overage charges).", + }), + max_purchase: z.number().nullable().meta({ + description: + "Maximum quantity that can be purchased as a top-up, or null for unlimited.", + }), + reset: ApiBalanceResetSchema.nullable().meta({ + description: "Reset configuration for this balance, or null if no reset.", + }), - // Extra fields - prepaid_quantity: z.number().default(0), - expires_at: z.number().nullable(), // For loose entitlements with expiry + prepaid_quantity: z.number().default(0).meta({ + description: "Quantity of prepaid units purchased.", + }), + expires_at: z.number().nullable().meta({ + description: + "Timestamp when this balance expires, or null for no expiration.", + }), }); export const ApiBalanceSchema = z.object({ - feature_id: z.string(), - feature: ApiFeatureV1Schema.optional(), - unlimited: z.boolean(), + feature_id: z.string().meta({ + description: "The feature ID this balance is for.", + }), + feature: ApiFeatureV1Schema.optional().meta({ + description: "The full feature object if expanded.", + }), + unlimited: z.boolean().meta({ + description: "Whether this feature has unlimited usage.", + }), - granted_balance: z.number(), - purchased_balance: z.number(), - current_balance: z.number(), - usage: z.number(), + granted_balance: z.number().meta({ + description: "Total balance granted from the plan's included usage.", + }), + purchased_balance: z.number().meta({ + description: "Total balance from prepaid purchases or top-ups.", + }), + current_balance: z.number().meta({ + description: "Current remaining balance available for use.", + }), + usage: z.number().meta({ + description: "Total usage consumed in the current period.", + }), - overage_allowed: z.boolean(), - max_purchase: z.number().nullable(), - reset: ApiBalanceResetSchema.nullable(), + overage_allowed: z.boolean().meta({ + description: + "Whether usage beyond the granted balance is allowed (with overage charges).", + }), + max_purchase: z.number().nullable().meta({ + description: + "Maximum quantity that can be purchased as a top-up, or null for unlimited.", + }), + reset: ApiBalanceResetSchema.nullable().meta({ + description: "Reset configuration for this balance, or null for no reset.", + }), - plan_id: z.string().nullable(), - breakdown: z.array(ApiBalanceBreakdownSchema).optional(), - rollovers: z.array(ApiBalanceRolloverSchema).optional(), + plan_id: z.string().nullable().meta({ + description: + "The primary plan ID this balance is associated with, or null for standalone balances.", + }), + breakdown: z.array(ApiBalanceBreakdownSchema).optional().meta({ + description: + "Detailed breakdown of balance sources when stacking multiple plans or grants.", + }), + rollovers: z.array(ApiBalanceRolloverSchema).optional().meta({ + description: "Rollover balances carried over from previous periods.", + }), }); export type ApiBalanceReset = z.infer; diff --git a/shared/api/customers/cusFeatures/apiBalanceV1.ts b/shared/api/customers/cusFeatures/apiBalanceV1.ts index 6fdea9653..8737951d9 100644 --- a/shared/api/customers/cusFeatures/apiBalanceV1.ts +++ b/shared/api/customers/cusFeatures/apiBalanceV1.ts @@ -4,12 +4,52 @@ import { z } from "zod/v4"; import { ApiFeatureV1Schema } from "../../features/apiFeatureV1"; import { ApiBalanceResetSchema, ApiBalanceRolloverSchema } from "./apiBalance"; +export const API_BALANCE_V1_EXAMPLE = { + feature_id: "messages", + granted: 100, + remaining: 72, + usage: 28, + unlimited: false, + overage_allowed: false, + max_purchase: null, + next_reset_at: 1773851121437, + breakdown: [ + { + id: "cus_ent_39qmLooixXLAqMywgXywjAz96rV", + plan_id: "pro_plan", + included_grant: 100, + prepaid_grant: 0, + remaining: 72, + usage: 28, + unlimited: false, + reset: { + interval: "month", + resets_at: 1773851121437, + }, + price: null, + expires_at: null, + }, + ], +}; + export const ApiBalanceBreakdownPriceSchema = z.object({ - amount: z.number().optional(), - tiers: z.array(UsageTierSchema).optional(), - billing_units: z.number(), - billing_method: z.enum(BillingMethod), - max_purchase: z.number().nullable(), + amount: z.number().optional().meta({ + description: "The per-unit price amount.", + }), + tiers: z.array(UsageTierSchema).optional().meta({ + description: "Tiered pricing configuration if applicable.", + }), + billing_units: z.number().meta({ + description: + "The number of units per billing increment (eg. $9 / 250 units).", + }), + billing_method: z.enum(BillingMethod).meta({ + description: "Whether usage is prepaid or billed pay-per-use.", + }), + max_purchase: z.number().nullable().meta({ + description: + "Maximum quantity that can be purchased, or null for unlimited.", + }), }); export const ApiBalanceBreakdownV1Schema = z.object({ @@ -17,52 +57,101 @@ export const ApiBalanceBreakdownV1Schema = z.object({ internal: true, }), - id: z.string().default(""), - plan_id: z.string().nullable(), + id: z.string().default("").meta({ + description: "The unique identifier for this balance breakdown.", + }), + plan_id: z.string().nullable().meta({ + description: + "The plan ID this balance originates from, or null for standalone balances.", + }), - included_grant: z.number(), - prepaid_grant: z.number(), - remaining: z.number(), - usage: z.number(), - unlimited: z.boolean(), + included_grant: z.number().meta({ + description: "Amount granted from the plan's included usage.", + }), + prepaid_grant: z.number().meta({ + description: "Amount granted from prepaid purchases or top-ups.", + }), + remaining: z.number().meta({ + description: "Remaining balance available for use.", + }), + usage: z.number().meta({ + description: "Amount consumed in the current period.", + }), + unlimited: z.boolean().meta({ + description: "Whether this balance has unlimited usage.", + }), - reset: ApiBalanceResetSchema.nullable(), + reset: ApiBalanceResetSchema.nullable().meta({ + description: "Reset configuration for this balance, or null if no reset.", + }), - price: ApiBalanceBreakdownPriceSchema.nullable(), + price: ApiBalanceBreakdownPriceSchema.nullable().meta({ + description: + "Pricing configuration if this balance has usage-based pricing.", + }), - // Extra fields - expires_at: z.number().nullable(), // For loose entitlements with expiry + expires_at: z.number().nullable().meta({ + description: + "Timestamp when this balance expires, or null for no expiration.", + }), overage: z.number().meta({ internal: true, }), }); -export const ApiBalanceV1Schema = z.object({ - object: z.literal("balance").meta({ - internal: true, - }), +export const ApiBalanceV1Schema = z + .object({ + object: z.literal("balance").meta({ + internal: true, + }), - feature_id: z.string(), - feature: ApiFeatureV1Schema.optional(), + feature_id: z.string().meta({ + description: "The feature ID this balance is for.", + }), + feature: ApiFeatureV1Schema.optional().meta({ + description: "The full feature object if expanded.", + }), - // Included + prepaid balance - granted: z.number(), + granted: z.number().meta({ + description: "Total balance granted (included + prepaid).", + }), - // Remaining balance, cannot go below 0 - remaining: z.number().min(0), + remaining: z.number().min(0).meta({ + description: "Remaining balance available for use.", + }), - // - usage: z.number(), - unlimited: z.boolean(), + usage: z.number().meta({ + description: "Total usage consumed in the current period.", + }), + unlimited: z.boolean().meta({ + description: "Whether this feature has unlimited usage.", + }), - overage_allowed: z.boolean(), - max_purchase: z.number().nullable(), - next_reset_at: z.number().nullable(), + overage_allowed: z.boolean().meta({ + description: + "Whether usage beyond the granted balance is allowed (with overage charges).", + }), + max_purchase: z.number().nullable().meta({ + description: + "Maximum quantity that can be purchased as a top-up, or null for unlimited.", + }), + next_reset_at: z.number().nullable().meta({ + description: + "Timestamp when the balance will reset, or null for no reset.", + }), - breakdown: z.array(ApiBalanceBreakdownV1Schema).optional(), - rollovers: z.array(ApiBalanceRolloverSchema).optional(), -}); + breakdown: z.array(ApiBalanceBreakdownV1Schema).optional().meta({ + description: + "Detailed breakdown of balance sources when stacking multiple plans or grants.", + }), + rollovers: z.array(ApiBalanceRolloverSchema).optional().meta({ + description: "Rollover balances carried over from previous periods.", + }), + }) + .meta({ + examples: [API_BALANCE_V1_EXAMPLE], + }); export type ApiBalanceBreakdownPrice = z.infer< typeof ApiBalanceBreakdownPriceSchema diff --git a/shared/api/customers/cusPlans/apiSubscriptionV1.ts b/shared/api/customers/cusPlans/apiSubscriptionV1.ts index 92a83fdb5..1a4ea26f1 100644 --- a/shared/api/customers/cusPlans/apiSubscriptionV1.ts +++ b/shared/api/customers/cusPlans/apiSubscriptionV1.ts @@ -2,31 +2,71 @@ import { ApiPlanV1Schema } from "@api/products/apiPlanV1"; import { z } from "zod/v4"; export const ApiSubscriptionV1Schema = z.object({ - plan: ApiPlanV1Schema.optional(), - plan_id: z.string(), + plan: ApiPlanV1Schema.optional().meta({ + description: "The full plan object if expanded.", + }), + plan_id: z.string().meta({ + description: "The unique identifier of the subscribed plan.", + }), - auto_enable: z.boolean(), - add_on: z.boolean(), + auto_enable: z.boolean().meta({ + description: "Whether the plan was automatically enabled for the customer.", + }), + add_on: z.boolean().meta({ + description: + "Whether this is an add-on plan rather than a base subscription.", + }), - // Flags / timestamps - status: z.enum(["active", "scheduled", "expired"]), - past_due: z.boolean(), - canceled_at: z.number().nullable(), - expires_at: z.number().nullable(), - trial_ends_at: z.number().nullable(), + status: z.enum(["active", "scheduled"]).meta({ + description: "Current status of the subscription.", + }), + past_due: z.boolean().meta({ + description: "Whether the subscription has overdue payments.", + }), + canceled_at: z.number().nullable().meta({ + description: + "Timestamp when the subscription was canceled, or null if not canceled.", + }), + expires_at: z.number().nullable().meta({ + description: + "Timestamp when the subscription will expire, or null if no expiry set.", + }), + trial_ends_at: z.number().nullable().meta({ + description: + "Timestamp when the trial period ends, or null if not on trial.", + }), - started_at: z.number(), - current_period_start: z.number().nullable(), - current_period_end: z.number().nullable(), - quantity: z.number(), + started_at: z.number().meta({ + description: "Timestamp when the subscription started.", + }), + current_period_start: z.number().nullable().meta({ + description: "Start timestamp of the current billing period.", + }), + current_period_end: z.number().nullable().meta({ + description: "End timestamp of the current billing period.", + }), + quantity: z.number().meta({ + description: "Number of units of this subscription (for per-seat plans).", + }), }); export const ApiPurchaseV0Schema = z.object({ - plan: ApiPlanV1Schema.optional(), - plan_id: z.string(), - expires_at: z.number().nullable(), - started_at: z.number(), - quantity: z.number(), + plan: ApiPlanV1Schema.optional().meta({ + description: "The full plan object if expanded.", + }), + plan_id: z.string().meta({ + description: "The unique identifier of the purchased plan.", + }), + expires_at: z.number().nullable().meta({ + description: + "Timestamp when the purchase expires, or null for lifetime access.", + }), + started_at: z.number().meta({ + description: "Timestamp when the purchase was made.", + }), + quantity: z.number().meta({ + description: "Number of units purchased.", + }), }); export type ApiSubscriptionV1 = z.infer; diff --git a/shared/api/entities/apiEntityV2.ts b/shared/api/entities/apiEntityV2.ts index 0040638e8..212f61354 100644 --- a/shared/api/entities/apiEntityV2.ts +++ b/shared/api/entities/apiEntityV2.ts @@ -15,10 +15,16 @@ export const BaseApiEntityV2Schema = ApiBaseEntitySchema.extend({ }); export const ApiEntityExpandSchema = z.object({ - invoices: z.array(ApiInvoiceV1Schema).optional().meta({ - description: - "Invoices for this entity (only included when expand=invoices)", - }), + invoices: z + .array(ApiInvoiceV1Schema) + .optional() + .meta({ + description: + "Invoices for this entity (only included when expand=invoices)", + }) + .meta({ + internal: true, + }), }); export const ApiEntityV2Schema = BaseApiEntityV2Schema.extend( diff --git a/shared/api/entities/crud/createEntityParams.ts b/shared/api/entities/crud/createEntityParams.ts new file mode 100644 index 000000000..96d0b89cb --- /dev/null +++ b/shared/api/entities/crud/createEntityParams.ts @@ -0,0 +1,37 @@ +import { z } from "zod/v4"; +import { CustomerDataSchema } from "../../common/customerData.js"; + +export const CreateEntityParamsV0Schema = z.object({ + id: z + .preprocess( + (val) => (typeof val === "number" ? String(val) : val), + z.string(), + ) + .nullable() + .meta({ + description: "The ID of the entity", + }), + name: z.string().nullish().meta({ + description: "The name of the entity", + }), + feature_id: z.string().meta({ + description: "The ID of the feature this entity is associated with", + }), + customer_data: CustomerDataSchema.optional().meta({ + description: + "Customer attributes used to resolve the customer when customer_id is not provided.", + }), +}); + +export const CreateEntityParamsV1Schema = CreateEntityParamsV0Schema.omit({ + id: true, +}).extend({ + customer_id: z.string().meta({ + description: "The ID of the customer to create the entity for.", + }), + entity_id: z.string().meta({ + description: "The ID of the entity.", + }), +}); + +export type CreateEntityParams = z.infer; diff --git a/shared/api/entities/crud/deleteEntityParams.ts b/shared/api/entities/crud/deleteEntityParams.ts new file mode 100644 index 000000000..5ca431bb7 --- /dev/null +++ b/shared/api/entities/crud/deleteEntityParams.ts @@ -0,0 +1,12 @@ +import { z } from "zod/v4"; + +export const DeleteEntityParamsV0Schema = z.object({ + customer_id: z.string().optional().meta({ + description: "The ID of the customer.", + }), + entity_id: z.string().meta({ + description: "The ID of the entity.", + }), +}); + +export type DeleteEntityParamsV0 = z.infer; diff --git a/shared/api/entities/crud/getEntityParams.ts b/shared/api/entities/crud/getEntityParams.ts new file mode 100644 index 000000000..8373f5022 --- /dev/null +++ b/shared/api/entities/crud/getEntityParams.ts @@ -0,0 +1,12 @@ +import { z } from "zod/v4"; + +export const GetEntityParamsV0Schema = z.object({ + customer_id: z.string().optional().meta({ + description: "The ID of the customer to create the entity for.", + }), + entity_id: z.string().meta({ + description: "The ID of the entity.", + }), +}); + +export type GetEntityParamsV0 = z.infer; diff --git a/shared/api/entities/crud/index.ts b/shared/api/entities/crud/index.ts new file mode 100644 index 000000000..2e5e11012 --- /dev/null +++ b/shared/api/entities/crud/index.ts @@ -0,0 +1,3 @@ +export * from "./createEntityParams.js"; +export * from "./deleteEntityParams.js"; +export * from "./getEntityParams.js"; diff --git a/shared/api/entities/entityOpModels.ts b/shared/api/entities/entityOpModels.ts index e0f5a1b2d..a4099d9b8 100644 --- a/shared/api/entities/entityOpModels.ts +++ b/shared/api/entities/entityOpModels.ts @@ -1,27 +1,8 @@ import { z } from "zod/v4"; import { queryStringArray } from "../apiUtils.js"; -import { CustomerDataSchema } from "../common/customerData.js"; import { CustomerExpand } from "../customers/components/customerExpand/customerExpand.js"; // Create Entity Params (based on CreateEntitySchema from shared/models) -export const CreateEntityParamsSchema = z.object({ - id: z - .preprocess( - (val) => (typeof val === "number" ? String(val) : val), - z.string(), - ) - .nullable() - .meta({ - description: "The ID of the entity", - }), - name: z.string().nullish().meta({ - description: "The name of the entity", - }), - feature_id: z.string().meta({ - description: "The ID of the feature this entity is associated with", - }), - customer_data: CustomerDataSchema.optional(), -}); // Get Entity Query Params export const GetEntityQuerySchema = z.object({ @@ -42,6 +23,5 @@ export const CreateEntityQuerySchema = z.object({ from_auto_create: z.boolean().default(false), }); -export type CreateEntityParams = z.infer; export type GetEntityQuery = z.infer; export type CreateEntityQuery = z.infer; diff --git a/shared/api/entities/index.ts b/shared/api/entities/index.ts new file mode 100644 index 000000000..63f745990 --- /dev/null +++ b/shared/api/entities/index.ts @@ -0,0 +1 @@ +export * from "./crud/index.js"; diff --git a/shared/api/events/aggregate/changes/V2.0_AggregateEventsChange.ts b/shared/api/events/aggregate/changes/V2.0_AggregateEventsChange.ts new file mode 100644 index 000000000..0afbf943b --- /dev/null +++ b/shared/api/events/aggregate/changes/V2.0_AggregateEventsChange.ts @@ -0,0 +1,47 @@ +import { ApiVersion } from "@api/versionUtils/ApiVersion.js"; +import { + AffectedResource, + defineVersionChange, +} from "@api/versionUtils/versionChangeUtils/VersionChange.js"; +import type { z } from "zod/v4"; +import { EventsAggregateResponseV0Schema } from "../eventsAggregateResponseV0.js"; +import { + type EventsAggregateResponseV1, + EventsAggregateResponseV1Schema, +} from "../eventsAggregateResponseV1.js"; + +/** + * V2_0_AggregateEventsChange: Transforms events aggregate response from V1 (V2.1) to V0 (V2.0) format + * + * Applied when: targetVersion <= V2.0 + * + * Changes: + * - For flat: Flattens list items from { period, values } to { period, ...values } + * - For grouped: Uses grouped_values instead of values for the V0 format + */ +export const V2_0_AggregateEventsChange = defineVersionChange({ + name: "V2_0 Aggregate Events Change", + newVersion: ApiVersion.V2_1, + oldVersion: ApiVersion.V2_0, + description: [ + "Restructure list items from { period, values, grouped_values? } to flat object", + ], + affectedResources: [AffectedResource.EventsAggregate], + newSchema: EventsAggregateResponseV1Schema, + oldSchema: EventsAggregateResponseV0Schema, + affectsResponse: true, + + transformResponse: ({ + input, + }: { + input: EventsAggregateResponseV1; + }): z.infer => { + return { + list: input.list.map((item) => ({ + period: item.period, + ...(item.grouped_values ?? item.values), + })), + total: input.total, + }; + }, +}); diff --git a/shared/api/events/aggregate/eventsAggregateResponse.ts b/shared/api/events/aggregate/eventsAggregateResponseV0.ts similarity index 59% rename from shared/api/events/aggregate/eventsAggregateResponse.ts rename to shared/api/events/aggregate/eventsAggregateResponseV0.ts index ac68a3504..e54855ea7 100644 --- a/shared/api/events/aggregate/eventsAggregateResponse.ts +++ b/shared/api/events/aggregate/eventsAggregateResponseV0.ts @@ -1,14 +1,14 @@ import z from "zod/v4"; -export const EVENTS_AGGREGATE_EXAMPLE = { +export const EVENTS_AGGREGATE_EXAMPLE_V0 = { list: [ { - timestamp: 1762905600000, + period: 1762905600000, messages: 10, seats: 3, }, { - timestamp: 1762992000000, + period: 1762992000000, messages: 3, seats: 12, }, @@ -26,7 +26,7 @@ export const EVENTS_AGGREGATE_EXAMPLE = { }; // Response without group_by: { period: number, [featureName]: number } -const EventAggregateResponseFlatSchema = z.object({ +const EventAggregateResponseFlatV0Schema = z.object({ list: z.array( z .object({ @@ -37,7 +37,7 @@ const EventAggregateResponseFlatSchema = z.object({ }); // Response with group_by: { period: number, [featureName]: { [groupValue]: number } } -const EventAggregateResponseGroupedSchema = z.object({ +const EventAggregateResponseGroupedV0Schema = z.object({ list: z.array( z .object({ @@ -47,7 +47,7 @@ const EventAggregateResponseGroupedSchema = z.object({ ), }); -const EventAggregateResponseTotalSchema = z.object({ +const EventAggregateResponseTotalV0Schema = z.object({ total: z.record( z.string(), z.object({ @@ -57,23 +57,25 @@ const EventAggregateResponseTotalSchema = z.object({ ), }); -export const EventsAggregateResponseSchema = z.union([ - EventAggregateResponseFlatSchema.and(EventAggregateResponseTotalSchema).meta({ - id: "EventAggregateResponseFlat", +export const EventsAggregateResponseV0Schema = z.union([ + EventAggregateResponseFlatV0Schema.and( + EventAggregateResponseTotalV0Schema, + ).meta({ + id: "EventAggregateResponseFlatV0", title: "No Group", description: "Response when group_by is not provided. Feature values are numbers.", }), - EventAggregateResponseGroupedSchema.and( - EventAggregateResponseTotalSchema, + EventAggregateResponseGroupedV0Schema.and( + EventAggregateResponseTotalV0Schema, ).meta({ - id: "EventAggregateResponseGrouped", + id: "EventAggregateResponseGroupedV0", title: "With Group", description: "Response when group_by is provided. Feature values are objects with group values as keys.", }), ]); -export type EventsAggregateResponse = z.infer< - typeof EventsAggregateResponseSchema +export type EventsAggregateResponseV0 = z.infer< + typeof EventsAggregateResponseV0Schema >; diff --git a/shared/api/events/aggregate/eventsAggregateResponseV1.ts b/shared/api/events/aggregate/eventsAggregateResponseV1.ts new file mode 100644 index 000000000..5db54a9e9 --- /dev/null +++ b/shared/api/events/aggregate/eventsAggregateResponseV1.ts @@ -0,0 +1,106 @@ +import { z } from "zod/v4"; + +export const EVENTS_AGGREGATE_EXAMPLE_V1_FLAT = { + list: [ + { + period: 1762905600000, + values: { + messages: 10, + sessions: 3, + }, + }, + { + period: 1762992000000, + values: { + messages: 3, + sessions: 12, + }, + }, + ], + total: { + messages: { + count: 2, + sum: 13, + }, + sessions: { + count: 2, + sum: 15, + }, + }, +}; + +export const EVENTS_AGGREGATE_EXAMPLE_V1_GROUPED = { + list: [ + { + period: 1762905600000, + values: { + messages: 10, + sessions: 3, + }, + grouped_values: { + messages: { api: 5, web: 5 }, + sessions: { api: 2, web: 1 }, + }, + }, + { + period: 1762992000000, + values: { + messages: 3, + sessions: 12, + }, + grouped_values: { + messages: { api: 1, web: 2 }, + sessions: { api: 10, web: 2 }, + }, + }, + ], + total: { + messages: { + count: 2, + sum: 13, + }, + sessions: { + count: 2, + sum: 15, + }, + }, +}; + +const EventAggregateListItemV1Schema = z.object({ + period: z.number().meta({ + description: "Unix timestamp (epoch ms) for this time period", + }), + values: z.record(z.string(), z.number()).meta({ + description: "Aggregated values per feature: { [featureId]: number }", + }), + grouped_values: z + .record(z.string(), z.record(z.string(), z.number())) + .optional() + .meta({ + description: + "Values broken down by group (only present when group_by is used): { [featureId]: { [groupValue]: number } }", + }), +}); + +const EventAggregateTotalItemSchema = z.object({ + count: z.number().meta({ description: "Number of events for this feature" }), + sum: z.number().meta({ description: "Sum of event values for this feature" }), +}); + +export const EventsAggregateResponseV1Schema = z.object({ + list: z.array(EventAggregateListItemV1Schema).meta({ + description: "Array of time periods with aggregated values", + }), + total: z.record(z.string(), EventAggregateTotalItemSchema).meta({ + description: + "Total aggregations per feature. Keys are feature IDs, values contain count and sum.", + }), +}); + +export type EventsAggregateResponseV1 = z.infer< + typeof EventsAggregateResponseV1Schema +>; + +export type EventAggregateListItemV1 = z.infer< + typeof EventAggregateListItemV1Schema +>; diff --git a/shared/api/models.ts b/shared/api/models.ts index 114f0d157..fe11b83fb 100644 --- a/shared/api/models.ts +++ b/shared/api/models.ts @@ -9,6 +9,7 @@ export * from "./entities/apiEntity.js"; export * from "./entities/apiEntityV2.js"; export * from "./entities/entityLegacyData.js"; export * from "./entities/entityOpModels.js"; +export * from "./entities/index.js"; export * from "./entities/prevVersions/apiEntityV0.js"; export * from "./errors/classes/featureErrClasses.js"; export * from "./errors/codes/featureErrCodes.js"; @@ -22,6 +23,8 @@ export * from "./others/apiInvoice/apiInvoiceV1.js"; export * from "./products/index.js"; // Referrals export * from "./referrals/apiReferralCode.js"; +export * from "./referrals/createReferralCodeParams.js"; +export * from "./referrals/redeemReferralCodeParams.js"; export * from "./referrals/referralOpModels.js"; // Helpers export * from "./utils/openApiHelpers.js"; @@ -33,7 +36,6 @@ export * from "./utils/zodToJSDoc.js"; // export * from "./products/apiProduct.js"; // export * from "./products/apiProductItem.js"; -export * from "./balances/balancesUpdateModels.js"; export * from "./balances/check/checkParams.js"; export * from "./balances/check/checkResponseV2.js"; export * from "./balances/check/checkResponseV3.js"; @@ -47,6 +49,7 @@ export * from "./balances/track/prevVersions/trackResponseV1.js"; export * from "./balances/track/trackParams.js"; export * from "./balances/track/trackResponseV2.js"; export * from "./balances/track/trackResponseV3.js"; +export * from "./balances/update/updateBalanceParams.js"; export * from "./balances/usageModels.js"; // Billing export * from "./billing/index.js"; @@ -59,7 +62,8 @@ export * from "./entities/apiBaseEntity.js"; export * from "./errors/index.js"; // Events export * from "./events/aggregate/eventsAggregateParams.js"; -export * from "./events/aggregate/eventsAggregateResponse.js"; +export * from "./events/aggregate/eventsAggregateResponseV0.js"; +export * from "./events/aggregate/eventsAggregateResponseV1.js"; export * from "./events/components/billingCycleIntervals.js"; export * from "./events/components/binsizeEnum.js"; export * from "./events/components/rangeEnum.js"; diff --git a/shared/api/referrals/createReferralCodeParams.ts b/shared/api/referrals/createReferralCodeParams.ts new file mode 100644 index 000000000..f9f327406 --- /dev/null +++ b/shared/api/referrals/createReferralCodeParams.ts @@ -0,0 +1,16 @@ +import { z } from "zod/v4"; + +export const CreateReferralCodeParamsSchema = z.object({ + customer_id: z.string().meta({ + description: "The unique identifier of the customer", + example: "cus_123", + }), + program_id: z.string().meta({ + description: "ID of your referral program", + example: "prog_123", + }), +}); + +export type CreateReferralCodeParams = z.infer< + typeof CreateReferralCodeParamsSchema +>; diff --git a/shared/api/referrals/redeemReferralCodeParams.ts b/shared/api/referrals/redeemReferralCodeParams.ts new file mode 100644 index 000000000..9fdb6008e --- /dev/null +++ b/shared/api/referrals/redeemReferralCodeParams.ts @@ -0,0 +1,16 @@ +import { z } from "zod/v4"; + +export const RedeemReferralCodeParamsSchema = z.object({ + code: z.string().meta({ + description: "The referral code to redeem", + example: "REF123ABC", + }), + customer_id: z.string().meta({ + description: "The unique identifier of the customer redeeming the code", + example: "cus_456", + }), +}); + +export type RedeemReferralCodeParams = z.infer< + typeof RedeemReferralCodeParamsSchema +>; diff --git a/shared/api/referrals/referralOpModels.ts b/shared/api/referrals/referralOpModels.ts index e222d45be..2d2e831b5 100644 --- a/shared/api/referrals/referralOpModels.ts +++ b/shared/api/referrals/referralOpModels.ts @@ -1,32 +1,2 @@ -import { z } from "zod/v4"; - -// Create Referral Code Request -export const CreateReferralCodeParamsSchema = z.object({ - customer_id: z.string().meta({ - description: "The unique identifier of the customer", - example: "cus_123", - }), - program_id: z.string().meta({ - description: "ID of your referral program", - example: "prog_123", - }), -}); - -// Redeem Referral Code Request -export const RedeemReferralCodeParamsSchema = z.object({ - code: z.string().meta({ - description: "The referral code to redeem", - example: "REF123ABC", - }), - customer_id: z.string().meta({ - description: "The unique identifier of the customer redeeming the code", - example: "cus_456", - }), -}); - -export type CreateReferralCodeParams = z.infer< - typeof CreateReferralCodeParamsSchema ->; -export type RedeemReferralCodeParams = z.infer< - typeof RedeemReferralCodeParamsSchema ->; +export * from "./createReferralCodeParams.js"; +export * from "./redeemReferralCodeParams.js"; diff --git a/shared/api/versionUtils/versionChangeUtils/VersionChange.ts b/shared/api/versionUtils/versionChangeUtils/VersionChange.ts index 2db1a76b3..3dd16972b 100644 --- a/shared/api/versionUtils/versionChangeUtils/VersionChange.ts +++ b/shared/api/versionUtils/versionChangeUtils/VersionChange.ts @@ -26,6 +26,7 @@ export enum AffectedResource { Checkout = "checkout", Attach = "attach", ApiSubscriptionUpdate = "api_subscription_update", + EventsAggregate = "events_aggregate", // Add more as needed } diff --git a/shared/api/versionUtils/versionChangeUtils/versionChangeRegistry.ts b/shared/api/versionUtils/versionChangeUtils/versionChangeRegistry.ts index 5607d65db..8ea7cc262 100644 --- a/shared/api/versionUtils/versionChangeUtils/versionChangeRegistry.ts +++ b/shared/api/versionUtils/versionChangeUtils/versionChangeRegistry.ts @@ -37,6 +37,8 @@ import { V1_2_TrackParamsChange } from "../../balances/track/requestChanges/V1.2 import { V0_2_AttachChange } from "../../billing/attach/changes/V0.2_AttachChange"; import { V1_2_AttachParamsChange } from "../../billing/attachV2/requestChanges/V1.2_AttachParamsChange"; import { V1_2_UpdateSubscriptionParamsChange } from "../../billing/updateSubscription/requestChanges/V1.2_UpdateSubscriptionParamsChange"; +// Import events aggregate changes +import { V2_0_AggregateEventsChange } from "../../events/aggregate/changes/V2.0_AggregateEventsChange"; import { ApiVersion } from "../ApiVersion"; import type { VersionChangeConstructor } from "./VersionChange"; import { VersionChangeRegistryClass } from "./VersionChangeRegistryClass"; @@ -47,6 +49,7 @@ export const V2_1_CHANGES: VersionChangeConstructor[] = [ V2_0_EntityChange, // Transforms Entity TO V2.0 format from V2.1 format V2_0_CheckChange, // Transforms Check TO V2.0 format from V2.1 format V2_0_TrackChange, // Transforms Track TO V2.0 format from V2.1 format + V2_0_AggregateEventsChange, // Transforms EventsAggregate TO V2.0 format from V2.1 format ]; export const V2_CHANGES: VersionChangeConstructor[] = [ diff --git a/shared/index.ts b/shared/index.ts index 9a878d27f..ee97b33d3 100644 --- a/shared/index.ts +++ b/shared/index.ts @@ -9,6 +9,9 @@ export * from "./api/billing/common/billingBehavior"; export * from "./api/billing/common/billingPreviewResponse"; export * from "./api/billing/common/billingResponse"; export * from "./api/billing/common/cancelAction"; +export * from "./api/billing/openBillingPortal/openBillingPortalParamsV1"; +export * from "./api/billing/openBillingPortal/openBillingPortalResponse"; +export * from "./api/billing/updateSubscription/previewUpdateSubscriptionResponse"; // Cursor pagination utilities export * from "./api/common/cursorPaginationSchemas"; export * from "./api/customers/components/customerExpand/customerExpand"; diff --git a/vite/src/hooks/common/useAutumnFlags.tsx b/vite/src/hooks/common/useAutumnFlags.tsx index cd25b392e..b51cbf315 100644 --- a/vite/src/hooks/common/useAutumnFlags.tsx +++ b/vite/src/hooks/common/useAutumnFlags.tsx @@ -16,15 +16,15 @@ export const useAutumnFlags = () => { }); useEffect(() => { - if (!customer?.features) return; + if (!customer?.balances) return; const nextFlags = { - pkey: notNullish(customer.features.pkey), - webhooks: notNullish(customer.features.webhooks), - stripe_key: notNullish(customer.features.stripe_key), - platform: notNullish(customer.features.platform), - vercel: notNullish(customer.features.vercel), - revenuecat: notNullish(customer.features.revenuecat), + pkey: notNullish(customer.balances.pkey), + webhooks: notNullish(customer.balances.webhooks), + stripe_key: notNullish(customer.balances.stripe_key), + platform: notNullish(customer.balances.platform), + vercel: notNullish(customer.balances.vercel), + revenuecat: notNullish(customer.balances.revenuecat), }; // Only update storage/state when values actually change @@ -38,7 +38,7 @@ export const useAutumnFlags = () => { ) { setFlags(nextFlags); } - }, [customer?.features]); + }, [customer?.balances]); return flags; };